:root {
    --gold: #f5c518;
    --dark: #0d0d0d;
    --card-bg: #1a1a2e;
    --accent: #e94560;
    --green: #16c79a;
    --muted: #888;
}

* { box-sizing: border-box; }

body {
    background: var(--dark);
    color: #f0f0f0;
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    margin: 0;
}

/* Login screen */
#login-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    background: radial-gradient(ellipse at center, #1a1a2e 0%, #0d0d0d 100%);
}

.logo-title {
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: 2px;
    color: var(--gold);
    text-transform: uppercase;
    text-align: center;
    margin-bottom: 0.25rem;
}

.logo-sub {
    color: var(--muted);
    text-align: center;
    margin-bottom: 2.5rem;
    font-size: 0.95rem;
}

.player-btn {
    width: 220px;
    padding: 1.1rem 1rem;
    margin: 0.5rem;
    border: 2px solid var(--gold);
    background: transparent;
    color: var(--gold);
    font-size: 1.3rem;
    font-weight: 700;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 1px;
}

.player-btn:hover, .player-btn:active {
    background: var(--gold);
    color: var(--dark);
}

/* Waiting screen */
#waiting-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    text-align: center;
}

.waiting-name {
    font-size: 1.8rem;
    color: var(--gold);
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.spinner {
    width: 50px; height: 50px;
    border: 4px solid #333;
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 2rem auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Game screen */
#game-screen {
    max-width: 480px;
    margin: 0 auto;
    padding: 0 0 6rem;
}

.top-bar {
    background: var(--card-bg);
    padding: 1rem 1.2rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 2px solid var(--gold);
    position: sticky;
    top: 0;
    z-index: 100;
}

.top-bar .game-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--gold);
    letter-spacing: 1px;
}

.top-bar .broadcast-num {
    font-size: 0.8rem;
    color: var(--muted);
}

/* Score cards */
.score-section {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    padding: 1rem 0.75rem 0;
}

.score-card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 1rem;
    border: 2px solid #333;
    transition: border-color 0.3s;
}

.score-card.is-me {
    border-color: var(--gold);
}

.score-card .player-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.25rem;
}

.score-card .chip-count {
    font-size: 2.2rem;
    font-weight: 900;
    color: var(--gold);
    line-height: 1;
}

.score-card .chip-label {
    font-size: 0.72rem;
    color: var(--muted);
    margin-top: 0.15rem;
}

.badge-row {
    display: flex;
    gap: 0.4rem;
    margin-top: 0.6rem;
    flex-wrap: wrap;
}

.badge-adj, .badge-dbl {
    font-size: 0.65rem;
    padding: 0.2rem 0.5rem;
    border-radius: 20px;
    font-weight: 600;
    letter-spacing: 0.5px;
}

.badge-adj {
    background: #2a2a40;
    color: #aaa;
    border: 1px solid #444;
}

