/* ─── Reset & base ─────────────────────────────────────────────────────────── */
[v-cloak] { display: none; }
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:          #0f1117;
  --bg-surface:  #1a1d2e;
  --bg-card:     #22253a;
  --bg-card-hover: #2a2f4a;
  --accent:      #f0a500;
  --accent-dim:  #a87000;
  --green:       #22c55e;
  --red:         #ef4444;
  --amber:       #d97706;
  --text:        #e8eaf0;
  --text-muted:  #8890aa;
  --border:      #2e334d;
  --radius:      12px;
  --radius-sm:   8px;
  --shadow:      0 4px 24px rgba(0,0,0,0.5);
  --font:        'Segoe UI', system-ui, -apple-system, sans-serif;
}

html {
  font-size: 16px;
  height: 100dvh;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  line-height: 1.6;
  height: 100dvh;
  overflow: hidden;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* In landscape on small screens the content may not fit — allow scrolling. */
@media (orientation: landscape) and (max-height: 600px) {
  html, body {
    height: auto;
    overflow: auto;
  }
  #app {
    height: auto;
    overflow: visible;
    min-height: 100dvh;
  }
}

/* ─── Layout ────────────────────────────────────────────────────────────────── */
.site-header {
  background: linear-gradient(135deg, #1a1d2e 0%, #0f1117 100%);
  border-bottom: 1px solid var(--border);
  padding: 0.55rem 1rem;
  text-align: center;
  flex-shrink: 0;
}

.header-inner { max-width: 780px; margin: 0 auto; }

.site-header h1 {
  font-size: clamp(1.1rem, 3.5vw, 1.6rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--accent);
  text-shadow: 0 0 40px rgba(240,165,0,0.3);
}

.subtitle { display: none; }

.main-content {
  max-width: 780px;
  margin: 0 auto;
  width: 100%;
  padding: 0.6rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  flex: 1;
  overflow: hidden;
}

.section {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}

.section-title {
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.section-hint {
  font-size: 0.8rem;
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  opacity: 0.6;
}

/* ─── Card picker ───────────────────────────────────────────────────────────── */
.card-section-header {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  height: 42px; /* matches .card-tile height — locks section regardless of play/edit mode */
}

.card-section-header .section-title {
  margin-bottom: 0;
}

.card-locked-badge {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--amber);
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.3);
  border-radius: 99px;
  padding: 0.15rem 0.55rem;
  letter-spacing: 0.02em;
  cursor: default;
}

.card-select-locked {
  opacity: 0.5;
  cursor: not-allowed;
}

/* .card-picker fills remaining space in the flex header row */
.card-picker {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
}

.card-select {
  width: 100%;
  height: 42px;             /* matches .card-tile height */
  padding: 0 2.5rem 0 0.75rem;
  font-size: 0.88rem;
  font-family: var(--font);
  font-weight: 600;
  background: var(--bg-card);
  color: var(--text);
  border: 2px solid var(--border); /* matches .card-tile border weight */
  border-radius: 999px;            /* pill — matches .card-tile */
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238890aa' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.9rem center;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.card-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 16px rgba(240,165,0,0.18);
}

.card-select option {
  background: var(--bg-card);
}

/* ─── A7: Card tile (play mode) ─────────────────────────────────────────────── */
.card-tile-row {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.card-redraw-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  font-size: 1.1rem;
  opacity: 1;
  transition: opacity 0.15s, background 0.15s;
}
/* Dim by default only on devices that truly support hover (not touch screens) */
@media (hover: hover) {
  .card-redraw-btn:not(:disabled) {
    opacity: 0.6;
  }
  .card-redraw-btn:hover:not(:disabled) {
    opacity: 1;
    background: var(--bg-hover, rgba(255,255,255,0.08));
  }
}
.card-redraw-btn:disabled {
  opacity: 0.25;
  cursor: default;
}

.card-tile {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 0.35rem;
  padding: 0 0.75rem;
  height: 42px;
  flex-shrink: 0;
  border-radius: 999px;
  border: 2px solid var(--border);
  background: var(--bg-card);
  background-image:
    repeating-linear-gradient(
      45deg,
      transparent,
      transparent 8px,
      rgba(255,255,255,0.025) 8px,
      rgba(255,255,255,0.025) 16px
    );
  transition: border-color 0.2s, box-shadow 0.2s, background-image 0.2s;
}

