/* ============================================================
   Vier Gewinnt — Premium Arcade UI
   Aesthetic: Deep-space arcade cabinet with physical board feel
   Fonts: Bebas Neue (display) + Nunito (body)
   ============================================================ */

/* ===========================
   CUSTOM PROPERTIES
=========================== */
:root {
    --bg-deep:        #030610;
    --bg-card:        rgba(6, 10, 28, 0.96);

    --board-face:     #091550;
    --board-mid:      #06103e;
    --board-dark:     #040c2e;
    --board-rim:      rgba(30, 65, 200, 0.55);
    --board-rim-hi:   rgba(60, 110, 255, 0.25);

    --red:            #d62d1a;
    --red-mid:        #ff4d38;
    --red-light:      #ff9080;
    --red-glow:       rgba(220, 60, 40, 0.65);

    --yellow:         #e8a800;
    --yellow-mid:     #ffc107;
    --yellow-light:   #ffe066;
    --yellow-glow:    rgba(230, 168, 0, 0.65);

    --accent:         #2f55d4;
    --accent-hi:      #4a72f5;
    --accent-glow:    rgba(47, 85, 212, 0.4);

    --text:           #dde4ff;
    --text-dim:       rgba(180, 195, 240, 0.55);
    --text-faint:     rgba(120, 140, 200, 0.3);

    --glass:          rgba(255, 255, 255, 0.035);
    --glass-border:   rgba(80, 110, 220, 0.18);
    --glass-border-hi: rgba(80, 110, 220, 0.38);

    --shadow-card:    0 30px 80px rgba(0, 0, 15, 0.92), 0 0 0 1px var(--glass-border);

    --radius-card:    22px;
    --radius-btn:     12px;
    --radius-pill:    100px;

    --ease:           cubic-bezier(0.4, 0, 0.2, 1);
    --ease-spring:    cubic-bezier(0.34, 1.56, 0.64, 1);
    --t:              0.22s;

    --font-display:   'Bebas Neue', sans-serif;
    --font-body:      'Nunito', sans-serif;
}

/* ===========================
   RESET & BASE
=========================== */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: var(--font-body);
    color: var(--text);
    background-color: var(--bg-deep);
    background-image:
        radial-gradient(ellipse 90% 55% at 50% -5%,  rgba(25, 55, 200, 0.22) 0%, transparent 70%),
        radial-gradient(ellipse 60% 45% at 15% 95%,  rgba(200, 50, 30, 0.07) 0%, transparent 65%),
        radial-gradient(ellipse 55% 40% at 85% 95%,  rgba(220, 165, 0, 0.07) 0%, transparent 65%);
    padding: 0.5rem;
}

/* Subtle dot-grid atmosphere */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background-image: radial-gradient(circle, rgba(80, 110, 255, 0.07) 1px, transparent 1px);
    background-size: 30px 30px;
    pointer-events: none;
    z-index: 0;
}

body > * { position: relative; z-index: 1; }

/* ===========================
   PAGE TITLE
=========================== */
#page-title {
    font-family: var(--font-display);
    font-size: clamp(2.2rem, 7vw, 3.8rem);
    letter-spacing: 0.1em;
    text-align: center;
    margin: 0.4rem 0 0.7rem;
    background: linear-gradient(120deg, var(--red-mid) 0%, var(--yellow-mid) 55%, var(--yellow-light) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 24px rgba(220, 60, 40, 0.28));
}

/* ===========================
   DIALOG BOXES
=========================== */
.dialog-box {
    background: var(--bg-card);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-card);
    padding: 1.75rem 2rem;
    max-width: 420px;
    width: 92%;
    text-align: center;
    box-shadow: var(--shadow-card);
    /* Top-edge highlight — feels like a physical card under light */
    background-image: linear-gradient(to bottom, rgba(80, 120, 255, 0.06) 0%, transparent 35%);
}

.dialog-box h2 {
    font-family: var(--font-display);
    font-size: 1.9rem;
    letter-spacing: 0.07em;
    color: var(--text);
    margin-bottom: 1.5rem;
}

