/* The landing page (public/index.html). Builds on the tokens in base.css. The one bold element is the
   hero ladder; everything else stays quiet. Phone first; two columns from 900px. */

body.landing { font-size: 18px; }
.landing main, .landing .top, .landing .bottom { max-width: 1120px; margin: 0 auto; padding-left: 20px; padding-right: 20px; }
.landing main { display: flex; flex-direction: column; gap: 64px; padding-bottom: 48px; }

.top { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding-top: 18px; padding-bottom: 8px; }
.top .logo { font-size: 21px; }
.top-nav { display: flex; align-items: center; gap: 4px; }
.top-link { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); font-weight: 700; text-decoration: none; padding: 10px 14px; border-radius: 999px; }
.top-link:hover { background: var(--panel); }
.top-link .icon { color: var(--accent-ink); }
@media (max-width: 420px) { .top-link { white-space: nowrap; padding: 10px 6px; font-size: 16px; } }

/* ---------- Hero: the ladder plays itself ---------- */
/* minmax(0, 1fr): the column never grows past the screen, whatever its contents ask for. */
.hero { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; padding-top: 20px; }
.ladder { display: flex; flex-direction: column; gap: 14px; }
/* The tiles and the mascot share one size (em), so he always fits on top of them on every screen. */
.ladder-stage { font-size: clamp(44px, min(17vw, 17vh), 132px); align-self: flex-start; }
.ladder-tiles { display: flex; gap: 0.16em; font-size: inherit; }

/* The mascot walks along the tops of the tiles, hops onto the one that changes and cheers. */
.mascot-track { position: relative; height: 1.3em; }
.mascot { position: absolute; left: 0; bottom: -0.02em; width: calc(1.3em * 100 / 140); height: 1.3em; color: var(--ink);
  transition: transform 0.7s ease-in-out; }
.mascot svg { display: block; width: 100%; height: 100%; overflow: visible; transition: transform 0.2s; }
.mascot.face-left svg { transform: scaleX(-1); }
.mascot :is(.m-arm-l, .m-arm-r, .m-leg-l, .m-leg-r, .m-body) { transform-box: view-box; transition: transform 0.25s ease-out; }
.mascot :is(.m-arm-l, .m-arm-r) { transform-origin: 50px 70px; }
.mascot :is(.m-leg-l, .m-leg-r) { transform-origin: 50px 98px; }
.mascot.walking .m-leg-l { animation: swing 0.35s ease-in-out infinite alternate; }
.mascot.walking .m-leg-r { animation: swing 0.35s ease-in-out infinite alternate-reverse; }
.mascot.walking .m-arm-l { animation: swing 0.35s ease-in-out infinite alternate-reverse; }
.mascot.walking .m-arm-r { animation: swing 0.35s ease-in-out infinite alternate; }
.mascot.walking .m-body { animation: bob 0.175s ease-in-out infinite alternate; }
.mascot.hop .m-body { animation: hop 0.36s ease-out; }
.mascot.cheer .m-arm-l { transform: rotate(95deg); }
.mascot.cheer .m-arm-r { transform: rotate(-95deg); }
@keyframes swing { from { transform: rotate(-18deg); } to { transform: rotate(18deg); } }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-3px); } }
@keyframes hop { 0% { transform: translateY(0); } 45% { transform: translateY(-22px); } 100% { transform: translateY(0); } }
.ladder-tiles .tile { width: 1.08em; height: 1.24em; font-size: inherit; border-radius: 0.16em; box-shadow: 0 0.08em 0 var(--tile-edge); }
.ladder-tiles .tile.changed { box-shadow: 0 0.08em 0 var(--gold-edge); text-decoration-thickness: 0.06em; text-underline-offset: 0.1em; }
.ladder-tiles .tile.flip { animation: flip 0.42s ease-out; }
@keyframes flip { 0% { transform: rotateX(0); } 45% { transform: rotateX(90deg); } 100% { transform: rotateX(0); } }
.ladder-trail { margin: 0; min-height: 1.5em; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 700; font-size: 0.85em; }
.ladder-trail b { color: var(--accent-ink); }

.hero h1 { font-size: clamp(34px, min(10vw, 9vh), 68px); margin: 0; letter-spacing: -0.02em; }
.hero h1 span { white-space: nowrap; }
@media (max-width: 359px) { .hero h1 span { white-space: normal; } }
.lede { margin: 14px 0 28px; max-width: 30em; color: var(--chain); font-size: 1.05em; }
.cta { display: flex; flex-direction: column; gap: 12px; }
.cta .btn { width: 100%; white-space: nowrap; }
.play-now { min-height: 64px; font-size: 22px; }

/* ---------- The hub: ways to play, and today's word ---------- */
.hub { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; scroll-margin-top: 16px; }
.hub h2 { font-size: 1.35em; margin: 0 0 6px; }
.ways { display: flex; flex-direction: column; gap: 8px; }
.way { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: var(--radius); background: var(--panel);
  color: var(--ink); text-decoration: none; transition: background 0.15s; }