/* Settled on a card: no special highlight — keep the same plain border as the resting state */
.card-tile-settled {
  background-image: none;
  animation: die-fadein 0.25s ease-out both;
}

.card-tile-back-icon {
  font-size: 1rem;
  opacity: 0.3;
  user-select: none;
}

.card-tile-back-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0.55;
}

.card-tile-face-icon {
  font-size: 1rem;
  line-height: 1;
  letter-spacing: 0.05em;
}

.card-tile-face-name {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ─── Guardian power badge ───────────────────────────────────────────────── */
.guardian-power-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0 0.55rem;
  height: 42px;
  border-radius: 999px;
  border: 1.5px solid;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  letter-spacing: 0.03em;
  cursor: default;
  user-select: none;
  transition: opacity 0.25s, color 0.25s, border-color 0.25s;
}
.guardian-badge-icon {
  font-size: 0.82rem;
  line-height: 1;
}
.guardian-power-available {
  border-color: rgba(110, 210, 110, 0.55);
  color: rgba(130, 220, 130, 0.95);
  background: rgba(110, 210, 110, 0.08);
}
.guardian-power-used {
  border-color: var(--border);
  color: var(--text-muted);
  opacity: 0.4;
  background: transparent;
}

@keyframes roll-dice-pulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(240,165,0,0.4); }
  50%       { box-shadow: 0 6px 30px rgba(240,165,0,0.65); }
}

/* ─── Dice ──────────────────────────────────────────────────────────────────── */
.dice-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  min-height: 36px; /* reserves space for .group-icon-btn so height stays stable in skull-island mode */
}

.dice-section-header .section-title { margin-bottom: 0; }

.mode-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.4rem;
  opacity: 0.7;
}

.dice-header-controls {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

/* Small ⊞ icon-only group button */
.group-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.group-icon-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-card);
}

.group-icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

/* Pre-roll: buttons visible but fully inert (no pointer events, no hover) */
.dice-ctrl-inactive {
  pointer-events: none;
}

/* 💡 Hint icon button — sits next to the group button */
.hint-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-size: 1.05rem;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}

.hint-icon-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-card);
}

/* Active: strategy is ON */
.hint-icon-btn-active {
  color: var(--green) !important;
  border-color: var(--green) !important;
  background: rgba(34, 197, 94, 0.12) !important;
}

.hint-icon-btn-active:hover {
  background: rgba(34, 197, 94, 0.2) !important;
}

/* Compact spinner for small icon buttons */
.spinner-sm {
  display: inline-block;
  width: 13px;
  height: 13px;
  border: 2px solid rgba(136, 144, 170, 0.25);
  border-top-color: var(--text-muted);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* Compact icon-only Play/Edit toggle */
.mode-toggle-compact {
  display: flex;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 2px;
}

.mode-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 24px;
  font-size: 0.85rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: background 0.15s, color 0.15s;
}

.mode-icon-btn:hover { color: var(--text); }

.mode-icon-btn.mode-btn-active {
  background: var(--accent);
  color: #0f1117;
}

.mode-icon-btn.mode-btn-active:hover { background: #f8b800; }

/* ─── Inline score (inside dice section) ────────────────────────────────────── */
.dice-score-row {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  padding: 0.3rem 0 0.15rem;
}

.dice-score-value {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}

.dice-score-value .score-unit {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}

.dice-score-value.score-busted { color: #fca5a5; }
.dice-score-value.score-animating { color: var(--text-muted); opacity: 0.6; }

.dice-score-bust-label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #fca5a5;
}

.dice-area { display: flex; flex-direction: column; gap: 0.75rem; }

.dice-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  justify-content: center;
}

.fixed-dice-group { display: flex; flex-direction: column; gap: 0.5rem; }

.fixed-dice-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.die {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  width: 72px;
  height: 80px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--border);
  background: var(--bg-card);
  transition: transform 0.1s, border-color 0.15s, background 0.15s, box-shadow 0.15s;
  padding: 0.4rem;
}