/* ===========================
   MODE BUTTONS
=========================== */
.mode-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.mode-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    padding: 1.25rem 1rem;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    color: var(--text);
    cursor: pointer;
    transition: var(--t) var(--ease);
    position: relative;
    overflow: hidden;
}

.mode-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(70, 100, 255, 0.1), transparent 60%);
    opacity: 0;
    transition: opacity var(--t) var(--ease);
}

.mode-btn i {
    font-size: 1.75rem;
    color: var(--accent-hi);
    transition: color var(--t);
}

.mode-btn span {
    font-weight: 800;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.mode-btn small {
    font-size: 0.72rem;
    color: var(--text-dim);
}

.mode-btn:hover,
.mode-btn.active {
    border-color: var(--glass-border-hi);
    background: rgba(47, 85, 212, 0.1);
    transform: translateY(-2px);
    box-shadow: 0 10px 30px rgba(47, 85, 212, 0.2);
}

.mode-btn:hover::after,
.mode-btn.active::after { opacity: 1; }

.mode-btn.active {
    border-color: rgba(80, 120, 255, 0.5);
    box-shadow: 0 0 0 1px rgba(80, 120, 255, 0.2), 0 10px 30px rgba(47, 85, 212, 0.25);
}

/* ===========================
   PLAYER NAME INPUTS
=========================== */
.player-names {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    margin-bottom: 1.25rem;
}

.name-input-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 0.55rem 0.85rem;
    transition: border-color var(--t);
}

.name-input-row:focus-within {
    border-color: var(--glass-border-hi);
    background: rgba(0, 0, 0, 0.4);
    box-shadow: 0 0 0 3px rgba(47, 85, 212, 0.12);
}

.name-chip {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
}

.chip-red {
    background: radial-gradient(circle at 36% 30%, var(--red-mid), var(--red));
    box-shadow: 0 2px 10px var(--red-glow);
}

.chip-yellow {
    background: radial-gradient(circle at 36% 30%, var(--yellow-light), var(--yellow));
    box-shadow: 0 2px 10px var(--yellow-glow);
}

.name-input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text);
    font-family: var(--font-body);
    font-size: 0.95rem;
    font-weight: 700;
}

.name-input::placeholder {
    color: var(--text-faint);
    font-weight: 400;
}

/* ===========================
   ONLINE SECTION
=========================== */
.online-label {
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.12em;
    margin-top: 1rem;
    margin-bottom: 0.75rem;
}

.or-divider {
    color: var(--text-faint);
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    margin: 0.85rem 0;
}

.join-section {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.game-code-input {
    flex: 1 1 100%;
    padding: 0.7rem 1rem;
    font-family: var(--font-display);
    font-size: 1.6rem;
    letter-spacing: 6px;
    text-align: center;
    text-transform: uppercase;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.35);
    color: var(--yellow-light);
    outline: none;
    transition: border-color var(--t), box-shadow var(--t);
}

.game-code-input:focus {
    border-color: var(--glass-border-hi);
    box-shadow: 0 0 0 3px rgba(47, 85, 212, 0.15);
}

.game-code-input::placeholder {
    font-family: var(--font-body);
    font-size: 0.95rem;
    letter-spacing: normal;
    color: var(--text-faint);
}

/* ===========================
   BUTTONS
=========================== */
.btn-start,
.btn-online {
    width: 100%;
    padding: 0.95rem 1.5rem;
    font-family: var(--font-display);
    font-size: 1.35rem;
    letter-spacing: 0.09em;
    border: none;
    border-radius: var(--radius-btn);
    background: linear-gradient(140deg, var(--accent-hi) 0%, var(--accent) 100%);
    color: #fff;
    cursor: pointer;
    transition: var(--t) var(--ease);
    margin-bottom: 0.75rem;
    box-shadow: 0 4px 20px rgba(47, 85, 212, 0.4), inset 0 1px 0 rgba(255,255,255,0.15);
    position: relative;
    overflow: hidden;
}

.btn-start::before,
.btn-online::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 50%;
    background: linear-gradient(to bottom, rgba(255,255,255,0.1), transparent);
    border-radius: var(--radius-btn) var(--radius-btn) 0 0;
    pointer-events: none;
}

