:root {
  --bg: #0e1116;
  --panel: #141923;
  --text: #e8eef6;
  --muted: #a7b0bc;
  --accent: #54a0ff;
  --good: #2ecc71;
  --warn: #f1c40f;
}

* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, sans-serif; background: var(--bg); color: var(--text); }
header { padding: 12px 16px; background: #0b0f15; border-bottom: 1px solid #242a33; }
h1 { margin: 0; font-size: 20px; }
.status { color: var(--muted); font-size: 13px; margin-top: 4px; }

main { display: grid; grid-template-columns: 1fr; gap: 16px; padding: 16px; max-width: 1100px; margin: 0 auto; }
.scoreboards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.board { background: var(--panel); padding: 12px; border-radius: 8px; }
.board h2 { margin: 0 0 8px 0; font-size: 16px; }
.score { display: grid; grid-template-columns: 1fr auto; gap: 4px 6px; font-size: 13px; align-items: center; grid-auto-rows: 24px; }
.score .row { display: contents; }
.score .label { color: var(--muted); white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.score .label .name { display: inline-block; min-width: 96px; }
.score .value { text-align: right; white-space: nowrap; }
/* Highlighted info row styling */
.score .hl { background: rgba(255,255,255,.06); padding: 0 6px; border-radius: 4px; }

/* Action button between category name and current score */
.actbtn { font-size: 12px; padding: 0 6px; height: 20px; line-height: 20px; border-radius: 6px; border: 1px solid #d0d7e2; background: #eef3fb; color: #0e1116; cursor: pointer; display: inline-flex; align-items: center; }
.actbtn:hover { filter: brightness(0.97); }
.actbtn:disabled { opacity: .55; cursor: not-allowed; }

.play { background: var(--panel); padding: 12px; border-radius: 8px; }
.controls { display: flex; gap: 8px; margin-bottom: 8px; }
button { background: #1b2330; color: var(--text); border: 1px solid #2a3342; border-radius: 6px; padding: 8px 10px; cursor: pointer; }
button[disabled] { opacity: .5; cursor: not-allowed; }
button:hover:not([disabled]) { border-color: var(--accent); }

.dice { display: grid; grid-template-columns: repeat(5, 64px); gap: 8px; margin: 8px 0; }
.die { position: relative; width: 64px; height: 64px; border-radius: 10px; border: 2px solid #555; background: #000; user-select: none; font-size: 0; overflow: hidden; box-shadow: 0 2px 6px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255,255,255,.04); }
.die.kept { outline: 2px solid var(--good); }
.die .keep { position: absolute; bottom: 4px; right: 4px; font-size: 11px; color: var(--muted); }

/* Dice pips */
.die-face { position: absolute; left: 0; top: 0; right: 0; bottom: 0; }
.pip { position: absolute; width: 11px; height: 11px; background: #fff; border-radius: 50%; transform: translate(-50%, -50%); pointer-events: none; box-shadow: 0 0 0 1px rgba(255,255,255,.1) inset; z-index: 1; }
.die .unknown { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-size: 26px; color: var(--muted); z-index: 0; }

/* Subtle roll animation */
.die.roll-anim { animation: rollWobble 240ms ease; }
@keyframes rollWobble {
  0%   { transform: rotate(0deg) scale(1); }
  20%  { transform: rotate(8deg) scale(1.03); }
  70%  { transform: rotate(-5deg) scale(0.98); }
  100% { transform: rotate(0deg) scale(1); }
}

.info { display: flex; gap: 24px; color: var(--muted); font-size: 14px; margin-top: 4px; }
.info span { color: var(--text); }

.categories { margin-top: 10px; display: none; }
.categories h3 { margin: 0 0 8px 0; font-size: 15px; }
#categories { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cat { background: #0f141c; border: 1px solid #2a3342; border-radius: 6px; padding: 6px; font-size: 13px; text-align: center; cursor: pointer; }
.cat.disabled { opacity: .35; cursor: not-allowed; }
.cat.best { border-color: var(--good); }

.log { background: var(--panel); padding: 12px; border-radius: 8px; }
#log { margin: 0; max-height: 240px; overflow: auto; font-size: 12px; color: var(--muted); }

@media (max-width: 900px) {
  #categories { grid-template-columns: repeat(4, 1fr); }
}