/* Inner wrapper — keeps content centred inside the die button */
.die-face-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
}

.die-emoji {
  font-size: 2rem;
  line-height: 1;
  display: block;
}

.die-name {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

/* Fade-in reveal animation (initial roll & reroll) */
@keyframes die-fadein {
  from { opacity: 0; transform: scale(0.82); }
  to   { opacity: 1; transform: scale(1);    }
}

.die-fadein {
  animation: die-fadein 0.32s ease-out both;
}

/* Blank / not-yet-rolled die */
.die-blank {
  border-style: dashed !important;
  border-color: var(--border) !important;
  cursor: default !important;
}

.die-blank:hover {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  transform: none !important;
  box-shadow: none !important;
}

.die-blank .die-emoji {
  font-size: 1.4rem;
  opacity: 0.25;
}

.die-blank .die-name {
  opacity: 0;
}

/* Interactive die */
.die-interactive {
  cursor: pointer;
  user-select: none;
  font-family: inherit;
}

@media (hover: hover) and (pointer: fine) {
  .die-interactive:hover {
    background: var(--bg-card-hover);
    border-color: var(--accent);
    transform: translateY(-3px);
    box-shadow: 0 6px 20px rgba(240,165,0,0.2);
  }
}

.die-interactive:active {
  transform: translateY(0);
  box-shadow: none;
}

/* Selected die (play mode) */
.die-selected {
  background: rgba(240,165,0,0.15) !important;
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 2px rgba(240,165,0,0.35), 0 4px 16px rgba(240,165,0,0.2);
  transform: translateY(-2px);
}

.die-selected:hover {
  background: rgba(240,165,0,0.22) !important;
  box-shadow: 0 0 0 2px rgba(240,165,0,0.5), 0 6px 20px rgba(240,165,0,0.3);
  transform: translateY(-4px);
}

/* ── A4: Strategy highlights ─────────────────────────────────────────────── */

/* Dice the strategy recommends rerolling: warm amber pulsing glow */
.die-strategy-reroll {
  animation: strategy-reroll-pulse 2s ease-in-out infinite;
}

@keyframes strategy-reroll-pulse {
  0%,  100% { box-shadow: 0 0 0 2px var(--amber), 0 0 10px rgba(217,119,6,0.45); }
  50%        { box-shadow: 0 0 0 3px var(--amber), 0 0 20px rgba(217,119,6,0.75); }
}

/* Dice to keep (or all non-skull when stop is recommended): calm green glow */
.die-strategy-keep {
  box-shadow: 0 0 0 2px rgba(34,197,94,0.55), 0 0 8px rgba(34,197,94,0.2);
}

/* Selection ring always dominates the strategy glow */
.die-selected.die-strategy-reroll {
  animation: none;
  box-shadow: 0 0 0 2px rgba(240,165,0,0.35), 0 4px 16px rgba(240,165,0,0.2);
}
.die-selected.die-strategy-keep {
  box-shadow: 0 0 0 2px rgba(240,165,0,0.35), 0 4px 16px rgba(240,165,0,0.2);
}

/* ─── Strategy panel (dedicated section below dice) ─────────────────────────── */
.strategy-panel {
  padding: 0.55rem 1rem;
  overflow: hidden;
}

.sp-top-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  /* Fixed height on the row (not the section) — prevents layout shift when emojis/pill appear */
  height: calc(0.95rem * 1.4);
  overflow: hidden;
}

.sp-action {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow: hidden;
  min-width: 0;
}

.sp-action-icon { font-size: 1rem; line-height: 1; }

.sp-action-label  { font-size: 0.95rem; font-weight: 700; }
.sp-label-stop    { color: #fca5a5; }
.sp-label-reroll  { color: var(--accent); }

.sp-reroll-dice {
  font-size: 1rem;
  letter-spacing: 0.02em;
  line-height: 1;
}

.sp-gain-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 99px;
  background: rgba(34,197,94,0.15);
  color: var(--green);
  border: 1px solid rgba(34,197,94,0.3);
}

.sp-details-link {
  background: none;
  border: none;
  font-family: var(--font);
  font-size: 0.75rem;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
  opacity: 0.6;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s, opacity 0.15s;
}