.btn-start:hover,
.btn-online:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(47, 85, 212, 0.55), inset 0 1px 0 rgba(255,255,255,0.15);
}

.btn-start:disabled {
    opacity: 0.3;
    cursor: not-allowed;
    transform: none;
    filter: none;
    box-shadow: none;
}

.btn-join {
    flex: 1 1 100%;
    padding: 0.72rem 1.25rem;
    font-family: var(--font-display);
    font-size: 1.2rem;
    letter-spacing: 0.07em;
    border: none;
    border-radius: 10px;
    background: linear-gradient(140deg, var(--accent-hi), var(--accent));
    color: #fff;
    cursor: pointer;
    transition: var(--t) var(--ease);
    box-shadow: 0 4px 16px rgba(47, 85, 212, 0.35);
}

.btn-join:hover {
    filter: brightness(1.12);
    box-shadow: 0 6px 22px rgba(47, 85, 212, 0.5);
}

.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1rem;
    padding: 0.4rem 0.85rem;
    font-family: var(--font-body);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-dim);
    background: none;
    border: none;
    text-decoration: none;
    cursor: pointer;
    transition: color var(--t);
    border-radius: 8px;
}

.btn-back:hover { color: var(--text); }

.btn-lobby {
    width: 100%;
    padding: 0.6rem;
    font-size: 0.84rem;
    font-weight: 700;
    border: 1px solid var(--glass-border);
    border-radius: 10px;
    background: var(--glass);
    color: var(--text);
    cursor: pointer;
    transition: var(--t) var(--ease);
}

.btn-lobby:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: var(--glass-border-hi);
}

.btn-copy {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    background: var(--glass);
    color: var(--text-dim);
    cursor: pointer;
    transition: var(--t) var(--ease);
    font-size: 0.9rem;
    flex-shrink: 0;
}

.btn-copy:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text);
    border-color: var(--glass-border-hi);
}

/* ===========================
   LOBBY
=========================== */
.game-code-display {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
}

.game-code-display > span {
    color: var(--text-dim);
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.code-box {
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: 6px;
    padding: 0.45rem 1rem;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid rgba(47, 85, 212, 0.45);
    border-radius: 10px;
    color: var(--yellow-light);
    text-shadow: 0 0 24px rgba(220, 168, 0, 0.45);
    box-shadow: inset 0 2px 8px rgba(0, 0, 0, 0.5);
}

.players-list {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 1rem;
}

.player-slot {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.75rem 1rem;
    background: rgba(0, 0, 0, 0.2);
    border: 1px dashed rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    transition: var(--t) var(--ease);
}

.player-slot.occupied {
    border-style: solid;
    border-color: var(--glass-border);
    background: rgba(255, 255, 255, 0.04);
}

.slot-chip {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    flex-shrink: 0;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
}

.slot-name {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
}

.lobby-hint {
    color: var(--text-dim);
    font-size: 0.82rem;
    margin-bottom: 1rem;
}

/* ===========================
   GAME SECTION
=========================== */
#game-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 100%;
    flex: 1;
    overflow: hidden;
    gap: 0.35rem;
    padding-top: 0.1rem;
}

/* ===========================
   STATUS BAR
=========================== */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 0.4rem 1.2rem;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    font-weight: 700;
    font-size: 0.88rem;
    letter-spacing: 0.02em;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    min-height: 38px;
}

.status-chip {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    flex-shrink: 0;
    transition: all 0.3s var(--ease-spring);
}

.status-chip.p1 {
    background: radial-gradient(circle at 36% 30%, var(--red-mid), var(--red));
    box-shadow: 0 0 12px var(--red-glow), 0 2px 4px rgba(0,0,0,0.5);
}

.status-chip.p2 {
    background: radial-gradient(circle at 36% 30%, var(--yellow-light), var(--yellow));
    box-shadow: 0 0 12px var(--yellow-glow), 0 2px 4px rgba(0,0,0,0.5);
}

#status-text {
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text);
}

/* ===========================
   SCORE BAR
=========================== */
#score-bar {
    display: flex;
    align-items: center;
    gap: 1.1rem;
    padding: 0.28rem 1.2rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    font-size: 0.84rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
}

