/* PlayCorrect — original dark, arcade-flavored theme. High contrast. No casino neon. */
:root {
  --bg: #14120f;
  --bg-raise: #1c1a16;
  --bg-chip: #26231e;
  --ink: #f3ead8;
  --muted: #cfc3ab;
  --faint: #9e937e;
  --line: #4a4338;
  --line-strong: #d7ccb6;
  --sage: #c5d4a8;
  --sage-ink: #14120f;
  --clay: #e0b4a6;
  --sky: #c5d0e0;
  --dusk: #d4c0d0;
  --warn: #e8c9a8;
  --bust: #e8b4a8;
  --focus: #f3ead8;
  --shadow: #0a0908;
  --font-body: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --font-pixel: "Press Start 2P", ui-monospace, monospace;
  --tap: 48px;
  --radius: 10px;
  --max: 42rem;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { background: var(--bg); color: var(--ink); }
body {
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.45;
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.02), transparent 12rem),
    var(--bg);
  color: var(--ink);
}

img, svg { display: block; }
button, a { font: inherit; color: inherit; }
button {
  appearance: none;
  background: var(--bg-chip);
  color: var(--ink);
  border: 3px solid var(--line);
  border-radius: 8px;
  min-height: var(--tap);
  padding: 0.35rem 0.7rem;
  cursor: pointer;
  box-shadow: 2px 2px 0 var(--shadow);
}
button:hover { border-color: var(--line-strong); }
button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
button:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--shadow); }
button[aria-pressed="true"], button.is-on {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 600;
}

.wrap {
  width: min(100%, var(--max));
  margin: 0 auto;
  padding: 0 0.85rem 14rem;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 0 0.5rem;
}
.logo {
  font-family: var(--font-pixel);
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  text-decoration: none;
  color: var(--ink);
  line-height: 1.3;
}
.logo span {
  display: block;
  font-family: var(--font-body);
  font-size: 0.7rem;
  letter-spacing: 0;
  color: var(--faint);
  font-weight: 400;
  margin-top: 0.25rem;
}
.nav {
  display: flex;
  gap: 0.4rem;
}
.nav a {
  text-decoration: none;
  border: 2px solid var(--line);
  padding: 0.4rem 0.65rem;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  border-radius: 8px;
  background: var(--bg-raise);
}
.nav a[aria-current="page"] {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 600;
}

/* Chip row */
.chips {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(6px);
  padding: 0.4rem 0 0.55rem;
  border-bottom: 2px solid var(--line);
  margin: 0 -0.85rem;
  padding-left: 0.85rem;
  padding-right: 0.85rem;
}
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.55rem;
  align-items: center;
}
.chip-group {
  display: flex;
  gap: 0.25rem;
  align-items: center;
}
.chip-group .lbl {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--faint);
  margin-right: 0.15rem;
}
.chip {
  min-width: 40px;
  min-height: 36px;
  padding: 0.2rem 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
}
.rules-badge {
  font-size: 0.78rem;
  color: var(--warn);
  margin: 0.3rem 0 0;
}

/* Table / hands */
.stage { margin-top: 0.85rem; }
.hand-block { margin-bottom: 0.65rem; }
.hand-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 0.3rem;
}
.cards {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
  min-height: 4.7rem;
  align-items: stretch;
}
.card-face, .card-slot {
  width: 3.2rem;
  min-height: 4.55rem;
  border-radius: 8px;
  border: 3px solid var(--line-strong);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 0.3rem 0.35rem 0.25rem;
  background: var(--ink);
  color: var(--bg);
  font-weight: 600;
  box-shadow: 3px 3px 0 var(--shadow);
}
.card-face .rank {
  font-family: var(--font-pixel);
  font-size: 1.05rem;
  line-height: 1;
}
.card-face .rank-bl {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  align-self: flex-end;
}
.card-slot {
  background: transparent;
  border-style: dashed;
  border-color: var(--line);
  box-shadow: none;
  color: var(--faint);
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  text-align: center;
}
.total-pill {
  display: inline-block;
  margin-left: 0.4rem;
  font-size: 0.8rem;
  color: var(--sage);
  letter-spacing: 0.02em;
}

.prompt {
  min-height: 1.5rem;
  color: var(--muted);
  margin: 0.35rem 0 0.5rem;
  font-weight: 600;
}

