:root {
  --red: #8c1d2f;
  --gold: #f2b632;
  --jade: #1f6f5c;
  --paper: #fbf1dc;
  --ink: #3a0f17;
}
* { box-sizing: border-box; }
body {
  margin: 0; color: var(--ink); background: var(--red);
  font: 16px/1.6 "Be Vietnam Pro", system-ui, sans-serif;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 18px 14px 36px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 10px; color: var(--paper); }
h1 { font: 800 2rem/1.1 "Baloo 2", system-ui, sans-serif; margin: 0; }
.wallet { background: var(--gold); color: var(--ink); padding: 4px 14px; border-radius: 999px; font-weight: 600; white-space: nowrap; }

.tabs { display: flex; gap: 8px; margin: 16px 0; }
.tab {
  flex: 1; padding: 9px 4px; cursor: pointer; font: 600 .95rem "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--paper); background: transparent; border: 2px solid var(--gold); border-radius: 12px;
}
.tab[aria-selected="true"] { background: var(--gold); color: var(--ink); }

.panel { background: var(--paper); border-radius: 18px; padding: 16px; border: 4px solid var(--gold); }
.rule { margin: 0 0 12px; font-size: .92rem; }
.chips { display: flex; gap: 8px; margin-bottom: 12px; }
.chip {
  flex: 1; padding: 8px 0; cursor: pointer; font: 600 1rem "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--ink); background: #fff; border: 3px dashed var(--red); border-radius: 999px;
}
.chip[aria-pressed="true"] { background: var(--red); color: var(--gold); border-style: solid; }

#board { display: grid; gap: 8px; }
#board.bc { grid-template-columns: repeat(3, 1fr); }
#board.num { grid-template-columns: repeat(4, 1fr); }
#board.tx { grid-template-columns: repeat(2, 1fr); }
.cell {
  position: relative; padding: 10px 4px; cursor: pointer; color: var(--ink);
  font-family: "Baloo 2", system-ui, sans-serif; line-height: 1.15;
  background: #fff; border: 3px solid var(--jade); border-radius: 14px;
}
.cell .big { display: block; font-size: 2rem; }
.bc .cell .big { font-size: 2.6rem; }
.tx .cell .big { font-size: 2.4rem; padding-top: 8px; }
.cell .sub { display: block; font-size: .9rem; font-family: "Be Vietnam Pro", system-ui, sans-serif; }
.cell .bet {
  position: absolute; top: -9px; right: -6px; min-width: 28px; padding: 0 7px;
  background: var(--red); color: var(--gold); border-radius: 999px; font: 600 .85rem/22px "Be Vietnam Pro", system-ui, sans-serif;
}
.cell.win { background: var(--gold); border-color: var(--red); }

.stats { margin: 12px 0 0; text-align: right; }
#dice { display: flex; justify-content: center; gap: 14px; min-height: 84px; margin: 8px 0; font-size: 3.6rem; line-height: 84px; }
#dice span { width: 84px; text-align: center; background: #fff; border: 3px solid var(--red); border-radius: 16px; }
#dice.sym span { font-size: 3rem; }
.msg { min-height: 3.2em; margin: 0 0 10px; font-weight: 600; text-align: center; }
.actions { display: flex; gap: 10px; }
.btn {
  flex: 2; padding: 12px; cursor: pointer; font: 600 1.1rem "Be Vietnam Pro", system-ui, sans-serif;
  color: var(--gold); background: var(--red); border: 3px solid var(--ink); border-radius: 14px;
}
.btn.ghost { flex: 1; color: var(--ink); background: #fff; }
.btn:disabled, .cell:disabled { opacity: .55; cursor: not-allowed; }
.foot { color: var(--paper); font-size: .88rem; text-align: center; margin-top: 14px; }
.link { background: none; border: 0; padding: 0; color: var(--gold); font: inherit; text-decoration: underline; cursor: pointer; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }
.panel :focus-visible { outline-color: var(--red); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
