/* Knucklebones — Manu Arcade No. XXXIV
   Game-specific styling only. The shell (masthead, hud, seal, toggles,
   board-frame, overlay, colophon) comes from ../_shared/palette.css.
   The dice tray is a dark felt canvas; the scorecard is a DOM table on
   parchment. No em dashes in any on-screen copy by house style. */

.gauge-glyph.gold { color: var(--gold-deep); }

/* Layout: tray + roll bar on the left, scorecard on the right (desktop);
   stacked on phones. */
.play {
  width: min(880px, 96vw);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: clamp(14px, 2.4vw, 26px);
  align-items: start;
}

/* The dark felt tray. board-frame gives the parchment surround. */
.tray-frame {
  width: 100%;
  display: flex;
  justify-content: center;
  background: linear-gradient(180deg, rgba(255,255,255,.08), rgba(0,0,0,.06)), var(--parchment-deep);
}
#tray {
  display: block;
  touch-action: none;        /* we own die taps; stop the page scrolling */
  cursor: default;
  border-radius: 8px;
  max-width: 100%;
}

/* Instruction caption floats over the tray until the first cast. */
.hint-overlay {
  position: absolute;
  left: 50%;
  bottom: clamp(8px, 4%, 18px);
  transform: translateX(-50%);
  margin: 0;
  width: max-content;
  max-width: 90%;
  text-align: center;
  font-family: var(--hand);
  font-style: italic;
  font-size: clamp(12px, 3vw, 15px);
  color: var(--gold-bright);
  text-shadow: 0 1px 0 rgba(0, 0, 0, .6), 0 0 12px rgba(227, 183, 84, .35);
  pointer-events: none;
  opacity: 1;
  transition: opacity .5s var(--ease), transform .5s var(--ease);
}
.hint-overlay.gone {
  opacity: 0;
  transform: translateX(-50%) translateY(8px);
}

/* Roll bar under the tray. */
.roll-bar {
  grid-column: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin-top: -4px;
}
.roll-btn {
  font-size: 14px;
  padding: 12px 22px;
  min-width: 200px;
  box-shadow: inset 0 1px 0 rgba(227,183,84,.3), 0 4px 12px rgba(61,15,18,.3);
}
.roll-btn:disabled {
  opacity: .5;
  cursor: default;
  background: var(--ink-light);
  border-color: var(--ink-light);
  box-shadow: none;
  transform: none;
}

.turn-status {
  margin: 0;
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: 11.5px;
  color: var(--ink-light);
  min-height: 1.2em;
  text-align: center;
  transition: color .2s var(--ease);
}
.turn-status.alert { color: var(--oxblood); }

/* Mode toggle (Casual / Daily) carries a glyph + label. */
.mode-toggle { display: inline-flex; align-items: center; gap: 6px; }
.mode-glyph { font-size: 1.05em; line-height: 1; }

/* ---- Scorecard ---------------------------------------------------------- */

.scorecard {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: stretch;
  background:
    radial-gradient(120% 80% at 20% 0%, rgba(217,148,65,.10), rgba(217,148,65,0) 50%),
    var(--cream);
  border-radius: 12px;
  padding: clamp(10px, 1.8vw, 16px);
  box-shadow:
    inset 0 0 0 1px rgba(200,156,58,.5),
    inset 0 0 0 3px rgba(122,104,80,.18),
    0 12px 30px rgba(58,46,34,.22);
}

.card-section + .card-section { margin-top: 12px; }
.card-section-title {
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .2em;
  font-size: 11px;
  color: var(--oxblood);
  margin: 0 2px 6px;
  border-bottom: 1px solid rgba(122,104,80,.3);
  padding-bottom: 4px;
}

.score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  text-align: left;
  gap: 8px;
  font-family: var(--body);
  font-size: clamp(14px, 1.8vw, 16px);
  color: var(--ink-soft);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 7px 10px;
  cursor: pointer;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s var(--ease);
}
/* A row you can score into glows faintly on hover with a solid wash. */
.score-row:not(:disabled):hover {
  background: rgba(90,26,31,.07);
  border-color: rgba(90,26,31,.25);
}
.score-row:disabled { cursor: default; }

.score-name { line-height: 1.15; }
.score-value {
  font-family: var(--display);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 1.05em;
  color: var(--ink);
  min-width: 2.2ch;
  text-align: right;
}

/* Open rows show a faint ghost preview of the would-be score. */
.score-row:not(.filled):not(.preview) .score-value { color: var(--ink-light); opacity: .6; }

/* The hovered/focused open row: a strong solid highlight + bold value. */
.score-row.preview {
  background: var(--oxblood);
  border-color: var(--oxblood);
  color: var(--parchment);
}
.score-row.preview .score-value { color: var(--gold-bright); opacity: 1; }
.score-row.preview.preview-zero { background: var(--ink-soft); border-color: var(--ink-soft); }
.score-row.preview.preview-zero .score-value { color: var(--parchment-deep); }

/* The best open category gets a quiet gold underline nudge. */
.score-row.best-hint:not(.preview) {
  box-shadow: inset 0 -2px 0 rgba(200,156,58,.7);
}

/* A filled row reads as inked-in: solid parchment-deep chip. */
.score-row.filled {
  background: rgba(122,104,80,.14);
  color: var(--ink-light);
}
.score-row.filled .score-name { color: var(--ink-light); }
.score-row.filled .score-value { color: var(--oxblood); opacity: 1; }
.score-row.filled.zero .score-value { color: var(--ink-light); }

/* The pop when a value is just committed. */
.score-row.just-scored {
  animation: score-pop .6s var(--ease);
}
@keyframes score-pop {
  0% { transform: scale(1); background: var(--gold-bright); }
  30% { transform: scale(1.03); background: rgba(227,183,84,.55); }
  100% { transform: scale(1); }
}

/* Subtotal rows (upper sum, bonus, lower sum). */
.score-row.subtotal {
  cursor: default;
  font-family: var(--caps);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 11px;
  color: var(--ink-light);
  padding: 6px 10px;
  margin-top: 2px;
  border-top: 1px dotted rgba(122,104,80,.35);
  border-radius: 0;
}
.score-row.subtotal .score-value {
  font-family: var(--caps);
  font-size: 12px;
  letter-spacing: .06em;
}
#bonus-row.earned { color: var(--forest); }
#bonus-row.earned .score-value { color: var(--forest); }

/* ---- Responsive --------------------------------------------------------- */

@media (max-width: 680px) {
  .play {
    grid-template-columns: 1fr;
    width: min(440px, 96vw);
  }
  .roll-bar { grid-column: 1; }
  .scorecard { grid-column: 1; grid-row: auto; }
  .roll-btn { min-width: 180px; }
}

@media (max-width: 380px) {
  .hud { gap: 8px; }
  .score-row { padding: 6px 8px; font-size: 14px; }
}