.sp-details-link:hover { color: var(--text); opacity: 1; }

/* Non-selectable die in play mode — no visual dimming, just suppress hover effects */
.die-not-selectable {
  cursor: not-allowed !important;
}

.die-not-selectable:hover {
  background: var(--bg-card) !important;
  border-color: var(--border) !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Fixed/locked die */
.die-fixed {
  opacity: 0.45;
  border-style: dashed;
  cursor: default;
}

/* ─── Score block ───────────────────────────────────────────────────────────── */
/* .score-section removed — score is now inline inside the dice section */

.score-value {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  line-height: 1;
}

.score-unit {
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-muted);
  letter-spacing: 0;
}

.score-bust {
  font-size: 1.1rem;
  font-weight: 600;
  color: #fca5a5;
}

/* Busted: show 0 pts in the same large style, tinted red */
.score-busted {
  color: #fca5a5;
}

.score-bust-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: #fca5a5;
  margin-top: 0.25rem;
}

/* Score cycling animation during reroll */
.score-animating {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  opacity: 0.6;
}

/* A5 + A6: score badges (full chest, pirate ship) */
.score-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.45rem;
}

.score-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.2rem 0.65rem;
  font-size: 0.82rem;
  font-weight: 700;
  border-radius: 99px;
  letter-spacing: 0.02em;
}

.badge-full-chest {
  color: #86efac;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.35);
}

.badge-ship-met {
  color: #86efac;
  background: rgba(34,197,94,0.12);
  border: 1px solid rgba(34,197,94,0.35);
}

.badge-ship-unmet {
  color: var(--amber);
  background: rgba(217,119,6,0.12);
  border: 1px solid rgba(217,119,6,0.35);
}

/* ─── Solve button ──────────────────────────────────────────────────────────── */
.action-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: transparent;
  border: none;
  padding: 0;
}

.action-buttons {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
}

.solve-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font);
  background: var(--accent);
  color: #0f1117;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  box-shadow: 0 4px 20px rgba(240,165,0,0.35);
  letter-spacing: 0.02em;
}

.solve-btn:hover:not(:disabled) {
  background: #f8b800;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(240,165,0,0.45);
}

.solve-btn:active:not(:disabled) {
  transform: translateY(0);
}

.solve-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Compact variant (used for Hint button) */
.solve-btn-icon {
  padding: 0.55rem 1.0rem;
  font-size: 0.88rem;
}

/* A4: active (strategy ON) state */
.solve-btn-active {
  background: var(--green);
  box-shadow: 0 4px 20px rgba(34,197,94,0.35);
}

.solve-btn-active:hover:not(:disabled) {
  background: #16a34a;
  box-shadow: 0 8px 28px rgba(34,197,94,0.45);
}

/* A4: Details button */
.details-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.65rem 1.1rem;
  font-size: 0.9rem;
  font-weight: 600;
  font-family: var(--font);

  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s;
}

.details-btn:hover {
  border-color: var(--text-muted);
  background: var(--bg-card);
  transform: translateY(-2px);
}

/* Icon-only variant: square-ish, no text */
.details-btn-icon {
  padding: 0.65rem 0.8rem;
  font-size: 1.05rem;
}

.roll-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s;
  letter-spacing: 0.02em;
}

.roll-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-card);
  transform: translateY(-2px);
}

.roll-btn:active:not(:disabled) { transform: translateY(0); }

.roll-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Primary variant: golden fill + pulse — used for the "Roll" CTA in card_revealed phase */
.roll-btn-primary {
  background: var(--accent);
  color: #0f1117;
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(240,165,0,0.4);
  animation: roll-dice-pulse 2s ease-in-out infinite;
}

.roll-btn-primary:hover:not(:disabled) {
  background: #f8b800;
  color: #0f1117;
  border-color: #f8b800;
  animation: none;
  box-shadow: 0 8px 28px rgba(240,165,0,0.5);
}

.roll-btn-primary:disabled {
  opacity: 0.5;
  animation: none;
}

/* ─── Big centered roll button (in dice section) ─────────────────────────────── */
.dice-action-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0.35rem 0;
}

