:root {
    --bg-color: #0f172a;
    --arena-color: #1e293b;
    --arena-border: #334155;
    --title-bg-top: #07111f;
    --title-bg-bottom: #0e2235;
    --title-gold: #f6c453;
    --title-cream: #f5efe2;
    --title-line: rgba(246, 196, 83, 0.28);
    
    --p1-color: #3b82f6;
    --p1-dark: #1d4ed8;
    
    --p2-color: #ef4444;
    --p2-dark: #b91c1c;

    --text-primary: #f8fafc;
    --text-meta: #94a3b8;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background: #08121d;
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    overflow: hidden;
}

#game-container {
    position: relative;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    max-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

#ui-layer {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    display: flex;
    justify-content: center;
    gap: 40px;
    padding: 15px 20px;
    z-index: 10;
    align-items: flex-start;
}

.player-ui {
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

/* Push UI panels outward */
#player1-ui { 
    transform: translateX(-300px);
    align-items: flex-start;
}

#player2-ui { 
    transform: translateX(300px);
    align-items: flex-end;
    text-align: right;
}

.player-name {
    font-size: 24px;
    font-weight: 900;
    letter-spacing: 2px;
}

.player-name.p1 {
    color: var(--p1-color);
    text-shadow: 0 0 10px rgba(59, 130, 246, 0.5);
}

.player-name.p2 {
    color: var(--p2-color);
    text-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
}

.health-bar-container {
    width: 100%;
    height: 32px;
    background-color: rgba(0,0,0,0.5);
    border: 2px solid #334155;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.8);
}

.health-bar {
    height: 100%;
    width: 100%;
    transition: width 0.1s linear;
}

.health-bar.p1 {
    background: linear-gradient(90deg, var(--p1-dark), var(--p1-color));
    box-shadow: 0 0 15px var(--p1-color);
}

.health-bar.p2 {
    background: linear-gradient(270deg, var(--p2-dark), var(--p2-color));
    box-shadow: 0 0 15px var(--p2-color);
}

.health-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 13px;
    font-weight: 700;
    text-shadow: 1px 1px 2px black;
}

.cooldowns {
    display: flex;
    flex-direction: column;
    gap: 9px;
    width: 100%;
}

.cooldown-item {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-meta);
}

#player2-ui .cooldown-item {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    font-size: 13px;
    font-weight: 700;
    color: var(--text-meta);
}

.key {
    display: inline-block;
    background-color: #334155;
    color: white;
    padding: 2px 8px;
    border-radius: 4px;
    border-bottom: 2px solid #0f172a;
    font-weight: 900;
    margin-right: 5px;
}

#player2-ui .key {
    margin-right: 0;
    margin-left: 5px;
}

.cooldown-bar-bg {
    width: 100%;
    height: 8px;
    background-color: rgba(0,0,0,0.5);
    border-radius: 4px;
    margin-top: 3px;
    overflow: hidden;
}

.cooldown-bar {
    height: 100%;
    width: 100%;
    background-color: #cbd5e1;
}

.cooldown-bar.p1-cd {
    background-color: var(--p1-color);
}

.cooldown-bar.p2-cd {
    background-color: var(--p2-color);
}

canvas {
    background-color: transparent;
    z-index: 1;
    border-radius: 50%;
    box-shadow: 0 0 80px rgba(0,0,0,0.8);
    transform: translateY(0px);
    display: block;
}

.overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    padding: clamp(28px, 4.2vw, 54px);
    background-color: rgba(15, 23, 42, 0.85);
    z-index: 20;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    backdrop-filter: blur(5px);
    overflow: auto;
}

#title-screen {
    background: rgba(5, 12, 21, 0.9);
    overflow: hidden;
}

