/* Judge a Book by Its Cover — the live stylesheet.
   Minimal homegrown-internet DLE: white background, system sans,
   pastel chip buttons (hierarchy by color, never size), stock HTML
   controls (accent-color slider, default focus rings), classic blue
   links, hairline stat rows, lime for wins and bullseyes, and the
   Penguin-paperback tri-band cover on the homepage.
   Previous designs are archived in archive/ and original-design/. */

:root {
  --ink: #1a1a1a;
  --soft: #666666;
  --ghost: #8a8a8a;
  --hairline: #e6e6e6;
  --green: #86efac;
  --pink: #f9a8d4;
  --blue: #93c5fd;
  --lime: #d9f99d;
  --alert: #ef4444;
  --wrong: #dc2626;
  --linkblue: #2222ee;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  background: #ffffff;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.5rem 1.1rem 2.25rem;
  text-align: center;
}

.hidden { display: none !important; }

a { color: var(--linkblue); }
a:visited { color: #551a8b; }

/* body is a centering flex column, so main must claim full width —
   otherwise it shrink-wraps and every screen gets a different width. */
#app { width: 100%; display: flex; flex-direction: column; align-items: center; }
.panel { width: 100%; max-width: 27rem; }
/* The homepage runs wider so the intro text breathes; the game screens
   stay narrow so the cover and controls hold together. */
#intro.panel { max-width: 34rem; }

/* ---------- masthead (round + final screens; click = back to start) ---------- */

.masthead {
  font-family: var(--sans);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--ink);
  padding: 0.35rem 1rem;
  margin-bottom: 1.1rem;
  cursor: pointer;
}
.masthead:hover { background: var(--green); }
.masthead:active { transform: translateY(1px); }

/* ---------- intro: a Penguin-paperback tri-band, in our pastels ---------- */

.book-cover {
  width: min(55vw, 200px);
  aspect-ratio: 2 / 3;
  margin: 0.5rem auto 1.75rem;
  background: #ffffff;
  border: 1px solid var(--ink);
  display: flex;
  flex-direction: column;
}

.cover-band {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.6rem;
}
.band-top { flex: 1; background: var(--green); }
.band-mid { flex: 1.3; background: #ffffff; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
.band-bottom { flex: 1; background: var(--pink); }

.book-cover h1 {
  font-size: 1.02rem;
  font-weight: 700;
  line-height: 1.45;
  white-space: pre-line; /* honor the line break written in copy.js */
}

.cover-ornament {
  font-size: 1.3rem;
  line-height: 1;
  color: var(--ink);
}

.tagline {
  font-size: 0.62rem;
  line-height: 1.55;
  color: var(--ink);
}

.lede { font-size: 0.9rem; text-align: left; }
.lede .lede-para { display: block; }
.lede .lede-para + .lede-para { margin-top: 0.8em; }

.rules-list {
  list-style: disc;
  text-align: left;
  font-size: 0.85rem;
  color: #444444;
  margin: 1.1rem 0 0;
  padding-left: 1.3rem;
}
.rules-list li { padding: 0.15rem 0; }

.intro-btns {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin-top: 1.5rem;
}
/* Stacked pair: identical size, hierarchy comes from color only. */
.intro-btns .btn {
  width: min(100%, 17rem);
  font-size: 1rem;
  padding: 0.7rem 1.6rem;
}

.daily-status { font-size: 0.78rem; color: var(--soft); margin-top: 0.9rem; min-height: 1.2em; }
.streak-badge {
  display: inline-block;
  background: var(--alert);
  color: #ffffff;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0 0.4rem;
  border-radius: 2px;
  margin-right: 0.35rem;
}

.fineprint, .hint { font-size: 0.72rem; color: var(--ghost); margin-top: 1.1rem; }

/* ---------- Geoguessr pro mode: a small dare, not a headline ----------
   Lives inside .intro-btns so it sits the same 0.6rem below Free play that
   Free play sits below the daily button. The scrawl is a stack of built-in
   handwriting fonts (Mac, iOS, Windows) — nothing gets downloaded. */

.promode {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 0.05rem;
  font-family: "Comic Sans MS", "Chalkboard SE", "Segoe Print", cursive;
  font-size: 0.85rem;
  color: var(--soft);
  cursor: pointer;
}
.promode-row { display: inline-flex; align-items: center; gap: 0.4rem; }
.promode input { accent-color: #ec4899; width: 0.95rem; height: 0.95rem; cursor: pointer; }
.promode-sub { font-size: 0.74rem; color: var(--ghost); }

/* ---------- buttons: the only color on the page ---------- */

.btn {
  font-family: var(--sans);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--ink);
  background: #f2f2f2;
  border: 1px solid var(--ink);
  padding: 0.55rem 1.4rem;
  cursor: pointer;
}
.btn.big { font-size: 1rem; padding: 0.7rem 1.6rem; width: min(100%, 17rem); }
.btn.green { background: var(--green); }
.btn.pink { background: var(--pink); }
.btn.blue { background: var(--blue); }
.btn:hover { filter: brightness(0.95); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; transform: none; cursor: default; }
/* Judge! before the slider has been touched: a colorless chip. It earns its
   green the moment you take a stance. (Declared after the color classes so
   it wins at equal specificity.) */
.btn.unarmed { background: #f2f2f2; color: var(--soft); cursor: not-allowed; }
.btn.unarmed:hover { filter: none; }
.btn.unarmed:active { transform: none; }
.btn, #guess-slider { touch-action: manipulation; }

/* ---------- round ---------- */

.round-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--soft);
  border-bottom: 1px solid var(--hairline);
  padding-bottom: 0.5rem;
  margin-bottom: 1.5rem;
}