.dice-roll-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

/* Flanking action buttons (hint, save) */
.dice-side-btn {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: inherit;
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transform: translateY(-8px);
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s, border-color 0.15s, opacity 0.15s;
}

.dice-side-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (hover: hover) and (pointer: fine) {
  .dice-side-btn:not(:disabled):hover {
    background: var(--bg-card-hover);
    border-color: var(--text-muted);
  }
}

.dice-side-btn:active:not(:disabled) {
  transform: translateY(-8px) scale(0.93);
}

/* Hint: strategy ON */
.dice-side-btn-on {
  color: var(--green) !important;
  border-color: var(--green) !important;
  background: rgba(34, 197, 94, 0.12) !important;
}

.dice-roll-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: var(--bg-card);
  color: var(--text-muted);
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s, border-color 0.15s, opacity 0.15s;
}

.dice-roll-btn-ready {
  background: var(--accent);
  border-color: var(--accent);
  color: #0f1117;
  box-shadow: 0 4px 24px rgba(240,165,0,0.4);
  animation: roll-dice-pulse 2s ease-in-out infinite;
}

.dice-roll-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  animation: none;
}

@media (hover: hover) and (pointer: fine) {
  .dice-roll-btn-ready:not(:disabled):hover {
    background: #f8b800;
    border-color: #f8b800;
    transform: translateY(-3px);
    box-shadow: 0 8px 28px rgba(240,165,0,0.5);
    animation: none;
  }
}

.dice-roll-btn:active:not(:disabled) {
  transform: scale(0.93);
  box-shadow: 0 2px 10px rgba(240,165,0,0.3);
  animation: none;
}

.dice-roll-emoji { font-size: 2rem; line-height: 1; }

.dice-roll-count {
  font-size: 0.7rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: 0.02em;
}

.randomize-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s;
}

.randomize-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-card);
  transform: translateY(-2px);
}

.randomize-btn:active:not(:disabled) { transform: translateY(0); }

.randomize-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Loading spinner */
.spinner {
  display: inline-block;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(15,17,23,0.3);
  border-top-color: #0f1117;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }


.error-msg {
  color: var(--red);
  font-size: 0.9rem;
}

/* ─── B1: Danger gauge ──────────────────────────────────────────────────────── */
.danger-gauge {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  width: min(280px, 90vw);
  align-self: center;
  /* Min-height: label line + gap + 6px track, so empty state reserves the same space */
  min-height: calc(0.82rem * 1.4 + 0.3rem + 6px);
  overflow: hidden;
}

.danger-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
}

.danger-pct {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.danger-track {
  height: 6px;
  background: var(--bg-card);
  border-radius: 99px;
  overflow: hidden;
  border: 1px solid var(--border);
}

.danger-fill {
  height: 100%;
  border-radius: 99px;
  transition: width 0.25s ease, background-color 0.25s ease;
  min-width: 4px;
}

.danger-safe   { background: var(--green); }
.danger-low    { background: #84cc16; }   /* lime-400 */
.danger-medium { background: var(--amber); }
.danger-high   { background: var(--red); }

.danger-last-reroll {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
  padding-top: 0.1rem;
}

/* ─── Results ───────────────────────────────────────────────────────────────── */
.result-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-radius: var(--radius-sm);
  font-size: 1.1rem;
  font-weight: 600;
}

.banner-icon { font-size: 1.5rem; }

.result-bust {
  background: rgba(239,68,68,0.12);
  border: 1px solid rgba(239,68,68,0.35);
  color: #fca5a5;
}

.results-header { margin-bottom: 1rem; }

.result-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.95rem;
  color: var(--text-muted);
}

.result-meta strong { color: var(--text); }

.skull-pip { font-size: 1rem; }

.none-label { opacity: 0.5; font-style: italic; }

.meta-sep { opacity: 0.4; }

/* ─── Table ──────────────────────────────────────────────────────────────────── */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