.title-scene {
    position: relative;
    width: min(780px, 100%);
    min-height: min(540px, 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: clamp(20px, 4vw, 48px) clamp(12px, 2.6vw, 24px);
}

.title-card {
    position: relative;
    z-index: 2;
    width: min(420px, 100%);
    max-height: 100%;
    padding: clamp(18px, 2.5vw, 30px) clamp(12px, 2.1vw, 26px) clamp(16px, 2.1vw, 24px);
    border-radius: clamp(18px, 3vw, 28px);
    border: 1px solid rgba(245, 239, 226, 0.12);
    background: rgba(10, 19, 31, 0.92);
    box-shadow:
        0 38px 90px rgba(0, 0, 0, 0.5),
        inset 0 1px 0 rgba(255, 255, 255, 0.06);
    text-align: center;
    overflow: auto;
}

.title-card::before,
.title-card::after {
    content: "";
    position: absolute;
    inset: 16px;
    border-radius: 20px;
    pointer-events: none;
}

.title-card::before {
    border: 1px solid rgba(245, 239, 226, 0.07);
}

.title-card::after {
    inset: auto 28px 28px;
    height: 1px;
    background: rgba(246, 196, 83, 0.22);
}

.title-kicker {
    color: var(--title-gold);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.35em;
    text-transform: uppercase;
}

.title-logo {
    margin-top: 10px;
    color: var(--title-cream);
    font-family: 'Teko', sans-serif;
    font-size: clamp(3rem, 7vw, 4.9rem);
    line-height: 0.88;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    text-shadow: 0 10px 30px rgba(0, 0, 0, 0.42);
}

.title-tagline {
    margin: 18px auto 0;
    max-width: 480px;
    color: rgba(226, 232, 240, 0.82);
    font-size: clamp(0.76rem, 1vw, 0.84rem);
    line-height: 1.6;
    font-weight: 500;
}

.title-actions {
    display: grid;
    gap: clamp(7px, 1vw, 10px);
    margin-top: clamp(14px, 1.9vw, 20px);
}

.title-action {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: clamp(9px, 1.4vw, 13px);
    width: 100%;
    padding: clamp(9px, 1.1vw, 12px) clamp(11px, 1.4vw, 14px);
    border-radius: clamp(14px, 2.2vw, 18px);
    border: 1px solid rgba(245, 239, 226, 0.14);
    background: rgba(17, 29, 43, 0.96);
    color: var(--title-cream);
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(0.76rem, 1vw, 0.86rem);
    font-weight: 700;
    letter-spacing: 0.03em;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease, box-shadow 0.16s ease;
}

.title-action span {
    color: rgba(226, 232, 240, 0.52);
    font-size: clamp(0.66rem, 1.2vw, 0.76rem);
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.title-action:hover {
    transform: translateY(-2px);
    border-color: rgba(245, 239, 226, 0.28);
    box-shadow: 0 18px 30px rgba(0, 0, 0, 0.26);
}

.title-action:active {
    transform: translateY(0);
}

.title-action-primary {
    border-color: rgba(246, 196, 83, 0.38);
    background: rgba(32, 44, 59, 0.98);
    box-shadow: 0 20px 36px rgba(3, 7, 18, 0.3);
}

.title-action-primary:hover {
    border-color: rgba(246, 196, 83, 0.6);
    box-shadow: 0 22px 42px rgba(3, 7, 18, 0.38);
}

.title-footer {
    margin-top: 24px;
    color: rgba(203, 213, 225, 0.62);
    font-size: 0.88rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.online-panel {
    margin-top: clamp(14px, 2vw, 22px);
    display: grid;
    gap: clamp(10px, 1.3vw, 14px);
    width: min(100%, 420px);
    padding: clamp(14px, 2vw, 18px);
    border-radius: 18px;
    border: 1px solid rgba(245, 239, 226, 0.12);
    background: rgba(8, 16, 29, 0.78);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.online-panel-header {
    display: grid;
    gap: 4px;
    text-align: left;
}

.online-panel-title {
    color: var(--title-cream);
    font-family: 'Teko', sans-serif;
    font-size: clamp(1.4rem, 2.4vw, 1.9rem);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.online-panel-subtitle {
    color: rgba(226, 232, 240, 0.72);
    font-size: clamp(0.78rem, 1vw, 0.9rem);
    line-height: 1.45;
}

.online-panel-actions {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: stretch;
}

.online-panel-btn,
.room-code-input {
    min-height: 48px;
    border-radius: 14px;
    border: 1px solid rgba(245, 239, 226, 0.14);
    background: rgba(17, 29, 43, 0.96);
    color: var(--title-cream);
    font-family: 'Space Grotesk', sans-serif;
    font-size: clamp(0.82rem, 1vw, 0.94rem);
    font-weight: 700;
}

#online-server-url-input {
    text-transform: none;
}

.online-panel-btn {
    padding: 0 18px;
    cursor: pointer;
    transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.online-panel-btn:hover {
    transform: translateY(-1px);
    border-color: rgba(245, 239, 226, 0.28);
    box-shadow: 0 14px 22px rgba(0, 0, 0, 0.2);
}

.online-panel-btn-primary {
    border-color: rgba(246, 196, 83, 0.35);
}

.room-code-display {
    min-width: 126px;
    padding: 0 16px;
    border-radius: 14px;
    border: 1px solid rgba(246, 196, 83, 0.24);
    background: rgba(30, 41, 59, 0.96);
    color: var(--title-gold);
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Teko', sans-serif;
    font-size: clamp(1.2rem, 2vw, 1.8rem);
    letter-spacing: 0.18em;
}

.room-code-input {
    width: 100%;
    padding: 0 14px;
    text-transform: uppercase;
    outline: none;
}

.room-code-input:focus {
    border-color: rgba(246, 196, 83, 0.45);
    box-shadow: 0 0 0 3px rgba(246, 196, 83, 0.08);
}

.online-status {
    min-height: 2.8em;
    color: rgba(203, 213, 225, 0.8);
    font-size: clamp(0.76rem, 0.95vw, 0.88rem);
    line-height: 1.5;
    text-align: left;
}

.title-orbit {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(148, 163, 184, 0.08);
    transform: translate(-50%, -50%);
}

.title-orbit::before,
.title-orbit::after {
    content: "";
    position: absolute;
    border-radius: 50%;
}

.title-orbit-outer {
    width: min(86vw, 900px);
    height: min(86vw, 900px);
    box-shadow: inset 0 0 80px rgba(56, 189, 248, 0.02);
}

.title-orbit-outer::before {
    width: 18px;
    height: 18px;
    top: 18%;
    left: 14%;
    background: #f6c453;
    box-shadow: 0 0 35px rgba(246, 196, 83, 0.35);
}

.title-orbit-mid {
    width: min(63vw, 640px);
    height: min(63vw, 640px);
    border-color: rgba(148, 163, 184, 0.12);
}

.title-orbit-mid::before {
    width: 12px;
    height: 12px;
    right: 10%;
    top: 20%;
    background: #60a5fa;
    box-shadow: 0 0 28px rgba(96, 165, 250, 0.4);
}

.title-orbit-inner {
    width: min(41vw, 420px);
    height: min(41vw, 420px);
    border-color: rgba(246, 196, 83, 0.16);
}

.title-orbit-inner::before {
    width: 9px;
    height: 9px;
    left: 12%;
    bottom: 18%;
    background: #f8fafc;
}

.hidden {
    display: none !important;
}

/* Menu */
#menu-screen {
    pointer-events: auto;
}

.menu-card {
    width: min(1440px, 100%);
    max-height: 100%;
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(148, 163, 184, 0.25);
    border-radius: clamp(16px, 2.2vw, 18px);
    padding: clamp(14px, 1.3vw, 22px) clamp(12px, 1.2vw, 18px) clamp(12px, 1.1vw, 16px);
    box-shadow: 0 30px 80px rgba(0,0,0,0.55);
    overflow: auto;
}

.menu-title {
    font-family: 'Teko', sans-serif;
    font-size: clamp(1.7rem, 2.1vw, 30px);
    font-weight: 700;
    letter-spacing: 0.08em;
    text-align: center;
}

.menu-subtitle {
    margin-top: 8px;
    color: var(--text-meta);
    text-align: center;
    font-weight: 700;
    font-size: clamp(0.8rem, 0.95vw, 0.96rem);
}

.menu-layout {
    margin-top: clamp(12px, 1vw, 16px);
    display: grid;
    grid-template-columns: minmax(0, 1.22fr) minmax(300px, 0.9fr);
    gap: clamp(12px, 1vw, 18px);
    align-items: start;
}

.menu-left,
.menu-right {
    min-width: 0;
}

.bot-settings {
    margin-top: 16px;
    padding: 14px 16px;
    border-radius: 14px;
    background: rgba(11, 18, 32, 0.56);
    border: 1px solid rgba(148, 163, 184, 0.16);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.bot-settings-label {
    color: var(--text-primary);
    font-family: 'Teko', sans-serif;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.bot-difficulty-options {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 10px;
}

.bot-difficulty-option {
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.26);
    background: rgba(2, 6, 23, 0.32);
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.bot-difficulty-option:hover {
    transform: translateY(-1px);
}

.bot-difficulty-option.selected {
    border-color: rgba(246, 196, 83, 0.68);
    box-shadow: 0 0 0 3px rgba(246, 196, 83, 0.12);
    background: rgba(38, 48, 62, 0.96);
}

.menu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(10px, 0.85vw, 14px);
    height: 100%;
}

.menu-col {
    padding: clamp(12px, 1vw, 16px) clamp(10px, 0.9vw, 14px) clamp(14px, 1vw, 18px);
    border-radius: 14px;
    background: rgba(30, 41, 59, 0.55);
    border: 1px solid rgba(148, 163, 184, 0.18);
    min-height: 100%;
}

.menu-col-title {
    font-family: 'Teko', sans-serif;
    font-weight: 900;
    letter-spacing: 0.12em;
    margin-bottom: 10px;
    font-size: clamp(1.12rem, 1.25vw, 1.42rem);
}
.menu-col-title.p1 { color: var(--p1-color); }
.menu-col-title.p2 { color: var(--p2-color); text-align: right; }

.menu-col-tools {
    display: flex;
    justify-content: flex-start;
    margin-bottom: 12px;
}

.menu-col-tools.p2 {
    justify-content: flex-end;
}

.menu-random-btn {
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.24);
    background: rgba(2, 6, 23, 0.38);
    color: var(--text-primary);
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}

.menu-random-btn:hover {
    transform: translateY(-1px);
}

.menu-random-btn.p1:hover,
.menu-random-btn.p1:focus-visible {
    border-color: rgba(59, 130, 246, 0.9);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.14);
}

.menu-random-btn.p2:hover,
.menu-random-btn.p2:focus-visible {
    border-color: rgba(239, 68, 68, 0.9);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.14);
}

.menu-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: clamp(8px, 0.75vw, 11px);
}

.menu-option {
    padding: clamp(10px, 0.95vw, 13px) clamp(8px, 0.85vw, 11px);
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.25);
    background: rgba(2, 6, 23, 0.25);
    color: var(--text-primary);
    font-weight: 900;
    letter-spacing: 1px;
    font-size: clamp(0.78rem, 0.82vw, 0.92rem);
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.menu-option:hover { transform: translateY(-1px); }
.menu-option.selected {
    border-color: rgba(255,255,255,0.65);
    box-shadow: 0 0 0 3px rgba(255,255,255,0.08);
}
.menu-option.p1.selected {
    border-color: rgba(59, 130, 246, 0.95);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.18), 0 0 18px rgba(59, 130, 246, 0.28);
}
.menu-option.p2.selected {
    border-color: rgba(239, 68, 68, 0.95);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.18), 0 0 18px rgba(239, 68, 68, 0.28);
}