/* Result */
.result {
  margin: 0.35rem 0 0.45rem;
  padding: 0.7rem 0.7rem 0.75rem;
  background: var(--bg-raise);
  border: 3px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 4px 4px 0 var(--shadow);
  min-height: 0;
}
.result.is-empty {
  border-style: dashed;
  box-shadow: none;
  color: var(--faint);
}
.play-word {
  font-family: var(--font-pixel);
  font-size: clamp(1.35rem, 7vw, 2.15rem);
  line-height: 1.25;
  letter-spacing: 0.02em;
  margin: 0 0 0.45rem;
  color: var(--sage);
  word-break: break-word;
}
.play-word[data-play="S"],
.play-word[data-play="BJ"] { color: var(--ink); }
.play-word[data-play="H"] { color: var(--sage); }
.play-word[data-play="D"],
.play-word[data-play="Ds"] { color: var(--sky); }
.play-word[data-play="P"] { color: var(--dusk); }
.play-word[data-play="Rh"],
.play-word[data-play="Rs"],
.play-word[data-play="Rp"] { color: var(--clay); }
.play-word[data-play="BUST"] { color: var(--bust); }
.play-sub {
  font-size: 1.02rem;
  margin: 0 0 0.35rem;
  color: var(--ink);
  font-weight: 600;
}
.play-reason { margin: 0; color: var(--muted); }
.insurance {
  margin: 0.55rem 0 0;
  padding: 0.45rem 0.55rem;
  border-left: 4px solid var(--warn);
  color: var(--ink);
  background: color-mix(in srgb, var(--warn) 12%, var(--bg-raise));
  font-weight: 600;
}
.exact-note {
  margin: 0.4rem 0 0;
  padding: 0.4rem 0.5rem;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--bg-chip);
  font-size: 0.92rem;
}
.exact-note strong { font-weight: 600; }
.exact-meta {
  display: block;
  margin-top: 0.25rem;
  color: var(--muted);
  font-size: 0.85rem;
}
.tag {
  display: inline-block;
  margin-left: 0.25rem;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border: 1px solid var(--line-strong);
  padding: 0.05rem 0.35rem;
  border-radius: 999px;
  color: var(--muted);
  vertical-align: middle;
}

.toolbar {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin: 0 0 0.45rem;
}
.toolbar button { flex: 1 1 22%; min-width: 5rem; font-weight: 600; }
.toolbar .primary {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.toolbar-extra {
  display: flex;
  justify-content: flex-end;
  margin: 0 0 0.4rem;
}
.toolbar-extra .textish {
  flex: 0 1 auto;
  min-width: 0;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.25rem 0.55rem;
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 999px;
}
.toolbar-extra .textish[aria-pressed="true"] {
  color: var(--ink);
  border-style: solid;
  background: var(--bg-chip);
}
.play-word-row {
  display: flex;
  align-items: flex-start;
  gap: 0.4rem;
  margin: 0 0 0.45rem;
}
.play-word-row .play-word { margin: 0; flex: 1 1 auto; }
.sparkle-mark {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  margin-top: 0.15rem;
  color: var(--ink);
  background: var(--bg-chip);
  border: 2px solid var(--line-strong);
  border-radius: 8px;
  text-decoration: none;
}
.sparkle-mark:hover, .sparkle-mark:focus-visible {
  border-color: var(--ink);
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}
.sparkle-mark svg {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
}

/* Keypad */
.keypad {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  width: min(100%, var(--max));
  bottom: 0;
  z-index: 30;
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  backdrop-filter: blur(6px);
  margin: 0;
  padding: 0.55rem 0.85rem calc(0.7rem + env(safe-area-inset-bottom));
  border-top: 2px solid var(--line);
}
.keypad-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.4rem;
}
.key {
  min-height: 56px;
  font-family: var(--font-pixel);
  font-size: 0.92rem;
  font-weight: 400;
  padding: 0;
}
.key[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
  box-shadow: none;
}

/* Footer / legal */
.legal {
  margin: 1.6rem 0 0.5rem;
  padding-top: 0.9rem;
  border-top: 2px solid var(--line);
  color: var(--muted);
  font-size: 0.8rem;
  line-height: 1.5;
}
.legal a { color: var(--ink); }
.legal p { margin: 0 0 0.5rem; }

/* Rules / prose pages */
.prose { margin-top: 1rem; }
.prose h1 {
  font-family: var(--font-pixel);
  font-size: 1rem;
  line-height: 1.5;
  margin: 0 0 0.8rem;
}
.prose h2 {
  font-family: var(--font-pixel);
  font-size: 0.72rem;
  line-height: 1.5;
  margin: 1.4rem 0 0.5rem;
}
.prose p, .prose li { color: var(--ink); }
.prose .muted { color: var(--muted); }

