/* Yearshot — mobile-first, dark-mode aware. Palette/layout rail reused from
   foundry/game (Statlas) and foundry/etymgame (Rootle); accent shifted to a
   sepia/darkroom amber to suit historical photographs. */
:root {
  --bg: #f6f4ef;
  --card: #ffffff;
  --text: #1c1a17;
  --muted: #6d685f;
  --line: #e3dfd6;
  --accent: #8a5a2b;
  --accent-text: #ffffff;
  --hit: #d3efdd;
  --hit-line: #4caf7d;
  --miss: #fbe2e0;
  --miss-line: #d96b62;
  --reveal: #f3e8d8;
  --reveal-line: #8a5a2b;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141311;
    --card: #1e1c19;
    --text: #ece8e1;
    --muted: #9c968a;
    --line: #33302a;
    --accent: #d3a05e;
    --accent-text: #241a0d;
    --hit: #1d3a2b;
    --hit-line: #4caf7d;
    --miss: #3d201e;
    --miss-line: #d96b62;
    --reveal: #33291b;
    --reveal-line: #d3a05e;
  }
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.wrap { max-width: 34rem; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

.top { text-align: center; margin-bottom: 0.9rem; }
h1 { font-size: 1.7rem; letter-spacing: 0.02em; }
.daynum { color: var(--muted); font-weight: 400; font-size: 1.1rem; }
.tagline { color: var(--muted); font-size: 0.9rem; }
.theme-chip {
  display: inline-block; margin-top: 0.4rem; padding: 0.15rem 0.7rem;
  border: 1px solid var(--reveal-line); background: var(--reveal);
  border-radius: 1rem; font-size: 0.8rem; font-weight: 600;
}
.archive-note { color: var(--muted); font-size: 0.8rem; margin-top: 0.3rem; }
.archive-note a { color: var(--accent); }

.photobox {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 0.8rem; padding: 0.5rem; margin-bottom: 1rem;
}
.photobox img {
  display: block; width: 100%; height: auto; max-height: 70vh;
  object-fit: contain; border-radius: 0.4rem; background: #000;
}

.guessrow {
  display: flex; align-items: center; justify-content: center;
  gap: 0.9rem; margin-bottom: 0.4rem;
}
.year-out {
  font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums;
  min-width: 5.2rem; text-align: center;
}
.nudge {
  width: 2.4rem; height: 2.4rem; font-size: 1.3rem; font-weight: 700;
  border: 1px solid var(--line); border-radius: 50%;
  background: var(--card); color: var(--text); cursor: pointer;
}
.nudge:active { transform: translateY(1px); }

input[type="range"] { width: 100%; accent-color: var(--accent); margin: 0.2rem 0 0; }
.scale {
  display: flex; justify-content: space-between; color: var(--muted);
  font-size: 0.75rem; margin-bottom: 0.7rem; font-variant-numeric: tabular-nums;
}

.history { list-style: none; margin-top: 0.8rem; display: grid; gap: 0.35rem; }
.history li {
  display: flex; align-items: center; gap: 0.6rem;
  border: 1px solid var(--line); border-radius: 0.5rem;
  padding: 0.4rem 0.7rem; font-size: 0.95rem; background: var(--card);
}
.history .g-year { font-weight: 700; font-variant-numeric: tabular-nums; }
.history .g-dir { color: var(--muted); font-size: 0.85rem; }

.msg { min-height: 1.4rem; color: var(--muted); font-size: 0.9rem; margin-top: 0.45rem; text-align: center; }

button.primary {
  display: block; width: 100%; font-size: 1rem; padding: 0.65rem 2rem;
  border: none; border-radius: 0.6rem; background: var(--accent);
  color: var(--accent-text); font-weight: 600; cursor: pointer;
}
button.primary:active { transform: translateY(1px); }
button.primary:disabled { opacity: 0.5; cursor: default; }

.endcard {
  text-align: center; background: var(--card); border: 1px solid var(--line);
  border-radius: 0.8rem; padding: 1.25rem 1rem; margin-top: 1rem;
}
.endcard h2 { margin-bottom: 0.3rem; }
.reveal-year { font-size: 2.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.points { font-weight: 700; margin-bottom: 0.7rem; }
.caption { font-size: 0.95rem; margin-bottom: 0.3rem; }
.where { color: var(--muted); font-size: 0.9rem; margin-bottom: 0.5rem; }
.source { font-size: 0.8rem; color: var(--muted); }
.source a { color: var(--accent); }
.rights { font-size: 0.72rem; color: var(--muted); margin-top: 0.2rem; }

.share-grid {
  font-family: ui-monospace, Menlo, monospace; font-size: 1.05rem;
  margin: 0.9rem auto; white-space: pre; line-height: 1.5;
}
.comeback { color: var(--muted); font-size: 0.85rem; margin-top: 0.8rem; }

.archive { margin-top: 1.4rem; }
.archive summary { cursor: pointer; color: var(--muted); font-size: 0.9rem; }
.archive-list {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(5.4rem, 1fr));
  gap: 0.4rem; margin-top: 0.7rem;
}
.archive-list a {
  display: block; text-align: center; padding: 0.4rem 0.2rem;
  border: 1px solid var(--line); border-radius: 0.5rem;
  color: var(--text); text-decoration: none; font-size: 0.85rem;
  background: var(--card);
}
.archive-list a.played { background: var(--hit); border-color: var(--hit-line); }
.archive-list a.current { border-color: var(--accent); font-weight: 700; }

.foot { margin-top: 2rem; color: var(--muted); font-size: 0.72rem; text-align: center; }
.foot a { color: var(--muted); }