.menu-actions {
    display: flex;
    justify-content: center;
    margin-top: clamp(14px, 1.2vw, 18px);
}

.build-hover-card {
    min-height: 100%;
    height: 100%;
    padding: clamp(14px, 1vw, 18px);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.48);
    border: 1px solid rgba(148, 163, 184, 0.2);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.12s ease;
}

#build-hover-card.hidden {
    display: block !important;
    visibility: hidden;
    opacity: 0;
}

.build-hover-name {
    font-size: clamp(1.05rem, 1.3vw, 1.3rem);
    font-weight: 900;
    letter-spacing: 1.5px;
}

.build-hover-desc {
    margin-top: 8px;
    color: var(--text-primary);
    font-size: clamp(0.82rem, 0.9vw, 0.98rem);
    line-height: 1.45;
    font-weight: 700;
    display: grid;
    gap: 10px;
}

.build-hover-stats {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    color: var(--text-meta);
    font-size: clamp(0.76rem, 0.8vw, 0.9rem);
    font-weight: 800;
}

.build-hover-section {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.62);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.build-hover-label {
    margin-bottom: 4px;
    color: #cbd5e1;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1.2px;
    text-transform: uppercase;
}

.build-stat-row {
    padding: 10px 12px;
    border-radius: 10px;
    background: rgba(15, 23, 42, 0.62);
    border: 1px solid rgba(148, 163, 184, 0.12);
}

