/* Stack - the page.  The canvas is the game; everything here sits on top of it. */
:root {
  --ink: #23202a;
  --paper: #fffdf8;
  --dim: #6d6678;
  --line: rgba(35, 32, 42, 0.14);
  --shadow: 0 18px 50px rgba(30, 20, 40, 0.20);
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: #f2c8b4;
  color: var(--ink);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
  overscroll-behavior: none;
}
body.modal-open { overflow: auto; }

#game {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  display: block;
  touch-action: manipulation;
  cursor: pointer;
}

.nogl {
  position: fixed; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 24px; text-align: center;
  background: linear-gradient(#f3a9bd, #f6e2a8);
}
.nogl h1 { font-size: 44px; margin: 0; font-weight: 300; letter-spacing: .04em; }

.hud {
  position: fixed; top: 0; left: 0; right: 0;
  padding: max(18px, env(safe-area-inset-top)) 16px 0;
  text-align: center; pointer-events: none;
}
/* facts.md M13: a bare integer, thin white type, upper centre.  No label, no frame. */
.score {
  font-size: clamp(44px, min(12vh, 20vw), 108px);
  font-weight: 200; line-height: 1;
  color: #fff;
  text-shadow: 0 2px 14px rgba(0, 0, 0, .13);
  letter-spacing: .01em;
  font-variant-numeric: tabular-nums;
}
.combo {
  margin-top: 6px; color: #fff; font-size: 13px; letter-spacing: .10em;
  text-transform: uppercase; opacity: .92;
}
.status {
  margin-top: 6px; color: #fff; font-size: 12px; letter-spacing: .06em; opacity: .82;
}

.toolbar {
  position: fixed; left: 0; right: 0;
  bottom: max(14px, env(safe-area-inset-bottom));
  display: flex; gap: 8px; justify-content: center; flex-wrap: wrap;
  padding: 0 12px;
}
.toolbar button {
  font: inherit; font-size: 13px;
  padding: 9px 15px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .55);
  background: rgba(255, 255, 255, .28);
  color: #fff; cursor: pointer;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.toolbar button:hover { background: rgba(255, 255, 255, .42); }
.toolbar button.tap { background: rgba(255, 255, 255, .86); color: var(--ink); font-weight: 600; }

.card {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 32px));
  max-height: min(84vh, 760px); overflow: auto;
  background: var(--paper); color: var(--ink);
  border-radius: 20px; padding: 26px 26px 24px;
  box-shadow: var(--shadow);
  text-align: center;
}
.card.wide { width: min(760px, calc(100vw - 24px)); text-align: left; }
.card h1 { font-size: 46px; font-weight: 300; margin: 0 0 10px; letter-spacing: .03em; }
.card h2 { font-size: 24px; font-weight: 500; margin: 0 0 12px; }
.card h3 { font-size: 15px; font-weight: 600; margin: 22px 0 6px; letter-spacing: .01em; }
.card p { margin: 0 0 10px; }
.card ul { margin: 0 0 12px; padding-left: 20px; }
.card li { margin-bottom: 6px; }
.lede { font-size: 17px; }
.big { font-size: 64px; font-weight: 200; line-height: 1.05; margin: 4px 0; }
.note { min-height: 1.5em; }
.dim, .meta, .credit { color: var(--dim); font-size: 13px; }
.credit { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.meta { margin-top: 12px; }
.toggle { margin: 12px 0; font-size: 14px; }
.toggle input { margin-right: 8px; }
.card a { color: #b2456a; }

button.primary {
  font: inherit; font-weight: 600; font-size: 16px;
  margin-top: 12px; padding: 12px 34px; border-radius: 999px;
  border: 0; background: var(--ink); color: #fff; cursor: pointer;
}
button.primary:hover { background: #3a3446; }
button.close {
  position: absolute; top: 14px; right: 16px;
  font: inherit; font-size: 12px; padding: 6px 12px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--dim); cursor: pointer;
}
button.close:hover { background: rgba(0, 0, 0, .05); }

.spec { margin-top: 8px; font-size: 12.5px; }
.spec-row {
  display: grid; grid-template-columns: 1fr; gap: 2px;
  padding: 9px 0; border-top: 1px solid var(--line);
}
.spec-row strong { font-weight: 600; }
.spec-val { color: var(--ink); }
.spec-src { color: var(--dim); font-size: 11.5px; }
.tag {
  justify-self: start; font-size: 10px; letter-spacing: .09em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 4px; font-weight: 700;
}
.tag-documented { background: #dceadb; color: #2f5b34; }
.tag-measured { background: #dbe4f0; color: #2c4b70; }
.tag-derived { background: #efe6d5; color: #6a5327; }
.tag-calibrated { background: #f0e2ec; color: #6e3556; }
.tag-reconstructed { background: #eeeaea; color: #63585b; }

@media (max-width: 480px) {
  .card { padding: 20px 18px; border-radius: 16px; }
  .card h1 { font-size: 38px; }
}
/* short landscape phones: keep the whole result card, button included, on one screen */
@media (max-height: 480px) {
  .card { padding: 14px 18px 12px; max-height: calc(100vh - 16px); }
  .card h1 { font-size: 30px; margin-bottom: 4px; }
  .card h2 { font-size: 20px; margin-bottom: 4px; }
  .big { font-size: 40px; }
  .lede { font-size: 15px; }
  .card p { margin-bottom: 6px; }
  button.primary { margin-top: 4px; padding: 9px 28px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
}

.consts { width: 100%; border-collapse: collapse; font-size: 13px; margin: 6px 0 4px; }
.consts th {
  text-align: left; font-weight: 500; color: var(--dim);
  padding: 6px 10px 6px 0; border-top: 1px solid var(--line); white-space: nowrap;
}
.consts td { padding: 6px 0; border-top: 1px solid var(--line); font-variant-numeric: tabular-nums; }
