/* =========================================================
   Poker 20-Bomb (撲克牌 20 Bomb) - Modern Casino Theme
   ========================================================= */

:root {
    --bg-dark: #0a0e14;
    --table-green: #115730;
    --table-center: #1a6f3f;
    --table-border: #3b2816;
    --table-gold: #e5b955;
    --text-gold: #f6d884;
    --accent-red: #e63946;
    --accent-blue: #3a86ff;
    --accent-green: #2a9d8f;
    --card-bg: #fdfdfd;
    --card-text: #1d2d44;
    --card-border: #cbd5e1;
    --font-main: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "PingFang TC", "Microsoft JhengHei", sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background-color: var(--bg-dark);
    color: #e2e8f0;
    font-family: var(--font-main);
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
}

/* Header & Top Bar */
.game-header {
    background: rgba(10, 14, 20, 0.95);
    border-bottom: 1px solid rgba(229, 185, 85, 0.25);
    padding: 10px 24px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: relative;
    z-index: 100;
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-gold);
    letter-spacing: 1px;
    text-shadow: 0 0 12px rgba(229, 185, 85, 0.4);
}

.logo .bomb-icon {
    font-size: 1.6rem;
    animation: pulse 2s infinite ease-in-out;
}

.header-controls {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-icon {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.btn-icon:hover {
    background: rgba(229, 185, 85, 0.2);
    border-color: var(--table-gold);
    transform: scale(1.05);
}

/* App Containers */
#app {
    flex: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.view-section {
    display: none;
    flex: 1;
    width: 100%;
}

.view-section.active {
    display: flex;
    flex-direction: column;
}

/* =========================================================
   Lobby Styles
   ========================================================= */
.lobby-container {
    max-width: 900px;
    margin: 40px auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 28px;
    width: 100%;
}

.player-profile-bar {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(229, 185, 85, 0.3);
    border-radius: 14px;
    padding: 16px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}

.player-profile-bar label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-gold);
}

.player-profile-bar input {
    flex: 1;
    max-width: 260px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 8px 14px;
    border-radius: 8px;
    font-size: 1rem;
    outline: none;
}

.player-profile-bar input:focus {
    border-color: var(--table-gold);
    box-shadow: 0 0 8px rgba(229, 185, 85, 0.4);
}

.modes-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 20px;
}

.mode-card {
    background: linear-gradient(145deg, rgba(25, 35, 48, 0.7), rgba(15, 20, 28, 0.8));
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 16px;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    overflow: hidden;
}

.mode-card:hover {
    transform: translateY(-4px);
    border-color: var(--table-gold);
    box-shadow: 0 12px 30px rgba(229, 185, 85, 0.15);
}

.mode-card .card-badge {
    position: absolute;
    top: 14px;
    right: 14px;
    font-size: 0.75rem;
    font-weight: 700;
    padding: 4px 8px;
    border-radius: 6px;
    background: rgba(229, 185, 85, 0.2);
    color: var(--text-gold);
    border: 1px solid rgba(229, 185, 85, 0.3);
}

.mode-icon {
    font-size: 2.4rem;
}

.mode-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: #fff;
}

.mode-desc {
    font-size: 0.88rem;
    color: #94a3b8;
    line-height: 1.45;
    flex: 1;
}

.config-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 6px;
}

.config-group span {
    font-size: 0.85rem;
    color: #cbd5e1;
}

.btn-seg {
    display: flex;
    border-radius: 8px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.2);
}

.btn-seg button {
    background: rgba(0, 0, 0, 0.3);
    color: #94a3b8;
    border: none;
    padding: 6px 14px;
    cursor: pointer;
    font-size: 0.85rem;
    transition: all 0.2s;
}

.btn-seg button.active {
    background: var(--table-gold);
    color: #000;
    font-weight: 700;
}

.btn-action {
    background: linear-gradient(135deg, #e5b955, #c59733);
    color: #0b0f19;
    border: none;
    padding: 12px 18px;
    border-radius: 10px;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    margin-top: 8px;
    transition: all 0.2s;
    box-shadow: 0 4px 14px rgba(229, 185, 85, 0.3);
}

.btn-action:hover {
    filter: brightness(1.1);
    transform: scale(1.02);
}

.btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: none;
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
}