.build-stat-top {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 7px;
}

.build-stat-bar {
    height: 8px;
    border-radius: 999px;
    overflow: hidden;
    background: rgba(51, 65, 85, 0.9);
}

.build-stat-fill {
    height: 100%;
    border-radius: 999px;
    background: linear-gradient(90deg, #22d3ee, #f59e0b);
    box-shadow: 0 0 12px rgba(34, 211, 238, 0.18);
}

.menu-primary {
    padding: clamp(10px, 1.4vw, 12px) clamp(24px, 3vw, 36px);
    font-size: clamp(0.94rem, 1.5vw, 18px);
    font-weight: 900;
    font-family: 'Space Grotesk', sans-serif;
    color: white;
    background: linear-gradient(135deg, #b87425, #2d5f97);
    border: none;
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 8px 24px rgba(45, 95, 151, 0.35);
    transition: all 0.2s ease;
}
.menu-primary:hover {
    transform: translateY(-2px) scale(1.03);
    box-shadow: 0 10px 28px rgba(45, 95, 151, 0.48);
}
.menu-primary:active { transform: translateY(1px); }

.menu-hint {
    margin-top: 14px;
    color: rgba(148, 163, 184, 0.95);
    text-align: center;
    font-weight: 800;
    line-height: 1.4;
    font-size: clamp(0.68rem, 0.85vw, 11px);
}

#winner-text {
    font-size: clamp(5rem, 14vw, 8.5rem);
    font-weight: 900;
    margin-bottom: 0;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    text-shadow: 0 0 20px rgba(255,255,255,0.3);
    opacity: 0;
    transform: scale(0.72) rotate(-7deg);
}

#game-over-screen {
    background: rgba(5, 12, 21, 0.18);
    backdrop-filter: blur(2px);
    pointer-events: none;
}

