/* Guess the Year (id: yearly) */

/* Readable text tints of the accent/good colours (the raw colours are too light for small text on white). */
:root { --yr-ink-accent: var(--accent); --yr-ink-good: var(--good); --yr-ink-ok: var(--ok); --yr-ink-bad: var(--bad); }
@media (prefers-color-scheme: light) {
  :root { --yr-ink-accent: #a84f15; --yr-ink-good: #1a7f50; --yr-ink-ok: #8a6700; --yr-ink-bad: #c92a2a; }
}

/* iPhone notch / home-bar safe areas (the page uses viewport-fit=cover). */
.dg-main {
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: calc(40px + env(safe-area-inset-bottom));
}
.dg-header { padding-left: max(12px, env(safe-area-inset-left)); padding-right: max(12px, env(safe-area-inset-right)); padding-top: max(10px, env(safe-area-inset-top)); }
.dg-icon-btn { width: 42px; height: 42px; }
.dg-icon-spacer { width: 42px; }
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
.yr-noscript { max-width: 420px; margin: 40px auto; padding: 0 16px; text-align: center; }
.yr-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.yr-progress { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 4px 0 12px; }
.yr-pips { display: flex; gap: 6px; }
.yr-pip {
  width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--muted); font-size: 13px; font-weight: 700; border: 1px solid var(--border);
}
.yr-pip.done { background: var(--surface); font-size: 16px; }
.yr-pip.now { border-color: var(--accent); color: var(--text); box-shadow: 0 0 0 1px var(--accent); }
.yr-score { font-variant-numeric: tabular-nums; white-space: nowrap; }
.yr-score-n { font-size: 20px; font-weight: 800; }

.yr-event { text-align: center; padding: 16px 16px 18px; }
.yr-emoji { font-size: 48px; line-height: 1.1; }
.yr-chip {
  display: inline-block; margin-top: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700;
  letter-spacing: .6px; text-transform: uppercase;
  background: color-mix(in srgb, var(--accent) 22%, var(--surface-2)); color: var(--text);
}
.yr-prompt { margin: 10px 0 0; font-size: 21px; line-height: 1.25; font-weight: 800; text-wrap: balance; outline: none; }

/* ---------- guess controls ---------- */
.yr-controls { margin-top: 10px; }
.yr-readout-wrap { text-align: center; }
.yr-readout {
  display: inline-block; width: 200px; height: 72px; padding: 0 10px; border-radius: 14px; box-sizing: border-box;
  border: 2px dashed transparent; background: none; color: var(--text); cursor: text;
  font-size: 60px; line-height: 66px; font-weight: 900; font-variant-numeric: tabular-nums; letter-spacing: 1px;
  text-align: center; font-family: inherit; touch-action: manipulation;
}
.yr-readout:hover, .yr-readout:focus-visible { border-color: var(--border); outline: none; }
.yr-readout-input { border: 2px solid var(--accent); border-style: solid; background: var(--surface); outline: none; }
.yr-hint { font-size: 12px; color: var(--muted); height: 16px; line-height: 16px; transition: color .15s; }
.yr-hint.on { color: var(--yr-ink-accent); font-weight: 700; }

.yr-slider-wrap { margin: 8px 0 0; }
/* The whole 56px-tall row is the touch target; the rail is drawn inside it. */
.yr-slider {
  position: relative; height: 56px; touch-action: none; cursor: pointer; outline: none;
  display: flex; align-items: center; padding: 0 18px; -webkit-user-select: none; user-select: none;
}
.yr-rail { position: relative; flex: 1; height: 14px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); }
.yr-band { position: absolute; top: 0; bottom: 0; }
.yr-band.b0 { background: color-mix(in srgb, var(--accent) 14%, var(--surface-2)); border-radius: 999px 0 0 999px; }
.yr-band.b1 { background: color-mix(in srgb, var(--accent) 28%, var(--surface-2)); border-left: 2px solid var(--surface); }
.yr-band.b2 { background: color-mix(in srgb, var(--accent) 44%, var(--surface-2)); border-left: 2px solid var(--surface); border-radius: 0 999px 999px 0; }
.yr-thumb {
  position: absolute; top: 50%; width: 36px; height: 36px; margin: -18px 0 0 -18px; border-radius: 50%;
  background: var(--accent); border: 4px solid var(--surface); box-shadow: 0 2px 10px rgba(0, 0, 0, .35);
  transition: transform .1s ease; z-index: 1;
}
.yr-thumb::after { /* grip line so it reads as draggable */
  content: ''; position: absolute; left: 50%; top: 50%; width: 3px; height: 12px; margin: -6px 0 0 -1.5px;
  border-radius: 2px; background: var(--accent-ink); opacity: .55;
}
.yr-slider.drag .yr-thumb, .yr-slider:focus-visible .yr-thumb { transform: scale(1.12); }
.yr-slider.fine .yr-thumb { box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 35%, transparent), 0 2px 10px rgba(0, 0, 0, .35); }
.yr-slider:focus-visible .yr-rail { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 50%, transparent); }

