@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,500;9..144,600;9..144,700&family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@500;600&display=swap');

:root {
    --felt:       #17362B;
    --felt-2:     #1F4436;
    --felt-3:     #275342;
    --cream:      #F2ECDA;
    --cream-dim:  #C9C2AD;
    --gold:       #CBA135;
    --gold-dim:   #9C7F30;
    --ink:        #0E1C15;
    --red:        #B0413E;
    --line:       rgba(242,236,218,0.14);
    --radius: 10px;
    --shadow: 0 12px 30px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(ellipse at top, rgba(255,255,255,0.05), transparent 60%),
        repeating-linear-gradient(135deg, rgba(255,255,255,0.015) 0 2px, transparent 2px 6px),
        var(--felt);
    color: var(--cream);
    font-family: 'Inter', system-ui, sans-serif;
    -webkit-font-smoothing: antialiased;
}

.wrap {
    max-width: 780px;
    margin: 0 auto;
    padding: 28px 18px 80px;
}

h1, h2, h3 { font-family: 'Fraunces', serif; font-weight: 600; margin: 0 0 4px; letter-spacing: 0.2px; }

.brand {
    display: flex;
    align-items: baseline;
    gap: 10px;
    margin-bottom: 8px;
}
.brand .suit { color: var(--gold); font-size: 1.4rem; }
.brand h1 { font-size: 1.5rem; }
.brand .tag { color: var(--cream-dim); font-size: 0.8rem; }

.nav-links { display: flex; gap: 8px; margin-bottom: 22px; }
.nav-link {
    background: transparent; border: 1px solid var(--line); color: var(--cream-dim);
    font-size: 0.78rem; font-weight: 500; padding: 6px 12px; border-radius: 20px;
}
.nav-link:hover { border-color: var(--gold); color: var(--gold); }

.card {
    background: linear-gradient(180deg, var(--felt-3), var(--felt-2));
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow);
}

.card h2 { font-size: 1.1rem; color: var(--gold); }
.muted { color: var(--cream-dim); font-size: 0.88rem; }

label { display:block; font-size: 0.82rem; color: var(--cream-dim); margin: 14px 0 5px; }
label:first-child { margin-top: 0; }

input[type=text], select {
    width: 100%;
    background: rgba(0,0,0,0.22);
    border: 1px solid var(--line);
    color: var(--cream);
    border-radius: 6px;
    padding: 11px 12px;
    font-size: 1rem;
    font-family: inherit;
}
input[type=text]:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

.row { display: flex; gap: 10px; }
.row > * { flex: 1; }

button {
    font-family: 'Inter', sans-serif;
    font-weight: 600;
    font-size: 0.95rem;
    border: none;
    border-radius: 6px;
    padding: 12px 18px;
    cursor: pointer;
    transition: transform 0.08s ease, filter 0.15s ease;
}
button:active { transform: scale(0.98); }
button:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary { background: var(--gold); color: var(--ink); width: 100%; margin-top: 16px; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }
.btn-ghost { background: transparent; border: 1px solid var(--line); color: var(--cream); }
.btn-ghost:hover { border-color: var(--gold); color: var(--gold); }

.err { background: rgba(176,65,62,0.18); border: 1px solid rgba(176,65,62,0.5); color: #F2C9C8;
       padding: 10px 12px; border-radius: 6px; font-size: 0.87rem; margin-top: 12px; }

.code-display {
    font-family: 'IBM Plex Mono', monospace;
    font-size: 2rem;
    letter-spacing: 6px;
    color: var(--gold);
    text-align: center;
    padding: 14px;
    background: rgba(0,0,0,0.22);
    border-radius: 8px;
    margin: 10px 0 4px;
}

/* --- Track (signature element): staircase of round card counts --- */
.track-wrap { overflow-x: auto; padding-bottom: 6px; }
.track {
    display: flex;
    align-items: flex-end;
    gap: 3px;
    height: 64px;
    min-width: 100%;
}
.track .bar {
    flex: 1;
    min-width: 9px;
    background: var(--cream-dim);
    opacity: 0.35;
    border-radius: 2px 2px 0 0;
    position: relative;
}
.track .bar.done { background: var(--gold-dim); opacity: 0.75; }
.track .bar.current { background: var(--gold); opacity: 1; box-shadow: 0 0 0 2px var(--gold), 0 0 14px rgba(203,161,53,0.6); }
.track .bar .n {
    position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
    font-family: 'IBM Plex Mono', monospace; font-size: 0.65rem; color: var(--cream-dim);
}
.track .bar.current .n { color: var(--gold); }

/* --- Seats / players --- */
.seats { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.seat {
    display: flex; align-items: center; gap: 10px;
    background: rgba(0,0,0,0.18);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 10px 14px;
}
.seat .idx { font-family: 'IBM Plex Mono', monospace; color: var(--cream-dim); width: 20px; }
.seat .name { flex: 1; font-weight: 600; }
.seat .chip { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.6px; padding: 3px 8px; border-radius: 20px; }
.seat .chip.you { background: rgba(203,161,53,0.2); color: var(--gold); }
.seat .chip.dealer { background: rgba(176,65,62,0.25); color: #F2C9C8; }
.seat .chip.host { background: rgba(255,255,255,0.1); color: var(--cream-dim); }
.seat.empty { opacity: 0.4; font-style: italic; }
.seat .status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--cream-dim); }
.seat .status-dot.bid { background: var(--gold); }
.seat .status-dot.result { background: #7FB88E; }

/* --- Bidding --- */
.bid-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.bid-grid button {
    background: rgba(0,0,0,0.2); border: 1px solid var(--line); color: var(--cream);
    width: 46px; height: 46px; font-family: 'IBM Plex Mono', monospace; font-weight: 600;
}
.bid-grid button:hover:not(:disabled) { border-color: var(--gold); color: var(--gold); }
.bid-grid button.disabled-sum { opacity: 0.25; }

.turn-banner {
    display:flex; align-items:center; gap:10px;
    padding: 12px 14px; border-radius: 8px;
    background: rgba(203,161,53,0.12); border: 1px solid rgba(203,161,53,0.35);
    margin-top: 12px; font-size: 0.92rem;
}
.turn-banner.waiting { background: rgba(255,255,255,0.05); border-color: var(--line); color: var(--cream-dim); }

/* --- Scoreboard --- */
table.score { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 0.85rem; }
table.score th, table.score td {
    padding: 7px 8px; text-align: center; border-bottom: 1px solid var(--line);
    font-family: 'IBM Plex Mono', monospace;
}
table.score th { color: var(--cream-dim); font-weight: 500; font-size: 0.72rem; text-transform: uppercase; }
table.score td.name-col, table.score th.name-col { text-align: left; font-family: 'Inter', sans-serif; }
table.score tr.totals td { font-weight: 700; color: var(--gold); border-top: 2px solid var(--gold-dim); border-bottom: none; }
.bid-result-cell { display: flex; flex-direction: column; line-height: 1.3; }
.bid-result-cell .b { color: var(--cream-dim); font-size: 0.72rem; }
.bid-result-cell .s { color: var(--gold); font-weight: 600; }

.footer-note { text-align: center; color: var(--cream-dim); font-size: 0.78rem; margin-top: 30px; }

.winner-banner {
    text-align: center; padding: 30px 20px;
}
.winner-banner .crown { font-size: 2.4rem; }
.winner-banner h2 { font-size: 1.6rem; color: var(--gold); margin-top: 6px; }

@media (max-width: 480px) {
    .code-display { font-size: 1.5rem; letter-spacing: 4px; }
    .bid-grid button { width: 40px; height: 40px; }
}