.cover-wrap { margin-bottom: 1.4rem; }
.cover-box { position: relative; display: inline-block; line-height: 0; }
#cover {
  width: min(60vw, 230px);
  aspect-ratio: 2 / 3;
  object-fit: cover;
  background: #f2f2f2;
  border: 1px solid var(--ink);
  user-select: none;
  -webkit-user-select: none;
}
/* Pro mode's toys: the cover flips, and after its 0.2s of fame a plain
   white dust jacket (with the ornament) drops over it. */
#cover.flipped { transform: rotate(180deg); }
.cover-shade {
  position: absolute;
  inset: 0;
  background: #ffffff;
  border: 1px solid var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  line-height: 1;
  color: var(--ghost);
}

.pro-timer {
  font-variant-numeric: tabular-nums;
  color: var(--soft);
}
.pro-timer.urgent { color: var(--alert); }

.guess-readout { margin-bottom: 0.3rem; }
.guess-label { font-size: 0.82rem; color: var(--soft); }
#guess-value {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #db2777;
  margin-left: 0.45rem;
}

/* The slider is the stock browser control on purpose — just tinted. */
#guess-slider {
  width: 100%;
  height: 34px;
  accent-color: #ec4899;
  cursor: pointer;
}
.slider-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--ghost);
  font-variant-numeric: tabular-nums;
  margin-bottom: 1.2rem;
}

/* ---------- stat rows (reveal + vs): hairlines, no chrome ---------- */

.stat-table {
  max-width: 18rem;
  margin: 0 auto 1rem;
  text-align: left;
}
.statrow {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.7rem;
  padding: 0.5rem 0.3rem;
}
.statrow + .statrow { border-top: 1px solid var(--hairline); }
.statlabel { font-size: 0.85rem; color: var(--soft); }
.statval { font-size: 1.05rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.statval.actual { color: var(--wrong); }
#points-box.bullseye { background: var(--lime); }

#verdict-line { font-size: 0.95rem; margin-bottom: 1rem; }

.reveal-quotes { margin-bottom: 1rem; }
.review-quote { font-size: 0.8rem; color: var(--soft); margin: 0.25rem 0; }

.book-id { font-size: 0.95rem; }
.book-id #reveal-title { font-weight: 700; }
.book-id #reveal-author::before { content: "— "; }
.book-id #reveal-author { color: var(--soft); }
.book-sub { font-size: 0.78rem; color: var(--soft); margin: 0.2rem 0 0.5rem; }

/* Next sits with the result; the book credit and quotes trail below it. */
#next-btn { margin: 0.2rem 0 1.3rem; }

/* ---------- final ---------- */

.final-kicker { font-size: 0.8rem; font-weight: 600; color: var(--soft); margin-top: 0.4rem; }
.final-score {
  font-size: 3.2rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  margin-bottom: 0.9rem;
}

.stat-table.vs { border-top: 1px solid var(--hairline); border-bottom: 1px solid var(--hairline); padding: 0.15rem 0; }
.statrow.win { background: var(--lime); }
.statrow.win .statlabel { color: var(--ink); font-weight: 700; }
.vs-result {
  font-size: 0.9rem;
  font-weight: 700;
  text-align: center;
  padding: 0.55rem 0.3rem 0.4rem;
  border-top: 1px solid var(--hairline);
  min-height: 1.5em;
}

.daily-note { font-size: 0.85rem; font-weight: 600; margin-bottom: 0.9rem; }
.final-title { font-size: 1.25rem; font-weight: 700; margin-top: 0.6rem; }
.final-blurb { font-size: 0.85rem; color: var(--soft); margin-bottom: 1.25rem; }

.recap {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.55rem;
  max-width: 20rem;
  margin: 0 auto;
}
.recap img {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border: 1px solid #d5d5d5;
}
.recap .recap-item { position: relative; cursor: pointer; }
.recap .recap-pts {
  display: block;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  color: var(--soft);
  margin-top: 0.2rem;
}
.recap .recap-tip {
  position: absolute;
  left: 50%;
  bottom: 1.5rem;
  transform: translateX(-50%);
  background: var(--ink);
  color: #ffffff;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding: 0.2rem 0.45rem;
  border-radius: 2px;
  opacity: 0;
  pointer-events: none;
  z-index: 2;
}
.recap .recap-item:hover .recap-tip,
.recap .recap-item.open .recap-tip { opacity: 1; }

.final-btns {
  display: flex;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-top: 1.4rem;
}
/* Side-by-side pair: equal widths here too. */
.final-btns .btn { flex: 1 1 0; max-width: 12rem; white-space: nowrap; }

.countdown {
  font-size: 0.78rem;
  color: var(--soft);
  font-variant-numeric: tabular-nums;
  margin-top: 0.9rem;
}

/* ---------- footer ---------- */

.colophon {
  font-size: 0.74rem;
  color: var(--ghost);
  margin-top: auto;
  padding-top: 2.5rem;
  text-align: center;
  line-height: 1.8;
}

/* ---------- touch devices ---------- */

@media (pointer: coarse) {
  .hint { display: none; }
}

/* "Move the slider first!" must surface even where the keyboard hint is
   hidden — a tap on the grey Judge! button forces the line visible. */
.hint.force { display: block; color: var(--ink); }

/* Touch sizing keyed on width as well as pointer type — phone browsers
   always get 44px+ targets even when pointer detection is flaky. */
@media (pointer: coarse), (max-width: 600px) {
  #guess-slider { height: 44px; }
  .btn { min-height: 44px; }
  .btn.big { min-height: 48px; }
  .masthead { min-height: 42px; padding: 0.5rem 1.1rem; }
}

@media (max-width: 420px) {
  .final-score { font-size: 2.7rem; }
}