#game-over-screen.show-rematch {
    pointer-events: auto;
}

.ko-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 26px;
    text-align: center;
}

.ko-burst {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 260px;
    height: 260px;
    border-radius: 50%;
    border: 1px solid rgba(248, 250, 252, 0.08);
    background: rgba(15, 23, 42, 0.22);
    transform: translate(-50%, -50%) scale(0.35);
    opacity: 0;
    filter: blur(1px);
}

#game-over-screen.ko-animate .ko-burst {
    animation: koBurst 0.55s cubic-bezier(0.18, 0.84, 0.24, 1) forwards;
}

#game-over-screen.ko-animate #winner-text {
    animation: koText 0.62s cubic-bezier(0.16, 0.88, 0.22, 1) 0.06s forwards;
}

#rematch-btn {
    padding: 15px 40px;
    font-size: 24px;
    font-weight: 700;
    font-family: 'Space Grotesk', sans-serif;
    color: white;
    background: rgba(17, 29, 43, 0.96);
    border: 1px solid rgba(148, 163, 184, 0.32);
    border-radius: 30px;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.28);
    transition: all 0.2s ease;
    pointer-events: auto;
    opacity: 0;
    transform: translateY(18px) scale(0.94);
}

#rematch-btn:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 16px 34px rgba(0, 0, 0, 0.34);
    border-color: rgba(245, 239, 226, 0.42);
}

#rematch-btn:active {
    transform: translateY(1px);
}

#game-over-screen.show-rematch #rematch-btn {
    animation: rematchPop 0.32s cubic-bezier(0.18, 0.84, 0.24, 1) forwards;
}

@keyframes koBurst {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.35);
    }
    55% {
        opacity: 0.85;
        transform: translate(-50%, -50%) scale(1.08);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.4);
    }
}

@keyframes koText {
    0% {
        opacity: 0;
        transform: scale(0.72) rotate(-7deg);
    }
    60% {
        opacity: 1;
        transform: scale(1.12) rotate(1deg);
    }
    100% {
        opacity: 1;
        transform: scale(1) rotate(0deg);
    }
}