a.way:hover { background: var(--panel-hi); }
.way > .icon:first-child { width: 44px; height: 44px; padding: 10px; border-radius: 12px; background: var(--panel-hi); color: var(--accent-ink); }
.way span { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; }
.way small { color: var(--muted); font-size: 0.85em; }
.way .go { color: var(--muted); }
.join { flex-direction: column; align-items: stretch; gap: 10px; background: none; padding: 14px 0 0; }
.join label { font-weight: 700; }
.join-row { display: flex; gap: 10px; }
.join input { flex: 1; width: 0; min-width: 0; min-height: 56px; border-radius: var(--radius); border: 2px solid var(--line); background: var(--screen); color: var(--ink);
  font: 800 1.5em var(--display); letter-spacing: 0.3em; text-transform: uppercase; text-align: center; }
.join input::placeholder { color: var(--line); }
.join input:focus { border-color: var(--ring); outline: none; }
.join .message { min-height: 0; margin: 0; font-size: 0.9em; }

/* Today's word: the whole card is the link. Shows today's number, how many have played and how they
   did (a small chart), and this device's streak. */
.today { display: flex; flex-direction: column; gap: 14px; padding: 22px 20px; border-radius: 20px; background: var(--panel);
  color: var(--ink); text-decoration: none; align-self: start; box-shadow: inset 0 3px 0 var(--gold); }
.today-head { display: flex; align-items: center; gap: 10px; font-size: 1.2em; }
.today-head b { font-family: var(--display); font-weight: 800; flex-grow: 1; }
.today-head .icon { color: var(--accent-ink); }
.today-no { font: 800 0.8em var(--display); color: var(--on-accent); background: var(--gold); border-radius: 8px; padding: 2px 9px; box-shadow: 0 3px 0 var(--gold-edge); }
.today-line { color: var(--chain); }
.today-board { display: flex; flex-direction: column; gap: 10px; }
.streak { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; }
.streak .icon { color: var(--gold); }
.today-group { display: flex; flex-direction: column; gap: 4px; color: var(--chain); }
.today-group span { display: inline-flex; align-items: center; gap: 8px; }
.today-group .icon { color: var(--accent-ink); }
.today .btn { pointer-events: none; }
.today:hover .btn { background: var(--line); }

/* ---------- How it works: the rules as a small ladder ---------- */
.rules h2 { font-size: 1.35em; margin: 0 0 18px; }
.rule-ladder { list-style: none; margin: 0; padding: 0; display: grid; gap: 18px; }
.rule-ladder li { display: grid; grid-template-columns: auto 1fr; gap: 18px; align-items: center; }
.rule-ladder p { margin: 0; max-width: 30em; color: var(--chain); }
.mini { display: inline-flex; gap: 4px; }
.mini i { font: normal 800 18px var(--display); text-transform: uppercase; width: 28px; height: 32px; border-radius: 6px; display: grid; place-items: center;
  background: var(--tile); color: var(--on-accent); box-shadow: 0 3px 0 var(--tile-edge); }
.mini i.hit { background: var(--gold); box-shadow: 0 3px 0 var(--gold-edge); text-decoration: underline 2px; text-underline-offset: 3px; }
.more { margin-top: 24px; }
.more summary { cursor: pointer; font-weight: 700; padding: 8px 0; color: var(--muted); }
.more summary:hover { color: var(--ink); }
.more dl { margin: 8px 0 0; display: grid; gap: 4px; max-width: 40em; }
.more dt { font-weight: 700; margin-top: 10px; }
.more dd { margin: 0; color: var(--chain); }

.footer-check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; color: var(--ink); }
.footer-check input { width: 20px; height: 20px; accent-color: var(--gold); }
.bottom { display: flex; gap: 8px 22px; flex-wrap: wrap; align-items: center; padding-top: 24px; padding-bottom: 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--panel-hi); }
.bottom a { color: var(--muted); }

/* Side by side on wide screens, and on phones held sideways (short screens need the room). */
@media (min-width: 900px), (orientation: landscape) and (min-width: 640px) {
  .hero { grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); align-items: center; gap: 56px; padding-top: 48px; min-height: 62vh; }
  .ladder { order: 2; align-items: center; }
  .ladder-stage { font-size: clamp(44px, min(6.2vw, 13vh), 96px); align-self: center; } /* four tiles fit their column at any width */
  .hero h1 span { display: block; }
  .cta { flex-direction: row; }
  .cta .btn { width: auto; }
  .play-now { min-width: 260px; }
}
@media (min-width: 900px) {
  .hub { grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 40px; }
  .today { margin-top: 44px; }
  .rule-ladder { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; }
  .rule-ladder li { grid-template-columns: 1fr; gap: 14px; align-items: start; }
}

/* Short screens (phones held sideways): less space above the hero, so the buttons are in view. */
@media (max-height: 500px) and (orientation: landscape) {
  .hero { padding-top: 4px; min-height: 0; gap: 32px; }
  .hero h1 { font-size: clamp(24px, 8vh, 40px); }
  .lede { margin: 8px 0 14px; font-size: 16px; line-height: 1.4; }
  .play-now { min-height: 56px; }
}

@media (prefers-reduced-motion: reduce) {
  .ladder-tiles .tile.flip, .mascot * { animation: none !important; }
  .mascot, .mascot svg { transition: none; }
}