.private-input-group {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

.private-input-group input {
    flex: 1;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #fff;
    padding: 8px 12px;
    border-radius: 8px;
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 2px;
    text-align: center;
}

/* Rules Cheatsheet Drawer */
.rules-card {
    background: rgba(17, 24, 39, 0.6);
    border: 1px dashed rgba(229, 185, 85, 0.4);
    border-radius: 14px;
    padding: 18px 24px;
    font-size: 0.9rem;
    line-height: 1.6;
    color: #cbd5e1;
}

.rules-card h3 {
    color: var(--text-gold);
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.rules-card ul {
    margin-left: 20px;
}

/* =========================================================
   Private Room Waiting Lobby
   ========================================================= */
.room-lobby-container {
    max-width: 650px;
    margin: 50px auto;
    padding: 30px;
    background: rgba(17, 24, 39, 0.85);
    border: 1px solid rgba(229, 185, 85, 0.4);
    border-radius: 20px;
    display: flex;
    flex-direction: column;
    gap: 22px;
    text-align: center;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6);
}

.room-code-badge {
    display: inline-block;
    background: rgba(229, 185, 85, 0.15);
    border: 2px dashed var(--table-gold);
    color: var(--text-gold);
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 6px;
    padding: 10px 24px;
    border-radius: 12px;
    margin: 10px auto;
    cursor: pointer;
}

.room-players-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left;
    margin: 10px 0;
}

.room-player-item {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    padding: 12px 18px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.room-player-item.is-host {
    border-color: var(--table-gold);
}

/* =========================================================
   Casino Poker Felt Table
   ========================================================= */
.table-view {
    position: relative;
    flex: 1;
    display: flex;
    flex-direction: column;
    background: radial-gradient(circle at 50% 45%, #185e35 0%, #0c361e 65%, #05160c 100%);
    overflow: hidden;
}

/* Wood border & stitched line */
.table-inner {
    flex: 1;
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 16px;
    border: 12px solid #281a0e;
    box-shadow: inset 0 0 80px rgba(0, 0, 0, 0.8), 0 0 20px rgba(0, 0, 0, 0.9);
    margin: 10px;
    border-radius: 40px;
}

/* Round Info & Scoreboard bar */
.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.4);
    border-radius: 20px;
    backdrop-filter: blur(8px);
    z-index: 10;
}

.round-badge {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-gold);
    display: flex;
    align-items: center;
    gap: 8px;
}

.room-tag {
    font-size: 0.85rem;
    color: #94a3b8;
    background: rgba(255, 255, 255, 0.08);
    padding: 4px 10px;
    border-radius: 8px;
}

/* Seats Layout */
.opponents-container {
    display: flex;
    justify-content: space-around;
    align-items: flex-start;
    padding: 10px;
    gap: 16px;
}

.player-seat {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    position: relative;
    transition: all 0.3s;
}

.seat-avatar-wrap {
    position: relative;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: #1e293b;
    border: 3px solid rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.8rem;
    box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
}

.player-seat.active .seat-avatar-wrap {
    border-color: var(--table-gold);
    box-shadow: 0 0 16px rgba(229, 185, 85, 0.6);
}

.player-seat.busted .seat-avatar-wrap {
    border-color: var(--accent-red);
    box-shadow: 0 0 20px rgba(230, 57, 70, 0.8);
    animation: shake 0.5s ease-in-out;
}

.seat-status-tag {
    position: absolute;
    bottom: -6px;
    right: -4px;
    background: #000;
    border: 1px solid #fff;
    font-size: 0.65rem;
    padding: 2px 6px;
    border-radius: 8px;
}

