:root {
  /* greyscale system — black & white with grey highlights */
  --paper: #f4f4f2;        /* soft off-white */
  --paper-2: #e9e9e6;      /* panel grey */
  --ink: #18181a;          /* near-black text */
  --body: #3d3d3f;         /* dark grey body */
  --muted: #8b8b8d;        /* mid-grey */
  --hairline: #dadad7;     /* light grey rules */
  --accent: #18181a;       /* primary highlight (near-black) */
  --accent-soft: #3a3a3c;  /* button hover */
  --mark: #7d7d80;         /* secondary highlight (mid-grey) */
  --shadow: 0 1px 2px rgba(0, 0, 0, .06), 0 8px 30px rgba(0, 0, 0, .08);
  --serif: "Newsreader", Georgia, "Times New Roman", serif;
  --sans: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--body);
  font-family: var(--serif);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
#root { min-height: 100%; }

.eyebrow {
  font-family: var(--sans);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .16em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }
.serif { font-family: var(--serif); }
a { color: var(--accent); }
.tabular { font-variant-numeric: tabular-nums; }

/* ---------- buttons ---------- */
.btn-primary {
  font-family: var(--sans);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  background: var(--accent);
  color: var(--paper);
  border: none;
  border-radius: 6px;
  padding: 14px 30px;
  cursor: pointer;
  transition: background .15s, opacity .15s;
}
.btn-primary:hover { background: var(--accent-soft); }
.btn-primary:disabled { background: var(--hairline); color: var(--muted); cursor: not-allowed; }
.btn-ghost {
  font-family: var(--sans); font-size: 12px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; background: none; border: 1px solid var(--accent);
  color: var(--accent); border-radius: 6px; padding: 8px 16px; cursor: pointer;
}
.btn-ghost:hover { background: var(--accent); color: var(--paper); }
.linkbtn { background: none; border: none; color: var(--muted); cursor: pointer;
  font-family: var(--sans); font-size: 12px; letter-spacing: .12em; text-transform: uppercase;
  text-decoration: underline; text-underline-offset: 4px; padding: 0; }

/* ---------- home ---------- */
.home { max-width: 640px; margin: 0 auto; padding: 64px 24px 88px; text-align: center; }
.logo-mark {
  width: 46px; height: 46px; margin: 0 auto 24px; color: var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.logo-mark svg { width: 46px; height: 46px; display: block; }
.home h1 {
  font-family: var(--serif); font-weight: 600; font-size: clamp(54px, 9vw, 92px);
  letter-spacing: .01em; color: var(--accent); line-height: 1.04; margin: 0;
}
.home .tag {
  font-style: italic; font-size: 23px; color: var(--body);
  margin: 24px 0 40px; line-height: 1.4;
}
.home .intro { font-size: 19px; line-height: 1.55; color: var(--body); margin: 0 0 14px; }
.home .date { margin: 30px 0 18px; }
.home-cta { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.streak-line { font-family: var(--sans); font-size: 13px; color: var(--muted); letter-spacing: .04em; }

.home hr { border: none; border-top: .5px solid var(--hairline); margin: 72px auto 48px; width: 120px; }
.section { max-width: 520px; margin: 0 auto; text-align: left; }
.section p { font-size: 17px; line-height: 1.6; color: var(--body); }
.section .eyebrow { color: var(--accent); margin-bottom: 12px; }
.howto-grid { display: grid; gap: 18px; margin: 8px 0 8px; }
.howto-step { display: grid; grid-template-columns: 30px 1fr; gap: 14px; align-items: start; }
.howto-step .n { font-family: var(--serif); font-style: italic; font-size: 26px; color: var(--mark); line-height: 1; }
.howto-step p { margin: 0; font-size: 16.5px; }
.sources { text-align: center; margin-top: 64px; }
.sources p { font-size: 15px; margin: 6px 0; }
.footer-note { font-family: var(--sans); font-size: 13px; color: var(--muted); letter-spacing: .06em;
  text-align: center; margin: 56px 0 0; }
.footer-note a { color: var(--muted); }

/* ---------- game shell ---------- */
.game { min-height: 100vh; display: flex; flex-direction: column; }
.game-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 18px; border-bottom: 1px solid var(--hairline); background: var(--paper);
  position: sticky; top: 0; z-index: 1100;
}
.game-header .home-link { font-family: var(--serif); font-style: italic; font-size: 22px;
  color: var(--accent); background: none; border: none; cursor: pointer; }
.progress-dots { display: flex; gap: 6px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--hairline); }
.dot.done { background: var(--mark); }
.dot.current { background: var(--accent); transform: scale(1.25); }
.score-pill { font-family: var(--sans); font-size: 12px; letter-spacing: .1em;
  color: var(--muted); text-transform: uppercase; white-space: nowrap; }
.score-pill b { color: var(--ink); font-size: 14px; }

/* mobile header: the "Round x/10" text already conveys progress, so drop the
   dots to stop them colliding with the score on narrow screens */
@media (max-width: 560px) {
  .game-header { padding: 10px 14px; }
  .game-header .home-link { font-size: 19px; }
  .progress-dots { display: none; }
  .score-pill { letter-spacing: .06em; }
}

.round { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 0; min-height: 0; }
@media (max-width: 880px) { .round { grid-template-columns: 1fr; } }

/* left: artwork */
.art-pane { background: var(--paper-2); display: flex; flex-direction: column;
  border-right: 1px solid var(--hairline); }