@keyframes rematchPop {
    0% {
        opacity: 0;
        transform: translateY(18px) scale(0.94);
    }
    70% {
        opacity: 1;
        transform: translateY(-4px) scale(1.03);
    }
    100% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* Mobile responsiveness */
@media (max-width: 1200px) {
    #ui-layer {
        gap: 30px;
        padding: 12px 15px;
    }
    
    .player-ui {
        width: 260px;
    }
    
    .player-name {
        font-size: 22px;
    }
    
    #player1-ui { transform: translateX(-255px); }
    #player2-ui { transform: translateX(255px); }
}

@media (max-width: 768px) {
    #ui-layer {
        gap: 20px;
        padding: 10px 10px;
        flex-direction: row;
        justify-content: center;
        align-items: flex-start;
    }
    
    .player-ui {
        width: 180px;
        flex-direction: column;
        gap: 8px;
    }
    
    #player1-ui {
        transform: translateX(-151px);
        align-items: flex-start;
    }
    
    #player2-ui {
        transform: translateX(151px);
        align-items: flex-end;
        text-align: right;
    }
    
    .player-name {
        font-size: 18px;
        margin-bottom: 0;
    }
    
    .health-bar-container {
        height: 26px;
    }
    
    .health-text {
        font-size: 11px;
    }
    
    .cooldowns {
        width: 100%;
        flex-direction: column;
        gap: 6px;
    }
    
    #player2-ui .cooldowns {
        flex-direction: column;
    }
    
    .cooldown-item {
        font-size: 11px;
        text-align: left;
    }
    
    #player2-ui .cooldown-item {
        text-align: right;
    }
    
    .key {
        padding: 1px 4px;
        font-size: 9px;
    }
    
    .cooldown-bar-bg {
        height: 6px;
        margin-top: 1px;
    }
    
    .bot-settings {
        flex-direction: column;
        align-items: stretch;
    }

    .bot-difficulty-options {
        justify-content: flex-start;
    }

    .title-scene {
        width: 100%;
        min-height: 100%;
        padding: 16px 4px;
    }

    .title-action {
        padding: 16px 16px;
        font-size: 0.98rem;
    }

    .title-action span {
        font-size: 0.68rem;
        letter-spacing: 0.1em;
    }

    .title-footer {
        font-size: 0.74rem;
        line-height: 1.5;
    }

    .menu-card {
        width: 100%;
    }

    .online-panel-actions {
        grid-template-columns: 1fr;
    }

    .room-code-display {
        min-width: 0;
        min-height: 48px;
    }
    
    .menu-layout {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .menu-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .menu-options {
        grid-template-columns: 1fr;
    }
    
    .build-hover-card {
        display: none;
    }
}

@media (max-width: 480px) {
    .title-kicker {
        font-size: 11px;
    }

    .title-logo {
        font-size: clamp(3.6rem, 18vw, 5rem);
    }

    .title-tagline {
        font-size: 0.92rem;
    }

    .title-action {
        align-items: flex-start;
        flex-direction: column;
        gap: 6px;
        text-align: left;
    }

    .online-panel {
        padding: 12px;
    }

    .overlay {
        padding: 8px;
    }

    #ui-layer {
        gap: 15px;
        padding: 8px 8px;
    }
    
    .player-ui {
        gap: 6px;
        width: 160px;
    }
    
    #player1-ui { transform: translateX(-104px); }
    #player2-ui { transform: translateX(104px); }
    
    .player-name {
        font-size: 16px;
    }
    
    .health-bar-container {
        height: 24px;
    }
    
    .health-text {
        font-size: 11px;
    }
    
    .cooldowns {
        width: 100%;
        gap: 5px;
    }
    
    .cooldown-item {
        font-size: 10px;
    }
    
    .key {
        padding: 0px 3px;
        font-size: 8px;
    }
    
    .cooldown-bar-bg {
        height: 5px;
        margin-top: 1px;
    }
    
    .menu-title {
        font-size: 28px;
    }
    
    .menu-subtitle {
        font-size: 14px;
    }
    
    .menu-option {
        padding: 10px 8px;
        font-size: 14px;
    }
    
    .menu-primary {
        padding: 12px 30px;
        font-size: 18px;
    }
    
    .menu-hint {
        font-size: 12px;
    }
    
    #winner-text {
        font-size: 36px;
        margin-bottom: 20px;
    }
    
    #rematch-btn {
        padding: 12px 30px;
        font-size: 18px;
    }
}