.seat-name {
    font-size: 0.88rem;
    font-weight: 700;
    color: #f1f5f9;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.8);
    max-width: 100px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.seat-stats {
    display: flex;
    align-items: center;
    gap: 8px;
    background: rgba(0, 0, 0, 0.5);
    border-radius: 12px;
    padding: 4px 10px;
    font-size: 0.82rem;
}

.score-chip {
    color: var(--text-gold);
    font-weight: 800;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* 20 Bomb Points Meter */
.bomb-meter {
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 6px;
    background: rgba(42, 157, 143, 0.3);
    color: #6ee7b7;
}

.bomb-meter.warning {
    background: rgba(245, 158, 11, 0.3);
    color: #fbbf24;
}

.bomb-meter.danger {
    background: rgba(230, 57, 70, 0.4);
    color: #f87171;
    animation: pulse 1s infinite;
}

.bomb-meter.busted {
    background: #e63946;
    color: #fff;
    font-weight: 900;
}

/* =========================================================
   Live Points Dashboard (全場即時點數概覽欄)
   ========================================================= */
.live-dashboard {
    display: flex;
    justify-content: center;
    gap: 12px;
    padding: 8px 12px;
    background: rgba(10, 15, 24, 0.7);
    border: 1px solid rgba(229, 185, 85, 0.3);
    border-radius: 14px;
    margin: 6px 0 8px 0;
    backdrop-filter: blur(6px);
    flex-wrap: wrap;
    z-index: 10;
}

.dashboard-item {
    display: flex;
    align-items: center;
    gap: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 6px 14px;
    transition: all 0.25s ease;
}

.dashboard-item.is-me {
    border-color: #3b82f6;
    background: rgba(59, 130, 246, 0.15);
}

.dashboard-item.is-winner {
    border-color: var(--table-gold);
    box-shadow: 0 0 10px rgba(229, 185, 85, 0.4);
}

.dash-avatar {
    font-size: 1.3rem;
}

.dash-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.dash-name-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 700;
    color: #e2e8f0;
}

.dash-score-badge {
    color: var(--text-gold);
    font-size: 0.78rem;
    background: rgba(0, 0, 0, 0.4);
    padding: 1px 5px;
    border-radius: 4px;
}

.dash-points-val {
    font-size: 1.15rem;
    font-weight: 900;
    letter-spacing: 0.5px;
    display: flex;
    align-items: baseline;
    gap: 2px;
}

.dash-points-val .sub {
    font-size: 0.72rem;
    font-weight: 600;
    color: #94a3b8;
}

/* Big Display for Seat Points */
.seat-stats {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    background: rgba(0, 0, 0, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 12px;
    padding: 6px 12px;
    min-width: 110px;
}

.seat-stats-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
}

.bomb-meter {
    font-size: 1.35rem;
    font-weight: 900;
    padding: 2px 8px;
    border-radius: 8px;
    background: rgba(42, 157, 143, 0.35);
    color: #6ee7b7;
    letter-spacing: 0.5px;
    text-shadow: 0 0 8px rgba(110, 231, 183, 0.4);
}

.bomb-meter.warning {
    background: rgba(245, 158, 11, 0.35);
    color: #fbbf24;
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.4);
}

.bomb-meter.danger {
    background: rgba(230, 57, 70, 0.45);
    color: #f87171;
    text-shadow: 0 0 10px rgba(248, 113, 113, 0.8);
    animation: pulse 0.8s infinite;
}

.bomb-meter.busted {
    background: #e63946;
    color: #fff;
    font-weight: 900;
    text-shadow: 0 0 10px #ff0000;
}

/* Progress bar inside seat */
.seat-progress-bar {
    width: 100%;
    height: 6px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 3px;
    overflow: hidden;
}

.seat-progress-fill {
    height: 100%;
    background: #10b981;
    border-radius: 3px;
    transition: width 0.3s ease, background-color 0.3s ease;
}

.seat-progress-fill.warning {
    background: #f59e0b;
}

.seat-progress-fill.danger {
    background: #ef4444;
}

/* =========================================================
   Center Reveal & Unobstructed Banner
   ========================================================= */
.table-center {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    position: relative;
    min-height: 250px;
    padding: 10px 0;
    gap: 12px;
}

/* =========================================================
   10s Tension Countdown Timer
   ========================================================= */
.timer-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    margin: 4px 0;
    z-index: 25;
}

