/* Subset of Source Han Sans JP for suits — served from the jdh8.github.io
   origin (see /fonts/SUITS-README.md), shared by all card sites.  No suits
   appear here, but the body font stack stays identical to the other games. */
@font-face {
  font-family: "Source Han Suits";
  font-weight: 1 1000;
  font-style: oblique -90deg 90deg;
  src: url("https://jdh8.github.io/fonts/suits.woff2") format("woff2");
}

/* The same kitchen-table look as the card games: flat felt, paper dice and
   scorecard, one gold accent.  No gradients or gloss. */

:root {
  --felt: #2c7a63;
  --card-bg: #fdfdf7;
  --black: #1b1b1b;
  --gold: #f5c518;
  --die: 3.2rem;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.4 "Source Han Suits", system-ui, sans-serif;
  color: #f2f2f2;
  background: var(--felt);
  display: grid;
  grid-template-columns: 1fr minmax(0, 17rem);
  grid-template-rows: auto 1fr;
  grid-template-areas:
    "header header"
    "main   log";
  min-height: 100vh;
}

header {
  grid-area: header;
  padding: 0.5rem 1rem;
  display: flex;
  align-items: baseline;
  gap: 1rem;
  border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
h1 { font-size: 1.2rem; margin: 0; }
.score { opacity: 0.9; }

/* Quiet header controls — not game actions, so styled apart from the felt's
   gold action buttons.  `#newgame` carries the auto margin that pushes the
   whole trailing group to the header's right edge. */
.quiet {
  font: inherit;
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 5px;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
#newgame { margin-left: auto; }
.quiet:hover { background: rgba(255, 255, 255, 0.12); }

main {
  grid-area: main;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1rem;
}

.board {
  display: grid;
  grid-template-columns: minmax(15rem, 19rem) minmax(0, 22rem);
  gap: 1.5rem;
  align-items: start;
  width: 100%;
  max-width: 44rem;
}

/* The scorecard: paper rows on the felt.  Open rows show the grey value the
   current dice would write and take the click; filled rows are settled. */
.scorecard {
  background: rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  padding: 0.5rem;
  font-size: 0.92rem;
}
.srow {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.18rem 0.5rem;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.srow .pot { opacity: 0.55; }
.srow .val { font-weight: 600; }
.srow.clickable { cursor: pointer; }
.srow.clickable:hover { background: rgba(245, 197, 24, 0.25); }
.srow.rule {
  border-top: 1px solid rgba(255, 255, 255, 0.25);
  margin-top: 0.25rem;
  padding-top: 0.35rem;
  opacity: 0.85;
  font-size: 0.85rem;
}
.srow.grand { font-weight: 700; font-size: 1rem; opacity: 1; }

.play {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1rem;
}

/* Dice: paper faces with a 3×3 pip grid.  Held dice wear the gold outline
   and sit a little lower, like dice pulled aside on the table. */
.dice { display: flex; gap: 0.7rem; padding: 0.5rem 0; }
.die {
  width: var(--die);
  height: var(--die);
  background: var(--card-bg);
  border-radius: 0.55rem;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: 0.45rem;
  flex: none;
}
.die .cell { display: flex; align-items: center; justify-content: center; }
.die .pip {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--black);
}
.die.clickable { cursor: pointer; transition: transform 0.08s; }
.die.clickable:hover { transform: translateY(-0.3rem); }
.die.held { outline: 3px solid var(--gold); transform: translateY(0.35rem); }
.die.held.clickable:hover { transform: translateY(0.05rem); }
.die.slot {
  background: transparent;
  border: 2px dashed rgba(255, 255, 255, 0.3);
  box-shadow: none;
}

.actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  min-height: 2.4rem;
}
.banner { font-size: 1.1rem; font-weight: 700; }
.actions button {
  font: inherit;
  padding: 0.4rem 0.9rem;
  border: 0;
  border-radius: 6px;
  background: var(--gold);
  color: #222;
  cursor: pointer;
  font-weight: 600;
}
.actions button:hover { background: #ffd83a; }
.actions button:disabled { opacity: 0.4; cursor: default; }

/* The Advisor panel: the solver's read on the current decision, laid out
   flat to match the felt — the same gold accent marks its pick. */
.hint {
  width: min(22rem, 100%);
  background: rgba(0, 0, 0, 0.18);
  border-radius: 8px;
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
}
.hint h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.7;
  margin: 0 0 0.3rem;
}
.hint-note { opacity: 0.7; font-size: 0.78rem; margin: 0 0 0.4rem; }
.hint-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.75rem;
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
  font-variant-numeric: tabular-nums;
}
.hint-row span:not(:first-child) { text-align: right; }
.hint-head {
  opacity: 0.6;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.hint-row.best { background: rgba(245, 197, 24, 0.22); font-weight: 700; }

.log {
  grid-area: log;
  padding: 0.5rem 1rem;
  background: rgba(0, 0, 0, 0.18);
  overflow-y: auto;
  max-height: 100vh;
  font-size: 0.85rem;
}
.log h2 { font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.7; }
.log div { padding: 0.1rem 0; opacity: 0.9; }

/* Hidden by default: drop the panel and reclaim its grid column so `main`
   spans the full width instead of leaving a gutter. */
body.log-hidden {
  grid-template-columns: 1fr;
  grid-template-areas: "header" "main";
}
body.log-hidden .log { display: none; }

@media (max-width: 40rem) {
  body {
    grid-template-columns: 1fr;
    grid-template-rows: none;
    grid-template-areas: "header" "main" "log";
  }
  .board { grid-template-columns: 1fr; }
  .log { max-height: 12rem; }
}
