/* Daily WordJump shares Daily Ballpark's house style: Libre Franklin and IBM Plex Mono,
   white cards on a tinted ground, black buttons, the same flag red and "you"
   orange. Daily WordJump's own colours are snow blue and piste blue. */
:root {
  --bg: #edf5fb;
  --card: #ffffff;
  --panel: #f2f5f8;
  --ink: #121212;
  --muted: #6b6b6b;
  --line: #e2e2e2;
  --accent: #121212;
  --accent-ink: #ffffff;
  --flag: #e5483b;
  --piste: #1f5fa8;
  --you: #ff8a3d;
  --danger: #b3261e;
  --rare: #6a3ab0;
  --rare-bg: #efe6fa;
  --ok: #1c7a3a;
  --clever: #c0352b;
  --clever-bg: #fbe5e3;
  --good: #1f5fa8;
  --good-bg: #e2edf8;
  --common: #1c7a3a;
  --common-bg: #e3f5e8;
  --obvious: #5a5f66;
  --obvious-bg: #eef0f2;
  --radius: 14px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Libre Franklin", system-ui, sans-serif;
  line-height: 1.5;
}

.site-header { border-bottom: 2px solid var(--piste); margin-bottom: 8px; }
.site-header-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 800;
  font-size: 24px;
  letter-spacing: -.03em;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
/* The mark: off the ramp, along a dashed flight path, landing as the day's letter tile. */
.brand-mark {
  flex: none;
  width: 32px;
  height: 32px;
  fill: none;
  stroke-linejoin: round;
  stroke-linecap: round;
}
.brand-mark .ramp { stroke: var(--ink); stroke-width: 2.2; }
.brand-mark .flight { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 2.2 2.6; }
.brand-mark .tile { fill: var(--flag); }
.brand-mark .letter { stroke: #ffffff; stroke-width: 1.9; }

.header-date { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; color: var(--ink); white-space: nowrap; }
.header-right { display: flex; align-items: center; gap: 12px; }
.help-btn {
  width: 34px; height: 34px; padding: 0; border-radius: 50%;
  background: transparent; color: var(--ink); border: 1.5px solid var(--ink);
  font-size: 17px; font-weight: 600; line-height: 1;
}
.help-btn:hover { background: rgba(0, 0, 0, .06); }

main {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 16px 24px;
  display: grid;
  gap: 16px;
}

.question-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 22px;
}

.hole-label {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--piste);
}

h1 {
  margin: 0 0 14px;
  font-weight: 700;
  letter-spacing: -.015em;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 1.15;
  text-wrap: balance;
}

.lede { margin: -4px 0 18px; color: var(--muted); font-size: 17px; max-width: 60ch; }
#startBtn { padding: 13px 34px; font-size: 17px; }

input[type="text"] {
  width: 100%;
  min-width: 0;
  font: inherit;
  font-size: 17px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--ink);
}

input[type="text"]:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0, 0, 0, .1); }
input[type="text"][aria-invalid="true"] { border-color: var(--danger); }

button {
  font: inherit;
  font-weight: 600;
  font-size: 16px;
  padding: 12px 22px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  transition: transform .08s ease, background .15s ease;
}

button:hover { background: #333333; }
button:active { transform: scale(.97); }
button:disabled { opacity: .55; cursor: default; }
button:focus-visible, .link-btn:focus-visible { outline: 3px solid var(--you); outline-offset: 2px; }

button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1.5px solid var(--accent);
}