.results-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.results-table th {
  padding: 0.6rem 0.75rem;
  text-align: left;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.results-table td {
  padding: 0.6rem 0.75rem;
  border-bottom: 1px solid rgba(46,51,77,0.5);
  vertical-align: middle;
  white-space: nowrap;
}

.results-table tr:last-child td {
  border-bottom: none;
}

.results-table tbody tr {
  transition: background 0.1s;
}

.results-table tbody tr:hover {
  background: rgba(255,255,255,0.03);
}

/* Best row */
.row-best {
  background: rgba(240,165,0,0.08) !important;
}
.row-best td { color: var(--text); }
.row-best:hover { background: rgba(240,165,0,0.12) !important; }

/* Stop row */
.row-stop {
  background: rgba(99,102,241,0.06);
}

.col-marker {
  font-size: 1rem;
  width: 2.5rem;
  text-align: center;
}

.col-emoji {
  font-size: 1rem;
  letter-spacing: 0.05em;
}

.col-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 0.875rem;
}

.col-ev {
  font-weight: 600;
  color: var(--text);
}

.col-delta.positive { color: var(--green); }
.col-delta.negative { color: var(--red); }

/* ─── Legend ─────────────────────────────────────────────────────────────────── */
.results-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.75rem;
  margin-top: 0.75rem;
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* ─── A4: Strategy modal ─────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 1rem;
  backdrop-filter: blur(2px);
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  width: min(92vw, 780px);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  animation: modal-in 0.18s ease-out;
}

@keyframes modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.modal-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  font-family: var(--font);
  cursor: pointer;
  padding: 0.3rem 0.6rem;
  border-radius: var(--radius-sm);
  line-height: 1;
  transition: color 0.15s, background 0.15s;
}

.modal-close-btn:hover {
  color: var(--text);
  background: var(--bg-card);
}

.modal-body {
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.modal-meta { margin-bottom: 0; }

/* ─── Footer ─────────────────────────────────────────────────────────────────── */
.site-footer { display: none; }

.site-footer a {
  color: var(--accent);
  text-decoration: none;
}
.site-footer a:hover { text-decoration: underline; }

/* ─── D1: Header layout (Scores button) ─────────────────────────────────────── */
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.scoreboard-header-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0.35rem 0.8rem;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: var(--font);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
}

.scoreboard-header-btn:hover {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-card);
}

/* ─── D1: Record Score button ────────────────────────────────────────────────── */
.finish-turn-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.88rem;
  font-weight: 600;
  font-family: var(--font);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  border-radius: 100px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s, transform 0.1s;
  letter-spacing: 0.02em;
}

.finish-turn-btn:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--text-muted);
  background: var(--bg-card);
  transform: translateY(-2px);
}

.finish-turn-btn:active:not(:disabled) { transform: translateY(0); }

.finish-turn-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* ─── D1: Submit-score modal ─────────────────────────────────────────────────── */
.modal-card.modal-sm {
  width: min(92vw, 420px);
}

.submit-score-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  padding: 1.4rem 1rem 1.2rem;
  border-radius: var(--radius-sm);
  background: var(--bg-card);
  border: 1px solid var(--border);
  text-align: center;
}

.submit-hero-number {
  font-size: 3.2rem;
  font-weight: 800;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.03em;
  line-height: 1;
}