.score-item {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.score-chip {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    flex-shrink: 0;
}

.score-item span:not(.score-chip):not(.score-val) {
    font-weight: 600;
    color: var(--text-dim);
    font-size: 0.8rem;
}

.score-val {
    font-family: var(--font-display);
    font-size: 1.45rem;
    line-height: 1;
    color: var(--yellow-mid);
    min-width: 1ch;
    text-align: center;
    text-shadow: 0 0 18px rgba(220, 168, 0, 0.5);
    letter-spacing: 0.02em;
}

.score-sep {
    color: var(--text-faint);
    font-weight: 300;
    font-size: 1rem;
}

/* ===========================
   BOARD WRAPPER
=========================== */
#board-wrapper {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* ===========================
   DROP PREVIEW ROW
=========================== */
#drop-preview-row {
    display: grid;
    grid-template-columns: repeat(7, var(--cell-size, 54px));
    width: calc(7 * var(--cell-size, 54px));
    height: var(--cell-size, 54px);
    pointer-events: none;
}

.drop-preview-slot {
    display: flex;
    align-items: center;
    justify-content: center;
}

.drop-preview-slot svg {
    width: 82%;
    height: 82%;
    opacity: 0;
    transition: opacity 0.1s ease;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.6));
}

.drop-preview-slot.show svg {
    opacity: 0.72;
}

/* ===========================
   COL TARGETS
=========================== */
#col-targets {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    padding: 5px;
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    z-index: 10;
}

.col-target {
    cursor: pointer;
    border-radius: 6px;
    transition: background 0.12s ease;
}

.col-target:hover {
    background: rgba(255, 255, 255, 0.05);
}

/* ===========================
   GAME BOARD — the crown jewel
=========================== */
#game-board {
    position: relative;
    display: grid;
    grid-template-columns: repeat(7, var(--cell-size, 54px));
    grid-template-rows: repeat(6, var(--cell-size, 54px));
    gap: 0;

    /* Deep metallic blue board face */
    background:
        linear-gradient(160deg,
            rgba(20, 55, 195, 0.25) 0%,
            transparent 45%,
            rgba(5, 10, 50, 0.15) 100%),
        linear-gradient(180deg, #0d1e70 0%, #060f45 55%, #0a1a62 100%);

    border-radius: 15px;
    padding: 5px;

    /* Layered shadows for physical depth */
    box-shadow:
        /* Hard outer edge (rim) */
        0 0 0 2px rgba(15, 35, 130, 0.9),
        0 0 0 4px rgba(8, 20, 80, 0.8),
        0 0 0 6px rgba(5, 12, 55, 0.6),
        /* Depth drop shadow */
        0 22px 60px rgba(0, 0, 25, 0.97),
        0 10px 28px rgba(0, 0, 15, 0.8),
        /* Specular top highlight — light from above */
        inset 0 2px 0 rgba(70, 120, 255, 0.22),
        inset 0 -3px 0 rgba(0, 0, 50, 0.5),
        inset 2px 0 0 rgba(50, 90, 220, 0.12),
        inset -3px 0 0 rgba(0, 0, 40, 0.35);
}

/* ===========================
   BOARD CELLS — punched holes
=========================== */
.board-cell {
    display: flex;
    align-items: center;
    justify-content: center;
    width: var(--cell-size, 54px);
    height: var(--cell-size, 54px);
    position: relative;
}