button.secondary:hover { background: #f2f2f2; }

.hole-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.hole-meta .hole-label { margin-bottom: 4px; }

/* ---- The answer sheet ---- */
.timer { margin: 0 0 4px; text-align: right; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums; }
.timer.low { color: var(--danger); }
.time-bar { height: 6px; border-radius: 3px; background: var(--panel); overflow: hidden; margin: 2px 0 14px; }
.time-bar i { display: block; height: 100%; width: 100%; background: var(--piste); transition: width .25s linear; }
.time-bar.low i { background: var(--flag); }

.letter-line { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.bib {
  display: inline-grid; place-items: center;
  width: 1.6em; height: 1.6em; border-radius: 10px;
  background: var(--flag); color: #fff; font-weight: 800;
}

.sheet-grid {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px;
}
.sheet-grid li { display: grid; gap: 4px; min-width: 0; }
.sheet-grid label { font-size: 14px; font-weight: 600; color: var(--muted); display: flex; gap: 8px; }
.sheet-grid label .num { color: var(--piste); font-family: "IBM Plex Mono", ui-monospace, monospace; font-weight: 500; }
.sheet-grid .check { min-height: 18px; font-size: 13px; font-weight: 600; line-height: 18px; }
.sheet-grid .check.ok { color: var(--ok); }
.sheet-grid .check.no { color: var(--danger); }

.sheet-foot { margin-top: 18px; display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
#jumpBtn { padding: 13px 34px; font-size: 17px; }

.hint { margin: 0; font-size: 14px; color: var(--muted); min-height: 1.5em; }
.hint.error { color: var(--danger); }

/* ---- The hill ---- */
.hill-wrap { margin: 0; }
.hill-caption { margin: 2px 4px 10px; }
#captionBeat { font-size: 18px; font-weight: 700; }

.hill {
  position: relative;
  aspect-ratio: 1000 / 520;
  max-width: 100%;
  border-radius: var(--radius);
  box-shadow: 0 1px 0 var(--line), 0 10px 30px rgba(0, 0, 0, .12);
  overflow: hidden;
  background: #9cc6ea;
}
#hillCanvas {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
.scoreboard {
  position: absolute; left: 14px; top: 12px;
  display: grid; gap: 0;
  padding: 8px 14px 9px;
  background: rgba(255, 255, 255, .92);
  border-radius: 12px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .12);
}
.scoreboard strong { font-size: clamp(22px, 4vw, 34px); font-weight: 800; letter-spacing: -.02em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.scoreboard strong.landed { color: var(--flag); }
.scoreboard span { font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 12px; color: var(--muted); }

.countdown { margin: 0; color: var(--muted); font-size: 15px; }
.countdown strong { color: var(--ink); font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .sheet-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .modal[open], .results-card, .answer-list li { animation: none; }
  .confetti { display: none; }
}

/* ---- Modal (how to play) ---- */
.modal {
  width: min(460px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  padding: 28px 24px 22px;
  border: none;
  border-radius: 18px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
  overflow-x: hidden;
  text-align: center;
}
.modal[open] { animation: popIn .35s cubic-bezier(.2, .9, .3, 1.2); }
.modal::backdrop { background: rgba(0, 0, 0, .5); }
@keyframes popIn { from { opacity: 0; transform: translateY(16px) scale(.97); } }

.close-btn {
  position: absolute; top: 12px; right: 12px;
  width: 36px; height: 36px; padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--panel); color: var(--ink);
}
.close-btn:hover { background: var(--line); }
.close-btn svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; fill: none; }

.end-actions { margin-top: 22px; display: grid; gap: 10px; justify-items: center; }

@media (max-width: 560px) {
  .modal { width: 100vw; max-width: 100vw; max-height: 92dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; padding: 26px 16px 20px; }
}

/* ---- Results card (replaces the question card when the jump is done) ---- */
.results-card { animation: cardIn .45s ease-out; }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } }

.res-question { margin: 2px 0 0; font-size: 15px; color: var(--muted); }
.res-main { margin-top: 10px; }
#resTitle { margin: 0; font-weight: 800; font-size: 44px; line-height: 1.05; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.res-sub { margin: 6px 0 0; font-size: 16px; color: var(--muted); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.res-marks { font-size: 18px; letter-spacing: 2px; }


