:root {
  --bg: #f6f5f1; --surface: #ffffff; --text: #1f2328; --muted: #6b6f76; --border: #dedbd2;
  --accent: #b5452b; --accent-text: #ffffff; --pos: #1d7a46; --neg: #b3261e; --warn: #9a6200;
  --tag: #ece8de; --tag-alt: #f6e3d8;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181a; --surface: #212226; --text: #e8e6e1; --muted: #9a9ca2; --border: #34363b;
    --accent: #e0714f; --accent-text: #17181a; --pos: #5cc489; --neg: #f07a70; --warn: #e2b04a;
    --tag: #2d2f33; --tag-alt: #3d2a22;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
a { color: var(--accent); }
main { max-width: 860px; margin: 0 auto; padding: 16px 16px 64px; }
h1 { font-size: 1.6rem; margin: .4em 0; }
h2 { font-size: 1.2rem; margin: 1.8em 0 .6em; }
h3 { font-size: 1.05rem; margin: 0; }
.top { display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: center; justify-content: space-between;
  padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { font-weight: 700; font-size: 1.15rem; text-decoration: none; color: var(--text); }
nav { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: center; }
nav a { text-decoration: none; color: var(--text); }
nav a:hover { color: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.warn { color: var(--warn); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.flash { padding: 10px 14px; border-radius: 8px; background: var(--tag); }
.flash.error { background: var(--tag-alt); color: var(--neg); }
.banner { text-align: center; padding: 8px 0 4px; }
.banner h2 { margin: 0; font-size: 1.5rem; }
.banner p { margin: 4px 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 12px 0; }
.card-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.card-head h1, .card-head h3 { margin: 0; }
.card-head a { color: var(--text); text-decoration: none; }
.card-head a:hover { color: var(--accent); }
.tag { flex: none; font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: var(--tag); color: var(--muted); }
.tag.alt { background: var(--tag-alt); }
.sides { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 12px 0; }
.side { background: var(--bg); border-radius: 8px; padding: 8px 12px; display: flex; flex-direction: column; }
.side-label { font-size: .875rem; color: var(--muted); }
.side-sum { font-size: 1.25rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.side .muted { font-size: .8rem; }
.mine { margin: 8px 0; }
.result { font-size: 1.1rem; }
.stake-form { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; }
.radio { display: inline-flex; gap: 6px; align-items: center; }
.amount input { width: 5.5em; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 4px; }
.narrow { max-width: 440px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 8px 0; }
.inline { display: inline; }
input, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 7px 10px; }
input[type=radio] { accent-color: var(--accent); }
input.short { width: 10em; }
button, .button { font: inherit; border: 1px solid var(--accent); background: var(--accent); color: var(--accent-text);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; text-decoration: none; display: inline-block; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.secondary { background: transparent; color: var(--text); border-color: var(--border); }
button.danger { background: transparent; color: var(--neg); border-color: var(--neg); }
button.small { padding: 3px 9px; font-size: .85rem; }
button.link { background: none; border: none; color: var(--muted); padding: 0; }
button.link:hover { color: var(--accent); }
table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .8rem; color: var(--muted); font-weight: 600; }
tr:last-child td { border-bottom: none; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.actions { white-space: nowrap; }
.actions form { margin-right: 4px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.stats div { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; }
.stats strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.prose li { margin: .5em 0; }
code.select { user-select: all; word-break: break-all; background: var(--tag); padding: 4px 8px; border-radius: 6px; }
@media (max-width: 560px) {
  .sides { grid-template-columns: 1fr; }
  .actions { white-space: normal; }
  th, td { padding: 6px; font-size: .9rem; }
}
.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; flex: none; }
.pot { display: flex; flex-direction: column; align-items: flex-end; background: var(--tag-alt); border-radius: 10px; padding: 6px 12px; }
.pot-label { font-size: .75rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.pot-sum { font-size: 1.3rem; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--accent); }
.pot-pending { font-size: .75rem; color: var(--muted); }
.badge { display: inline-block; margin-top: 4px; font-size: .8rem; color: var(--muted); }
.badge.empty { font-style: italic; }
.highscore tr.me td { font-weight: 600; }
.highscore .rank { width: 3em; }
.steps { padding-left: 1.4em; }
.steps li { margin: 10px 0; }
tr.me td { font-weight: 600; }
.amount-edit { width: 6em; text-align: right; }
