/* =====================================================================
   Hopdle — the daily Wikipedia hopping puzzle
   Palette: leaf & pond greens, warm cream, sunny yellow. Every text colour passes
   WCAG AA contrast (4.5:1) on the background it sits on, in light and dark mode.
   ===================================================================== */
:root {
  --bg: #FBF5E6;            /* cream */
  --panel: #FFFCF3;         /* card cream */
  --ink: #1E3A2A;           /* deep green-black text */
  --dim: #566A5C;           /* secondary text */
  --line: #E7DEC6;          /* soft cream borders */
  --lily: #27704A;          /* main green: buttons, links */
  --lily-soft: #E8F3DF;
  --on-lily: #FFFFFF;       /* text on green buttons */
  --leaf: #58B263;          /* lily pads, decorative */
  --water: #24675F;         /* pond teal for text (misses) */
  --water-soft: #DDEFEA;
  --warm: #E9B10C;          /* sunny yellow for borders/fills */
  --warm-ink: #7A5600;      /* yellow-family text */
  --warm-soft: #FFF1C2;
  --pond-1: #D3EEE8;        /* pond water */
  --pond-2: #A9D9CE;
  --pond-glint: rgba(255, 255, 255, .55);
  --trail: #FFFCF3;
  --shadow: 0 2px 0 rgba(30, 58, 42, .07), 0 8px 24px rgba(30, 58, 42, .07);
  --radius: 18px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10241A;
    --panel: #173322;
    --ink: #F7F0DC;
    --dim: #B7C5AF;
    --line: #2D4B37;
    --lily: #72CF88;
    --lily-soft: #1F4A30;
    --on-lily: #0E2016;     /* white on this bright green would be unreadable */
    --leaf: #4FA35A;
    --water: #8FD3C6;
    --water-soft: #1B3B34;
    --warm: #F5CF4A;
    --warm-ink: #F8D978;
    --warm-soft: #3B3413;
    --pond-1: #174239;
    --pond-2: #0F2F2A;
    --pond-glint: rgba(255, 255, 255, .08);
    --trail: #F7F0DC;
    --shadow: 0 2px 0 rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
/* Backup fonts while Nunito downloads (first visits). Text is drawn in a common system font resized to Nunito's
   exact width and line height (measured per weight), so lines break in the same places and nothing on the page
   jumps when Nunito arrives. Before these, a phone or Linux font could reflow whole paragraphs (PageSpeed showed
   layout shift 0.27 on answer pages). "Nunito Fallback" covers Windows, Mac, Linux (Liberation/Arimo) and Android
   (Roboto); "Nunito Fallback Wide" covers Linux machines that only have DejaVu Sans. Safari keeps its own rounded
   font (ui-rounded). Nunito's metrics: ascent 1011, descent 353, no line gap (per 1000). */
@font-face { font-family: "Nunito Fallback"; font-weight: 100 549; size-adjust: 101.99%; ascent-override: 99.13%; descent-override: 34.61%; line-gap-override: 0%;
  src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("LiberationSans"), local("Arimo"), local("Arimo-Regular"), local("Helvetica"), local("Roboto"), local("Roboto-Regular"); }
@font-face { font-family: "Nunito Fallback"; font-weight: 550 649; size-adjust: 102.91%; ascent-override: 98.24%; descent-override: 34.3%; line-gap-override: 0%;
  src: local("Arial"), local("ArialMT"), local("Liberation Sans"), local("LiberationSans"), local("Arimo"), local("Arimo-Regular"), local("Helvetica"), local("Roboto"), local("Roboto-Regular"); }
@font-face { font-family: "Nunito Fallback"; font-weight: 650 749; size-adjust: 98.18%; ascent-override: 102.97%; descent-override: 35.95%; line-gap-override: 0%;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("LiberationSans-Bold"), local("Arimo Bold"), local("Arimo-Bold"), local("Helvetica Bold"), local("Helvetica-Bold"), local("Roboto Bold"), local("Roboto-Bold"); }
@font-face { font-family: "Nunito Fallback"; font-weight: 750 849; size-adjust: 100.41%; ascent-override: 100.69%; descent-override: 35.16%; line-gap-override: 0%;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("LiberationSans-Bold"), local("Arimo Bold"), local("Arimo-Bold"), local("Helvetica Bold"), local("Helvetica-Bold"), local("Roboto Bold"), local("Roboto-Bold"); }
@font-face { font-family: "Nunito Fallback"; font-weight: 850 1000; size-adjust: 102.68%; ascent-override: 98.46%; descent-override: 34.38%; line-gap-override: 0%;
  src: local("Arial Bold"), local("Arial-BoldMT"), local("Liberation Sans Bold"), local("LiberationSans-Bold"), local("Arimo Bold"), local("Arimo-Bold"), local("Helvetica Bold"), local("Helvetica-Bold"), local("Roboto Bold"), local("Roboto-Bold"); }
@font-face { font-family: "Nunito Fallback Wide"; font-weight: 100 549; size-adjust: 88.78%; ascent-override: 113.87%; descent-override: 39.76%; line-gap-override: 0%;
  src: local("DejaVu Sans"), local("DejaVuSans"), local("Bitstream Vera Sans"), local("Verdana"); }
@font-face { font-family: "Nunito Fallback Wide"; font-weight: 550 649; size-adjust: 89.58%; ascent-override: 112.86%; descent-override: 39.4%; line-gap-override: 0%;
  src: local("DejaVu Sans"), local("DejaVuSans"), local("Bitstream Vera Sans"), local("Verdana"); }
@font-face { font-family: "Nunito Fallback Wide"; font-weight: 650 749; size-adjust: 82.24%; ascent-override: 122.93%; descent-override: 42.92%; line-gap-override: 0%;
  src: local("DejaVu Sans Bold"), local("DejaVuSans-Bold"), local("Bitstream Vera Sans Bold"), local("Verdana Bold"), local("Verdana-Bold"); }
@font-face { font-family: "Nunito Fallback Wide"; font-weight: 750 849; size-adjust: 84.11%; ascent-override: 120.2%; descent-override: 41.97%; line-gap-override: 0%;
  src: local("DejaVu Sans Bold"), local("DejaVuSans-Bold"), local("Bitstream Vera Sans Bold"), local("Verdana Bold"), local("Verdana-Bold"); }
@font-face { font-family: "Nunito Fallback Wide"; font-weight: 850 1000; size-adjust: 86.01%; ascent-override: 117.54%; descent-override: 41.04%; line-gap-override: 0%;
  src: local("DejaVu Sans Bold"), local("DejaVuSans-Bold"), local("Bitstream Vera Sans Bold"), local("Verdana Bold"), local("Verdana-Bold"); }

html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  font-family: "Nunito", ui-rounded, "Nunito Fallback", "Nunito Fallback Wide", system-ui, sans-serif;
  background: var(--bg); color: var(--ink);
  min-height: 100dvh; -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; cursor: pointer; }