.badge-adj.used { color: #555; }

.badge-dbl {
    background: #2d1a00;
    color: var(--gold);
    border: 1px solid var(--gold);
}

.badge-dbl.used {
    background: #1a1a1a;
    color: #555;
    border-color: #333;
}

/* Round cards */
.rounds-section {
    padding: 1rem 0.75rem 0;
}

.section-title {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 0.75rem;
}

.round-card {
    background: var(--card-bg);
    border-radius: 14px;
    padding: 1rem 1.1rem;
    margin-bottom: 0.75rem;
    border: 2px solid #222;
    transition: border-color 0.2s;
}

.round-card.active-round {
    border-color: var(--accent);
}

.round-card.done-round {
    border-color: var(--green);
    opacity: 0.85;
}

.round-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.round-num {
    font-size: 1rem;
    font-weight: 800;
    color: #fff;
}

.round-status {
    font-size: 0.72rem;
    padding: 0.2rem 0.6rem;
    border-radius: 20px;
    font-weight: 600;
}

.status-open   { background: #1a1a30; color: #888; }
.status-active { background: var(--accent); color: #fff; }
.status-done   { background: var(--green); color: #000; }

/* Estimate inputs */
.estimate-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.estimate-group label {
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.3rem;
}

.estimate-group input {
    width: 100%;
    background: #111;
    border: 1.5px solid #333;
    border-radius: 8px;
    color: #fff;
    padding: 0.55rem 0.7rem;
    font-size: 1rem;
    font-weight: 700;
    outline: none;
    transition: border-color 0.2s;
}

.estimate-group input:focus { border-color: var(--gold); }
.estimate-group input:disabled { opacity: 0.4; }

.estimate-group input.locked {
    border-color: var(--green);
    color: var(--green);
}

/* Action buttons */
.action-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.5rem;
    flex-wrap: wrap;
}

.btn-save {
    flex: 1;
    background: var(--gold);
    color: var(--dark);
    border: none;
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
}

.btn-save:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-adjust {
    flex: 1;
    background: transparent;
    border: 1.5px solid #555;
    color: #aaa;
    border-radius: 8px;
    padding: 0.6rem 0.8rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-adjust:disabled { opacity: 0.3; cursor: not-allowed; }
.btn-adjust:not(:disabled):hover { border-color: var(--gold); color: var(--gold); }

.btn-doubler {
    width: 100%;
    background: transparent;
    border: 1.5px solid var(--gold);
    color: var(--gold);
    border-radius: 8px;
    padding: 0.55rem 0.8rem;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.btn-doubler:disabled { border-color: #333; color: #444; cursor: not-allowed; }
.btn-doubler.active-dbl { background: var(--gold); color: var(--dark); }

/* Bet section */
.bet-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.6rem;
    margin-top: 0.6rem;
    padding-top: 0.6rem;
    border-top: 1px solid #222;
}

.bet-group {
    flex: 1;
}

.bet-label {
    font-size: 0.7rem;
    color: var(--muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: block;
    margin-bottom: 0.3rem;
}

.bet-max {
    color: #555;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
}

.bet-input-wrap {
    display: flex;
    gap: 0.4rem;
}

.bet-input-wrap input {
    width: 80px;
    background: #111;
    border: 1.5px solid #e94560;
    border-radius: 8px;
    color: #fff;
    padding: 0.5rem 0.6rem;
    font-size: 1rem;
    font-weight: 700;
    outline: none;
}

.bet-input-wrap input:focus { border-color: #ff7090; }
.bet-input-wrap input:disabled { opacity: 0.4; }

.btn-bet {
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    padding: 0.5rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-bet:disabled { opacity: 0.35; cursor: not-allowed; }

.bet-other {
    text-align: right;
    min-width: 80px;
}

.bet-other-label {
    display: block;
    font-size: 0.65rem;
    color: #555;
    margin-bottom: 0.2rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.bet-other-val {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--muted);
}

.result-pot {
    margin-top: 0.4rem;
    padding-top: 0.4rem;
    border-top: 1px solid #2a2a2a;
    color: var(--gold) !important;
}

/* Answer section */
.answer-section {
    margin-top: 0.6rem;
    display: flex;
    gap: 0.5rem;
    align-items: stretch;
}

.answer-section input {
    flex: 1;
    background: #111;
    border: 1.5px solid var(--accent);
    border-radius: 8px;
    color: #fff;
    padding: 0.6rem 0.8rem;
    font-size: 1rem;
    font-weight: 700;
    outline: none;
}

.btn-answer {
    background: var(--accent);
    border: none;
    border-radius: 8px;
    color: #fff;
    padding: 0.6rem 1rem;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    white-space: nowrap;
}

.btn-answer:disabled { opacity: 0.35; cursor: not-allowed; }

/* Result display */
.result-box {
    margin-top: 0.75rem;
    background: #111;
    border-radius: 10px;
    padding: 0.8rem 1rem;
    border: 1px solid #2a2a2a;
}

.result-box .result-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}

.result-box .result-row:last-child { margin-bottom: 0; }

.result-box .winner-tag {
    font-size: 0.7rem;
    background: var(--green);
    color: #000;
    border-radius: 10px;
    padding: 0.15rem 0.5rem;
    font-weight: 700;
}

.result-box .chips-won {
    font-weight: 800;
    color: var(--gold);
}

/* Bottom reset bar */
.reset-bar {
    position: fixed;
    bottom: 0;
    left: 0; right: 0;
    background: var(--card-bg);
    border-top: 2px solid #222;
    padding: 0.75rem 1rem;
    max-width: 480px;
    margin: 0 auto;
}

.btn-reset {
    width: 100%;
    background: transparent;
    border: 1.5px solid #444;
    color: #666;
    border-radius: 10px;
    padding: 0.7rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 0.5rem;
}

.btn-reset:hover { border-color: var(--accent); color: var(--accent); }

.btn-exit {
    width: 100%;
    background: transparent;
    border: 1.5px solid #2a2a2a;
    color: #444;
    border-radius: 10px;
    padding: 0.55rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.5px;
}

.btn-exit:hover { border-color: #666; color: #888; }

/* Toast */
.toast-container {
    position: fixed;
    top: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    width: 90%;
    max-width: 380px;
}

.toast-msg {
    background: #222;
    color: #fff;
    padding: 0.8rem 1.2rem;
    border-radius: 10px;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    font-weight: 600;
    border-left: 4px solid var(--green);
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
    animation: slideIn 0.3s ease;
}

.toast-msg.error { border-left-color: var(--accent); }

@keyframes slideIn {
    from { opacity: 0; transform: translateY(-10px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }
