/* ===== WIN BINGO Game Page ===== */

/* Status bar */
.status-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.6rem;
    padding: 0.8rem 1rem;
    margin: 1.1rem 0.9rem 0;
}
.stat { text-align: center; }
.stat-label { display: block; font-size: 0.68rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.stat strong { font-size: 1.15rem; font-family: var(--font-display); }
.stat strong.countdown { color: var(--gold); font-size: 1.4rem; }

.phase-badge { font-size: 0.78rem !important; padding: 0.25rem 0.7rem; border-radius: 999px; background: rgba(74, 168, 255, 0.15); color: var(--blue); }
.phase-badge.lobby { background: rgba(45, 212, 122, 0.15); color: var(--green); }
.phase-badge.drawing { background: rgba(255, 210, 74, 0.15); color: var(--gold); }
.phase-badge.winner { background: rgba(255, 85, 102, 0.18); color: var(--red); }

.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px rgba(45, 212, 122, 0.2); margin-right: 0.3rem; }

.coin-balance.bump { animation: coin-bump 0.9s ease; }
@keyframes coin-bump {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 210, 74, 0.6); }
    30% { transform: scale(1.14); box-shadow: 0 0 20px 6px rgba(255, 210, 74, 0.7); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 210, 74, 0); }
}

/* Layout */
.game-wrap { max-width: 1180px; margin: 0 auto; padding-bottom: 5rem; }
.game-layout { display: grid; grid-template-columns: 55fr 45fr; gap: 0; margin-top: 1.1rem; padding: 0 0 0 0.9rem; }
.game-layout.lobby-full { grid-template-columns: 1fr; }
.game-main { min-width: 0; display: flex; flex-direction: column; }

/* Fullscreen button */
.fullscreen-toggle {
    position: fixed;
    bottom: calc(var(--bottom-nav-h) + 1rem);
    right: 1rem;
    z-index: 90;
    width: 48px; height: 48px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), var(--gold-2));
    color: #1a1200;
    border: none;
    box-shadow: 0 4px 16px rgba(245, 158, 11, 0.4);
    display: flex; align-items: center; justify-content: center;
    font-size: 1.2rem; cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
}
.fullscreen-toggle:hover { transform: scale(1.08); box-shadow: 0 6px 20px rgba(245, 158, 11, 0.55); }
.fullscreen-toggle:active { transform: scale(0.95); }
.fullscreen-toggle.hidden { display: none; }

/* On the game page the balance lives in the panel, not the top nav.
   Hide the nav balance + logout while selecting cards and drawing. */
body[data-page="game"] .navbar .coin-balance,
body[data-page="game"] .navbar .nav-right { display: none !important; }
.lobby-balance { font-size: 0.82rem; padding: 0.4rem 0.7rem; flex: none; }

/* ===== Card lobby ===== */
.lobby-head-right { display: flex; align-items: center; gap: 0.5rem; flex: none; }
.lobby-split {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}
/* Lobby panel: reserve space for header (~84px), bottom nav (--bottom-nav-h),
   and the grid gap/margins (~40px). Fallback uses 100px for bottom nav if
   --bottom-nav-h not yet measured. */
#lobby-panel { 
    display: flex; flex-direction: column; 
    height: calc(100vh - 124px - var(--bottom-nav-h, 100px)); 
    min-height: 480px; 
}
.lobby-split .card-lobby {
    flex: 1;
    min-height: 0;
    max-height: none;
    overflow-y: auto;
    padding: 0.25rem;
}
.lobby-topbar { display: flex; align-items: center; justify-content: space-between; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.7rem; }
.countdown-pill {
    display: inline-flex; align-items: center; gap: 0.35rem;
    background: rgba(255, 210, 74, 0.12);
    border: 1px solid rgba(255, 210, 74, 0.35);
    color: var(--gold);
    font-family: var(--font-display);
    font-weight: 700; font-size: 0.85rem;
    padding: 0.3rem 0.75rem; border-radius: 999px;
    white-space: nowrap;
}
.card-lobby {
    display: grid;
    grid-template-columns: repeat(auto-fill, 38px);
    gap: 0.3rem;
    justify-content: center;
    align-content: start;
    max-height: 460px;
    overflow-y: auto;
    padding: 0.25rem;
}
.lobby-card {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--panel);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0;
    cursor: pointer;
    font-family: 'Oswald', var(--font);
    font-weight: 600;
    font-size: 0.72rem;
    line-height: 1;
    transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
    position: relative;
    overflow: hidden;
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
    touch-action: manipulation;
}
.lobby-card .lc-num { font-family: 'Oswald', var(--font); font-size: 0.9rem; font-weight: 600; color: var(--text); line-height: 1; }
.lobby-card:hover:not(.taken):not(.mine) { transform: translateY(-2px); border-color: var(--gold); }
.lobby-card.taken { cursor: not-allowed; background: #ff8c00; border-color: #ff8c00; box-shadow: 0 0 12px rgba(255, 140, 0, 0.4); }
.lobby-card.taken .lc-num { color: #fff; }
/* Selected card: solid green fill -- color change is enough to indicate selection. */
.lobby-card.mine { border-color: #2dd47a; background: #2dd47a; box-shadow: 0 0 12px rgba(45, 212, 122, 0.45); }
.lobby-card.mine .lc-num { color: #06231a; }
/* Removed ::after checkmark - green fill is sufficient indicator */

.lobby-loading, .empty-state { color: var(--muted); text-align: center; padding: 2rem 0; }

/* ===== Board ===== */
.board-top { display: flex; flex-direction: column; align-items: center; gap: 0.55rem; margin-bottom: 0.9rem; }
#board-panel .panel-head h2 { font-size: 1.1rem; letter-spacing: 0.5px; }

/* Board panel: fill the available space, cells shrink to fit */
#board-panel {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}
#board-panel .panel-head { flex: none; margin-bottom: 0.5rem; }
#board-panel .board-bottom {
    flex: 1;
    min-height: 0;
    max-width: none;
    width: 100%;
    margin: 0;
    display: flex;
    align-items: stretch;
    overflow: hidden;
}
.board-top .current-ball {
    width: 62px; height: 62px;
    border-radius: 16px;
    background: linear-gradient(135deg, var(--gold), #ff9f2e 55%, #ff6a00);
    color: #1a1200;
    border: 2px solid rgba(255, 240, 190, 0.75);
    box-shadow: 0 0 0 4px rgba(255, 210, 74, 0.15), 0 6px 22px rgba(255, 150, 40, 0.55), inset 0 -6px 10px rgba(0, 0, 0, 0.18);
    animation: current-pulse 1.3s ease-in-out infinite alternate;
}
.board-top .current-ball .ball-number { font-size: 1.35rem; }
.board-top .current-ball .ball-letter { font-size: 0.85rem; }
@keyframes current-pulse {
    from { transform: scale(1); box-shadow: 0 0 0 4px rgba(255, 210, 74, 0.15), 0 6px 22px rgba(255, 150, 40, 0.55), inset 0 -6px 10px rgba(0, 0, 0, 0.18); }
    to { transform: scale(1.08); box-shadow: 0 0 0 8px rgba(255, 210, 74, 0.3), 0 10px 30px rgba(255, 150, 40, 0.85), inset 0 -6px 10px rgba(0, 0, 0, 0.18); }
}
.current-ball-wrap { display: flex; flex-direction: column; align-items: center; gap: 0.3rem; }
.ball {
    width: 110px; height: 110px; border-radius: 50%;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    background: radial-gradient(circle at 32% 28%, #ffffff 0%, #e4e7f0 35%, #aab2c9 100%);
    color: #16203a;
    box-shadow: inset -8px -10px 18px rgba(0, 0, 0, 0.25), inset 6px 8px 14px rgba(255, 255, 255, 0.8), 0 10px 26px rgba(0, 0, 0, 0.4);
}
.ball .ball-letter { font-family: var(--font-display); font-size: 1.3rem; font-weight: 900; }
.ball .ball-number { font-family: var(--font-display); font-size: 2rem; font-weight: 900; line-height: 1; }
.ball-sub { color: var(--muted); font-size: 0.75rem; }
.ball.b-pop { animation: ball-pop 0.45s ease; }
@keyframes ball-pop {
    0% { transform: scale(0.4); }
    60% { transform: scale(1.12); }
    100% { transform: scale(1); }
}

.ball-B { background: radial-gradient(circle at 32% 28%, #dbe8ff, #4aa8ff 70%, #1f6fd0); color: #fff; }
.ball-I { background: radial-gradient(circle at 32% 28%, #ffe2ee, #ff6fa3 70%, #d13a79); color: #fff; }
.ball-N { background: radial-gradient(circle at 32% 28%, #ffecdb, #ff9f43 70%, #d97706); color: #fff; }
.ball-G { background: radial-gradient(circle at 32% 28%, #d9fbe9, #2dd47a 70%, #15935a); color: #fff; }
.ball-O { background: radial-gradient(circle at 32% 28%, #efe3ff, #a06bff 70%, #7a3fd8); color: #fff; }

.last-ten { width: 100%; min-width: 0; text-align: center; }
.section-label { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.6px; color: var(--muted); margin-bottom: 0.35rem; }
.last-ten-grid { display: flex; gap: 0.3rem; flex-wrap: nowrap; justify-content: center; }
.last-ten .ball { width: 32px; height: 32px; color: #16203a; box-shadow: inset -2px -3px 5px rgba(0, 0, 0, 0.2), 0 3px 8px rgba(0, 0, 0, 0.35); }
.last-ten .ball .ball-number { font-size: 0.68rem; }
.last-ten .ball .ball-letter { display: none; }

.fly-ball {
    position: fixed;
    z-index: 9999;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    color: #16203a;
    pointer-events: none;
    transition: transform 0.42s cubic-bezier(0.3, 0.7, 0.4, 1), opacity 0.55s ease;
    will-change: transform, opacity;
    box-shadow: inset -2px -3px 5px rgba(0, 0, 0, 0.2), 0 8px 20px rgba(0, 0, 0, 0.45);
}
.fly-ball .ball-letter { display: none; }
.fly-ball .ball-number { font-size: 0.72rem; }

.board-bottom { max-width: 480px; margin: 0 auto; }
.board-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.6rem;
}
.board-colhead {
    height: 34px;
    border-radius: 9px;
    background: var(--panel-2);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.8rem;
    letter-spacing: 1px;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
}
.board-col-B { background: linear-gradient(135deg, #4aa8ff, #1f6fd0); }
.board-col-I { background: linear-gradient(135deg, #ff6fa3, #d13a79); }
.board-col-N { background: linear-gradient(135deg, #ff9f43, #d97706); }
.board-col-G { background: linear-gradient(135deg, #2dd47a, #15935a); }
.board-col-O { background: linear-gradient(135deg, #a06bff, #7a3fd8); }
.board-cell {
    aspect-ratio: 1;
    border-radius: 9px;
    background: var(--panel);
    border: 1px solid var(--border);
    display: flex; align-items: center; justify-content: center;
    font-family: var(--font-display);
    font-weight: 700;
    font-size: 1.4rem;
    color: #fff;
    transition: border-color 0.2s, box-shadow 0.2s, background 0.2s, transform 0.2s;
}
.board-cell-B { border-color: rgba(74, 168, 255, 0.55); }
.board-cell-I { border-color: rgba(255, 111, 163, 0.55); }
.board-cell-N { border-color: rgba(255, 159, 67, 0.55); }
.board-cell-G { border-color: rgba(45, 212, 122, 0.55); }
.board-cell-O { border-color: rgba(160, 107, 255, 0.55); }
.board-cell.drawn { background: linear-gradient(135deg, var(--gold), var(--gold-2)); color: #1a1200; border-color: transparent; box-shadow: 0 3px 12px rgba(245, 181, 10, 0.3); }
.board-cell.newest {
    border-color: #fff;
    background: linear-gradient(135deg, #fff3c4, var(--gold), #ffb300);
    color: #1a1200;
    box-shadow: 0 0 0 3px rgba(255, 210, 74, 0.65), 0 6px 18px rgba(245, 181, 10, 0.55);
    animation: cell-flash 0.9s ease;
    transform: scale(1.1);
}
@keyframes cell-flash {
    0% { transform: scale(0.5); box-shadow: 0 0 0 0 rgba(255, 210, 74, 0); }
    35% { transform: scale(1.25); box-shadow: 0 0 0 8px rgba(255, 210, 74, 0.8); }
    70% { transform: scale(1.08); box-shadow: 0 0 0 4px rgba(255, 210, 74, 0.5); }
    100% { transform: scale(1.1); box-shadow: 0 0 0 3px rgba(255, 210, 74, 0.65); }
}

/* A called number that is also on the player's own cards is NOT highlighted on
   the board -- it used to get a pulsing outer glow here. The "My Cards" panel
   in the sidebar is where matched cells get marked, and the board stays a plain
   record of what has been called. See game.js renderBoard(). */

/* ===== My cards ===== */
.side-top-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}
.side-top-row .side-balance { justify-content: center; margin-bottom: 0; font-size: 1rem; }
.selected-cards { display: flex; flex-direction: column; gap: 0.8rem; margin-top: 1rem; border-top: 1px dashed var(--border); padding-top: 1rem; }
.selected-cards .section-label { margin-bottom: 0.2rem; }
.lobby-split .selected-cards {
    flex: 0 0 auto;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    margin-top: 0;
    border-top: 1px dashed var(--border);
    padding-top: 0.6rem;
    max-height: 40%;
    overflow-y: auto;
}
.lobby-split .selected-cards .section-label { grid-column: 1 / -1; margin: 0; }
/* Running total of the cards held this round. */
.lobby-split .selected-cards .section-label .sc-total { color: var(--gold); font-weight: 700; }
.lobby-split .selected-cards .bingo-card {
    background: linear-gradient(160deg, #ffd24a 0%, #ff9f2e 55%, #ff6a00 100%);
    border-color: rgba(255, 255, 255, 0.3);
    box-shadow: 0 4px 14px rgba(255, 150, 40, 0.35);
    padding: 0.35rem;
}
.lobby-split .selected-cards .bingo-card .bc-head { font-size: 0.62rem; padding-bottom: 0.2rem; }
.lobby-split .selected-cards .bingo-card .bc-head strong { color: #1a1200; }
.lobby-split .selected-cards .bingo-card .bc-head span { color: rgba(26, 18, 0, 0.75); }
.lobby-split .selected-cards .bc-grid { gap: 2px; }
.lobby-split .selected-cards .bc-colhead { color: #1a1200; font-size: 0.5rem; padding: 1px 0; }
.lobby-split .selected-cards .bc-cell {
    aspect-ratio: 1.4;
    font-size: 0.6rem;
    background: rgba(26, 32, 64, 0.92);
    color: #fff;
    border-radius: 4px;
    border: none;
}
.lobby-split .selected-cards .bc-cell.marked { background: rgba(45, 212, 122, 0.95); color: #06231a; box-shadow: 0 2px 6px rgba(45, 212, 122, 0.45); }
.lobby-split .selected-cards .bc-cell.free { background: rgba(255, 255, 255, 0.28); color: #1a1200; }
.mycards { display: grid; grid-template-columns: 1fr; gap: 0.35rem; min-width: 0; }
/* The card list takes whatever the sidebar column has left over. The old
   max-height: calc(100vh - 340px) estimated that leftover by hand and guessed
   it wrong, which is what pushed the last card row under the bottom menu --
   .mycards-panel above is flex:1 with min-height:0, so the panel resolves the
   real space on its own and any max-height here can only fight it. */
.mycards-scroll { min-height: 0; flex: 1; overflow-y: auto; max-height: none; padding-right: 0.25rem; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.bingo-card { position: relative; }
.bingo-card.won { border-color: var(--gold); box-shadow: 0 0 18px rgba(245, 181, 10, 0.35); }
.bingo-badge {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%) rotate(-8deg);
    background: linear-gradient(135deg, var(--gold), #ff8c00);
    color: #1a1200;
    font-family: var(--font-display);
    font-weight: 900;
    font-size: 1.05rem;
    letter-spacing: 1px;
    padding: 0.28rem 0.7rem;
    border-radius: 10px;
    box-shadow: 0 4px 18px rgba(245, 181, 10, 0.5);
    animation: bingo-flash 0.7s ease infinite alternate;
    z-index: 3;
}
.bingo-card {
    background: #161c36;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.2rem;
    min-width: 0;
}
.bingo-card .bc-head { display: flex; justify-content: space-between; align-items: center; font-family: var(--font-display); font-size: 0.72rem; color: var(--muted); padding: 0 0.15rem 0.25rem; }
.bingo-card .bc-head strong { color: var(--gold); }
.bc-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; min-width: 0; }
.bc-cell { min-width: 0; aspect-ratio: 1.4; border-radius: 6px; background: var(--panel); display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.78rem; border: 1px solid rgba(255,255,255,0.04); }
.bc-cell.marked { background: rgba(45, 212, 122, 0.9); color: #06231a; box-shadow: 0 2px 8px rgba(45, 212, 122, 0.45); }
.bc-cell.free { background: rgba(45, 212, 122, 0.9); color: #06231a; box-shadow: 0 2px 8px rgba(45, 212, 122, 0.45); }
.bc-grid .bc-colhead { color: var(--muted); font-size: 0.6rem; font-weight: 700; text-align: center; padding: 2px 0; }
.bc-cell.pattern-hit { animation: glow-pulse 0.6s ease; }
@keyframes glow-pulse { 0% { box-shadow: 0 0 0 0 rgba(45, 212, 122, 0.7); } 100% { box-shadow: 0 0 0 10px rgba(45, 212, 122, 0); } }

/* ===== Chat ===== */
/* Height available to the sidebar column: the viewport minus the sticky header
   (84px) and the fixed bottom menu (--bottom-nav-h, measured by game.js).
   1rem leaves the header's own bottom margin clear.

   The old calc(100vh - 104px) reserved only ~20px for the menu, far less than
   the menu's real ~83px, so the sidebar ran underneath it and the last card's
   5th row was hidden as soon as a player held more than two cards. */
.game-side {
    --side-available: calc(100vh - 84px - var(--bottom-nav-h) - 1rem);
    min-width: 0;
    position: sticky;
    top: 84px;
    align-self: start;
    /* A definite height, not just a max-height: the card list is sized by the
       flex chain below it, which only divides real available space if the
       column itself has a resolved height. With max-height the column stayed
       content-sized and the list ran on until its own max-height. */
    height: var(--side-available);
    display: flex;
    flex-direction: column;
}
.game-side #mycards-panel { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; margin-bottom: 0; }
.game-side #mycards-panel .board-top { flex: none; }
.chat-panel { display: flex; flex-direction: column; height: 320px; }
.chat-bottom { margin: 1.1rem 0.9rem 0; }
.chat-body { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 0.5rem; padding: 0.4rem 0.2rem; }
.chat-msg { font-size: 0.82rem; padding: 0.4rem 0.7rem; border-radius: 10px; background: var(--panel); max-width: 92%; }
.chat-msg .cm-head { display: flex; gap: 0.4rem; align-items: baseline; }
.chat-msg .cm-name { font-weight: 700; color: var(--gold); font-size: 0.76rem; }
.chat-msg .cm-time { font-size: 0.66rem; color: var(--muted); }
.chat-msg.me { align-self: flex-end; background: rgba(45, 212, 122, 0.12); }
.chat-msg.system { align-self: center; background: rgba(74, 168, 255, 0.12); color: var(--blue); }
.chat-msg.pinned { border-left: 3px solid var(--gold); }

.chat-input { display: flex; gap: 0.4rem; margin-top: 0.5rem; }
.chat-input input {
    flex: 1; padding: 0.55rem 0.7rem; border-radius: 10px;
    border: 1px solid var(--border); background: rgba(0, 0, 0, 0.25); color: var(--text); outline: none;
}
.chat-input input:focus { border-color: var(--gold); }
.send-btn { background: var(--gold); border: none; color: #1a1200; border-radius: 10px; width: 40px; cursor: pointer; font-size: 1rem; }
.emoji-btn { background: var(--panel-2); border: 1px solid var(--border); border-radius: 10px; width: 40px; cursor: pointer; }
.emoji-picker { display: flex; flex-wrap: wrap; gap: 0.3rem; padding: 0.5rem; margin-top: 0.5rem; background: var(--panel-2); border-radius: 10px; max-height: 140px; overflow-y: auto; }
.emoji-picker button { background: none; border: none; font-size: 1.2rem; cursor: pointer; padding: 0.2rem; }
.emoji-picker button:hover { transform: scale(1.3); }

/* ===== Winner overlay ===== */
.winner-overlay {
    position: fixed; inset: 0; z-index: 150;
    background: rgba(5, 8, 18, 0.88);
    backdrop-filter: blur(6px);
    display: flex; align-items: center; justify-content: center;
}
#confetti-canvas, #money-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.winner-card {
    text-align: center; position: relative; padding: 2rem 2rem 1.4rem;
    max-width: 560px; width: 90%; max-height: 92vh; overflow-y: auto;
    background: linear-gradient(160deg, rgba(22, 30, 54, 0.97), rgba(10, 14, 30, 0.97));
    border: 1px solid rgba(255, 210, 74, 0.35);
    border-radius: 20px;
    box-shadow: 0 0 45px rgba(255, 210, 74, 0.28), 0 24px 70px rgba(0, 0, 0, 0.65);
}
.winner-close {
    position: absolute; top: 10px; right: 12px; z-index: 2;
    width: 34px; height: 34px; border-radius: 50%;
    border: 1px solid var(--border); background: rgba(255, 255, 255, 0.08);
    color: var(--text); font-size: 1rem; line-height: 1; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
}
.winner-close:hover { color: var(--gold); border-color: var(--gold); transform: scale(1.08); }
.bingo-title {
    font-family: var(--font-display);
    font-size: 3.2rem;
    font-weight: 900;
    background: linear-gradient(135deg, var(--gold), #ff8c00, var(--gold));
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    animation: bingo-flash 0.8s ease infinite alternate;
}
@keyframes bingo-flash { from { filter: drop-shadow(0 0 6px rgba(255, 210, 74, 0.4)); } to { filter: drop-shadow(0 0 22px rgba(255, 210, 74, 0.9)); } }
.winner-card .wn-congrats { font-size: 1.2rem; font-weight: 800; color: var(--text); margin: 0.8rem 0 0.2rem; }
.winner-card .wn-card-title { font-family: var(--font-display); font-weight: 800; color: var(--gold); font-size: 1.15rem; margin: 0.6rem 0 0.8rem; letter-spacing: 1px; }
.winner-card .wn-message { font-size: 1rem; color: var(--text); margin: 0.8rem 0 0.2rem; }
.winner-card .wn-who {
    font-family: var(--font-display); font-weight: 800; color: var(--gold);
    text-transform: uppercase; letter-spacing: 1px;
}
.winner-card .wn-amount { font-size: 1.7rem; font-weight: 800; color: var(--green); }
.winner-card .wn-amount.wn-count { animation: win-pop 0.6s ease; }
.winner-card .wn-card-title:first-of-type { margin-top: 0.2rem; }
.wn-card { margin: 0 auto; max-width: 260px; }
.wn-card .bc-grid { gap: 4px; }
.wn-card .bc-cell { font-size: 0.95rem; }
@keyframes win-pop {
    0% { transform: scale(0.4); opacity: 0; }
    60% { transform: scale(1.2); }
    100% { transform: scale(1); opacity: 1; }
}
.winner-timer { margin-top: 1.4rem; color: var(--muted); }
.winner-timer strong { color: var(--gold); font-family: var(--font-display); font-size: 1.2rem; }

/* ===== Winner card: own win vs other players ===== */
.winner-card.mine {
    border-color: rgba(76, 217, 100, 0.55);
    background: linear-gradient(160deg, rgba(14, 40, 24, 0.97), rgba(8, 18, 12, 0.97));
    box-shadow: 0 0 55px rgba(76, 217, 100, 0.35), 0 24px 70px rgba(0, 0, 0, 0.65);
}
.winner-card.mine .bingo-title {
    background: linear-gradient(135deg, #7ef29a, #2fd96a, #7ef29a);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.winner-card.mine .wn-congrats { color: #c9f7d5; }
.winner-card.mine .wn-who,
.winner-card.mine .wn-card-title { color: #7ef29a; }
.winner-card.mine .wn-amount { color: #4ce464; }

.winner-card:not(.mine) {
    border-color: rgba(90, 160, 255, 0.5);
    background: linear-gradient(160deg, rgba(18, 28, 56, 0.97), rgba(8, 12, 26, 0.97));
    box-shadow: 0 0 45px rgba(90, 160, 255, 0.3), 0 24px 70px rgba(0, 0, 0, 0.65);
}
.winner-card:not(.mine) .wn-message { color: var(--muted); letter-spacing: 1px; }
.winner-card:not(.mine) .wn-who,
.winner-card:not(.mine) .wn-card-title { color: #7fb8ff; }
.winner-card:not(.mine) .wn-congrats { color: #d9e8ff; }
.winner-card:not(.mine) .wn-amount { color: #5aa0ff; }

/* ===== Pulsing gold ring (lobby) ===== */
.pulse-ring { animation: ring-pulse 1.6s ease infinite; }
@keyframes ring-pulse { 0% { box-shadow: 0 0 0 0 rgba(255, 210, 74, 0.5); } 100% { box-shadow: 0 0 0 16px rgba(255, 210, 74, 0); } }

/* ===== Room picker ===== */
.room-picker {
    display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap;
    padding: 0.7rem 1rem; margin-bottom: 1.1rem; border-radius: 14px;
}
.room-picker-label { font-weight: 700; color: var(--muted); font-size: 0.9rem; }
.room-picker-options { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.room-refresh {
    margin-left: auto;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.8rem;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.3);
    color: var(--text);
    font-weight: 700;
    font-size: 0.8rem;
    cursor: pointer;
    flex: none;
    transition: transform 0.2s ease, border-color 0.15s ease, color 0.15s ease;
}
.room-refresh:hover { border-color: var(--gold); color: var(--gold); transform: rotate(180deg); }
.rooms-footer { display: flex; justify-content: center; margin-top: 1.2rem; }
.rooms-footer .room-refresh { margin-left: 0; }
.room-pill {
    padding: 0.45rem 0.9rem; border-radius: 999px; cursor: pointer;
    background: rgba(0, 0, 0, 0.3); border: 1px solid rgba(255, 210, 74, 0.45); color: var(--text);
    font-weight: 700; font-size: 0.85rem; transition: all 0.2s ease;
}
.room-pill:hover { border-color: var(--gold); }
.room-pill .room-pill-check { display: none; margin-right: 0.35rem; font-weight: 900; }
.room-pill.active .room-pill-check { display: inline; }
.room-pill.active { background: linear-gradient(135deg, var(--gold), #ff8c00); color: #1a0b02; border-color: transparent; }
.room-pill-sub { opacity: 0.75; font-weight: 600; margin-left: 0.3rem; }

/* ===== Rooms page (choose your room) ===== */
.rooms-page { max-width: 1080px; margin: 0 auto; padding: 1.1rem 0.9rem 5rem; }
.rooms-head { text-align: center; margin: 0.6rem 0 1.5rem; }
.rooms-title { font-size: 1.9rem; margin-bottom: 0.25rem; }
.rooms-sub { color: var(--muted); font-size: 0.95rem; }
.room-grid-empty { grid-column: 1 / -1; }

.room-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
    gap: 0.85rem;
}

.room-card {
    --room-a: #2b6bf2; --room-b: #0a1738;
    --room-c: rgba(96, 165, 250, 0.55); --room-glow: rgba(43, 107, 242, 0.5);
    position: relative;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.8rem;
    border-radius: 15px;
    background: linear-gradient(155deg, var(--room-a) 0%, var(--room-b) 68%);
    border: 1px solid var(--room-c);
    box-shadow: 0 14px 32px -12px var(--room-glow), inset 0 1px 0 rgba(255, 255, 255, 0.12);
    color: #fff;
    cursor: pointer;
    overflow: hidden;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.room-card:hover { transform: translateY(-4px); border-color: var(--room-a); box-shadow: 0 22px 46px -12px var(--room-glow), inset 0 1px 0 rgba(255, 255, 255, 0.14); }

/* decorative floating ball + watermark */
.room-card::before {
    content: '';
    position: absolute; right: -24px; top: -24px;
    width: 104px; height: 104px; border-radius: 50%;
    background: radial-gradient(circle at 35% 30%, rgba(255, 255, 255, 0.4), rgba(255, 255, 255, 0.06) 60%, transparent 72%);
    opacity: 0.55; pointer-events: none;
}
.room-card::after {
    content: 'BINGO';
    position: absolute; right: 6px; bottom: 42px;
    font-family: var(--font-display); font-weight: 900; font-size: 2rem; letter-spacing: 3px;
    color: rgba(255, 255, 255, 0.07); pointer-events: none;
}

/* Colorful blinking BINGO overlay (shown when someone wins until the next staking time) */
.room-bingo-blink {
    display: none;
    position: absolute; inset: 0;
    align-items: center; justify-content: center;
    z-index: 5;
    background: rgba(0, 0, 0, 0.5);
    font-family: var(--font-display); font-weight: 900;
    font-size: 2.4rem; letter-spacing: 6px;
    color: #ffd24a;
    animation: bingo-blink 0.75s infinite;
    pointer-events: none;
}
.room-bingo-blink.show { display: flex; }
@keyframes bingo-blink {
    0%, 100% { color: #ffd24a; text-shadow: 0 0 16px #ffd24a, 0 0 30px #ff6d00, 0 0 46px #e3347f; }
    25% { color: #2dd47a; text-shadow: 0 0 16px #2dd47a, 0 0 30px #1fa85c, 0 0 46px #2b6bf2; }
    50% { color: #ff6d00; text-shadow: 0 0 16px #ff6d00, 0 0 30px #e3347f, 0 0 46px #8b3df0; }
    75% { color: #2b6bf2; text-shadow: 0 0 16px #2b6bf2, 0 0 30px #8b3df0, 0 0 46px #e3347f; }
}

/* Room gradients. Twelve well-separated hues; rooms.php hashes the room id into
   this list so every room gets its own colour instead of a repeating stripe.
   --room-a drives the gradient head + the light-theme rail, --room-b the deep
   base, --room-c the border, --room-glow the drop shadow. */
.room-t1  { --room-a: #2b6bf2; --room-b: #0a1738; --room-c: rgba(96, 165, 250, 0.55);  --room-glow: rgba(43, 107, 242, 0.55); }
.room-t2  { --room-a: #e3347f; --room-b: #38081f; --room-c: rgba(244, 114, 182, 0.55); --room-glow: rgba(227, 52, 127, 0.55); }
.room-t3  { --room-a: #f07f16; --room-b: #351406; --room-c: rgba(251, 146, 60, 0.6);   --room-glow: rgba(240, 127, 22, 0.55); }
.room-t4  { --room-a: #1fa85c; --room-b: #072512; --room-c: rgba(74, 222, 128, 0.5);  --room-glow: rgba(31, 168, 92, 0.55); }
.room-t5  { --room-a: #8b3df0; --room-b: #22083d; --room-c: rgba(192, 132, 252, 0.55); --room-glow: rgba(139, 61, 240, 0.55); }
.room-t6  { --room-a: #0e9aa7; --room-b: #04262b; --room-c: rgba(94, 234, 212, 0.5);  --room-glow: rgba(14, 154, 167, 0.55); }
.room-t7  { --room-a: #dc2626; --room-b: #2a0808; --room-c: rgba(252, 165, 165, 0.5);  --room-glow: rgba(220, 38, 38, 0.55); }
.room-t8  { --room-a: #65a30d; --room-b: #131f05; --room-c: rgba(190, 242, 100, 0.5);  --room-glow: rgba(101, 163, 13, 0.55); }
.room-t9  { --room-a: #ca8a04; --room-b: #1f1403; --room-c: rgba(253, 224, 71, 0.5);   --room-glow: rgba(202, 138, 4, 0.55); }
.room-t10 { --room-a: #a21caf; --room-b: #26072f; --room-c: rgba(232, 121, 249, 0.5);  --room-glow: rgba(162, 28, 175, 0.55); }
.room-t11 { --room-a: #0369a1; --room-b: #041826; --room-c: rgba(125, 211, 252, 0.5);  --room-glow: rgba(3, 105, 161, 0.55); }
.room-t12 { --room-a: #4f46e5; --room-b: #0d0d33; --room-c: rgba(165, 180, 252, 0.5);  --room-glow: rgba(79, 70, 229, 0.55); }

.room-card-top { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; z-index: 1; }
.room-status {
    display: inline-flex; align-items: center; gap: 0.35rem;
    font-size: 0.66rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
    padding: 0.2rem 0.45rem; border-radius: 999px;
    background: rgba(0, 0, 0, 0.32); border: 1px solid rgba(255, 255, 255, 0.14);
    backdrop-filter: blur(4px); white-space: nowrap;
}
.room-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 0 rgba(45, 212, 122, 0.6); animation: room-pulse 1.6s ease infinite; }
@keyframes room-pulse { 0% { box-shadow: 0 0 0 0 rgba(45, 212, 122, 0.6); } 100% { box-shadow: 0 0 0 8px rgba(45, 212, 122, 0); } }
.room-status.phase-lobby .room-pulse { background: var(--green); }
.room-status.phase-locked .room-pulse { background: #facc15; animation-name: room-pulse-gold; box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.6); }
.room-status.phase-drawing .room-pulse { background: var(--gold); animation-name: room-pulse-gold; box-shadow: 0 0 0 0 rgba(255, 210, 74, 0.6); }
.room-status.phase-winner .room-pulse { background: #ff8a9b; animation: none; }
.room-status.phase-paused .room-pulse, .room-status.phase-waiting .room-pulse { background: var(--muted); animation: none; }
@keyframes room-pulse-gold { 0% { box-shadow: 0 0 0 0 rgba(255, 210, 74, 0.6); } 100% { box-shadow: 0 0 0 8px rgba(255, 210, 74, 0); } }
.room-phase-label { color: #fff; }

.room-countdown {
    display: none;
    font-family: var(--font-display); font-size: 0.7rem; font-weight: 700; font-variant-numeric: tabular-nums;
    padding: 0.2rem 0.45rem; border-radius: 999px;
    background: rgba(0, 0, 0, 0.32); border: 1px solid rgba(255, 255, 255, 0.14);
    color: var(--gold); white-space: nowrap;
}
.room-countdown.show { display: inline-block; }

/* Lobby countdown urgency: red blinking at <=10s, faster alarm at <=4s */
.room-countdown.warn {
    color: #ff5257;
    background: rgba(255, 60, 70, 0.18);
    border-color: rgba(255, 60, 70, 0.55);
    font-weight: 900;
    animation: cd-blink 0.6s ease infinite;
}
.room-countdown.urgent {
    color: #ff2d3d;
    font-weight: 900;
    animation: cd-alarm 0.3s linear infinite;
}
@keyframes cd-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes cd-alarm { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.5; transform: scale(1.15); } }

.room-card-main { display: flex; flex-direction: column; gap: 0.1rem; z-index: 1; }
.room-title-row { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.room-emoji { font-size: 1.3rem; flex: none; }
.room-name { font-family: var(--font-display); font-size: 1.12rem; font-weight: 800; letter-spacing: 0.4px; color: #fff; margin: 0; }
.room-desc { font-size: 0.72rem; line-height: 1.35; color: rgba(255, 255, 255, 0.78); min-height: 1.2em; }

.room-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.35rem; z-index: 1; }
.room-stat {
    text-align: center; padding: 0.38rem 0.15rem;
    background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px; backdrop-filter: blur(4px);
}
.room-stat > strong { display: block; font-family: var(--font-display); font-size: 1rem; line-height: 1.2; }
.room-stat > span { font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.5px; color: rgba(255, 255, 255, 0.7); }

/* Balls stat: only the current picked ball, animated when it changes */
.room-stat strong.room-current-ball { display: flex; justify-content: center; align-items: center; min-height: 34px; }
.room-live-ball {
    display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
    min-width: 34px; height: 34px; padding: 3px 6px; border-radius: 50%;
    background: radial-gradient(circle at 32% 26%, #ffe97a 0%, var(--gold) 45%, var(--gold-2) 100%);
    color: #241400;
    box-shadow: 0 0 0 0 rgba(255, 210, 74, 0.65), inset 0 -3px 6px rgba(160, 100, 0, 0.35);
    animation: room-live-ball-pop 0.6s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}
.room-live-ball-letter { font-size: 0.52rem; line-height: 1; font-weight: 800; color: #241400; }
.room-live-ball-num { font-size: 0.95rem; line-height: 1.1; font-weight: 800; color: #241400; }
.room-balls-empty { font-family: var(--font-display); font-size: 1rem; color: #fff; line-height: 1.2; }
.room-current-ball .room-countdown { font-size: 1.05rem; padding: 0.15rem 0.35rem; line-height: 1.2; }
@keyframes room-live-ball-pop {
    0% { transform: scale(0.25) rotate(-12deg); opacity: 0; }
    60% { transform: scale(1.18) rotate(3deg); opacity: 1; }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

.room-prize {
    display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; z-index: 1;
    background: rgba(0, 0, 0, 0.32); border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px; padding: 0.42rem 0.6rem;
}
.room-prize span { font-size: 0.62rem; text-transform: uppercase; letter-spacing: 0.5px; color: rgba(255, 255, 255, 0.75); }
.room-prize strong { font-family: var(--font-display); font-size: 0.92rem; color: var(--gold); }

.room-join {
    z-index: 1;
    display: flex; justify-content: space-between; align-items: center; gap: 0.4rem;
    padding: 0.52rem 0.75rem; border-radius: 10px;
    background: linear-gradient(135deg, #ffd24a 0%, #ff9f2e 55%, #ff6a00 100%);
    border: 1px solid rgba(255, 255, 255, 0.35);
    color: #1a1200; font-weight: 700; font-size: 0.8rem; text-decoration: none;
    box-shadow: 0 4px 16px rgba(255, 150, 40, 0.4);
    animation: room-join-beat 1.6s ease-in-out infinite;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.room-join:hover {
    text-decoration: none; color: #1a1200;
    background: linear-gradient(135deg, #ffe97a 0%, #ffb347 55%, #ff7b1c 100%);
    transform: scale(1.04);
    box-shadow: 0 6px 22px rgba(255, 150, 40, 0.6);
    animation-play-state: paused;
}
.room-join-arrow { transition: transform 0.15s ease; }
.room-card:hover .room-join-arrow { transform: translateX(4px); }
@keyframes room-join-beat {
    0%, 100% { transform: scale(1); box-shadow: 0 4px 16px rgba(255, 150, 40, 0.4); }
    12% { transform: scale(1.04); box-shadow: 0 6px 22px rgba(255, 150, 40, 0.65); }
    22% { transform: scale(1); box-shadow: 0 4px 16px rgba(255, 150, 40, 0.4); }
    34% { transform: scale(1.03); box-shadow: 0 5px 20px rgba(255, 150, 40, 0.55); }
    44% { transform: scale(1); box-shadow: 0 4px 16px rgba(255, 150, 40, 0.4); }
}

/* ===== Virtual Games (home) ===== */
.virtual-page { max-width: 1080px; margin: 0 auto; padding: 1.1rem 0.9rem 5rem; }
.virtual-head { text-align: center; margin: 0.6rem 0 1.5rem; }
.virtual-title { font-size: 1.9rem; margin-bottom: 0.25rem; }
.virtual-sub { color: var(--muted); font-size: 0.95rem; }
.virtual-home {
    max-width: 1080px;
    margin: 1.5rem auto 0;
    padding: 0 0.9rem;
}
.virtual-home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1.1rem;
}
.virtual-card {
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border-radius: 18px;
    background: linear-gradient(155deg, var(--panel-2) 0%, var(--bg-2) 70%);
    border: 1px solid var(--border);
    box-shadow: 0 14px 32px -12px rgba(0, 0, 0, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    text-decoration: none;
    color: var(--text);
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.virtual-card:hover {
    transform: translateY(-4px);
    text-decoration: none;
    color: var(--text);
    box-shadow: 0 22px 46px -12px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.virtual-keno-card:hover { border-color: #ff5566; }
.virtual-slot-card:hover { border-color: #9b5cff; }
.virtual-card-img {
    display: block;
    width: 100%;
    height: 180px;
    object-fit: cover;
    object-position: center;
}
.virtual-card-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.9rem 1rem 1rem;
}
.virtual-card-body h3 { font-size: 1.2rem; }
.virtual-card-body p { color: var(--muted); font-size: 0.85rem; line-height: 1.45; }
.virtual-card-cta {
    margin-top: 0.35rem;
    align-self: flex-start;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--gold);
    transition: transform 0.15s ease;
}
.virtual-card:hover .virtual-card-cta { transform: translateX(4px); }
.virtual-keno-card .virtual-card-cta { color: #ff8a99; }
.virtual-slot-card .virtual-card-cta { color: #c39bff; }