button, a, input { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:focus-visible { outline: 3px solid var(--warm); outline-offset: 2px; border-radius: 6px; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Header ---------- */
.top {
  display: flex; align-items: center; justify-content: space-between;
  max-width: 560px; margin: 0 auto; padding: 10px 16px 8px;
  border-bottom: 2px dashed var(--line);
}
.top-group { display: flex; gap: 8px; }
.brand { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.logo { margin: 0; font-size: 30px; font-weight: 900; letter-spacing: -0.5px; color: var(--lily); white-space: nowrap; line-height: 1.05; }
.logo a, .logo { display: inline-flex; align-items: center; gap: 6px; color: var(--lily); text-decoration: none; }
.logo a:hover .logo-frog { animation: logo-hop .5s ease; }
.logo-frog { width: 38px; height: auto; aspect-ratio: 120 / 112; flex: none; }
@keyframes logo-hop { 40% { transform: translateY(-6px) scale(1.05, .95); } 70% { transform: translateY(0) scale(1.08, .9); } }
.icon-btn {
  width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center;
  border: 2px solid var(--line); background: var(--panel); font-weight: 800; font-size: 16px;
}
.icon-btn:hover { border-color: var(--leaf); }
.icon-btn { position: relative; }
.streak-pip {
  position: absolute; right: -8px; top: -6px; min-width: 22px; padding: 1px 5px; border-radius: 999px;
  background: #7A5600; color: #fff; font-size: 11px; font-weight: 900; line-height: 16px; border: 2px solid var(--bg);
}

/* ---------- Sidebar (modes + Unlimited) ---------- */
.scrim { position: fixed; inset: 0; background: rgba(16, 36, 26, .5); z-index: 30; }
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(360px, 90vw); z-index: 31;
  background: var(--panel); box-shadow: 8px 0 40px rgba(0, 0, 0, .25);
  padding: 16px 18px 24px; overflow-y: auto;
  transform: translateX(-105%); transition: transform .28s cubic-bezier(.2, .9, .3, 1);
}
.sidebar.open { transform: none; }
.side-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.small-logo { font-size: 24px; }
.small-logo .logo-frog { width: 30px; }
.side-close { position: static; }
.side-daily {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  border: 2px solid var(--line); background: var(--bg); border-radius: 14px; padding: 12px;
}
.side-daily:hover { border-color: var(--leaf); }
.side-daily small, .diff small { display: block; color: var(--dim); font-size: 12px; font-weight: 700; }
.side-ico { font-size: 24px; }
.side-archive { margin-top: 8px; text-decoration: none; color: inherit; }
.side-title { margin: 22px 0 2px; font-size: 20px; font-weight: 900; color: var(--ink); }
.side-sub { margin: 0 0 8px; color: var(--dim); font-size: 13px; font-weight: 700; }
.side-label { margin: 14px 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.cat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.cat {
  display: flex; align-items: center; gap: 6px; text-align: left; font-weight: 800; font-size: 14px;
  border: 2px solid var(--line); background: var(--bg); border-radius: 12px; padding: 8px 10px;
}
.cat span { font-size: 18px; }
.cat.on, .diff.on { border-color: var(--lily); background: var(--lily-soft); }
.diff-list { display: grid; gap: 6px; }
.diff { text-align: left; border: 2px solid var(--line); background: var(--bg); border-radius: 12px; padding: 8px 12px; }
.diff b { font-weight: 900; }
.diff-hard.on { border-color: var(--warm); background: var(--warm-soft); }
.diff-extreme.on { border-color: #B4234F; background: color-mix(in srgb, #B4234F 12%, var(--panel)); }
.sidebar .primary { margin-top: 18px; }
.sidebar .primary:disabled { opacity: .6; cursor: wait; }

/* Difficulty badges: fixed colours so white text stays readable in both themes */
.diff-badge { padding: 1px 9px; border-radius: 999px; font-size: 12px; font-weight: 900; color: #fff; background: #27704A; }
.diff-badge.hard { background: #8A5A00; }
.diff-badge.extreme { background: #B4234F; }

/* ---------- Layout ---------- */
.wrap { max-width: 560px; margin: 0 auto; padding: 12px 16px 40px; }
.meta { text-align: center; color: var(--dim); font-weight: 700; margin: 6px 0 12px; }

/* Start / target cards */
.ends { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: stretch; }
.ends-arrow { align-self: center; font-size: 22px; color: var(--leaf); }
.end-card {
  background: var(--panel); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 10px; text-align: center; box-shadow: var(--shadow); min-width: 0;
}
.end-card.goal { border-color: var(--warm); background: linear-gradient(var(--panel), color-mix(in srgb, var(--warm-soft) 60%, var(--panel))); }
.end-card .tag { display: inline-block; font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.end-card.goal .tag { color: var(--warm-ink); }
.thumb {
  display: block; width: 64px; height: 64px; margin: 6px auto; border-radius: 50%;
  object-fit: cover; color: transparent; /* no alt text flashing while it loads */
  background: var(--line) center / cover no-repeat; border: 3px solid var(--lily-soft);
}
.end-card.goal .thumb { border-color: var(--warm-soft); }
.end-card .title { margin: 4px 0 2px; font-size: 18px; font-weight: 900; line-height: 1.15; overflow-wrap: anywhere; }
.end-card .desc { margin: 0; font-size: 12px; color: var(--dim); line-height: 1.3; min-height: 2.6em; }

/* HUD */
.hud { display: flex; justify-content: center; align-items: center; gap: 10px; margin: 14px 2px 8px; font-weight: 800; }
.hud-label { color: var(--dim); font-size: 13px; text-transform: uppercase; letter-spacing: .5px; }
.hop-num { font-size: 18px; color: var(--lily); }
.hud-sep { width: 1px; height: 18px; background: var(--line); margin: 0 4px; }
.lives { display: inline-flex; gap: 2px; align-items: center; }
.life { width: 21px; height: auto; transition: filter .3s, opacity .3s, transform .3s; }
.life.lost { opacity: .25; filter: grayscale(1); transform: scale(.85); }
.lives-num { min-width: 2ch; color: var(--lily); }
.lives-bar { display: inline-block; width: 110px; height: 10px; border-radius: 99px; background: var(--line); overflow: hidden; vertical-align: middle; }
.lives-bar span { display: block; height: 100%; background: var(--lily); border-radius: 99px; transition: width .3s; }

/* =====================================================================
   The pond: lily pads on water, the frog hopping from pad to pad
   ===================================================================== */
.pond {
  position: relative; margin-top: 8px; padding: 16px 12px 18px;
  border-radius: 26px; overflow: visible;
  background: linear-gradient(172deg, var(--pond-1), var(--pond-2));
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--panel) 55%, transparent), inset 0 4px 14px rgba(20, 60, 50, .12);
}
/* Until the puzzle loads, hold the pond at its starting size (start + target pads, one line of description)
   so the text below doesn't jump down when the pads appear. Two rules: a browser without :has() skips only the second. */
.pond:empty { min-height: 226px; }
.pond:has(> .pond-rows:empty) { min-height: 226px; }
.pond-label .d[data-desc]:empty { min-height: 1.3em; }
/* the water itself: drifting light glints and reeds at the edges (all decoration, clipped to the pond) */
.pond-water { position: absolute; inset: 0; z-index: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.caustics {
  position: absolute; inset: -260px; opacity: .9;
  background-image:
    radial-gradient(ellipse 46px 9px at 30px 40px, var(--pond-glint), transparent 70%),
    radial-gradient(ellipse 30px 7px at 170px 110px, var(--pond-glint), transparent 70%),
    radial-gradient(ellipse 58px 10px at 120px 200px, var(--pond-glint), transparent 70%),
    radial-gradient(ellipse 22px 6px at 220px 30px, var(--pond-glint), transparent 70%);
  background-size: 260px 240px;
  animation: drift 38s linear infinite;
}
@keyframes drift { to { transform: translate(260px, 240px); } }
.reeds { position: absolute; width: 62px; height: 84px; }
.reeds-a { right: -8px; bottom: -10px; }
.reeds-b { left: -14px; top: 44%; width: 44px; height: 60px; transform: scaleX(-1); opacity: .75; }
.reeds .sway { transform-origin: 50% 100%; transform-box: fill-box; animation: sway 5.5s ease-in-out infinite alternate; }
.reeds-b .sway { animation-duration: 7s; animation-delay: -2s; }
@keyframes sway { from { transform: rotate(-3deg); } to { transform: rotate(3.5deg); } }

.trail { position: absolute; inset: 0; pointer-events: none; overflow: visible; z-index: 1; }
.hop-line { fill: none; stroke: var(--trail); stroke-width: 3.2; stroke-linecap: round; stroke-dasharray: 2 9; opacity: .95; }
.hop-line.fresh { animation: trail-draw .7s ease-out both; }
@keyframes trail-draw { from { stroke-dashoffset: 120; opacity: 0; } to { stroke-dashoffset: 0; opacity: .95; } }
.hop-line.replay { animation: trail-gold .9s ease-out both; }
@keyframes trail-gold { 0% { stroke: var(--trail); } 35% { stroke: var(--warm); stroke-width: 5.5; } 100% { stroke: var(--warm); stroke-width: 3.4; } }
.todo-line { fill: none; stroke: var(--trail); stroke-width: 2; stroke-dasharray: 1 10; stroke-linecap: round; opacity: .5; }

.pond-rows { position: relative; z-index: 2; list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.pond-row { display: grid; grid-template-columns: 84px 1fr; align-items: center; min-height: 64px; }
.lily-slot { position: relative; height: 62px; }
.lily { position: absolute; top: 1px; left: 4px; width: 60px; height: 60px; }
.pond-row.alt .lily { left: 22px; }            /* a gentle zig-zag across the pond */
.pad-svg { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 4px 0 rgba(18, 70, 55, .2)); }
/* pads float: each bobs a little, out of step with its neighbours */
.pad-leaf { transform-box: fill-box; transform-origin: 50% 50%; animation: bob 4.2s ease-in-out infinite; animation-delay: calc(var(--i, 0) * -1.3s); }
@keyframes bob { 50% { transform: translateY(1.6px) rotate(1.2deg); } }
.pond-row.warm .lily::before {              /* "one hop away" glow */
  content: ""; position: absolute; inset: -7px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--warm) 60%, transparent) 0 55%, transparent 72%);
  animation: glow 1.6s ease-in-out infinite;
}
@keyframes glow { 50% { transform: scale(1.12); opacity: .7; } }
.pond-row.target .lily, .pond-row.goal .lily { filter: drop-shadow(0 0 8px color-mix(in srgb, var(--warm) 60%, transparent)); }
.pond-row.target { margin-top: 18px; }            /* a bit of open water before the target */
.pond-row.target .lily { opacity: .92; }
.pond-row.target.near .lotus { transform-box: fill-box; transform-origin: 50% 90%; animation: lotus-call 1.4s ease-in-out infinite; }
@keyframes lotus-call { 50% { transform: scale(1.1); } }
.pond-row.target.lost .lily { opacity: .45; filter: grayscale(.6); }
.pond-row.bloom .lotus { transform-box: fill-box; transform-origin: 50% 85%; animation: bloom .9s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes bloom { 0% { transform: scale(.7) rotate(-8deg); } 60% { transform: scale(1.5) rotate(3deg); } 100% { transform: scale(1.36); } }
.pond-row.bloom .lily::after {             /* a sunny glow behind the lotus once you arrive */
  content: ""; position: absolute; inset: -18px; z-index: -1; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--warm) 55%, transparent), transparent 68%);
  animation: glow 2.2s ease-in-out infinite;
}
.pond-row.growing .lily { animation: pad-grow .55s cubic-bezier(.3, 1.5, .5, 1) .18s both; }
@keyframes pad-grow { from { transform: scale(.15) rotate(-30deg); opacity: 0; } to { transform: none; opacity: 1; } }

.pond-label {
  min-width: 0; padding: 8px 12px; border-radius: 14px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 2px solid color-mix(in srgb, var(--leaf) 30%, transparent);
  box-shadow: 0 2px 0 rgba(30, 58, 42, .06);
}
.pond-row.growing .pond-label { animation: label-in .4s ease .45s both; }
@keyframes label-in { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }
.pond-row.target .pond-label { border-style: dashed; border-color: var(--warm); }
.pond-row.goal .pond-label { border-color: var(--warm); background: color-mix(in srgb, var(--warm-soft) 90%, transparent); }
.pond-row.warm .pond-label { border-color: var(--warm); }
.pond-label .tag { display: block; font-size: 10.5px; font-weight: 900; text-transform: uppercase; letter-spacing: .8px; color: var(--dim); }
.pond-row.target .tag, .pond-row.goal .tag, .pond-row.warm .tag { color: var(--warm-ink); }
.pond-label .t { font-weight: 900; font-size: 17px; line-height: 1.2; overflow-wrap: anywhere; }
.pond-label .t a { color: inherit; text-decoration-color: color-mix(in srgb, var(--leaf) 60%, transparent); text-underline-offset: 3px; }
.pond-label .d { font-size: 12px; color: var(--dim); font-weight: 600; line-height: 1.3; }
.pond-label .here {
  display: inline-block; margin-top: 4px; font-size: 10.5px; font-weight: 900; text-transform: uppercase;
  letter-spacing: .5px; color: var(--lily); background: var(--lily-soft); border-radius: 999px; padding: 1px 8px;
}
.pond-label .here.hot { color: var(--warm-ink); background: var(--warm-soft); }

/* the frog and its shadow on the water */
.frog-hopper {
  position: absolute; left: 0; top: 0; z-index: 4; width: 50px; height: 47px;
  transform-origin: 50% 85%; pointer-events: none; will-change: transform;
}
.frog-hopper .frog { width: 100%; height: 100%; display: block; overflow: visible; filter: drop-shadow(0 2px 0 rgba(30, 58, 42, .25)); }
.frog-shadow {
  position: absolute; left: 0; top: 0; z-index: 1; width: 40px; height: 10px; border-radius: 50%;
  background: rgba(20, 50, 35, .22); filter: blur(1px); pointer-events: none; transform-origin: 50% 50%;
}

/* frog parts & moods (also used in the results card and the help demo) */
.frog .legs-jump, .frog .mouth-sad, .frog .mouth-open, .frog .drop { display: none; }
.frog.jumping .legs-jump { display: inline; }
.frog.jumping .legs-sit { display: none; }
.frog.sad .mouth-happy, .frog.excited .mouth-happy { display: none; }
.frog.sad .mouth-sad, .frog.sad .drop { display: inline; }
.frog.excited .mouth-open { display: inline; }
.frog .lids ellipse { transform-box: fill-box; transform-origin: 50% 0; transform: scaleY(0); animation: blink 5.5s infinite; }
.frog .lids ellipse:last-child { animation-delay: .03s; }
.frog.sad .lids ellipse { animation: none; transform: scaleY(.38); }   /* droopy eyes */
@keyframes blink { 0%, 93%, 100% { transform: scaleY(0); } 95.5% { transform: scaleY(1); } }

/* splash, ripples and confetti (created by js/pond.js) */
.ripple {
  position: absolute; z-index: 1; width: 70px; height: 24px; border-radius: 50%;
  border: 3px solid color-mix(in srgb, var(--water) 55%, transparent); pointer-events: none;
}
.splash-drop {
  position: absolute; z-index: 5; width: 12px; height: 15px; pointer-events: none;
  border-radius: 50% 50% 50% 50% / 62% 62% 38% 38%;
  background: radial-gradient(circle at 35% 30%, #fff 0 18%, #5DBCD2 20%);
  border: 2px solid #23707F; box-shadow: 0 1px 0 rgba(0, 0, 0, .15);
}
.confetti { position: absolute; z-index: 5; width: 9px; height: 9px; border-radius: 3px; pointer-events: none; }
.confetti.petal { width: 8px; height: 14px; border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%; }
/* a wrong guess, plopping into the pond and sinking */
.sink-word {
  position: absolute; z-index: 5; pointer-events: none; white-space: nowrap;
  padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 900;
  color: var(--water); background: var(--water-soft); border: 2px solid color-mix(in srgb, var(--water) 45%, transparent);
  text-decoration: line-through; text-decoration-thickness: 2px;
}
.bubble {
  position: absolute; z-index: 4; pointer-events: none; border-radius: 50%;
  border: 1.5px solid color-mix(in srgb, #fff 80%, transparent); background: color-mix(in srgb, #fff 25%, transparent);
}

/* help-popup demo pond */
.pond-rows.demo { gap: 6px; padding: 10px 8px; border-radius: 20px; background: linear-gradient(170deg, var(--pond-1), var(--pond-2)); }
.pond-rows.demo .pond-row { grid-template-columns: 64px 1fr; min-height: 48px; }
.pond-rows.demo .lily-slot { height: 46px; }
.pond-rows.demo .lily { width: 44px; height: 44px; left: 2px; }
.pond-rows.demo .pond-row.alt .lily { left: 14px; }
.pond-rows.demo .pond-row.target { margin-top: 6px; }
.pond-rows.demo .pond-label { padding: 5px 10px; }
.pond-rows.demo .pond-label .t { font-size: 15px; }
.demo-frog { position: absolute; left: 50%; top: 40%; width: 38px; transform: translate(-50%, -50%); z-index: 2; }
.demo-frog .frog { width: 100%; height: auto; display: block; animation: demo-hop 2.4s ease-in-out infinite; }
@keyframes demo-hop { 0%, 70%, 100% { transform: translateY(0); } 80% { transform: translateY(-8px) scale(.95, 1.06); } 90% { transform: translateY(0) scale(1.06, .94); } }

/* Missed guesses: little splashes */
.misses { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0 0; }
.miss {
  font-size: 13px; font-weight: 700; color: var(--water); background: var(--water-soft);
  padding: 3px 10px 3px 8px; border-radius: 999px; text-decoration: line-through;
}
.miss::before { content: "💦 "; text-decoration: none; display: inline-block; margin-right: 2px; }

/* ---------- Input ---------- */
.guess-dock {
  position: sticky; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 6; margin-top: 18px;
  background: var(--bg); padding: 6px 0;
}
.guess { display: flex; gap: 8px; }
.typing-strip { display: none; }
/* Typing mode (phones, keyboard open): the dock is pinned right above the keyboard by main.js */
body.typing .guess-dock {
  position: fixed; left: 0; right: 0; bottom: auto; margin: 0; z-index: 25;
  padding: 8px 12px 10px; border-top: 2px solid var(--line);
  box-shadow: 0 -8px 20px rgba(30, 58, 42, .10);
}
body.typing .guess-dock .guess { max-width: 560px; margin: 0 auto; }
body.typing .typing-strip {
  display: flex; align-items: center; gap: 8px; max-width: 560px; margin: 0 auto 7px; min-width: 0;
  font-size: 14px; font-weight: 800;
}
.ts-frog { flex: none; width: 30px; height: 28px; display: block; }
.ts-frog .frog { width: 100%; height: 100%; display: block; overflow: visible; }
.ts-frog.hop .frog { animation: ts-hop .55s ease; }
@keyframes ts-hop { 35% { transform: translateY(-9px) scale(.92, 1.08); } 70% { transform: translateY(0) scale(1.1, .9); } }
.ts-route { flex: 1; min-width: 0; display: flex; align-items: center; gap: 6px; white-space: nowrap; overflow: hidden; }
.ts-route b { overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ts-arrow { color: var(--leaf); flex: none; }
.ts-goal { display: inline-flex; gap: 3px; min-width: 0; color: var(--warm-ink); flex: 1 1 auto; }
.ts-goal b { color: var(--ink); }
.typing-strip.hot .ts-goal { animation: glow 1.4s ease-in-out infinite; }
.ts-lives { flex: none; color: var(--dim); font-size: 13px; }
.guess input {
  flex: 1; min-width: 0; font: inherit; font-size: 17px; font-weight: 700; color: var(--ink);
  background: var(--panel); border: 2px solid var(--line); border-radius: 16px; padding: 14px 16px; outline: none;
}
.guess input:focus { border-color: var(--leaf); box-shadow: 0 0 0 4px color-mix(in srgb, var(--leaf) 20%, transparent); }
.guess button, .primary, .results-btn {
  border: 0; border-radius: 16px; background: var(--lily); color: var(--on-lily);
  font-weight: 900; font-size: 17px; padding: 0 22px; box-shadow: 0 4px 0 color-mix(in srgb, var(--lily) 55%, #000);
}
.guess button:active, .primary:active, .results-btn:active { transform: translateY(3px); box-shadow: none; }
.guess button:disabled { opacity: .6; cursor: wait; }
.guess.shake { animation: shake .4s; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }
.primary { display: block; width: 100%; padding: 14px; margin-top: 12px; }
.secondary {
  display: block; width: 100%; padding: 12px; margin-top: 8px; border-radius: 16px; font-weight: 900; font-size: 16px;
  border: 2px solid var(--lily); background: transparent; color: var(--lily);
}
.results-btn { display: block; width: 100%; padding: 14px; margin-top: 18px; }
.cta-frog { width: 24px; height: auto; vertical-align: -5px; margin-right: 6px; }
.h-frog { width: 18px; height: auto; vertical-align: -3px; }

.done-box {
  display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center;
  margin-top: 18px; padding: 14px 16px; border-radius: var(--radius);
  background: var(--lily-soft); border: 2px solid var(--lily); font-weight: 700;
  animation: rise .35s cubic-bezier(.2, 1.4, .4, 1) both;
}
.done-box > b { font-size: 18px; font-weight: 900; color: var(--lily); }
.done-box #doneCountdown { font-variant-numeric: tabular-nums; color: var(--ink); }
.done-box small { color: var(--dim); font-size: 13px; }
@keyframes rise { from { opacity: 0; transform: translateY(-10px) scale(.96); } to { opacity: 1; transform: none; } }

.beta-row { display: flex; justify-content: center; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.beta-reset { display: block; border: 2px dashed var(--line); background: none; color: var(--dim); border-radius: 999px; padding: 6px 16px; font-weight: 800; font-size: 14px; }
.beta-reset:hover { border-color: var(--warm); color: var(--warm-ink); }
.beta-reset.armed { border-style: solid; border-color: #8A5A00; background: #8A5A00; color: #fff; }
.beta-reset span { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; background: #8A5A00; color: #fff; border-radius: 6px; padding: 1px 5px; margin-left: 4px; vertical-align: 2px; }

.hint-row { margin-top: 8px; }
.hint-btn {
  border: 2px solid var(--warm); background: var(--warm-soft); color: var(--ink);
  border-radius: 999px; padding: 6px 14px; font-weight: 800; font-size: 14px;
}
.hint-btn small { font-weight: 700; color: var(--dim); margin-left: 4px; }
.hint-btn:disabled { opacity: .55; cursor: default; }
.hint-text {
  margin: 8px 0 0; padding: 10px 14px; border-radius: 14px; font-weight: 700; font-size: 15px; line-height: 1.4;
  background: var(--warm-soft); border: 2px dashed var(--warm); animation: rise .35s both;
}

.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.choices .label { width: 100%; font-size: 13px; color: var(--dim); font-weight: 700; }
.choice { border: 2px solid var(--lily); background: var(--panel); color: var(--lily); border-radius: 999px; padding: 6px 14px; font-weight: 800; }
.choice:hover { background: var(--lily-soft); }
.choice.none { border-color: var(--line); color: var(--dim); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; top: 76px; transform: translate(-50%, -20px); opacity: 0;
  background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 14px;
  font-weight: 800; max-width: 90vw; text-align: center; pointer-events: none; overflow-wrap: anywhere;
  transition: opacity .2s, transform .2s; z-index: 20; box-shadow: 0 8px 24px rgba(0, 0, 0, .18);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.splash { background: #24675F; color: #fff; }
.toast.warm { background: #7A5600; color: #fff; }

/* ---------- Modals ---------- */
.modal {
  width: min(440px, 92vw); max-height: 90vh; max-height: 90dvh; border: 0; border-radius: 24px; padding: 22px;
  background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(0, 0, 0, .3);
}
.modal::backdrop { background: rgba(16, 36, 26, .55); }
/* The stats window has tabs of different heights: pin its top so the tab bar never jumps */
#statsModal { margin-top: max(12px, 5vh); margin-top: max(12px, 5dvh); }
.modal h2 { margin: 0 0 8px; font-size: 24px; font-weight: 900; }
.modal h3 { margin: 18px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.close { position: absolute; right: 12px; top: 10px; width: 40px; height: 40px; border: 0; background: none; font-size: 18px; color: var(--dim); }
.help-head { display: flex; align-items: center; gap: 12px; }
.help-head h2 { margin: 0; }
.help-frog { width: 56px; height: auto; aspect-ratio: 120 / 112; flex: none; }
.help-tag { margin: 0; color: var(--lily); font-weight: 800; font-style: italic; }
/* On short screens the rules scroll: "Let's hop!" stays pinned in view so nobody has to hunt for it */
#helpModal > .primary { position: sticky; bottom: 0; z-index: 3; box-shadow: 0 4px 0 color-mix(in srgb, var(--lily) 55%, #000), 0 0 0 22px var(--panel), 0 -24px 16px 18px var(--panel); }
#helpModal > .primary:active { box-shadow: 0 0 0 22px var(--panel), 0 -24px 16px 18px var(--panel); }
.rules { padding-left: 20px; line-height: 1.45; }
.small { font-size: 14px; color: var(--dim); line-height: 1.45; }
.small a { color: var(--lily); font-weight: 800; }
.example { margin: 12px 0; }
/* "How to play" can open before main.js draws its mini pond: keep its space (236px at every width) so the text below doesn't jump */
.example:empty { min-height: 236px; }

/* Results */
.result-head { text-align: center; }
.result-frog { position: relative; width: 92px; margin: 0 auto; }
.result-frog .frog { width: 100%; height: auto; display: block; }
.result-frog.won .frog { animation: cheer 1.2s ease-in-out 2; }
.result-frog .badge { position: absolute; right: -14px; top: -6px; font-size: 30px; line-height: 1; }
@keyframes cheer { 30% { transform: translateY(-10px) scale(.95, 1.06); } 55% { transform: none; } 75% { transform: translateY(-5px); } }
.result-head .grade { font-size: 22px; font-weight: 900; margin: 6px 0 2px; }
.result-head .score { color: var(--dim); font-weight: 800; }
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
.compare h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--dim); }
.compare.stacked { grid-template-columns: 1fr; }
.compare.stacked > div + div { border-top: 2px dashed var(--line); padding-top: 10px; }
/* mini paths: a little lily pad before each step */
.mini-path { list-style: none; margin: 0; padding: 0; font-size: 14px; font-weight: 700; }
.mini-path li { padding: 3px 0; overflow-wrap: anywhere; }
.mini-path li:not(.alt-gap)::before {
  content: ""; display: inline-block; width: 15px; height: 15px; margin-right: 7px; vertical-align: -2px;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M50 50L50 6A44 44 0 1 0 88.1 28Z' fill='%2358B263' stroke='%232E7D42' stroke-width='6' stroke-linejoin='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.mini-path li.gap { color: var(--dim); font-style: italic; }
.mini-path a { color: inherit; text-decoration-color: var(--line); }
.mini-path .hop-link { color: var(--lily); }
.hop-hint { margin: 14px 0 0; text-align: center; font-size: 13px; color: var(--dim); font-weight: 700; }
.lost-path li.alt-gap { padding: 2px 0 4px 22px; }
.alt-btn { border: 1.5px dashed var(--line); background: none; color: var(--dim); border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 800; }
.alt-btn:hover, .alt-btn.open { border-color: var(--warm); color: var(--ink); background: var(--warm-soft); }
.alts { margin: 6px 0 2px; padding: 8px 10px; border-radius: 12px; font-size: 13px; background: var(--warm-soft); border: 1.5px solid var(--warm); animation: rise .25s both; }
.alt-note { margin: 0 0 4px; color: var(--dim); font-weight: 700; }
.alt-route { padding: 2px 0; font-weight: 700; }
.alt-route.best { font-weight: 900; }
.alt-route a { color: var(--lily); }
/* your game as a little pond picture: pads and splashes in the order they happened */
.journey {
  margin: 12px auto 0; max-width: 420px; padding: 4px 6px; border-radius: 18px;
  background: linear-gradient(172deg, var(--pond-1), var(--pond-2));
  box-shadow: inset 0 0 0 3px color-mix(in srgb, var(--panel) 55%, transparent);
}
.journey svg { display: block; width: 100%; height: auto; overflow: visible; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; }
.stat-grid b { display: block; font-size: 28px; font-weight: 900; color: var(--lily); }
.stat-grid span { font-size: 12px; color: var(--dim); font-weight: 700; }
.dist { display: grid; gap: 4px; }
.dist-row { display: grid; grid-template-columns: 22px 1fr; gap: 6px; align-items: center; font-weight: 800; font-size: 13px; }
.dist-bar { background: var(--line); color: var(--ink); border-radius: 6px; padding: 2px 8px; text-align: right; min-width: 26px; width: var(--w); }
.dist-bar.mine { background: var(--lily); color: var(--on-lily); }
.next { text-align: center; margin-top: 18px; color: var(--dim); font-weight: 700; }
.next b { color: var(--ink); font-variant-numeric: tabular-nums; }
.tt-follow { display: block; margin: 10px auto 0; text-align: center; color: var(--lily); font-weight: 800; font-size: 14px; text-decoration: none; }
.tt-follow:hover { text-decoration: underline; }

/* ---------- Challenges, past puzzles, sharing ---------- */
.challenge {
  display: flex; gap: 10px; align-items: center; margin: 0 0 12px; padding: 10px 14px; border-radius: 16px;
  background: var(--warm-soft); border: 2px solid var(--warm); font-weight: 700; line-height: 1.35;
  animation: rise .4s cubic-bezier(.2, 1.4, .4, 1) both;
}
.challenge b { color: var(--ink); }
.ch-flag { font-size: 24px; flex: none; }
.archive-note { margin: -4px 0 12px; text-align: center; font-size: 13px; font-weight: 700; color: var(--dim); }
.archive-note a { color: var(--lily); font-weight: 900; }
.done-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0 2px; }
.mini-btn {
  display: inline-block; border: 2px solid var(--lily); background: var(--panel); color: var(--lily);
  border-radius: 999px; padding: 7px 14px; font-weight: 900; font-size: 14px; text-decoration: none;
}
.mini-btn.primaryish { background: var(--lily); color: var(--on-lily); }
.share-cta { margin-top: 14px; }
.share-note { margin: 6px 0 0; text-align: center; font-size: 12.5px; color: var(--dim); font-weight: 700; }
.vs {
  margin: 12px 0 0; padding: 10px 12px; border-radius: 14px; text-align: center;
  background: var(--lily-soft); border: 2px solid var(--lily);
}
.vs b { display: block; font-size: 17px; }
.vs span { display: block; font-size: 13px; color: var(--dim); font-weight: 700; margin-top: 2px; }
.vs.lose { background: var(--water-soft); border-color: var(--water); }
.vs.tie { background: var(--warm-soft); border-color: var(--warm); }

/* ---------- Stats card tabs ---------- */
.tabs { display: flex; gap: 4px; margin: -4px 40px 14px 0; padding: 4px; border-radius: 999px; background: var(--bg); border: 2px solid var(--line); }
.tab { flex: 1; border: 0; background: none; border-radius: 999px; padding: 7px 4px; font-weight: 900; font-size: 13.5px; color: var(--dim); }
.tab[aria-selected="true"] { background: var(--lily); color: var(--on-lily); }
.rec-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.rec { padding: 10px 12px; border-radius: 14px; background: var(--bg); border: 2px solid var(--line); }
.rec b { display: block; font-size: 22px; font-weight: 900; color: var(--lily); line-height: 1.1; }
.rec span { display: block; font-size: 12.5px; font-weight: 800; }
.rec small { display: block; font-size: 11.5px; color: var(--dim); font-weight: 700; }
.rec.wide { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.rec.wide b { font-size: 30px; }
.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.recent li { display: grid; grid-template-columns: 3.2em 4.5em 1fr; gap: 6px; align-items: center; font-size: 13.5px; font-weight: 700; padding: 6px 10px; border-radius: 10px; background: var(--bg); }
.rc-n { font-weight: 900; color: var(--lily); }
.rc-d { color: var(--dim); font-size: 12px; }
.badge-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.badge-card {
  display: grid; gap: 2px; padding: 10px; border-radius: 14px; border: 2px dashed var(--line);
  background: var(--bg); color: var(--dim); min-width: 0;
}
/* each badge is a little medallion: a soft grey coin while locked, shiny gold once earned */
.bc-icon {
  display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 4px; border-radius: 50%;
  font-size: 23px; line-height: 1;
  background: radial-gradient(circle at 34% 28%, #FBF8EE, #E3DCC8 62%, #CFC6AE);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .6), 0 3px 0 #BDB39A;
}
.badge-card .bc-icon { filter: grayscale(1); opacity: .55; }
.badge-card b { color: var(--ink); font-size: 14px; }
.bc-desc { font-size: 12px; font-weight: 700; line-height: 1.3; }
.badge-card small { font-size: 11px; font-weight: 800; }
.badge-card.got { border-style: solid; border-color: var(--warm); background: var(--warm-soft); color: var(--ink); }
.badge-card.got .bc-icon, .ach-medal {
  filter: none; opacity: 1;
  background: radial-gradient(circle at 34% 28%, #FFF8D6, #F8D452 50%, #E09C08 100%);
  box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .55), inset 0 -4px 0 rgba(176, 127, 6, .35), 0 3px 0 #B07F06, 0 0 0 4px color-mix(in srgb, var(--warm) 25%, transparent);
}
.badge-card.got small { color: var(--warm-ink); }
.bc-bar { display: block; height: 6px; border-radius: 99px; background: var(--line); overflow: hidden; margin-top: 4px; }
.bc-bar span { display: block; height: 100%; background: var(--leaf); }
.fr-puzzle { margin: 0 0 10px; padding: 10px 12px; border-radius: 14px; background: var(--bg); border: 2px solid var(--line); }
.fr-puzzle ul { list-style: none; margin: 6px 0 0; padding: 0; }
.fr-puzzle li { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; font-weight: 700; padding: 2px 0; }
.fr-puzzle li.me { color: var(--lily); font-weight: 900; }
.empty-pond { text-align: center; color: var(--dim); font-weight: 700; padding: 8px 0; }
.empty-pond .frog { width: 64px; height: auto; display: block; margin: 0 auto 6px; }

/* ---------- Settings ---------- */
.set-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 2px dashed var(--line); }
.set-row b { display: block; }
.set-row small { display: block; color: var(--dim); font-size: 12.5px; font-weight: 700; }
.set-row input[type="text"] {
  width: 46%; min-width: 120px; font: inherit; font-weight: 800; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px;
}
.set-row input[type="checkbox"] { width: 46px; height: 26px; accent-color: var(--lily); }
.set-card { margin: 12px 0; padding: 12px; border-radius: 14px; background: var(--lily-soft); border: 2px solid color-mix(in srgb, var(--lily) 40%, transparent); }
.set-card .small { margin: 4px 0 0; }
.danger-link { display: block; margin: 14px auto 0; border: 0; background: none; color: #B4234F; font-weight: 800; font-size: 14px; text-decoration: underline; }
.danger-link.armed { background: #B4234F; color: #fff; text-decoration: none; border-radius: 999px; padding: 8px 14px; }
@media (prefers-color-scheme: dark) { .danger-link { color: #FF8FAE; } }

/* account card (Settings) and leaderboards (Friends tab) */
.acct-row { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.acct-row input { flex: 1; min-width: 0; font: inherit; font-weight: 800; font-size: 16px; color: var(--ink); background: var(--panel); border: 2px solid var(--line); border-radius: 12px; padding: 8px 10px; }
.acct-more { margin-top: 8px; }
.acct-more summary { cursor: pointer; font-weight: 800; font-size: 13.5px; color: var(--lily); }
.acct-msg { margin: 6px 0 0; min-height: 1.2em; font-size: 13px; font-weight: 800; color: var(--lily); }
.code { font-family: ui-monospace, monospace; letter-spacing: 1px; color: var(--ink); }
.mini-btn.danger { border-color: #B4234F; color: #B4234F; }
.lb ol, ol.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.fr-puzzle ol.lb { margin-top: 6px; }
.fr-puzzle .lb li { background: var(--panel); }
.lb-rank { text-align: center; }
.lb li { display: grid; grid-template-columns: 2.2em 1fr auto; gap: 8px; align-items: center; padding: 6px 10px; border-radius: 10px; background: var(--bg); font-weight: 800; font-size: 14px; }
.lb li.me { background: var(--lily-soft); color: var(--lily); }
.lb-rank { color: var(--dim); }
.lb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Achievement celebration screen (tier-1 common … tier-4 legendary) ---------- */
.ach-modal {
  position: fixed; width: min(380px, 92vw); max-height: 94vh; max-height: 94dvh; margin: auto; padding: 0; border: 0;
  border-radius: 30px; overflow: hidden; text-align: center; color: var(--ink); background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .45);
}
.ach-modal[open] { animation: ach-in .45s cubic-bezier(.2, 1.4, .4, 1) both; }
@keyframes ach-in { from { transform: scale(.6) translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.ach-modal::backdrop { background: rgba(16, 36, 26, .62); }
.ach-modal.tier-3::backdrop { background: rgba(8, 30, 18, .8); }
.ach-modal.tier-4::backdrop { background: radial-gradient(circle at 50% 40%, rgba(60, 40, 150, .7), rgba(6, 4, 24, .92)); }
/* (each dvh height has a plain vh line first, for browsers from before 2022 that don't know dvh) */
.ach-body { position: relative; z-index: 2; max-height: 94vh; max-height: 94dvh; overflow-y: auto; padding: 26px 22px 22px; }
.ach-kicker { margin: 0; font-size: 12.5px; font-weight: 900; letter-spacing: 1.4px; text-transform: uppercase; color: var(--warm-ink); }
.ach-medal {
  width: 104px; height: 104px; margin: 14px auto 10px; border-radius: 50%; display: grid; place-items: center;
  font-size: 50px; line-height: 1; animation: ach-pop .75s cubic-bezier(.2, 1.7, .4, 1) .1s both;
}
@keyframes ach-pop { from { transform: scale(0) rotate(-30deg); } to { transform: none; } }
.ach-modal h2 { margin: 6px 0 4px; font-size: 28px; font-weight: 900; line-height: 1.1; animation: ach-rise .5s .3s both; }
.ach-desc { margin: 0 auto; max-width: 280px; font-weight: 700; color: var(--dim); animation: ach-rise .5s .4s both; }
@keyframes ach-rise { from { transform: translateY(12px); opacity: 0; } to { transform: none; opacity: 1; } }
.ach-frog { margin: 16px 0 0; padding: 12px 10px 14px; border-radius: 22px; background: color-mix(in srgb, var(--lily-soft) 85%, transparent); animation: ach-rise .5s .8s both; }
.ach-new { margin: 0; font-size: 13px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; color: var(--lily); }
.ach-frog-pic { width: 132px; margin: 36px auto 2px; }   /* room for tall hats (the wizard's pokes up) */
.ach-frog-pic .frog { display: block; width: 100%; height: auto; animation: ach-hop 1s 1.1s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes ach-hop { 0% { transform: scale(0) translateY(40px); } 60% { transform: scale(1.08) translateY(-10px); } 100% { transform: none; } }
.ach-frog-name { font-size: 20px; font-weight: 900; }
.ach-actions { margin-top: 16px; }
.ach-actions .primary { margin-top: 0; }
.ach-rays, .ach-stars { position: absolute; z-index: 0; pointer-events: none; display: none; }
.ach-rays {
  left: 50%; top: 92px; width: 1000px; height: 1000px; margin: -500px 0 0 -500px;
  background: repeating-conic-gradient(rgba(246, 201, 69, .3) 0 9deg, transparent 9deg 18deg);
  -webkit-mask-image: radial-gradient(circle, #000 0 18%, transparent 46%); mask-image: radial-gradient(circle, #000 0 18%, transparent 46%);
  animation: ach-spin 26s linear infinite;
}
@keyframes ach-spin { to { transform: rotate(360deg); } }
.ach-bit { position: absolute; left: 0; top: 0; z-index: 3; width: 9px; height: 9px; border-radius: 3px; pointer-events: none; }
.ach-bit.petal { width: 8px; height: 14px; border-radius: 50% 50% 50% 50% / 70% 70% 30% 30%; }
.ach-bit.star { width: 12px; height: 12px; border-radius: 0; clip-path: polygon(50% 0, 62% 38%, 100% 50%, 62% 62%, 50% 100%, 38% 62%, 0 50%, 38% 38%); }
/* rare: sunny, with slowly turning rays */
.ach-modal.tier-2 { background: linear-gradient(180deg, var(--warm-soft), var(--panel) 62%); }
.tier-2 .ach-rays, .tier-3 .ach-rays, .tier-4 .ach-rays { display: block; }
.tier-2 .ach-medal { width: 112px; height: 112px; font-size: 54px; }
/* epic: a deep green stage with gold */
.ach-modal.tier-3 { color: #FFFCF3; background: radial-gradient(circle at 50% 18%, #39A266, #1E5A3A 58%, #133D27); box-shadow: 0 0 0 3px #F6C945, 0 24px 80px rgba(0, 0, 0, .5); }
.tier-3 .ach-kicker, .tier-4 .ach-kicker { color: #FFD84D; }
.tier-3 .ach-desc { color: #D8EFD9; }
.tier-3 .ach-medal, .tier-4 .ach-medal { width: 124px; height: 124px; font-size: 60px; margin: 26px auto 18px; }
.tier-3 .ach-medal { box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .55), inset 0 -6px 0 rgba(176, 127, 6, .35), 0 5px 0 #B07F06, 0 0 0 10px rgba(246, 201, 69, .35), 0 0 40px 12px rgba(255, 216, 77, .55); }
.tier-3 .ach-frog, .tier-4 .ach-frog { background: rgba(255, 255, 255, .12); }
.tier-3 .ach-new, .tier-4 .ach-new { color: #FFD84D; }
.tier-3 .ach-rays { background: repeating-conic-gradient(rgba(255, 216, 77, .32) 0 8deg, transparent 8deg 16deg); }
.tier-3 .ach-actions .secondary, .tier-4 .ach-actions .secondary { color: #FFFCF3; border-color: rgba(255, 252, 243, .7); }
.tier-3 .ach-actions .primary, .tier-4 .ach-actions .primary { background: #F6C945; color: #3A2A00; box-shadow: 0 4px 0 #B07F06; }
/* legendary: a starry night sky, a rainbow-ringed medal, gold everywhere */
.ach-modal.tier-4 { color: #FFFCF3; background: radial-gradient(circle at 50% 16%, #6A55E0, #2A1C7A 55%, #120B3D); box-shadow: 0 0 0 3px #FFE27A, 0 0 60px 10px rgba(255, 226, 122, .35), 0 24px 80px rgba(0, 0, 0, .6); }
.tier-4 .ach-desc { color: #DCD4FF; }
.tier-4 .ach-medal { box-shadow: inset 0 0 0 4px rgba(255, 255, 255, .6), 0 0 0 7px #FFE27A, 0 0 0 12px #FF9CD6, 0 0 0 17px #8FE3FF, 0 0 50px 22px rgba(255, 226, 122, .55); }
.tier-4 .ach-rays { background: repeating-conic-gradient(rgba(255, 226, 122, .3) 0 7deg, rgba(180, 155, 255, .18) 7deg 14deg, transparent 14deg 21deg); animation-duration: 18s; }
.tier-4 .ach-stars {
  display: block; inset: 0;
  background-image: radial-gradient(1.6px 1.6px at 12% 18%, #fff, transparent), radial-gradient(1.3px 1.3px at 82% 12%, #fff, transparent),
    radial-gradient(2px 2px at 70% 40%, #FFE27A, transparent), radial-gradient(1.4px 1.4px at 22% 62%, #fff, transparent),
    radial-gradient(1.8px 1.8px at 90% 74%, #fff, transparent), radial-gradient(1.2px 1.2px at 40% 88%, #fff, transparent),
    radial-gradient(2px 2px at 8% 86%, #FFE27A, transparent), radial-gradient(1.4px 1.4px at 58% 22%, #fff, transparent);
  animation: ach-twinkle 2.4s ease-in-out infinite alternate;
}
@keyframes ach-twinkle { from { opacity: .45; } to { opacity: 1; } }

/* Settings: pick your frog (only frogs you've unlocked show up) */
.frog-pick { flex-direction: column; align-items: stretch; }
.frog-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 8px; margin-top: 8px; }
.frog-opt {
  display: grid; justify-items: center; gap: 2px; padding: 12px 4px 6px; border-radius: 16px;
  border: 2px solid var(--line); background: var(--bg); font-size: 12px; font-weight: 900; color: var(--ink);
}
.frog-opt .frog { width: 56px; height: auto; display: block; overflow: visible; }
.frog-opt.on { border-color: var(--lily); background: var(--lily-soft); box-shadow: 0 0 0 3px color-mix(in srgb, var(--lily) 25%, transparent); }
.frog { overflow: visible; }

/* ---------- About / FAQ text below the game ---------- */
.about-wrap { max-width: 560px; margin: 0 auto; padding: 8px 16px 56px; color: var(--dim); font-size: 14px; line-height: 1.55; font-weight: 600; }
.about-wrap h2 { margin: 0 0 6px; font-size: 18px; font-weight: 900; color: var(--ink); padding-top: 20px; border-top: 2px dashed var(--line); }
.about-wrap h3 { margin: 16px 0 4px; font-size: 15px; font-weight: 900; color: var(--ink); }
.about-wrap p { margin: 0 0 8px; }
.about-wrap ol { margin: 0 0 8px; padding-left: 20px; }
.about-wrap b { color: var(--ink); }
.about-foot { font-size: 13px; }
.about-wrap a, .done-box a, .arch-about a { color: var(--lily); font-weight: 800; }

/* ---------- Archive, answer & guide pages ---------- */
.arch-home { display: grid; place-items: center; text-decoration: none; color: inherit; }
.arch { padding-bottom: 48px; }
.arch-title { margin: 8px 0 4px; font-size: 26px; font-weight: 900; text-align: center; }
.arch-lead { text-align: center; color: var(--dim); font-weight: 700; margin: 0 0 14px; line-height: 1.45; }
.arch-lead b { color: var(--ink); }
.arch-h2 { margin: 22px 0 10px; font-size: 18px; font-weight: 900; }
/* the answer path, drawn as lily pads on a little pond */
.arch-path {
  list-style: none; margin: 0; padding: 14px 12px; border-radius: 22px; display: grid; gap: 10px;
  background: linear-gradient(170deg, var(--pond-1), var(--pond-2));
}
.arch-path li {
  display: flex; gap: 12px; align-items: center; position: relative;
  background: color-mix(in srgb, var(--panel) 92%, transparent); border: 2px solid color-mix(in srgb, var(--leaf) 30%, transparent);
  border-radius: 14px; padding: 8px 12px;
}
.arch-path li.start { border-style: dashed; }
.arch-path li.goal { border-color: var(--warm); background: color-mix(in srgb, var(--warm-soft) 90%, transparent); }
.arch-path .n {
  flex: 0 0 auto; position: relative; width: 44px; height: 44px; display: grid; place-items: center;
  font-weight: 900; font-size: 14px; color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .55);
}
.arch-path .n svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; filter: drop-shadow(0 2px 0 rgba(18, 70, 55, .2)); }
.arch-path .n b { position: relative; }
.share-sample {
  margin: 10px 0 12px; padding: 12px 16px; border-radius: 14px; background: var(--panel); border: 2px solid var(--line);
  font: inherit; font-size: 16px; font-weight: 800; line-height: 1.55; white-space: pre-wrap; color: var(--ink);
}
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.arch-path a, .arch-path b { color: var(--ink); font-weight: 800; font-size: 17px; text-decoration-color: var(--line); }
.arch-path small { display: block; color: var(--dim); font-size: 12px; font-weight: 700; }
.arch-note { color: var(--dim); font-size: 13px; font-weight: 700; line-height: 1.5; margin: 14px 0 0; }
.arch-cta { text-align: center; text-decoration: none; margin: 18px 0 0; }
.arch-nav { display: flex; justify-content: space-between; align-items: center; margin: 18px 0 0; font-weight: 800; }
.arch-nav a, .arch-more a { color: var(--lily); text-decoration: none; }
.arch-more { text-align: center; margin-top: 14px; font-weight: 800; }
.arch-about { margin-top: 28px; padding-top: 16px; border-top: 2px dashed var(--line); color: var(--dim); font-size: 14px; font-weight: 600; line-height: 1.55; }
.arch-about h2 { font-size: 16px; font-weight: 900; color: var(--ink); margin: 0 0 6px; }
.arch-list { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 8px; }
.arch-list a {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-areas: "num route badge" "num date badge";
  gap: 0 10px; align-items: center; text-decoration: none; color: var(--ink);
  background: var(--panel); border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px;
}
.arch-list a:hover { border-color: var(--leaf); }
.arch-num { grid-area: num; font-weight: 900; color: var(--lily); min-width: 3ch; }
.arch-route { grid-area: route; font-weight: 800; overflow-wrap: anywhere; }
.arch-list small { grid-area: date; color: var(--dim); font-weight: 700; font-size: 12px; }
.arch-list .diff-badge { grid-area: badge; }
.guide h2 { margin: 26px 0 8px; font-size: 19px; font-weight: 900; }
.guide ol:not(.arch-path), .guide ul { margin: 0; padding-left: 22px; line-height: 1.55; font-weight: 600; }
.guide li + li { margin-top: 6px; }
.guide p { line-height: 1.55; font-weight: 600; }
.guide a:not(.primary) { color: var(--lily); font-weight: 800; }

/* hint pages */
.arch-try { text-align: center; margin: -4px 0 12px; font-size: 13.5px; font-weight: 800; color: var(--dim); }
.arch-try a, .arch-note a { color: var(--lily); }
.hints { display: grid; gap: 8px; }
.hint-card { border: 2px solid var(--warm); background: var(--warm-soft); border-radius: 14px; padding: 4px 14px; }
.hint-card summary { cursor: pointer; font-weight: 900; padding: 8px 0; list-style-position: inside; }
.hint-card p { margin: 0 0 10px; font-weight: 700; line-height: 1.5; }
.hint-card[open] { background: var(--panel); }

/* footer on every page */
.site-foot { max-width: 560px; margin: 0 auto; padding: 18px 16px calc(28px + env(safe-area-inset-bottom)); text-align: center; border-top: 2px dashed var(--line); }
.site-foot nav { display: flex; flex-wrap: wrap; justify-content: center; gap: 0 14px; }
.site-foot a { display: inline-block; padding: 5px 2px; color: var(--lily); font-weight: 800; font-size: 14px; text-decoration: none; }
.site-foot a:hover { text-decoration: underline; }
.site-foot p { margin: 8px 0 0; font-size: 12.5px; color: var(--dim); font-weight: 700; }

/* ---------- Phones ---------- */
@media (max-width: 480px) {
  .top { padding: 8px 12px 6px; padding-top: max(8px, env(safe-area-inset-top)); }
  .top-group { gap: 6px; }
  .logo { font-size: 25px; }
  .logo-frog { width: 32px; }
  .wrap { padding: 8px 12px 32px; }
  .about-wrap { padding: 4px 14px calc(40px + env(safe-area-inset-bottom)); }
  .meta { margin: 4px 0 10px; font-size: 14px; }
  .ends { gap: 6px; }
  .ends-arrow { font-size: 18px; }
  .end-card { padding: 8px 6px; border-radius: 16px; }
  .thumb { width: 52px; height: 52px; margin: 4px auto; }
  .end-card .title { font-size: 16px; }
  .end-card .desc { font-size: 11px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .hud { gap: 8px; margin: 12px 0 6px; }
  .hud-label { font-size: 12px; }
  .life { width: 19px; }
  .pond { padding: 12px 8px 14px; border-radius: 22px; }
  .pond:empty { min-height: 211px; }
  .pond:has(> .pond-rows:empty) { min-height: 211px; }
  .pond-row { grid-template-columns: 70px 1fr; }
  .lily { width: 52px; height: 52px; left: 2px; top: 5px; }
  .pond-row.alt .lily { left: 16px; }
  .frog-hopper { width: 44px; height: 41px; }
  .pond-label { padding: 7px 10px; }
  .pond-label .t { font-size: 16px; }
  .guess input { padding: 13px 14px; font-size: 16px; } /* 16px+ stops iOS zooming in on focus */
  .guess button { padding: 0 18px; min-height: 50px; }
  .hint-btn { padding: 8px 14px; }
  .hint-text { font-size: 14px; }
  .choice { padding: 8px 14px; }
  .modal { width: 94vw; padding: 18px 16px; border-radius: 20px; max-height: 88vh; max-height: 88dvh; }
  .modal h2 { font-size: 22px; }
  .close { right: 6px; top: 6px; }
  .result-head .grade { font-size: 20px; }
  .stat-grid b { font-size: 24px; }
  .sidebar { width: min(340px, 88vw); padding-top: max(16px, env(safe-area-inset-top)); }
  .toast { top: calc(68px + env(safe-area-inset-top)); }
}
/* Very narrow phones */
@media (max-width: 350px) {
  .logo { font-size: 21px; }
  .logo-frog { width: 27px; }
  .icon-btn { width: 36px; height: 36px; }
  .top-group { gap: 4px; }
  .end-card .title { font-size: 15px; }
  .thumb { width: 46px; height: 46px; }
  .hud-sep { display: none; }
  .life { width: 16px; }
  .guess button { padding: 0 14px; }
  .pond-row { grid-template-columns: 62px 1fr; }
  .lily { width: 46px; height: 46px; }
  .pond-row.alt .lily { left: 12px; }
  /* Stats tabs: at 13.5px "Friends" ran under the close ✕ on 320px phones */
  .tabs { gap: 2px; margin-right: 36px; }
  .tab { font-size: 12.5px; padding: 7px 2px; }
}

/* Browsers without color-mix() (Safari/iOS before 16.2) drop those declarations entirely, which would
   leave the pond labels and path cards with no background or border. Plain fallbacks for them: */
@supports not (color: color-mix(in srgb, red, blue)) {
  .pond-label, .arch-path li { background: var(--panel); border: 2px solid var(--line); }
  .pond-row.goal .pond-label, .arch-path li.goal { background: var(--warm-soft); border-color: var(--warm); }
  .end-card.goal { background: var(--warm-soft); }
  .diff-extreme.on { background: var(--panel); }
  .ach-frog { background: var(--lily-soft); }
  .guess input:focus { box-shadow: 0 0 0 4px var(--lily-soft); }
  .guess button, .primary, .results-btn { box-shadow: 0 4px 0 rgba(0, 0, 0, .3); }
  #helpModal > .primary { box-shadow: 0 4px 0 rgba(0, 0, 0, .3), 0 0 0 22px var(--panel), 0 -24px 16px 18px var(--panel); }
}
