:root {
    --radius: 6px;
    --sans: "Inter", system-ui, -apple-system, Segoe UI, sans-serif;
    --serif: "Fraunces", "Source Serif Pro", Georgia, serif;
    --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

    /* casino (default) — felt-green on warm cream */
    --bg: #f4efe2;
    --surface: #ffffff;
    --border: #d9cdb0;
    --ink: #1f1a12;
    --muted: #6a5f49;
    --accent: #246b4a;
    --accent-ink: #ffffff;
    --warn: #a4451f;
    --win: #2e7d32;
    --loss: #8a1f12;
}

body[data-theme="midnight"] {
    --bg: #0e1424;
    --surface: #182138;
    --border: #2b3a5c;
    --ink: #e5ebf9;
    --muted: #8a99bc;
    --accent: #7fa8ff;
    --accent-ink: #0b1226;
    --warn: #ffb774;
    --win: #85e3a9;
    --loss: #ff8f8f;
}

body[data-theme="parchment"] {
    --bg: #f1e6c9;
    --surface: #faf3df;
    --border: #d2bf8f;
    --ink: #3c2e1a;
    --muted: #7a6336;
    --accent: #8a3b1c;
    --accent-ink: #faf3df;
    --warn: #b06420;
    --win: #4e6b1c;
    --loss: #7a2410;
}

body[data-theme="sunset"] {
    --bg: #fff1e3;
    --surface: #ffffff;
    --border: #f4c69c;
    --ink: #3b1d0d;
    --muted: #91573a;
    --accent: #d14a2a;
    --accent-ink: #ffffff;
    --warn: #c03f58;
    --win: #d47910;
    --loss: #ad1a1a;
}

body[data-theme="forest"] {
    --bg: #0f1e14;
    --surface: #152b1f;
    --border: #2b4e37;
    --ink: #e6f3e2;
    --muted: #9bb8a2;
    --accent: #b6d769;
    --accent-ink: #11200f;
    --warn: #e9a46b;
    --win: #b6d769;
    --loss: #e58481;
}

body[data-theme="mono"] {
    --bg: #ffffff;
    --surface: #fafafa;
    --border: #d5d5d5;
    --ink: #0b0b0b;
    --muted: #666666;
    --accent: #0b0b0b;
    --accent-ink: #ffffff;
    --warn: #4d4d4d;
    --win: #2b7a2b;
    --loss: #8a1a1a;
}

body[data-theme="vapor"] {
    --bg: #1b0f36;
    --surface: #291b4d;
    --border: #5a3a8c;
    --ink: #f2e6ff;
    --muted: #b79fdd;
    --accent: #ff77d9;
    --accent-ink: #1b0f36;
    --warn: #ffd166;
    --win: #80ffea;
    --loss: #ff7a9e;
}

body[data-theme="amber"] {
    --bg: #080807;
    --surface: #111110;
    --border: #3a2a05;
    --ink: #ffb84a;
    --muted: #a07b2e;
    --accent: #ffb84a;
    --accent-ink: #0a0806;
    --warn: #ff8a3c;
    --win: #ffd277;
    --loss: #ff6a4a;
}

body[data-theme="blueprint"] {
    --bg: #0b2944;
    --surface: #10385a;
    --border: #2d5f8f;
    --ink: #e8f4ff;
    --muted: #9fc2e0;
    --accent: #ffffff;
    --accent-ink: #0b2944;
    --warn: #ffc973;
    --win: #a4e8b0;
    --loss: #ff9c9c;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--sans);
    line-height: 1.5;
    min-height: 100vh;
}

header.app {
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

header.app .brand {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.25rem;
    letter-spacing: 0.01em;
    text-decoration: none;
    color: var(--ink);
}

nav.app {
    display: flex;
    gap: 1.2rem;
    align-items: center;
    flex-wrap: wrap;
}

nav.app a {
    color: var(--muted);
    text-decoration: none;
    font-size: 0.925rem;
    padding: 0.25rem 0;
    border-bottom: 1px solid transparent;
    transition: color 120ms, border-color 120ms;
}

nav.app a:hover, nav.app a.active {
    color: var(--ink);
    border-bottom-color: var(--accent);
}

.me-chip {
    font-size: 0.85rem;
    color: var(--muted);
}

main {
    max-width: 960px;
    margin: 0 auto;
    padding: 2rem 1.5rem;
}

h1, h2, h3 {
    font-family: var(--serif);
    font-weight: 600;
    text-wrap: balance;
    margin: 0 0 0.5em;
}

h1 { font-size: 1.85rem; }
h2 { font-size: 1.35rem; margin-top: 2rem; }
h3 { font-size: 1.1rem; margin-top: 1.5rem; }

a { color: var(--accent); }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1.5rem;
    margin-bottom: 1.25rem;
}

.section-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
}

@media (max-width: 720px) {
    .section-grid { grid-template-columns: 1fr; }
}

table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.925rem;
}

th, td {
    text-align: left;
    padding: 0.5rem 0.65rem;
    border-bottom: 1px solid var(--border);
}

th {
    font-weight: 600;
    color: var(--muted);
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

td.num, th.num {
    text-align: right;
    font-variant-numeric: tabular-nums;
    font-family: var(--mono);
}

tr:last-child td { border-bottom: none; }

.rank {
    display: inline-block;
    min-width: 1.8em;
    font-family: var(--mono);
    color: var(--muted);
}

form.inline {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    align-items: end;
}

label {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

input[type="text"], input[type="password"], input[type="number"], select, textarea {
    background: var(--bg);
    color: var(--ink);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.65rem;
    font-size: 0.95rem;
    font-family: var(--sans);
    width: 100%;
}

textarea { min-height: 4em; resize: vertical; }

input[type="checkbox"] {
    width: auto;
}

button, .btn {
    background: var(--accent);
    color: var(--accent-ink);
    border: none;
    border-radius: var(--radius);
    padding: 0.55rem 1.1rem;
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    display: inline-block;
    font-family: var(--sans);
}

button:hover, .btn:hover { filter: brightness(1.05); }

.btn-ghost {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--border);
}

.btn-warn { background: var(--warn); color: white; }

.pill {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    font-weight: 600;
    background: var(--border);
    color: var(--ink);
}

.pill.won, .pill.closed { background: var(--win); color: #0d2510; }
.pill.lost { background: var(--loss); color: #fff; }
.pill.open { background: var(--accent); color: var(--accent-ink); }

.err {
    background: var(--loss);
    color: white;
    padding: 0.65rem 1rem;
    border-radius: var(--radius);
    margin-bottom: 1rem;
}

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.winner { color: var(--win); font-weight: 600; }

.leaderboard td.score { font-size: 1.1rem; }

.login-shell {
    max-width: 360px;
    margin: 4rem auto 0;
    text-align: center;
}

.login-shell h1 { font-size: 2.1rem; }

.login-shell form {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    text-align: left;
    margin-top: 1.5rem;
}

.player-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 0.75rem;
    margin-top: 1rem;
}

.player-grid button {
    padding: 1rem 0.5rem;
    text-align: center;
    font-size: 1rem;
    line-height: 1.2;
}