/* Printable card */
.card-page .chips { position: static; }
.chart-wrap { margin-top: 0.8rem; }
.chart-title {
  font-family: var(--font-pixel);
  font-size: 0.7rem;
  margin: 0.9rem 0 0.35rem;
}
.chart {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  table-layout: fixed;
}
.chart th, .chart td {
  border: 1px solid var(--line);
  text-align: center;
  padding: 0.22rem 0;
  font-weight: 600;
}
.chart th {
  background: var(--bg-chip);
  font-weight: 600;
  color: var(--muted);
}
.chart td[data-code="H"] { background: #243024; color: var(--sage); }
.chart td[data-code="S"] { background: #2a2620; color: var(--ink); }
.chart td[data-code="D"],
.chart td[data-code="Ds"] { background: #222833; color: var(--sky); }
.chart td[data-code="P"] { background: #2a2230; color: var(--dusk); }
.chart td[data-code^="R"] { background: #33241f; color: var(--clay); }
.chart .row-head { text-align: left; padding-left: 0.4rem; color: var(--muted); background: var(--bg-raise); }
.legend { font-size: 0.85rem; color: var(--muted); margin: 0.7rem 0; }
.print-bar { margin: 0.8rem 0; }

@media (min-width: 720px) {
  .play-word { font-size: 2.2rem; }
  .card-face, .card-slot { width: 4.1rem; min-height: 5.8rem; }
}

@media (prefers-reduced-motion: reduce) {
  button:active { transform: none; }
}


/* Milestone 4: guide pages, tables, below-fold intro, secondary nav */
.skip-link {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--paper, #1c1916);
  color: var(--ink);
  padding: 0.4rem 0.7rem;
  z-index: 20;
}
.skip-link:focus { left: 0.5rem; top: 0.5rem; }
.nav { display: flex; flex-wrap: wrap; gap: 0.35rem 0.85rem; }
.subnav {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem 0.85rem;
  margin: 0.75rem 0 0;
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--line);
  font-size: 0.85rem;
}
.subnav a { color: var(--muted); text-decoration: none; }
.subnav a:hover, .subnav a[aria-current="page"] { color: var(--ink); text-decoration: underline; }
.below-fold {
  margin: 3.5rem 0 1.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--line);
}
.below-fold h2 { font-family: "IBM Plex Sans", sans-serif; font-size: 1.05rem; margin: 0 0 0.5rem; }
.below-fold p, .guide-links p { color: var(--ink); }
.guide-links { list-style: none; padding: 0; margin: 0.6rem 0 0; }
.guide-links li { margin: 0 0 0.35rem; }
.guide-links a { color: var(--ink); }
.prose { max-width: 42rem; }
.prose h1 { font-family: "IBM Plex Sans", sans-serif; font-weight: 600; font-size: 1.65rem; line-height: 1.25; margin: 1.1rem 0 0.6rem; }
.prose h2 { font-family: "IBM Plex Sans", sans-serif; font-weight: 600; font-size: 1.15rem; margin: 1.5rem 0 0.5rem; }
.prose h3 { font-family: "IBM Plex Sans", sans-serif; font-weight: 600; font-size: 1rem; margin: 1.15rem 0 0.4rem; }
.prose p, .prose li { line-height: 1.55; }
.prose .lede { font-size: 1.05rem; }
.prose table, .play-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.8rem 0 1.1rem;
  font-size: 0.88rem;
}
.play-table th, .play-table td, .prose table th, .prose table td {
  border: 1px solid var(--line);
  padding: 0.35rem 0.45rem;
  text-align: left;
  vertical-align: top;
}
.play-table th, .prose table th { background: rgba(255,255,255,0.04); font-weight: 600; }
.play-table td.num, .prose td.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.tag-verified, .tag-computed {
  display: inline-block;
  font-size: 0.75rem;
  letter-spacing: 0.02em;
  border: 1px solid var(--line);
  padding: 0.05rem 0.35rem;
  margin-left: 0.25rem;
}
.related { margin-top: 2rem; }
.related ul { padding-left: 1.1rem; }
.prose .legal-inline { color: var(--muted); font-size: 0.92rem; }
@media print {
  .subnav, .below-fold, .skip-link { display: none !important; }
}

/* Print: ink on paper, grayscale-friendly, one letter/A4 page */
@media print {
  :root { --bg: #fff; --ink: #111; --muted: #222; --faint: #333; --line: #222; }
  html, body { background: #fff; color: #111; }
  .nav, .keypad, .toolbar, .print-bar, .chips,
  .site-header .logo span { display: none !important; }
  .wrap { padding: 0; max-width: none; width: 100%; }
  .site-header { padding: 0 0 0.2rem; }
  .logo { color: #111; font-size: 8pt; }
  .legend, #card-subtitle { color: #111; font-size: 8pt; margin: 0.2rem 0 0.35rem; }
  .chart-title { margin: 0.35rem 0 0.12rem; font-size: 8pt; color: #111; }
  .chart { font-size: 8pt; }
  .chart th, .chart td {
    border: 1px solid #111;
    color: #111 !important;
    background: #fff !important;
    padding: 0.07rem 0;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  /* Pattern/weight, not hue, so the card stays readable in grayscale. */
  .chart td[data-code="S"] { font-weight: 700; background: #e6e6e6 !important; }
  .chart td[data-code="H"] { font-weight: 400; background: #fff !important; }
  .chart td[data-code="D"],
  .chart td[data-code="Ds"] { font-weight: 700; text-decoration: underline; background: #fff !important; }
  .chart td[data-code="P"] { font-weight: 700; background: #d0d0d0 !important; }
  .chart td[data-code^="R"] { font-style: italic; background: #fff !important; }
  .chart td[data-code="BJ"] { font-weight: 400; background: #fff !important; }
  .chart .row-head { background: #fff !important; text-align: left; color: #111 !important; }
  .legal { color: #111; border-color: #111; font-size: 7pt; margin-top: 0.25rem; padding-top: 0.2rem; }
  .legal a { color: #111; }
  .legal p { margin: 0 0 0.25rem; }
  @page { size: letter; margin: 0.32in; }
}