.timer-ring {
    width: 68px;
    height: 68px;
    border-radius: 50%;
    border: 4px solid var(--table-gold);
    background: radial-gradient(circle, #1a2234 0%, #0d121c 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.85rem;
    font-weight: 900;
    color: var(--text-gold);
    box-shadow: 0 0 18px rgba(229, 185, 85, 0.5), inset 0 0 10px rgba(0, 0, 0, 0.6);
    transition: border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
    text-shadow: 0 0 8px rgba(229, 185, 85, 0.6);
}

.timer-ring.warning {
    border-color: #f59e0b;
    color: #fbbf24;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.6);
    text-shadow: 0 0 8px rgba(251, 191, 36, 0.6);
}

.timer-ring.danger {
    border-color: #ef4444;
    color: #f87171;
    box-shadow: 0 0 25px rgba(239, 68, 68, 0.9), inset 0 0 12px rgba(239, 68, 68, 0.4);
    text-shadow: 0 0 10px #ff0000;
    animation: timerPulse 0.5s infinite;
}

.timer-label {
    font-size: 0.8rem;
    font-weight: 700;
    color: #cbd5e1;
    letter-spacing: 1px;
}

@keyframes timerPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

/* =========================================================
   Side Announcement Panel (本局獲勝者 - 移至牌桌側邊)
   ========================================================= */
.round-result-banner {
    position: absolute;
    right: 28px;
    top: 50%;
    transform: translateY(-50%);
    width: 260px;
    background: rgba(10, 16, 26, 0.95);
    border: 2px solid var(--table-gold);
    border-radius: 16px;
    padding: 16px 18px;
    box-shadow: 0 12px 35px rgba(0, 0, 0, 0.8), 0 0 20px rgba(229, 185, 85, 0.35);
    z-index: 60;
    display: none;
    text-align: left;
    backdrop-filter: blur(10px);
}

.round-result-banner.active {
    display: flex;
    flex-direction: column;
    gap: 8px;
    animation: slideInRight 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.banner-title {
    font-size: 1.15rem;
    font-weight: 800;
    color: var(--text-gold);
    display: flex;
    align-items: center;
    gap: 6px;
    border-bottom: 1px solid rgba(229, 185, 85, 0.25);
    padding-bottom: 6px;
}

.banner-desc {
    font-size: 0.92rem;
    color: #f1f5f9;
    line-height: 1.5;
}

@keyframes slideInRight {
    0% { transform: translateY(-50%) translateX(40px); opacity: 0; }
    100% { transform: translateY(-50%) translateX(0); opacity: 1; }
}

/* Center Cards Layout: Enlarged, Clearly Visible */
.center-cards-layout {
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 24px;
    flex-wrap: wrap;
    margin: 8px 0;
    z-index: 20;
}

.center-card-slot {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    transition: transform 0.3s ease;
}

.center-card-slot.is-winner {
    transform: translateY(-8px) scale(1.05);
}

.center-card-slot .owner-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: #f8fafc;
    background: rgba(0, 0, 0, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 3px 10px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.center-card-slot.is-winner .owner-label {
    border-color: var(--table-gold);
    color: var(--text-gold);
    background: rgba(229, 185, 85, 0.2);
}

/* Card Flipper during Reveal */
.card-flipper {
    width: 82px;
    height: 116px;
    perspective: 800px;
    cursor: default;
    transition: transform 0.3s;
}

.card-flipper.flipped {
    transform: scale(1.08);
}

.card-center-num {
    font-size: 2.2rem;
    font-weight: 900;
    align-self: center;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

/* Reveal Math Info Tag under card */
.reveal-math-tag {
    font-size: 0.8rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 6px;
    background: rgba(0, 0, 0, 0.75);
    border: 1px solid rgba(255, 255, 255, 0.2);
    text-align: center;
    max-width: 120px;
    line-height: 1.3;
}

.reveal-math-tag.safe {
    color: #6ee7b7;
    border-color: #10b981;
}

.reveal-math-tag.busted {
    color: #f87171;
    border-color: #e63946;
    background: rgba(230, 57, 70, 0.2);
    animation: pulse 1s infinite;
}

.reveal-math-tag.winner {
    color: var(--text-gold);
    border-color: var(--table-gold);
    background: rgba(229, 185, 85, 0.2);
    box-shadow: 0 0 10px rgba(229, 185, 85, 0.4);
}

/* Reveal Controls (繼續下一局按鈕) */
.reveal-controls {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 10px;
    z-index: 40;
}

.btn-next-round {
    background: linear-gradient(135deg, #e5b955, #c59733);
    color: #0b0f19;
    border: 2px solid #fff;
    padding: 10px 28px;
    border-radius: 30px;
    font-size: 1.05rem;
    font-weight: 900;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(229, 185, 85, 0.5);
    animation: pulse 1.5s infinite;
    transition: all 0.2s;
}

.btn-next-round:hover {
    transform: scale(1.06);
    filter: brightness(1.15);
    box-shadow: 0 8px 26px rgba(229, 185, 85, 0.7);
}

@keyframes slideDown {
    0% { transform: translateY(-16px); opacity: 0; }
    100% { transform: translateY(0); opacity: 1; }
}

/* High number card highlights */
.card-front[data-val="11"],
.card-front[data-val="12"],
.card-front[data-val="13"] {
    background: linear-gradient(135deg, #fffbeb, #ffffff);
    color: #b45309;
    border-color: #f59e0b;
}

/* Bottom Player Deck / Hand Tray */
.player-hand-tray {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 20;
    padding-top: 10px;
}

.hand-preview-info {
    font-size: 0.88rem;
    font-weight: 600;
    color: #e2e8f0;
    background: rgba(0, 0, 0, 0.6);
    padding: 4px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.hand-cards-list {
    display: flex;
    justify-content: center;
    gap: 6px;
    flex-wrap: nowrap;
    overflow-x: auto;
    padding: 10px 10px 16px;
    max-width: 100%;
}

/* Clickable Hand Cards */
.hand-card-item {
    width: 68px;
    height: 98px;
    background: #ffffff;
    border: 2px solid #94a3b8;
    border-radius: 8px;
    color: #0f172a;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 5px;
    cursor: pointer;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    flex-shrink: 0;
}

.hand-card-item:hover {
    transform: translateY(-14px) scale(1.06);
    border-color: var(--table-gold);
    box-shadow: 0 12px 20px rgba(0, 0, 0, 0.6), 0 0 10px rgba(229, 185, 85, 0.4);
}

.hand-card-item.selected {
    transform: translateY(-20px) scale(1.1);
    border-color: #3b82f6;
    box-shadow: 0 14px 24px rgba(0, 0, 0, 0.6), 0 0 14px rgba(59, 130, 246, 0.8);
}

.hand-card-item.would-bust {
    border-color: #f87171;
}

.hand-card-item.would-bust:hover {
    border-color: var(--accent-red);
    box-shadow: 0 12px 20px rgba(230, 57, 70, 0.4);
}

.hand-card-item .card-center-num {
    font-size: 1.6rem;
}

/* =========================================================
   Game Over Modal
   ========================================================= */
.game-over-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(10px);
    z-index: 200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.game-over-modal.active {
    display: flex;
}

.modal-content {
    background: #111827;
    border: 2px solid var(--table-gold);
    border-radius: 20px;
    max-width: 520px;
    width: 100%;
    padding: 30px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    text-align: center;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.8);
    animation: popIn 0.4s ease;
}

.leaderboard-table {
    width: 100%;
    border-collapse: collapse;
    margin: 10px 0;
}

.leaderboard-table th,
.leaderboard-table td {
    padding: 10px 12px;
    text-align: left;
}

.leaderboard-table th {
    color: #94a3b8;
    font-size: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.leaderboard-table tr.winner-row {
    background: rgba(229, 185, 85, 0.15);
    color: var(--text-gold);
    font-weight: 800;
}

/* Animations */
@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.08); opacity: 0.85; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-8px); }
    40%, 80% { transform: translateX(8px); }
}

@keyframes popIn {
    0% { transform: translate(-50%, -50%) scale(0.85); opacity: 0; }
    100% { transform: translate(-50%, -50%) scale(1); opacity: 1; }
}

/* Toast Notification */
.toast-msg {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(15, 23, 42, 0.95);
    border: 1px solid var(--table-gold);
    color: #f8fafc;
    padding: 10px 22px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.6);
    z-index: 300;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
}

.toast-msg.show {
    opacity: 1;
}

/* Responsive adjustments: Mobile 100dvh No-Scroll, Zero-Overlap */
@media (max-width: 800px) {
    html, body {
        width: 100vw;
        max-width: 100vw;
        height: 100dvh;
        max-height: 100dvh;
        overflow: hidden !important;
        position: fixed;
        margin: 0;
        padding: 0;
        box-sizing: border-box;
        touch-action: manipulation;
    }

    *, *::before, *::after {
        box-sizing: border-box;
        min-width: 0;
    }

    #app {
        width: 100vw;
        max-width: 100vw;
        height: calc(100dvh - 38px);
        overflow: hidden !important;
        margin: 0;
        padding: 0;
    }

    .game-header {
        height: 38px;
        padding: 4px 10px;
    }

    .logo {
        font-size: 0.95rem;
        gap: 6px;
    }

    .logo .bomb-icon {
        font-size: 1.15rem;
    }

    .btn-icon {
        width: 28px;
        height: 28px;
        font-size: 0.85rem;
    }

    .table-view {
        width: 100vw;
        max-width: 100vw;
        height: 100%;
        overflow: hidden !important;
        padding: 0;
        margin: 0;
    }

    .table-inner {
        width: calc(100vw - 6px) !important;
        max-width: calc(100vw - 6px) !important;
        height: calc(100% - 6px) !important;
        max-height: calc(100% - 6px) !important;
        margin: 3px !important;
        padding: 4px 6px !important;
        border-width: 3px !important;
        border-radius: 14px !important;
        overflow: hidden !important;
        display: flex;
        flex-direction: column;
        justify-content: space-between;
    }

    .table-header {
        padding: 2px 6px;
        margin-bottom: 2px;
    }

    .round-badge {
        font-size: 0.75rem;
    }

    .room-tag {
        font-size: 0.65rem;
        padding: 1px 5px;
    }

    /* Live Dashboard: 4 Compact Tiles (Grid 4 columns) */
    .live-dashboard {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 2px !important;
        padding: 2px 4px !important;
        margin: 2px 0 !important;
        width: 100% !important;
        border-radius: 6px !important;
    }

    .dashboard-item {
        padding: 2px 3px !important;
        gap: 2px !important;
        border-radius: 4px !important;
        flex-direction: column !important;
        align-items: center !important;
        text-align: center !important;
    }

    .dash-avatar {
        font-size: 0.9rem !important;
    }

    .dash-info {
        gap: 0 !important;
        align-items: center !important;
    }

    .dash-name-row {
        font-size: 0.62rem !important;
        gap: 2px !important;
    }

    .dash-score-badge {
        font-size: 0.58rem !important;
        padding: 0 2px !important;
    }

    .dash-points-val {
        font-size: 0.78rem !important;
    }

    .dash-points-val .sub {
        font-size: 0.55rem !important;
    }

    /* Opponents: Grid of 3 seats across 100% width */
    .opponents-container {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 4px !important;
        padding: 2px 0 !important;
        width: 100% !important;
    }

    .player-seat {
        gap: 1px !important;
        width: 100% !important;
        align-items: center !important;
    }

    .seat-avatar-wrap {
        width: 30px !important;
        height: 30px !important;
        font-size: 0.85rem !important;
        border-width: 1.5px !important;
    }

    .seat-status-tag {
        font-size: 0.5rem !important;
        padding: 0 2px !important;
        bottom: -3px !important;
        right: -3px !important;
    }

    .seat-name {
        font-size: 0.65rem !important;
        max-width: 70px !important;
    }

    .seat-stats {
        padding: 1px 3px !important;
        min-width: 0 !important;
        width: 100% !important;
        max-width: 80px !important;
        gap: 1px !important;
    }

    .score-chip {
        font-size: 0.6rem !important;
    }

    .bomb-meter {
        font-size: 0.82rem !important;
        padding: 0 2px !important;
    }

    .seat-progress-bar {
        height: 2.5px !important;
    }

    /* Center Table Area */
    .table-center {
        flex: 1 !important;
        min-height: 0 !important;
        padding: 2px 0 !important;
        gap: 2px !important;
        justify-content: center !important;
        width: 100% !important;
        max-width: 100% !important;
    }

    .timer-container {
        margin: 1px 0 !important;
        gap: 1px !important;
    }

    .timer-ring {
        width: 36px !important;
        height: 36px !important;
        font-size: 1.1rem !important;
        border-width: 2.5px !important;
    }

    .timer-label {
        display: none !important;
    }

    /* Center Played Cards: Grid 4 columns fitting 100% */
    .center-cards-layout {
        display: grid !important;
        grid-template-columns: repeat(4, 1fr) !important;
        gap: 4px !important;
        margin: 2px 0 !important;
        width: 100% !important;
        max-width: 320px !important;
    }

    .center-card-slot {
        gap: 1px !important;
        align-items: center !important;
        width: 100% !important;
    }

    .center-card-slot .owner-label {
        font-size: 0.6rem !important;
        padding: 1px 3px !important;
        max-width: 65px !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .card-flipper {
        width: 38px !important;
        height: 54px !important;
    }

    .card-flipper.flipped {
        transform: none !important;
    }

    .card-center-num {
        font-size: 1.05rem !important;
    }

    .card-corner {
        font-size: 0.55rem !important;
    }

    .card-face {
        padding: 2px !important;
        border-radius: 4px !important;
        border-width: 1px !important;
    }

    .reveal-math-tag {
        font-size: 0.58rem !important;
        padding: 1px 2px !important;
        max-width: 65px !important;
        line-height: 1.1 !important;
    }

    /* ZERO OVERLAPPING: Winner Announcement is completely inline */
    .round-result-banner {
        position: static !important;
        transform: none !important;
        width: 100% !important;
        max-width: 320px !important;
        padding: 4px 8px !important;
        margin: 2px auto !important;
        border-radius: 8px !important;
        border-width: 1px !important;
        text-align: center !important;
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6) !important;
    }

    .round-result-banner.active {
        display: flex !important;
        flex-direction: column !important;
        gap: 1px !important;
        animation: none !important;
    }

    .banner-title {
        font-size: 0.8rem !important;
        padding-bottom: 1px !important;
        justify-content: center !important;
    }

    .banner-desc {
        font-size: 0.7rem !important;
        line-height: 1.2 !important;
    }

    .reveal-controls {
        margin-top: 2px !important;
    }

    .btn-next-round {
        padding: 4px 14px !important;
        font-size: 0.8rem !important;
        border-width: 1px !important;
    }

    /* Player Hand Tray: Exactly 2 Compact Rows (7 on row 1, 6 on row 2), 100% fit, NO SCROLL */
    .player-hand-tray {
        padding: 2px 0 0 0 !important;
        gap: 2px !important;
        width: 100% !important;
    }

    .hand-preview-info {
        font-size: 0.68rem !important;
        padding: 1px 6px !important;
        max-width: 96% !important;
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
    }

    .hand-cards-list {
        display: grid !important;
        grid-template-columns: repeat(7, 1fr) !important;
        gap: 2px !important;
        overflow: hidden !important;
        max-height: 110px !important;
        padding: 2px !important;
        width: 100% !important;
        max-width: 340px !important;
        margin: 0 auto !important;
    }

    .hand-card-item {
        width: 100% !important;
        height: 48px !important;
        min-width: 0 !important;
        padding: 2px 1px !important;
        border-radius: 4px !important;
        border-width: 1px !important;
        box-sizing: border-box !important;
    }

    .hand-card-item .card-center-num {
        font-size: 0.95rem !important;
    }

    .hand-card-item .card-corner {
        font-size: 0.55rem !important;
    }

    .hand-card-item:hover,
    .hand-card-item:active {
        transform: translateY(-3px) scale(1.05) !important;
    }
}