.yr-ticks { position: relative; height: 18px; margin: -6px 18px 0; }
.yr-tick {
  position: absolute; top: 4px; transform: translateX(-50%); font-size: 11px; line-height: 14px; color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.yr-tick::before { content: ''; position: absolute; left: 50%; top: -6px; width: 1px; height: 5px; background: var(--muted); opacity: .6; }
.yr-tick.major { color: var(--text); font-weight: 700; }
.yr-eras { position: relative; height: 22px; margin: 4px 18px 0; }
.yr-era {
  position: absolute; top: 0; box-sizing: border-box; padding: 3px 4px 0; text-align: center; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; font-size: 10.5px; letter-spacing: .2px; color: var(--muted);
  border-top: 2px solid color-mix(in srgb, var(--accent) 40%, var(--border));
}
.yr-era.b0, .yr-era.b1 { border-right: 1px solid var(--surface-2); }
.yr-era.b2 { color: var(--yr-ink-accent); font-weight: 700; }

.yr-nudges { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 10px; }
.yr-nudge {
  padding: 0; height: 50px; font-size: 18px; font-variant-numeric: tabular-nums; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.yr-lock { font-size: 18px; padding: 15px; margin-top: 10px; touch-action: manipulation; }

/* ---------- reveal ---------- */
.yr-reveal { margin-top: 12px; }
.yr-answer { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.yr-answer-year { font-size: 46px; font-weight: 900; line-height: 1; font-variant-numeric: tabular-nums; color: var(--yr-ink-good); }
.yr-verdict { display: flex; flex-direction: column; align-items: flex-end; font-weight: 700; text-align: right; }
.yr-points { font-size: 26px; font-weight: 900; font-variant-numeric: tabular-nums; }
.yr-verdict.good .yr-points { color: var(--yr-ink-good); }
.yr-verdict.ok .yr-points { color: var(--yr-ink-ok); }
.yr-verdict.meh .yr-points { color: var(--yr-ink-accent); }
.yr-verdict.bad .yr-points { color: var(--yr-ink-bad); }

.yr-mini { display: flex; align-items: center; gap: 10px; margin: 34px 0 30px; }
.yr-mini-end { flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.yr-line { position: relative; flex: 1; height: 6px; border-radius: 999px; background: var(--surface-2); }
.yr-gap {
  position: absolute; top: 0; bottom: 0; border-radius: 999px;
  background: repeating-linear-gradient(90deg, var(--accent) 0 6px, color-mix(in srgb, var(--accent) 40%, transparent) 6px 10px);
  transition: transform .4s cubic-bezier(.2, .8, .2, 1);
}
.yr-gap.grow { transform: scaleX(0); }
.yr-mark { position: absolute; top: 50%; width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%; border: 3px solid var(--surface); }
.yr-mark.guess { background: var(--accent); z-index: 1; }
.yr-mark.actual { background: var(--good); z-index: 2; transition: transform .25s cubic-bezier(.3, 1.6, .5, 1), opacity .2s; }
.yr-mark.actual.hidden { transform: scale(0); opacity: 0; }
.yr-mark-label {
  position: absolute; left: 50%; transform: translateX(-50%); white-space: nowrap; font-size: 13px; font-weight: 800;
  font-variant-numeric: tabular-nums; padding: 1px 6px; border-radius: 6px; line-height: 16px;
}
.yr-mark.guess .yr-mark-label { top: 18px; color: var(--yr-ink-accent); }
.yr-mark.actual .yr-mark-label { bottom: 18px; color: var(--yr-ink-good); background: color-mix(in srgb, var(--good) 14%, var(--surface)); }
.yr-fact { margin: 0; line-height: 1.5; }
.yr-next { margin-top: 12px; }

/* ---------- finished ---------- */
.yr-final { text-align: center; padding: 18px 16px; }
.yr-final-label { font-size: 13px; font-weight: 700; letter-spacing: .8px; text-transform: uppercase; color: var(--muted); }
.yr-final-score { font-size: 56px; font-weight: 900; line-height: 1.05; font-variant-numeric: tabular-nums; margin-top: 2px; }
.yr-final-of { font-size: 20px; font-weight: 700; color: var(--muted); }
.yr-final-emoji { font-size: 28px; letter-spacing: 4px; margin: 6px 0 2px; }
.yr-final-btns { display: grid; grid-template-columns: 2fr 1fr; gap: 8px; margin-top: 14px; }
.yr-final-btns .dg-btn { min-height: 50px; }
.yr-final .dg-next { margin-top: 12px; font-size: 14px; }

.yr-tl-head { margin: 22px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); }
.yr-timeline { list-style: none; margin: 0; padding: 0; }
.yr-tl-item { position: relative; display: flex; gap: 10px; align-items: flex-start; }
/* Connector through the emoji dots: year column 48px + 10px gap + half the 40px dot. */
.yr-tl-item::before, .yr-tl-gap::before {
  content: ''; position: absolute; left: 77px; width: 2px; margin-left: -1px; background: var(--border); top: 0; bottom: 0;
}
.yr-tl-item:first-child::before { top: 20px; }
.yr-tl-item:last-child::before { bottom: auto; height: 20px; }
.yr-tl-gap { position: relative; padding: 4px 0 4px 92px; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.yr-tl-year { flex: none; width: 48px; padding-top: 9px; text-align: right; font-weight: 900; font-variant-numeric: tabular-nums; }
.yr-tl-dot {
  flex: none; width: 40px; height: 40px; border-radius: 50%; background: var(--surface); border: 2px solid var(--border);
  display: flex; align-items: center; justify-content: center; font-size: 20px; position: relative; z-index: 1;
}
.yr-tl-body { flex: 1; min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; }
.yr-tl-text { font-weight: 700; line-height: 1.3; }
.yr-tl-meta { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; margin-top: 4px; font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.yr-tl-meta strong { color: var(--text); }
.yr-tl-fact { margin-top: 4px; font-size: 14px; }
.yr-tl-fact summary { cursor: pointer; color: var(--yr-ink-accent); font-weight: 700; padding: 6px 0; min-height: 24px; }
.yr-tl-fact p { margin: 2px 0 2px; color: var(--text); line-height: 1.45; }

.yr-more { margin-top: 8px; }
.yr-more-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.yr-more-game {
  display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 6px; border-radius: 12px; text-align: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; min-width: 0;
}
.yr-more-game:hover { background: var(--surface-2); }
.yr-more-icon { font-size: 24px; line-height: 1.2; }
.yr-more-tag { font-size: 12px; line-height: 1.3; color: var(--muted); }

/* ---------- how-to example ---------- */
.yr-howto-ex { margin: 10px 0; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); text-align: center; }
.yr-howto-q { font-weight: 800; }
.yr-howto-a { display: flex; justify-content: center; gap: 18px; margin-top: 4px; font-variant-numeric: tabular-nums; }
.yr-howto-a span:last-child b { color: var(--yr-ink-good); }
.yr-howto-r { margin-top: 2px; font-weight: 700; }

@media (max-width: 370px) {
  .yr-readout { font-size: 52px; }
  .yr-prompt { font-size: 19px; }
  .yr-pip { width: 26px; height: 26px; }
  .yr-era { font-size: 9.5px; }
  .yr-more-tag { display: none; }
}
@media (min-width: 700px) {
  .yr-emoji { font-size: 64px; }
  .yr-prompt { font-size: 25px; }
}