/* The hole */
.board-cell::before {
    content: '';
    position: absolute;
    width: 78%;
    height: 78%;
    border-radius: 50%;
    /* Deep dark void at the center, slight blue tinge at rim */
    background: radial-gradient(circle at 42% 36%,
        #060d26 0%,
        #030818 45%,
        #020612 100%);
    /* Multi-layer inset shadow for convincing 3D depth */
    box-shadow:
        inset 0 5px 14px rgba(0, 0, 0, 1),
        inset 0 3px 8px rgba(0, 0, 0, 0.95),
        inset 4px 4px 10px rgba(0, 0, 0, 0.85),
        inset -2px -2px 6px rgba(20, 60, 200, 0.1),
        /* Rim highlight — board light reflected on hole edge */
        0 -1px 0 rgba(40, 80, 220, 0.22),
        0 1px 3px rgba(0, 0, 0, 0.8);
}

.board-cell svg {
    position: relative;
    z-index: 2;
    width: 80%;
    height: 80%;
    filter: drop-shadow(0 3px 8px rgba(0,0,0,0.75));
}

/* ===========================
   CHIP SVG CLASS
=========================== */
.chip { display: block; }

/* ===========================
   CHIP ANIMATIONS — preserved exactly
=========================== */
@keyframes chipDrop {
    0%   { transform: translateY(calc(-1 * var(--drop-distance))); }
    70%  { transform: translateY(6px); }
    85%  { transform: translateY(-4px); }
    95%  { transform: translateY(2px); }
    100% { transform: translateY(0); }
}

.chip-dropping {
    animation: chipDrop 0.48s cubic-bezier(.25,.46,.45,.94) forwards;
}

@keyframes winPulseRed {
    50% { transform: scale(1.12); filter: brightness(1.3) drop-shadow(0 0 18px rgba(255,80,80,1)); }
}

@keyframes winPulseYellow {
    50% { transform: scale(1.12); filter: brightness(1.35) drop-shadow(0 0 18px rgba(255,220,50,1)); }
}

.chip-p1.chip-winning { animation: winPulseRed    0.8s ease-in-out infinite; }
.chip-p2.chip-winning { animation: winPulseYellow 0.8s ease-in-out infinite; }

@keyframes boardShake {
    15%  { transform: translateX(-8px); }
    30%  { transform: translateX(7px); }
    45%  { transform: translateX(-5px); }
    100% { transform: translateX(0); }
}

.board-shake { animation: boardShake 0.48s ease-out; }

@keyframes chipAppear {
    0%   { transform: scale(0.2); opacity: 0; }
    70%  { transform: scale(1.1); opacity: 1; }
    100% { transform: scale(1);   opacity: 1; }
}

.chip-appearing { animation: chipAppear 0.25s ease-out forwards; }

/* ===========================
   GAME CONTROLS
=========================== */
.game-controls {
    display: flex;
    gap: 0.75rem;
    margin-top: 0.2rem;
}

.btn-control {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.42rem 1rem;
    font-family: var(--font-body);
    font-size: 0.8rem;
    font-weight: 700;
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-pill);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text-dim);
    cursor: pointer;
    transition: var(--t) var(--ease);
    letter-spacing: 0.02em;
}

.btn-control:hover {
    background: rgba(255, 255, 255, 0.07);
    border-color: var(--glass-border-hi);
    color: var(--text);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4);
}

/* ===========================
   RESULT MODAL
=========================== */
#result-modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 3, 14, 0.85);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.result-content {
    background:
        linear-gradient(160deg, rgba(10, 16, 50, 0.98) 0%, rgba(4, 7, 22, 0.98) 100%);
    border: 1px solid var(--glass-border-hi);
    border-radius: 26px;
    padding: 2.5rem 2.25rem;
    text-align: center;
    animation: scaleIn 0.38s var(--ease-spring);
    box-shadow:
        0 35px 100px rgba(0, 0, 0, 0.95),
        0 0 0 1px rgba(47, 85, 212, 0.2),
        inset 0 1px 0 rgba(100, 140, 255, 0.12);
    min-width: 290px;
    /* Top glow */
    background-image:
        linear-gradient(160deg, rgba(80, 120, 255, 0.07) 0%, transparent 40%),
        linear-gradient(160deg, rgba(10, 16, 50, 0.98) 0%, rgba(4, 7, 22, 0.98) 100%);
}

@keyframes scaleIn {
    from { transform: scale(0.75); opacity: 0; }
    to   { transform: scale(1);    opacity: 1; }
}

.result-emoji {
    font-size: 4.5rem;
    margin-bottom: 0.6rem;
    animation: bounce 1s ease-in-out infinite;
    display: block;
    line-height: 1;
    filter: drop-shadow(0 8px 20px rgba(0,0,0,0.5));
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-14px); }
}