.answers { margin-top: 16px; border-top: 1px solid var(--line); }
.answers summary {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 2px 0;
  font-weight: 600; font-size: 15px;
  cursor: pointer; list-style: none;
}
.answers summary::-webkit-details-marker { display: none; }
.answers summary::after {
  content: ""; width: 8px; height: 8px; margin-left: auto;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg); transition: transform .2s ease;
}
.answers[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.answers summary:hover .answers-hint { color: var(--ink); }
.answers summary:focus-visible { outline: 3px solid var(--you); outline-offset: 2px; border-radius: 6px; }
.answers-hint { font-weight: 400; font-size: 14px; color: var(--muted); }

/* Phones: keep the name, date and help button on one line. */
@media (max-width: 420px) {
  .brand { font-size: 20px; }
  .brand-mark { width: 28px; height: 28px; }
  .header-right { gap: 8px; }
  .answers-hint { display: none; }
}
.answer-list { list-style: none; margin: 12px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.answer-list li {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; align-items: center;
  padding: 10px 12px; background: var(--panel); border-radius: 10px;
  animation: clueIn .3s ease-out backwards;
}
.answer-list .cat { grid-column: 1 / -1; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.answer-list .ans { font-size: 16px; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.answer-list .ans.blank { color: var(--muted); font-weight: 400; }
.answer-list .tag { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; white-space: nowrap; background: #e6e6e6; color: var(--muted); }
.answer-list .tag.rare { background: var(--rare-bg); color: var(--rare); }
.answer-list .tag.clever { background: var(--clever-bg); color: var(--clever); }
.answer-list .tag.good { background: var(--good-bg); color: var(--good); }
.answer-list .tag.common { background: var(--common-bg); color: var(--common); }
.answer-list .tag.obvious { background: var(--obvious-bg); color: var(--obvious); }
@keyframes clueIn { from { opacity: 0; transform: translateY(-4px); } }

.res-actions { margin-top: 16px; display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; }
#shareBtn { padding: 13px 28px; font-size: 17px; }

/* ---- Stats card ---- */
.stats-card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 22px 22px; }
.stats-card h3 { margin: 0 0 12px; font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
#distributionWrap h3 { margin-top: 22px; }

.end-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; text-align: center; }
.end-stats div { display: grid; gap: 2px; }
.end-stats strong { font-size: 26px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.end-stats span { font-size: 12px; color: var(--muted); line-height: 1.25; }

.distribution { list-style: none; margin: 0; padding: 0; display: grid; gap: 5px; max-width: 520px; }
.distribution li { display: grid; grid-template-columns: 130px 1fr; align-items: center; gap: 8px; font-size: 13px; }
.distribution .bar {
  min-width: 26px; width: 0; padding: 3px 8px; border-radius: 5px;
  background: #dcdcdc; color: var(--ink); font-weight: 600; text-align: right;
  font-variant-numeric: tabular-nums; transition: width .6s ease;
}
.distribution li.today .bar { background: var(--you); color: #fff; }

/* ---- Confetti ---- */
.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.confetti i {
  position: absolute; top: -12px; width: 8px; height: 12px; border-radius: 2px;
  animation: fall var(--dur) ease-in var(--delay) forwards;
}
@keyframes fall { to { transform: translate(var(--drift), 105vh) rotate(var(--spin)); opacity: 0; } }

@media (max-width: 560px) {
  #resTitle { font-size: 40px; }
  .answer-list { grid-template-columns: 1fr; }
  .res-actions { flex-direction: column; align-items: stretch; text-align: center; gap: 10px; }
  .end-stats strong { font-size: 19px; }
  .stats-card { padding: 16px; }
  .scoreboard { left: 8px; top: 8px; padding: 5px 10px 6px; }
}

/* ---- How to play ---- */
#howToTitle { margin: 4px 0 0; font-weight: 800; font-size: 30px; line-height: 1.1; letter-spacing: -.02em; }
.howto-intro { margin: 8px 0 0; color: var(--muted); }
.howto-diagram { display: block; width: 100%; height: auto; margin: 16px 0 4px; }
.howto-diagram text { font: 600 11px "Libre Franklin", sans-serif; fill: var(--muted); }
.howto-diagram text.k { fill: var(--flag); font-weight: 800; }
.howto-steps { list-style: none; margin: 12px auto 0; padding: 0; display: grid; gap: 10px; text-align: left; width: fit-content; }
.howto-steps li { display: flex; gap: 12px; align-items: flex-start; font-size: 16px; line-height: 26px; } /* 26px matches the number circles, so each one sits level with its first line */
.howto-steps .step {
  flex: none; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent); color: #fff; font-size: 13px; font-weight: 600;
}
#startPlayingBtn { width: 100%; padding: 14px; font-size: 17px; }

@media (max-width: 560px) {
  #howToTitle { font-size: 28px; }
}

/* ---- Footer ---- */
.site-footer {
  max-width: 1040px; margin: 32px auto 0; padding: 20px 16px 32px;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px 32px; flex-wrap: wrap;
  font-size: 13px; color: var(--muted);
}
.footer-about { margin: 0; max-width: 560px; line-height: 1.5; }
.footer-about strong { color: var(--ink); font-weight: 600; }
.footer-meta { margin: 0; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.link-btn {
  padding: 0; border: none; background: none; color: var(--accent);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 2px;
}
.link-btn:hover { background: none; color: var(--flag); }
.link-btn:active { transform: none; }
.noscript { padding: 16px; background: #fdecea; border-radius: 10px; }

/* ---- 404 ------------------------------------------------------------------- */
.not-found { text-align: center; padding: 32px 22px 36px; }
.lost-ski { display: block; width: 220px; height: auto; margin: 0 auto 12px; border-radius: 10px; }
.not-found .hole-label { margin: 0 0 4px; font-family: "IBM Plex Mono", ui-monospace, monospace; font-size: 13px; color: var(--muted); }
.not-found h1 { margin-bottom: 8px; }
.not-found-text { margin: 0 auto 22px; max-width: 420px; color: var(--muted); }
.button-link {
  display: inline-block; padding: 12px 22px; border-radius: 10px;
  background: var(--accent); color: var(--accent-ink); font-weight: 600; text-decoration: none;
}
.button-link:hover { background: #333333; }