.submit-hero-number.submit-hero-neg  { color: #fca5a5; }
.submit-hero-number.submit-hero-zero { color: var(--text-muted); }

.submit-hero-unit {
  font-size: 0.9rem;
  color: var(--text-muted);
  font-weight: 500;
  margin-top: 0.1rem;
}

.submit-hero-bust {
  font-size: 0.85rem;
  color: #fca5a5;
  font-weight: 600;
  margin-top: 0.3rem;
}

.submit-zombie-note {
  font-size: 0.82rem;
  color: var(--text-muted, #94a3b8);
  text-align: center;
  margin: -0.25rem 0 0.5rem;
}

.submit-player-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.submit-player-label {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.submit-name-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  font-family: var(--font);
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.submit-name-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(240, 165, 0, 0.15);
}

.submit-name-input::placeholder {
  color: var(--text-muted);
  opacity: 0.5;
}

.submit-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}

/* ─── D1: Scoreboard table ───────────────────────────────────────────────────── */
.scoreboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.sb-round-th {
  padding: 0.55rem 0.65rem;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  width: 2.5rem;
}

.sb-player-th {
  padding: 0.55rem 1rem;
  text-align: right;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.sb-round-td {
  padding: 0.5rem 0.65rem;
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(46, 51, 77, 0.5);
}

.sb-score-td {
  padding: 0.5rem 1rem;
  text-align: right;
  font-variant-numeric: tabular-nums;
  border-bottom: 1px solid rgba(46, 51, 77, 0.5);
  font-weight: 500;
}

.score-cell-pos   { color: var(--green); }
.score-cell-neg   { color: #fca5a5; }
.score-cell-zero  { color: var(--text-muted); }
.score-cell-empty { color: var(--text-muted); opacity: 0.3; }

.sb-total-row {
  border-top: 2px solid var(--border);
}

.sb-total-label {
  font-size: 1rem;
  font-weight: 700;
}

.sb-total-td {
  font-size: 1rem;
  font-weight: 800;
  border-bottom: none;
}

.sb-round-td.sb-total-label { border-bottom: none; }

.sb-total-pos { color: var(--accent); }
.sb-total-neg { color: #fca5a5; }

.sb-avg-row {
  border-top: 1px solid var(--border);
}

.sb-avg-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

.sb-avg-td {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: none;
}

.sb-round-td.sb-avg-label { border-bottom: none; }

.scoreboard-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 0.75rem 0;
  opacity: 0.7;
}

.reset-scores-btn {
  align-self: center;
}

/* ─── D1: Scoreboard cell with delete button ─────────────────────────────────── */
.sb-cell-inner {
  display: grid;
  grid-template-columns: 1.5rem 1fr;
  align-items: center;
  gap: 0.35rem;
}

.sb-cell-inner span {
  text-align: right;
}

.sb-delete-btn {
  background: none;
  border: none;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0.15rem 0.25rem;
  border-radius: 4px;
  opacity: 0.4;
  color: var(--text-muted);
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

/* On real pointer devices: dim until the row is hovered */
@media (hover: hover) and (pointer: fine) {
  .sb-delete-btn { opacity: 0.1; }
  .sb-score-td:hover .sb-delete-btn { opacity: 0.5; }
}

.sb-delete-btn:hover {
  opacity: 1 !important;
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
}

.sb-edit-btn {
  background: none;
  border: none;
  font-size: 0.72rem;
  cursor: pointer;
  padding: 0.15rem 0.25rem;
  border-radius: 4px;
  opacity: 0.4;
  color: var(--text-muted);
  line-height: 1;
  flex-shrink: 0;
  transition: opacity 0.15s, background 0.15s;
}

@media (hover: hover) and (pointer: fine) {
  .sb-edit-btn { opacity: 0.1; }
  .sb-score-td:hover .sb-edit-btn { opacity: 0.5; }
}

.sb-edit-btn:hover {
  opacity: 1 !important;
  background: rgba(99, 102, 241, 0.15);
}

/* ─── D1: Scoreboard footer actions row ──────────────────────────────────────── */
.sb-footer-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.sb-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font);
  background: rgba(240, 165, 0, 0.1);
  color: var(--accent);
  border: 1px solid rgba(240, 165, 0, 0.3);
  border-radius: 100px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}

.sb-share-btn:hover {
  background: rgba(240, 165, 0, 0.2);
  border-color: var(--accent);
  transform: translateY(-2px);
}

.sb-share-btn:active { transform: translateY(0); }

/* ─── Confirmation modal: destructive action button ─────────────────────────── */
.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.7rem;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: var(--font);
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 100px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
  box-shadow: 0 4px 20px rgba(239, 68, 68, 0.35);
  letter-spacing: 0.02em;
}

.btn-danger:hover {
  background: #dc2626;
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(239, 68, 68, 0.45);
}

.btn-danger:active { transform: translateY(0); }

.confirm-message {
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.confirm-message strong { color: var(--text); }

/* ─── Edit entry modal: action row ──────────────────────────────────────────── */
.edit-entry-actions {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.edit-right-actions {
  display: flex;
  gap: 0.5rem;
}

.submit-hero-score-row {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}

/* ─── Skull Island ───────────────────────────────────────────────────────────── */

/* Card section: skull island keeps the same 42px height as normal play — no override needed */
.card-section-skull-island {}

/* Compact skull island indicator — lives in the card-section-header row */
.skull-island-indicator {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.skull-island-indicator-icon {
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}

.skull-island-indicator-title {
  font-size: 0.82rem;
  font-weight: 800;
  color: #fca5a5;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  white-space: nowrap;
}

.skull-island-indicator-skulls {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 99px;
  padding: 0.1rem 0.45rem;
  flex-shrink: 0;
  white-space: nowrap;
}

.skull-island-indicator-penalty {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Skull Island section title tint */
.section-title-skull-island {
  color: #fca5a5 !important;
}

/* Skull dice: locked / set aside (red-dimmed) */
.die-skull-island-locked {
  border-color: rgba(239, 68, 68, 0.5) !important;
  background: rgba(239, 68, 68, 0.08) !important;
  opacity: 0.65;
  cursor: default !important;
}

.die-skull-island-locked:hover {
  background: rgba(239, 68, 68, 0.08) !important;
  border-color: rgba(239, 68, 68, 0.5) !important;
  transform: none !important;
  box-shadow: none !important;
}

/* Non-skull dice during skull island: pulsing amber border (will be rerolled) */
.die-skull-island-reroll {
  border-color: rgba(240, 165, 0, 0.5);
  animation: skull-island-reroll-pulse 1.8s ease-in-out infinite;
  cursor: default !important;
}

.die-skull-island-reroll:hover {
  transform: none !important;
  box-shadow: none !important;
}

@keyframes skull-island-reroll-pulse {
  0%, 100% { border-color: rgba(240, 165, 0, 0.3); box-shadow: none; }
  50%       { border-color: rgba(240, 165, 0, 0.7); box-shadow: 0 0 8px rgba(240, 165, 0, 0.2); }
}

/* Skull Island score color */
.score-skull-island { color: #fca5a5; }

/* Scoreboard skull island cells */
.score-cell-skull-island  { color: var(--text-muted); }

/* Skull Island event rows in the scoreboard */
.sb-skull-island-event-row {
  background: rgba(239, 68, 68, 0.06);
  border-top: 1px solid rgba(239, 68, 68, 0.2);
}

.sb-skull-island-event-cell {
  padding: 0.5rem 1rem;
  text-align: right;
  border-bottom: 1px solid rgba(239, 68, 68, 0.15);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

.sb-skull-island-source {
  color: var(--text-muted);
}

.sb-skull-island-deduction {
  color: #fca5a5;
}

/* Submit modal skull island hero */
.submit-hero-skull-icon {
  font-size: 2.2rem;
  line-height: 1;
  margin-bottom: 0.2rem;
}

.submit-skull-island-penalty {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0.5rem;
  padding: 0.5rem 0.8rem;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.25);
  border-radius: var(--radius-sm);
  width: 100%;
}

.submit-skull-island-skulls {
  font-size: 1rem;
  font-weight: 800;
  color: #fca5a5;
}

.submit-skull-island-arrow {
  color: var(--text-muted);
  opacity: 0.5;
}

.submit-skull-island-amount {
  font-size: 0.88rem;
  font-weight: 700;
  color: #fca5a5;
}

/* ─── Rules button & modal ───────────────────────────────────────────────────── */
.rules-header-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  font-size: 0.95rem;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.rules-header-btn:hover {
  background: var(--bg-card);
  border-color: var(--text-muted);
}

.rules-intro {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.55;
}

.rules-section {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.rules-section-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--text-muted);
}

.rules-section p {
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.55;
}

.rules-example {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
}

.rules-list {
  padding-left: 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  color: var(--text);
  line-height: 1.5;
}

.rules-combos {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.6rem 0.9rem;
}

.rules-combo-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}


.rules-combo-desc {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.rules-combo-pts {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.rules-controls-list {
  list-style: none;
  padding-left: 0;
}

.rules-ctrl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  font-size: 0.95rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  vertical-align: middle;
  flex-shrink: 0;
}

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 500px) {
  .die {
    width: 60px;
    height: 68px;
  }
  .die-emoji { font-size: 1.6rem; }
  .section { padding: 1rem; }
}