.result-content h2 {
    font-family: var(--font-display);
    font-size: 2.4rem;
    letter-spacing: 0.07em;
    color: var(--yellow-mid);
    margin-bottom: 1.75rem;
    text-shadow: 0 0 35px rgba(220, 168, 0, 0.45);
}

.winner-buttons {
    display: flex;
    gap: 0.75rem;
    justify-content: center;
}

.btn-winner {
    padding: 0.72rem 1.5rem;
    font-family: var(--font-display);
    font-size: 1.25rem;
    letter-spacing: 0.07em;
    border: none;
    border-radius: var(--radius-btn);
    background: linear-gradient(140deg, var(--accent-hi), var(--accent));
    color: #fff;
    cursor: pointer;
    transition: var(--t) var(--ease);
    box-shadow: 0 4px 18px rgba(47, 85, 212, 0.45), inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn-winner:hover {
    filter: brightness(1.12);
    transform: translateY(-2px);
    box-shadow: 0 8px 26px rgba(47, 85, 212, 0.55);
}

.btn-winner.secondary {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    box-shadow: none;
}

.btn-winner.secondary:hover {
    background: rgba(255, 255, 255, 0.12);
    border-color: var(--glass-border-hi);
}

/* ===========================
   INVITE OVERLAY
=========================== */
#invite-overlay {
    position: fixed;
    inset: 0;
    background: rgba(2, 3, 14, 0.88);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 900;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    animation: fadeIn 0.2s ease;
}

.invite-panel {
    background: var(--bg-card);
    border: 1px solid var(--glass-border-hi);
    border-radius: var(--radius-card);
    padding: 1.75rem 2rem;
    max-width: 380px;
    width: 92%;
    box-shadow: var(--shadow-card);
    text-align: center;
    background-image: linear-gradient(to bottom, rgba(80, 120, 255, 0.06) 0%, transparent 35%);
}

.invite-panel h3 {
    font-family: var(--font-display);
    font-size: 1.6rem;
    letter-spacing: 0.07em;
    color: var(--text);
    margin-bottom: 1.2rem;
}

.invite-loading,
.invite-empty {
    color: var(--text-dim);
    font-size: 0.88rem;
    padding: 1rem 0;
    line-height: 1.6;
}

#invite-friends-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 300px;
    overflow-y: auto;
    margin-bottom: 1rem;
    scrollbar-width: thin;
    scrollbar-color: var(--glass-border) transparent;
}

.invite-friend-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.85rem;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    text-align: left;
}

.invite-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.9rem;
    color: #fff;
    flex-shrink: 0;
}

.invite-name {
    flex: 1;
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-invite-send {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(140deg, var(--accent-hi), var(--accent));
    color: #fff;
    cursor: pointer;
    font-size: 0.85rem;
    transition: var(--t) var(--ease);
    flex-shrink: 0;
    box-shadow: 0 3px 12px rgba(47, 85, 212, 0.4);
}

.btn-invite-send:hover:not(:disabled) {
    filter: brightness(1.15);
    transform: scale(1.08);
    box-shadow: 0 5px 18px rgba(47, 85, 212, 0.55);
}

.btn-invite-send.sent {
    background: linear-gradient(140deg, #22c55e, #16a34a);
    box-shadow: 0 3px 12px rgba(34, 197, 94, 0.4);
    cursor: default;
}

.btn-invite-send:disabled { cursor: not-allowed; opacity: 0.7; }

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 600px) {
    body { padding: 0.25rem; }

    #page-title {
        font-size: clamp(2rem, 9vw, 2.8rem);
        margin: 0.25rem 0 0.5rem;
    }

    .dialog-box {
        padding: 1.25rem 1.25rem;
        border-radius: 18px;
    }

    .mode-btn { padding: 1rem 0.6rem; }
    .mode-btn i { font-size: 1.5rem; }

    .status-bar { padding: 0.38rem 1rem; font-size: 0.82rem; }
    #score-bar  { padding: 0.25rem 1rem; font-size: 0.78rem; }

    .result-content {
        padding: 2rem 1.5rem;
        margin: 0 1rem;
    }

    .result-content h2 { font-size: 2rem; }
}