.art-frame { flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 28px; min-height: 280px; cursor: zoom-in; }
.art-frame img { max-width: 100%; max-height: 70vh; box-shadow: var(--shadow);
  background: #fff; }
@media (max-width: 880px) { .art-frame img { max-height: 46vh; } }
.art-caption { padding: 12px 20px 18px; border-top: 1px solid var(--hairline);
  font-family: var(--sans); font-size: 12px; letter-spacing: .04em; color: var(--muted);
  display: flex; justify-content: space-between; }

/* right: controls */
.guess-pane { display: flex; flex-direction: column; min-height: 0; }
.map-wrap { position: relative; flex: 1; min-height: 300px; }
#map { position: absolute; inset: 0; background: #e3e3e0; }
.map-hint { position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  z-index: 500; background: rgba(28,27,23,.82); color: var(--paper); font-family: var(--sans);
  font-size: 12px; letter-spacing: .06em; padding: 6px 14px; border-radius: 20px;
  pointer-events: none; }

.controls { border-top: 1px solid var(--hairline); padding: 16px 20px 18px; background: var(--paper); }
.control-block + .control-block { margin-top: 16px; }
.control-label { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.control-label .eyebrow { color: var(--muted); }
.period-value { font-family: var(--serif); font-size: 22px; color: var(--ink); }
.period-value.unset { color: var(--muted); font-style: italic; font-size: 17px; }

/* timeline slider */
.timeline { position: relative; padding-top: 4px; }
input[type=range].time-range { -webkit-appearance: none; appearance: none; width: 100%;
  height: 4px; border-radius: 3px; background: var(--hairline); outline: none; margin: 10px 0 6px; }
input[type=range].time-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%; background: var(--accent); cursor: pointer;
  border: 3px solid var(--paper); box-shadow: 0 1px 4px rgba(0,0,0,.25); }
input[type=range].time-range::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent); cursor: pointer; border: 3px solid var(--paper); }
.era-axis { display: flex; justify-content: space-between; font-family: var(--sans);
  font-size: 10.5px; letter-spacing: .04em; color: var(--muted); }
.era-bands { display: flex; height: 5px; border-radius: 3px; overflow: hidden; margin-bottom: 2px; }
.era-bands span { display: block; }

.submit-row { margin-top: 18px; }
.submit-row .btn-primary { width: 100%; }

/* ---------- reveal ---------- */
.reveal-pane { display: flex; flex-direction: column; min-height: 0; overflow-y: auto; }
.reveal-scores { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--hairline); }
.rs { padding: 12px 14px; border-left: 1px solid var(--hairline); }
.rs:first-child { border-left: none; }
.rs .eyebrow { color: var(--muted); }
.rs .val { font-family: var(--serif); font-size: 20px; color: var(--ink); margin-top: 3px; }
.rs .pts { font-family: var(--serif); color: var(--mark); }
.rs .pts.miss { color: var(--muted); }
.info { padding: 16px 20px; }
.info h2 { font-family: var(--serif); font-size: 24px; color: var(--ink); margin: 4px 0 2px; line-height: 1.15; }
.info h2 .ital { font-style: italic; font-weight: 400; color: var(--body); }
.info .by { font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--accent); margin: 2px 0 12px; }
.info dl { margin: 0; border-top: 1px solid var(--hairline); }
.info .row { display: grid; grid-template-columns: 96px 1fr; gap: 8px; padding: 8px 0;
  border-bottom: 1px solid var(--hairline); }
.info dt { font-family: var(--sans); font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.info dd { margin: 0; font-size: 16px; color: var(--ink); }
.metlink { display: inline-block; margin-top: 14px; }

/* ---------- results ---------- */
.results { max-width: 640px; margin: 0 auto; padding: 56px 24px 90px; text-align: center; }
.results .eyebrow { color: var(--accent); }
.bigscore { font-family: var(--serif); font-size: clamp(64px, 14vw, 104px); color: var(--accent); line-height: 1; margin: 10px 0 2px; }
.bigscore small { font-size: 28px; color: var(--muted); }
.rank-line { font-size: 20px; font-style: italic; color: var(--body); margin: 6px 0 4px; }
.mean-line { font-family: var(--sans); font-size: 13px; letter-spacing: .02em; margin: 0 0 24px; }
.hist { display: flex; align-items: flex-end; gap: 2px; height: 120px; margin: 24px 0 8px; }
.hist .bar { flex: 1; background: var(--hairline); border-radius: 2px 2px 0 0; min-height: 2px; }
.hist .bar.mean { background: var(--mark); }
.hist .bar.you { background: var(--accent); }
.hist-axis { display: flex; justify-content: space-between; font-family: var(--sans);
  font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.field-label { font-family: var(--sans); font-size: 12px; letter-spacing: .04em; margin-bottom: 22px; }
.breakdown { border-top: 1px solid var(--hairline); margin-top: 18px; }
.brow { display: grid; grid-template-columns: 28px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--hairline); text-align: left; }
.brow .thumb { width: 34px; height: 34px; object-fit: cover; background: var(--paper-2); }
.brow .bt { font-size: 16px; color: var(--ink); line-height: 1.2; }
.brow .bm { font-family: var(--sans); font-size: 11px; color: var(--muted); letter-spacing: .03em; }
.brow .bs { font-family: var(--serif); font-size: 18px; color: var(--mark); }
.share-row { margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 14px; }

/* lightbox */
.lightbox { position: fixed; inset: 0; z-index: 3000; background: rgba(20,18,15,.94);
  display: flex; align-items: center; justify-content: center; padding: 24px; }
.lightbox img { max-width: 96%; max-height: 92%; object-fit: contain; }
.lightbox .close { position: absolute; top: 14px; right: 18px; font-size: 30px; color: var(--paper);
  background: none; border: none; cursor: pointer; line-height: 1; }

.loading { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.loading .eyebrow { color: var(--muted); }
