/* Shared stylesheet for all pages. Mobile-first: base rules target phones, media queries widen. */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2430;
  --muted: #5d6878;
  --border: #dde1e7;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --ok-bg: #dcfce7;
  --ok-text: #166534;
  --error-bg: #fee2e2;
  --error-text: #991b1b;
  --dot-saved: #16a34a;
  --tint: #eff6ff;
  --radius: 8px;
  --gutter: 16px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

/* The hidden attribute always wins, even over classes that set display (grid, flex, ...) */
[hidden] { display: none !important; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); }

/* Top menu: logo with gradient mark, user area, ☰; a thin gradient line closes it off below */
.site-header {
  position: relative;          /* anchor for the dropdown menu and the line */
  z-index: 30;
  display: grid;
  grid-template-columns: 1fr 1fr auto auto;
  align-items: center;
  gap: 4px 10px;
  padding: 10px var(--gutter);
  background: var(--surface);
  box-shadow: 0 4px 16px rgb(15 23 42 / 0.08);
}
.site-header::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 3px;
  background: linear-gradient(90deg, #1d4ed8, #1e3a8a 50%, #0e7490);
}
.brand {
  grid-column: 1;
  justify-self: start;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: #1d4ed8;
  background: linear-gradient(100deg, #1d4ed8, #0e7490);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.brand::before {
  content: "x";
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  color: #fff;
  -webkit-text-fill-color: #fff;
  background: linear-gradient(145deg, #1d4ed8, #0e7490);
  font-size: 1.15rem;
  font-weight: 900;
  box-shadow: 0 4px 10px rgb(29 78 216 / 0.35);
  transition: transform 0.2s;
}
.brand:hover::before { transform: rotate(-6deg) scale(1.08); }
.menu-toggle {
  grid-column: 4;
  grid-row: 1;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1.2rem;
  line-height: 1;
  background: var(--surface);
  color: #1e3a8a;
  transition: background 0.15s, border-color 0.15s;
}
.menu-toggle:hover { filter: none; background: var(--tint); border-color: #93c5fd; }
.menu-toggle[aria-expanded="true"] { border-color: transparent; color: #fff; background: linear-gradient(145deg, #1d4ed8, #1e3a8a); }

/* Main menu: dropdown below the hamburger button in the top-right corner */
.main-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: var(--gutter);
  z-index: 20;
  min-width: 230px;
  padding: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: 0 18px 44px rgb(15 23 42 / 0.22);
  animation: tile-in 0.18s ease-out;
}
.main-menu ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.main-menu a {
  display: block;
  padding: 10px 14px;
  border-radius: 10px;
  color: var(--text);
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}
.main-menu a:hover { background: var(--tint); color: #1e40af; }
.main-menu a[aria-current="page"] { color: #fff; background: linear-gradient(115deg, #1d4ed8, #1e3a8a); font-weight: 800; }
/* Language switch at the bottom of the main menu */
.menu-languages { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin-top: 8px; padding: 12px 4px 2px; border-top: 1px solid var(--border); }
.menu-heading { flex-basis: 100%; padding: 0 4px 4px; font-size: 0.8rem; font-weight: 600; color: var(--muted); }
.menu-languages button { flex: 1; padding: 7px 10px; border: 1px solid var(--border); border-radius: 10px; background: none; color: var(--text); font-weight: 600; }
.menu-languages button:hover { filter: none; background: var(--tint); border-color: #93c5fd; }
.menu-languages button[aria-pressed="true"] { color: #fff; border-color: transparent; background: linear-gradient(115deg, #1d4ed8, #1e3a8a); }

main {
  max-width: 960px;
  margin: 0 auto;
  padding: var(--gutter);
}

/* Task menu (logged-in users): row of tabs under the header on phones, left column from 720px */
.task-menu {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.task-menu ul { list-style: none; margin: 0; padding: 4px 12px 10px; display: flex; gap: 8px; overflow-x: auto; }
.task-menu li {
  flex: 1;
  animation: tile-in 0.4s ease-out backwards;
  animation-delay: calc(var(--i, 0) * 40ms);
}
.task-menu-collapsed .task-menu ul { display: none; }
.task-menu-marker { display: none; }
.task-menu-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 10px var(--gutter);
  border-radius: 0;
  background: none;
  color: var(--text);
  font-weight: 600;
}
.task-menu-toggle:hover { background: var(--bg); filter: none; }
.task-menu-chevron { font-size: 1.3rem; line-height: 1; transform: rotate(-90deg); }
.task-menu-collapsed .task-menu-chevron { transform: rotate(90deg); }
/* Same colours as the start page tiles (.tile-color-*, .test-tile): gradient chips on phones,
   gradient markers in the column, where only the current page gets the full gradient */
.task-menu a {
  position: relative;
  overflow: hidden;
  display: block;
  padding: 8px 12px;
  text-align: center;
  border-radius: var(--radius);
  color: #fff;
  background: linear-gradient(145deg, var(--from), var(--to));
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: transform 0.2s, box-shadow 0.2s, color 0.15s;
}
.task-menu a:hover, .task-menu a:focus-visible { transform: translateY(-2px) scale(1.03); box-shadow: 0 8px 18px var(--glow); }
.task-menu a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.task-menu a[aria-current="page"] { font-weight: 800; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--from); }

.muted { color: var(--muted); }

h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h2 { font-size: 1.1rem; margin: 0 0 12px; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--gutter);
}
.card + .card { margin-top: var(--gutter); }
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }

button {
  font: inherit;
  padding: 10px 16px;          /* comfortable touch target */
  border: 0;
  border-radius: var(--radius);
  background: var(--accent);
  color: var(--accent-text);
  cursor: pointer;
}
button:hover { filter: brightness(1.08); }



/* User area in the top menu: links as soft pills, sign-up as the eye-catcher */
.user-nav { grid-column: 3; grid-row: 1; display: flex; align-items: center; gap: 6px; }
.nav-link {
  padding: 8px 14px;
  border-radius: 10px;
  background: none;
  color: #1e3a8a;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.nav-link:hover, .nav-link[aria-current="page"] { filter: none; background: var(--tint); }
.nav-cta {
  padding: 8px 16px;
  border-radius: 10px;
  color: #fff;
  background: linear-gradient(115deg, #1d4ed8, #1e3a8a);
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgb(29 78 216 / 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}
.nav-cta:hover, .nav-cta:focus-visible { transform: translateY(-2px); box-shadow: 0 8px 18px rgb(29 78 216 / 0.45); }
/* Logged in: round initial and name, leading to the profile */
.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  padding: 4px 12px 4px 4px;
  border-radius: 999px;
  color: var(--text);
  font-weight: 700;
  text-decoration: none;
  transition: background 0.15s;
}
.user-chip:hover, .user-chip[aria-current="page"] { background: var(--tint); }
.user-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(145deg, #1d4ed8, #0e7490);
  font-size: 0.95rem;
  font-weight: 800;
}
.user-name { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Narrow phones: the logo shrinks to its mark and the name to the initial */
@media (max-width: 479px) {
  .brand { font-size: 0; gap: 0; }
  .user-name { display: none; }
  .user-chip { padding: 4px; }
}
@media (max-width: 399px) {
  .site-header { column-gap: 4px; padding-inline: 8px; }
  .user-nav { gap: 2px; font-size: 0.92rem; }
  .nav-link { padding: 8px 7px; }
  .nav-cta { padding: 8px 10px; }
  .brand::before { width: 30px; height: 30px; font-size: 1rem; }
  .menu-toggle { width: 36px; height: 36px; }
}

main.narrow { max-width: 420px; }
main.wide-home { max-width: 960px; }

main.wide { max-width: 1400px; }

/* Start page (logged in): bold animated banner, then large square tiles in study order.
   All gradient colours keep white text at contrast 4.5:1 or better. */
body:has(#home), body:has(.auth-shell), body:has(.task-page), body:has(.profile-page), body:has(.results-page) {
  background-image:
    radial-gradient(circle at 12% 18%, rgb(37 99 235 / 0.24), transparent 38%),
    radial-gradient(circle at 88% 12%, rgb(30 64 175 / 0.16), transparent 36%),
    radial-gradient(circle at 78% 85%, rgb(14 116 144 / 0.2), transparent 40%),
    radial-gradient(circle at 20% 88%, rgb(14 165 233 / 0.18), transparent 38%);
  background-attachment: fixed;
}
main:has(> #home) { max-width: 1240px; }
.home { display: flex; flex-direction: column; gap: 24px; }

.hero.gradient-hero {
  position: relative;
  overflow: hidden;
  padding: 32px 24px;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(115deg, #1d4ed8, #1e3a8a, #0e7490, #1e3a8a, #1d4ed8);
  background-size: 300% 100%;
  box-shadow: 0 16px 40px rgb(30 64 175 / 0.3);
  animation: hero-flow 16s linear infinite;
}
/* Soft light circles in the corner */
.gradient-hero::before, .gradient-hero::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.1);
  pointer-events: none;
}
.gradient-hero::before { width: 280px; height: 280px; top: -120px; right: -60px; }
.gradient-hero::after { width: 160px; height: 160px; bottom: -90px; right: 180px; }
.hero.gradient-hero h1 { position: relative; margin: 0 0 6px; font-size: clamp(2.2rem, 6vw, 3.75rem); font-weight: 800; line-height: 1.1; overflow-wrap: anywhere; }
.gradient-hero .hero-lead { position: relative; margin: 0; font-size: clamp(1.05rem, 2vw, 1.3rem); color: #fff; }
@keyframes hero-flow { to { background-position: 150% 0; } }

/* 2 square tiles per row on phones and tablets, 4 from 960px */
.task-tiles {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
/* Square, but a very long title makes the whole row taller instead of being cut off */
.task-tiles > li { display: grid; min-width: 0; }
.task-tiles > li::before { content: ""; grid-area: 1 / 1; padding-bottom: 100%; }
.task-tiles > li > .task-tile { grid-area: 1 / 1; }
.task-tile {
  --from: #1d4ed8;
  --to: #1e3a8a;
  --glow: rgb(29 78 216 / 0.45);
  position: relative;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
  border-radius: 20px;
  color: #fff;
  text-decoration: none;
  background: linear-gradient(145deg, var(--from), var(--to));
  box-shadow: 0 8px 20px rgb(15 23 42 / 0.18);
  transition: transform 0.2s, box-shadow 0.2s;
  animation: tile-in 0.5s ease-out backwards;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.tile-color-0 { --from: #1d4ed8; --to: #1e3a8a; --glow: rgb(29 78 216 / 0.45); }
.tile-color-1 { --from: #0369a1; --to: #1d4ed8; --glow: rgb(3 105 161 / 0.45); }
.tile-color-2 { --from: #172554; --to: #2563eb; --glow: rgb(23 37 84 / 0.45); }
.tile-color-3 { --from: #0f766e; --to: #0369a1; --glow: rgb(15 118 110 / 0.45); }
.tile-color-4 { --from: #1e40af; --to: #0e7490; --glow: rgb(30 64 175 / 0.45); }
.tile-color-5 { --from: #0e7490; --to: #047857; --glow: rgb(14 116 144 / 0.45); }
.test-tile { --from: #0f172a; --to: #1e3a8a; --glow: rgb(15 23 42 / 0.45); }
.test-tile .task-tile-kicker { color: #fbbf24; }
.test-tile .task-tile-symbol { color: #fbbf24; opacity: 0.45; }

.task-tile-kicker { position: relative; padding-right: 44px; font-size: 0.85rem; font-weight: 700; line-height: 1.3; }
.task-tile-title { position: relative; margin-top: auto; padding-top: 12px; font-size: clamp(1.1rem, 2.2vw, 1.5rem); font-weight: 800; line-height: 1.2; overflow-wrap: anywhere; }
/* Giant number or symbol behind the text */
.task-tile-symbol {
  position: absolute;
  right: 10px;
  bottom: -6px;
  font-size: clamp(5.5rem, 13vw, 10rem);
  font-weight: 900;
  line-height: 1;
  opacity: 0.16;
  transition: transform 0.25s;
}
.task-tile-arrow {
  position: absolute;
  top: 12px;
  right: 12px;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 700;
  background: rgb(255 255 255 / 0.2);
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
/* Light sweep across tiles and side menu entries on hover */
.task-tile::after, .task-menu a::after, .step-card::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 -60%;
  width: 40%;
  background: linear-gradient(100deg, transparent, rgb(255 255 255 / 0.28), transparent);
  transform: skewX(-18deg);
  pointer-events: none;
}
.task-tile:hover, .task-tile:focus-visible { transform: translateY(-6px) scale(1.02); box-shadow: 0 18px 36px var(--glow); }
.task-tile:hover::after, .task-tile:focus-visible::after, .task-menu a:hover::after, .task-menu a:focus-visible::after, .step-card:hover::after { left: 130%; transition: left 0.6s ease-out; }
.task-tile:hover .task-tile-symbol, .task-tile:focus-visible .task-tile-symbol { transform: scale(1.12) rotate(-4deg); }
.task-tile:hover .task-tile-arrow, .task-tile:focus-visible .task-tile-arrow { background: #fff; color: var(--from); transform: translateX(3px); }
.task-tile:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
@keyframes tile-in { from { opacity: 0; transform: translateY(18px) scale(0.96); } }

@media (min-width: 720px) {
  .hero.gradient-hero { padding: 48px 44px; }
  .task-tiles { gap: 20px; }
  .task-tile { padding: 22px; }
  .task-tile-kicker { font-size: 0.95rem; }
  .task-tile-arrow { top: 18px; right: 18px; }
}
@media (min-width: 960px) {
  .task-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .task-tile-symbol { font-size: clamp(6rem, 11vw, 10rem); }
}
/* Landing page for visitors who are not logged in: same look as the logged-in start page */
.landing { display: flex; flex-direction: column; gap: 48px; }
.landing > section > h2 {
  width: fit-content;
  margin: 0 0 20px;
  font-size: clamp(1.6rem, 3.5vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
  color: #1d4ed8;
  background: linear-gradient(100deg, #1d4ed8, #1e3a8a 55%, #0e7490);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Banner: text on the left, floating task squares on the right on wide screens */
.landing .hero.gradient-hero { padding: 40px 24px; }
.landing .hero.gradient-hero h1 { margin: 0 0 16px; }
.landing .gradient-hero .hero-lead { max-width: 60ch; margin: 0 0 28px; }
.eyebrow { position: relative; margin: 0 0 12px; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #fef3c7; }
.hero-actions { position: relative; display: flex; flex-wrap: wrap; gap: 12px; }
.hero-tiles { display: none; }

/* Links styled like buttons, in the banner */
.button {
  display: inline-block;
  padding: 13px 26px;
  border: 2px solid #fff;
  border-radius: 12px;
  background: #fff;
  color: #1e40af;
  font-weight: 800;
  text-decoration: none;
  box-shadow: 0 8px 20px rgb(15 23 42 / 0.25);
  transition: transform 0.2s, box-shadow 0.2s;
}
.button.secondary { background: transparent; color: #fff; box-shadow: none; }
.button:hover, .button:focus-visible { transform: translateY(-3px) scale(1.03); box-shadow: 0 14px 28px rgb(15 23 42 / 0.35); }
.button:focus-visible { outline: 3px solid #fef3c7; outline-offset: 3px; }

/* Steps: gradient cards like the task tiles, giant number behind the text */
.steps {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.step-card.card {
  position: relative;
  overflow: hidden;
  min-height: 260px;
  margin: 0;
  padding: 24px;
  border: 0;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(145deg, var(--from), var(--to));
  box-shadow: 0 10px 24px rgb(15 23 42 / 0.18);
  transition: transform 0.2s, box-shadow 0.2s;
}
.step-card:hover { transform: translateY(-6px) scale(1.02); box-shadow: 0 18px 36px var(--glow); }
.step-card h3 { position: relative; margin: 0 0 10px; font-size: 1.5rem; font-weight: 800; line-height: 1.2; }
.step-card p { position: relative; margin: 0; font-size: 1.05rem; }
.step-number {
  position: absolute;
  right: 14px;
  bottom: -14px;
  font-size: 10rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0.16;
  transition: transform 0.25s;
}
.step-card:hover .step-number { transform: scale(1.12) rotate(-4deg); }

/* Frosted cards over the page background */
.landing-split { display: grid; gap: 20px; align-items: start; }
.glass-card.card {
  border: 1px solid rgb(255 255 255 / 0.8);
  border-radius: 20px;
  background: rgb(255 255 255 / 0.78);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 28px rgb(15 23 42 / 0.1);
}
.glass-card.card { margin: 0; padding: 24px; }
.glass-card h2 { font-size: 1.4rem; font-weight: 800; }
/* Checkmarks in small gradient circles */
.plain-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.plain-list li { display: flex; gap: 12px; }
.plain-list li::before {
  content: "✓";
  flex: none;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  color: #fff;
  background: linear-gradient(145deg, #1d4ed8, #0e7490);
  font-weight: 800;
}

@media (min-width: 720px) {
  .landing .hero.gradient-hero { padding: 64px 48px; }
  .landing-split { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 1060px) {
  .landing .gradient-hero > :not(.hero-tiles) { max-width: 60%; }
  .hero-tiles {
    position: absolute;
    top: 50%;
    right: 48px;
    display: grid;
    grid-template-columns: repeat(2, 120px);
    gap: 16px;
    transform: translateY(-50%) rotate(6deg);
  }
  .hero-tile {
    display: grid;
    place-items: center;
    width: 120px;
    height: 120px;
    border: 2px solid rgb(255 255 255 / 0.35);
    border-radius: 20px;
    color: #fff;
    background: linear-gradient(145deg, var(--from), var(--to));
    font-size: 3.2rem;
    font-weight: 900;
    box-shadow: 0 14px 30px rgb(15 23 42 / 0.35);
    animation: tile-float 5s ease-in-out infinite alternate;
  }
  .hero-tile.test-tile { color: #fbbf24; }
  .hero-tile:nth-child(2) { animation-delay: -1.2s; }
  .hero-tile:nth-child(3) { animation-delay: -2.4s; }
  .hero-tile:nth-child(4) { animation-delay: -3.6s; }
}
@keyframes tile-float { to { transform: translateY(-14px); } }

/* Sections slide in while scrolling, where the browser supports it; elsewhere they are simply visible */
@supports (animation-timeline: view()) {
  .step-card, .landing-split > .card {
    animation: tile-in linear backwards;
    animation-timeline: view();
    animation-range: entry 0% entry 50%;
  }
}

/* Login and registration: gradient welcome panel and frosted form, side by side on wide screens */
main.auth-shell { display: grid; place-items: center; max-width: 980px; min-height: calc(100vh - 56px); }
.auth-card {
  width: 100%;
  overflow: hidden;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  border: 1px solid rgb(255 255 255 / 0.8);
  border-radius: 24px;
  background: rgb(255 255 255 / 0.82);
  backdrop-filter: blur(10px);
  box-shadow: 0 24px 60px rgb(30 64 175 / 0.2);
  animation: tile-in 0.5s ease-out backwards;
}
.auth-intro.hero.gradient-hero { padding: 28px 24px; border-radius: 0; box-shadow: none; }
.auth-headline { position: relative; margin: 0; font-size: clamp(1.5rem, 4vw, 2.3rem); font-weight: 800; line-height: 1.15; }
.auth-tiles { display: none; }
.auth-form { padding: 28px 24px; }
.auth-form h1 {
  width: fit-content;
  margin: 0 0 20px;
  font-size: clamp(1.8rem, 4vw, 2.4rem);
  font-weight: 800;
  line-height: 1.2;
  color: #1d4ed8;
  background: linear-gradient(100deg, #1d4ed8, #1e3a8a 55%, #0e7490);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.auth-form .form { gap: 18px; }
.auth-form .form label { gap: 6px; }
.auth-form .form input {
  min-width: 0;
  padding: 13px 14px;
  font-weight: 400;
  border: 2px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-form .form input:hover { border-color: #93c5fd; }
.auth-form .form input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 4px rgb(37 99 235 / 0.25); }
.auth-form button[type="submit"] {
  margin-top: 4px;
  padding: 14px 20px;
  border-radius: 12px;
  background: linear-gradient(115deg, #1d4ed8, #1e3a8a);
  font-weight: 800;
  box-shadow: 0 10px 22px rgb(30 64 175 / 0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
.auth-form button[type="submit"]:hover:not(:disabled), .auth-form button[type="submit"]:focus-visible { filter: none; transform: translateY(-3px); box-shadow: 0 16px 30px rgb(30 64 175 / 0.4); }
.auth-form button[type="submit"]:focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
.auth-form .form-error { border-radius: 12px; }
.auth-switch { margin: 20px 0 0; text-align: center; }
.auth-switch a { color: #1e40af; font-weight: 700; }

@media (min-width: 860px) {
  .auth-card { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .auth-intro.hero.gradient-hero { display: flex; flex-direction: column; justify-content: center; padding: 48px 40px; }
  .auth-form { padding: 48px 40px; }
  .auth-tiles {
    position: relative;
    display: grid;
    grid-template-columns: repeat(4, 64px);
    gap: 12px;
    width: fit-content;
    margin-top: 36px;
    transform: rotate(-4deg);
  }
  .auth-tile {
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border: 2px solid rgb(255 255 255 / 0.35);
    border-radius: 14px;
    color: #fff;
    background: linear-gradient(145deg, var(--from), var(--to));
    font-size: 1.7rem;
    font-weight: 900;
    box-shadow: 0 10px 20px rgb(15 23 42 / 0.35);
    animation: tile-float 5s ease-in-out infinite alternate;
  }
  .auth-tile.test-tile { color: #fbbf24; }
  .auth-tile:nth-child(2) { animation-delay: -1.2s; }
  .auth-tile:nth-child(3) { animation-delay: -2.4s; }
  .auth-tile:nth-child(4) { animation-delay: -3.6s; }
}

/* Profile page: banner with the user's initial, then account details and password side by side */
main.profile-page { display: flex; flex-direction: column; gap: 24px; max-width: 980px; }
.profile-banner.hero.gradient-hero { display: flex; align-items: center; gap: 20px; }
.profile-banner.hero.gradient-hero h1 { margin: 0; font-size: clamp(1.8rem, 5vw, 3rem); }
.profile-banner .eyebrow { margin-bottom: 4px; }
.profile-banner > div { position: relative; min-width: 0; }
.profile-avatar {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 84px;
  height: 84px;
  border: 4px solid rgb(255 255 255 / 0.85);
  border-radius: 50%;
  color: #1e3a8a;
  background: #fff;
  font-size: 2.4rem;
  font-weight: 900;
  box-shadow: 0 10px 24px rgb(15 23 42 / 0.3);
}
.profile-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; align-items: start; }
.profile-grid .card + .card { margin-top: 0; }
.status-list { display: flex; flex-direction: column; gap: 10px; margin: 0; }
.status-list > div { padding: 12px 14px; border-radius: 12px; background: var(--tint); }
.status-list dt { font-size: 0.85rem; font-weight: 600; color: var(--muted); }
.status-list dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.auth-form .form-success { border-radius: 12px; }
@media (min-width: 860px) {
  .profile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .profile-banner.hero.gradient-hero { padding: 36px 40px; }
}

@media (prefers-reduced-motion: reduce) {
  .hero.gradient-hero, .task-tile, .task-menu li, .hero-tile, .auth-card, .auth-tile, .main-menu, .step-card, .landing-split > .card { animation: none; }
  .task-tile, .task-tile *, .task-tile::after, .task-menu a, .task-menu a *, .task-menu a::after, .button, .step-card, .step-card *, .step-card::after, .auth-form .form input, .auth-form button[type="submit"], .brand::before, .nav-cta { transition: none; }
  .task-tile:hover, .task-tile:focus-visible, .task-menu a:hover, .task-menu a:focus-visible, .button:hover, .button:focus-visible, .step-card:hover, .auth-form button[type="submit"]:hover:not(:disabled), .auth-form button[type="submit"]:focus-visible, .brand:hover::before, .nav-cta:hover, .nav-cta:focus-visible { transform: none; }
  .step-card:hover .step-number { transform: none; }
  .task-tile:hover .task-tile-symbol, .task-tile:focus-visible .task-tile-symbol { transform: none; }
  .task-tile:hover::after, .task-tile:focus-visible::after, .task-menu a:hover::after, .task-menu a:focus-visible::after, .step-card:hover::after { transition: none; }
}

.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; }
.form label small { font-weight: 400; color: var(--muted); }
.form input {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
}
.form input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button:disabled { opacity: 0.6; cursor: wait; }
.form-success {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--ok-bg);
  color: var(--ok-text);
}
.form-error {
  margin: 0;
  padding: 8px 12px;
  border-radius: var(--radius);
  background: var(--error-bg);
  color: var(--error-text);
}

@media (min-width: 720px) {
  h1 { font-size: 2rem; }
  main { padding: 32px var(--gutter); }

  body.with-task-menu {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    min-height: 100vh;
  }
  body.with-task-menu .site-header { grid-column: 1 / -1; }
  body.with-task-menu main { width: 100%; }
  .task-menu { border-bottom: 0; border-right: 1px solid var(--border); }
  .task-menu-inner { position: sticky; top: 0; }
  .task-menu ul { flex-direction: column; gap: 4px; padding: 4px 12px var(--gutter); overflow: visible; }
  .task-menu a { display: flex; align-items: center; gap: 10px; padding: 6px 12px; text-align: left; color: var(--text); background: none; font-weight: 500; white-space: normal; line-height: 1.25; }
  .task-menu-marker {
    flex: none;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(145deg, var(--from), var(--to));
    font-size: 0.85rem;
    font-weight: 800;
    transition: transform 0.25s;
  }
  .test-tile .task-menu-marker { color: #fbbf24; }
  /* Current page always, other entries while hovered or focused: the full gradient */
  .task-menu a[aria-current="page"], .task-menu a:hover, .task-menu a:focus-visible {
    color: #fff;
    background: linear-gradient(145deg, var(--from), var(--to));
    box-shadow: 0 8px 18px var(--glow);
  }
  .task-menu a[aria-current="page"] { font-weight: 800; }
  .task-menu a[aria-current="page"] .task-menu-marker, .task-menu a:hover .task-menu-marker, .task-menu a:focus-visible .task-menu-marker { background: rgb(255 255 255 / 0.22); }
  @media (prefers-reduced-motion: no-preference) {
    .task-menu a:hover .task-menu-marker, .task-menu a:focus-visible .task-menu-marker { transform: scale(1.12) rotate(-4deg); }
  }
  .task-menu-toggle { padding: 12px 24px; }
  .task-menu-chevron { transform: rotate(180deg); }

  /* Collapsed: a narrow rail with only the markers; the labels stay available to screen readers */
  body.task-menu-collapsed { grid-template-columns: 64px minmax(0, 1fr); }
  .task-menu-collapsed .task-menu ul { display: flex; padding: 4px 8px var(--gutter); }
  .task-menu-collapsed .task-menu a { justify-content: center; padding: 6px 0; }
  .task-menu-collapsed .task-menu-toggle { justify-content: center; padding: 12px 0; }
  .task-menu-collapsed .task-menu-chevron { transform: none; }
  .task-menu-collapsed .task-menu-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }
}

/* ======================================================================================
   Play area (task.html). For first graders: no text, big touch targets, calm colours.
   ====================================================================================== */

:root {
  --ball: clamp(22px, 6.2vw, 60px);  /* ball diameter; all ten-strip sizes derive from it */
  --ball-on: #e5484d;                /* coloured ball */
  --ball-on-edge: #b4232a;
  --ball-off: #ffffff;
  --ball-off-edge: #9aa6b8;
  --separator: #1e3a8a;              /* dark blue separator */
  --cover: #facc15;                  /* yellow cover in task 3d */
  --key: clamp(46px, 7.2vw, 68px);   /* number pad keys and answer boxes */
}

main.task-page { max-width: 1240px; }
:where(.task-page) { --from: #1d4ed8; --to: #1e3a8a; --glow: rgb(29 78 216 / 0.45); }

.play {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-height: calc(100vh - 140px);
  padding: 16px;
  border: 1px solid rgb(255 255 255 / 0.8);
  border-radius: 24px;
  background: rgb(255 255 255 / 0.9);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 32px rgb(15 23 42 / 0.12);
  -webkit-user-select: none;
  user-select: none;
}

/* Top bar: task badge left, progress dots in the middle, nuts right */
.play-bar { display: flex; align-items: center; gap: 16px; }
.task-badge {
  flex: none;
  display: grid;
  place-items: center;
  min-width: 48px;
  height: 48px;
  padding: 0 10px;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--from), var(--to));
  font-size: 1.2rem;
  font-weight: 900;
}
.progress { flex: 1; display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0; padding: 0; list-style: none; }
.progress li { width: 16px; height: 16px; border-radius: 50%; background: #e2e8f0; transition: background 0.3s; }
.progress li.done { background: linear-gradient(145deg, var(--from), var(--to)); }
.progress li.current { box-shadow: 0 0 0 3px var(--from); background: #fff; }
.nut-counter {
  flex: none;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 0 0 auto;
  padding: 4px 16px 4px 6px;
  border-radius: 999px;
  background: #fef3c7;
  color: #78350f;
  font-size: 1.6rem;
  font-weight: 900;
}
.progress:not([hidden]) + .nut-counter { margin-left: 0; }
.nut-counter img { width: 44px; height: 44px; }
.nut-counter.bump { animation: bump 0.5s ease-out; }
@keyframes bump { 40% { transform: scale(1.25); } }

.stage { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; }
.stage-top { display: flex; justify-content: center; }
.strip-row { display: flex; justify-content: center; max-width: 100%; }

/* ---------- Ten-strip: gap0 ball1 gap1 … ball10 gap10, all in one frame ---------- */
.tenstrip {
  --gap: calc(var(--ball) * 0.32);
  display: inline-flex;
  align-items: stretch;
  padding: calc(var(--ball) * 0.22) calc(var(--ball) * 0.12);
  border: 3px solid #cbd5e1;
  border-radius: calc(var(--ball) * 0.36);
  background: #f8fafc;
}
.strip-ball, .strip-gap {
  position: relative;
  flex: none;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
}
.strip-ball { width: var(--ball); height: var(--ball); display: grid; place-items: center; }
.strip-ball::before {
  content: "";
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: var(--ball-off);
  border: 3px solid var(--ball-off-edge);
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}
.strip-ball.filled::before {
  border-color: var(--ball-on-edge);
  background: radial-gradient(circle at 35% 30%, #ff8a8d, var(--ball-on) 55%, var(--ball-on-edge));
}
.strip-gap { width: var(--gap); }
.strip-gap.gap-middle { width: calc(var(--ball) * 0.95); }
.strip-gap.gap-end { width: calc(var(--gap) * 0.9); }

/* Separator: dark blue bar standing out above and below the strip */
.strip-gap::after {
  content: "";
  position: absolute;
  left: 50%;
  top: calc(var(--ball) * -0.42);
  bottom: calc(var(--ball) * -0.42);
  width: max(6px, calc(var(--ball) * 0.14));
  border-radius: 99px;
  background: var(--separator);
  transform: translateX(-50%) scaleY(0);
  transition: transform 0.15s;
}
.strip-gap.has-separator::after { transform: translateX(-50%) scaleY(1); }

/* Clickable parts: balls in task 1a, gaps in tasks 3a/3b (hit area wider than the gap) */
.mode-select .strip-ball, .mode-separator .strip-gap { cursor: pointer; touch-action: manipulation; }
.mode-select .strip-ball:hover::before { transform: scale(1.06); }
.mode-select .strip-ball:focus-visible, .mode-separator .strip-gap:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 8px; }
.mode-separator .strip-gap::before { content: ""; position: absolute; inset: -14px -6px; }
.mode-separator .strip-gap.gap-middle::before { inset: -14px 4px; }
.mode-separator .strip-gap:not(.has-separator):hover::after { transform: translateX(-50%) scaleY(1); opacity: 0.25; }

/* Cover (task 3d): one yellow band from the cover start to the right end of the strip */
.tenstrip .covered { background: var(--cover); }
.tenstrip .covered.strip-ball::before { visibility: hidden; }
.tenstrip .covered.cover-start { border-radius: 10px 0 0 10px; }
.tenstrip .strip-gap.gap-end.covered:last-child { border-radius: 0 10px 10px 0; }
.tenstrip .covered.cover-start.gap-end:last-child { border-radius: 10px; }

/* ---------- Choices (task 1b: three strips, task 2: three numbers) ---------- */
.choices { display: flex; gap: 16px; }
.strip-choices { flex-direction: column; align-items: center; --ball: clamp(18px, 5vw, 46px); }
.number-choices { justify-content: center; }
.choice {
  padding: 10px;
  border: 4px solid transparent;
  border-radius: 20px;
  background: none;
  color: var(--text);
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}
.choice:hover { filter: none; background: var(--tint); }
.choice[aria-pressed="true"] { border-color: var(--from); background: var(--tint); box-shadow: 0 8px 20px var(--glow); }
.choice:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.number-choices .choice {
  display: grid;
  place-items: center;
  width: calc(var(--key) * 1.6);
  height: calc(var(--key) * 1.6);
  border-color: var(--border);
  background: #fff;
  font-size: calc(var(--key) * 0.8);
  font-weight: 900;
}
.number-choices .choice[aria-pressed="true"] { border-color: var(--from); background: var(--tint); }
.strip-row.flash { animation: tile-in 0.3s ease-out; }
.strip-row.gone { visibility: hidden; }

/* ---------- Number boxes and pad ---------- */
.num-box {
  display: grid;
  place-items: center;
  width: calc(var(--key) * 1.25);
  height: calc(var(--key) * 1.25);
  padding: 0;
  border: 4px solid #94a3b8;
  border-radius: 16px;
  background: #fff;
  color: var(--text);
  font-size: calc(var(--key) * 0.7);
  font-weight: 900;
  line-height: 1;
}
.num-box.whole { width: calc(var(--key) * 1.6); height: calc(var(--key) * 1.6); font-size: calc(var(--key) * 0.95); border-color: var(--from); }
button.num-box { cursor: pointer; }
button.num-box:hover { filter: none; border-color: var(--from); }
button.num-box.empty { border-style: dashed; }
button.num-box.active { border-color: var(--from); border-style: solid; box-shadow: 0 0 0 5px var(--glow); }
button.num-box.drop-target { border-color: #16a34a; border-style: solid; box-shadow: 0 0 0 6px rgb(22 163 74 / 0.4); transform: scale(1.06); }
.num-box.wrong { animation: shake 0.45s; border-color: #dc2626; }
@keyframes shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

.parts { display: flex; justify-content: center; gap: calc(var(--key) * 1.4); }

.number-pad { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: calc(var(--key) * 8.2); }
.pad-key {
  width: var(--key);
  height: var(--key);
  padding: 0;
  border: 0;
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, var(--from), var(--to));
  font-size: calc(var(--key) * 0.5);
  font-weight: 900;
  box-shadow: 0 4px 0 rgb(15 23 42 / 0.25);
  touch-action: none; /* dragging a key must not scroll the page */
  transition: transform 0.1s, box-shadow 0.1s;
}
.pad-key:hover { filter: brightness(1.1); }
.pad-key.pressed { transform: translateY(3px); box-shadow: 0 1px 0 rgb(15 23 42 / 0.25); }
.pad-key:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.drag-ghost {
  position: fixed;
  z-index: 100;
  display: grid;
  place-items: center;
  width: var(--key);
  height: var(--key);
  border-radius: 14px;
  color: #fff;
  background: linear-gradient(145deg, #1d4ed8, #1e3a8a);
  font-size: calc(var(--key) * 0.5);
  font-weight: 900;
  box-shadow: 0 12px 24px rgb(15 23 42 / 0.35);
  transform: translate(-50%, -60%) scale(1.1);
  pointer-events: none;
}

/* ---------- Composition tasks: task left, found compositions right (below on phones) ---------- */
.comp-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 24px; width: 100%; }
.comp-main { display: flex; flex-direction: column; align-items: center; gap: 28px; }
.comp-aside { display: flex; flex-direction: column; justify-content: flex-end; }
.found-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 0 0 2px #cbd5e1, 0 6px 16px rgb(15 23 42 / 0.1);
  font-size: 1.5rem;
  font-weight: 900;
  text-align: center;
}
.found-table th { padding: 6px; color: #fff; background: linear-gradient(115deg, var(--from), var(--to)); font-size: 1.7rem; }
.found-table td { width: 50%; height: 2.6rem; padding: 0; border-top: 2px solid #e2e8f0; }
.found-table td + td { border-left: 4px solid var(--separator); }
.found-table tr.filled td { animation: tile-in 0.35s ease-out; }
.found-table tr.flash td { animation: flash-cell 0.9s ease-out; }
@keyframes flash-cell { 30% { background: #fef3c7; } }
@media (max-width: 959px) {
  .comp-aside { max-width: 320px; width: 100%; margin: 0 auto; }
  .found-table td { height: 2.2rem; }
}
@media (min-width: 960px) {
  .comp-layout { grid-template-columns: minmax(0, 1fr) 220px; }
}

/* ---------- Number picker (start of the composition tasks) ---------- */
.number-picker { display: grid; grid-template-columns: repeat(5, var(--key)); gap: 16px; --key: clamp(54px, 12vw, 104px); }
.picker-key {
  height: var(--key);
  padding: 0;
  border-radius: 20px;
  color: #fff;
  background: linear-gradient(145deg, var(--from), var(--to));
  font-size: calc(var(--key) * 0.5);
  font-weight: 900;
  box-shadow: 0 8px 18px var(--glow);
  transition: transform 0.15s;
}
.picker-key:hover, .picker-key:focus-visible { filter: none; transform: translateY(-4px) scale(1.05); }

/* ---------- Action buttons: trash left, flag middle, submit right ---------- */
.play-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.action-button {
  display: inline-grid;
  place-items: center;
  width: 76px;
  height: 76px;
  padding: 0;
  border-radius: 22px;
  color: #fff;
  box-shadow: 0 8px 18px rgb(15 23 42 / 0.2);
  transition: transform 0.15s, opacity 0.15s;
}
.action-button .icon, .action-button svg { width: 40px; height: 40px; display: block; }
.action-button:hover { filter: none; transform: translateY(-3px); }
.action-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.action-clear { background: linear-gradient(145deg, #ef4444, #b91c1c); }
.action-done { background: linear-gradient(145deg, #16a34a, #15803d); margin-left: auto; }
.action-submit { background: linear-gradient(145deg, #2563eb, #1e3a8a); width: 96px; }
.action-clear[hidden] + .action-done { margin-left: 0; }
.action-done[hidden] + .action-submit { margin-left: auto; }
.action-submit[aria-disabled="true"] { opacity: 0.35; cursor: default; transform: none; }
/* Becoming ready: two gentle pulses draw the eye to the ✓ */
.action-submit.pulse { animation: ready-pulse 0.7s ease-in-out 2; }
@keyframes ready-pulse { 50% { transform: scale(1.12); box-shadow: 0 0 0 10px rgb(37 99 235 / 0.25), 0 8px 18px rgb(15 23 42 / 0.2); } }
.action-home { background: linear-gradient(145deg, #64748b, #334155); }

/* ---------- Squirrel feedback overlay ---------- */
.feedback-overlay {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: rgb(15 23 42 / 0.25);
}
.feedback-overlay img { width: min(60vmin, 420px); height: auto; animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1); }
.feedback-good { background: rgb(22 163 74 / 0.22); }
.feedback-bad { background: rgb(220 38 38 / 0.18); }
.feedback-bad img { animation: pop 0.35s cubic-bezier(0.2, 1.4, 0.4, 1), shake 0.45s 0.35s; }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } }

/* ---------- Demo: the hand shows how a task works (js/demo.js) ---------- */
.demo-button {
  flex: none;
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  padding: 0;
  border: 3px solid var(--from);
  border-radius: 14px;
  color: var(--from);
  background: #fff;
}
.demo-button .icon, .demo-button svg { width: 30px; height: 30px; display: block; }
.demo-button:hover { filter: none; background: var(--tint); }
.demo-button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.demo-overlay {
  position: fixed;
  inset: 0;
  z-index: 80; /* below the squirrel (90), which the demo shows too */
  display: flex;
  padding: 16px;
  overflow: auto;
  background: rgb(15 23 42 / 0.45);
  animation: demo-in 0.25s ease-out;
}
.demo-overlay.closing { opacity: 0; transition: opacity 0.25s; }
@keyframes demo-in { from { opacity: 0; } }
.demo-panel {
  flex: 1;
  width: 100%;
  max-width: 1240px;
  min-height: 0;
  margin: auto;
  border: 4px dashed var(--from); /* a copy of the screen, not the real one */
  background: rgb(255 255 255 / 0.97);
}
.demo-panel .play-actions { justify-content: flex-end; }
.demo-badge .icon, .demo-badge svg { width: 30px; height: 30px; display: block; }
.demo-panel .demo-pressed { filter: brightness(0.92); }

/* The hand: its fingertip sits at the translated point (the target's centre) */
.demo-hand {
  --move: 650ms;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1;
  pointer-events: none;
  transition: transform var(--move) cubic-bezier(0.45, 0, 0.25, 1);
}
.demo-hand svg {
  display: block;
  width: 64px;
  height: auto;
  margin: -2px 0 0 -24px;
  filter: drop-shadow(0 6px 8px rgb(15 23 42 / 0.35));
  transform-origin: 24px 2px;
  transition: transform 0.15s;
}
.demo-hand.pressed svg { transform: scale(0.85); }
.demo-hand.pressed::after { /* ripple at the fingertip */
  content: "";
  position: absolute;
  left: -18px;
  top: -18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.7);
  box-shadow: 0 0 0 3px var(--from);
  animation: demo-ripple 0.35s ease-out forwards;
}
@keyframes demo-ripple { from { transform: scale(0.3); opacity: 1; } to { transform: scale(1.3); opacity: 0; } }

/* ---------- End screen ---------- */
.end-screen { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; }
.end-squirrel { width: min(46vmin, 300px); height: auto; animation: pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1); }
.end-score { display: flex; align-items: baseline; gap: 10px; margin: 0; font-size: clamp(3rem, 9vw, 5rem); font-weight: 900; line-height: 1; }
.end-correct { color: #15803d; }
.end-slash, .end-total { color: var(--muted); }
.end-nuts { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; max-width: 640px; }
.end-nut { width: 48px; height: 48px; animation: tile-in 0.4s ease-out backwards; }
.end-nut:nth-child(n) { animation-delay: calc(var(--i, 0) * 60ms); }
.end-nut.missing { filter: grayscale(1); opacity: 0.25; }
.end-actions { display: flex; gap: 20px; margin-top: 8px; }

@media (max-width: 719px) {
  .play { padding: 12px; gap: 14px; }
  .action-button { width: 64px; height: 64px; }
  .action-submit { width: 80px; }
  .nut-counter img { width: 34px; height: 34px; }
  .nut-counter { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  .feedback-overlay img, .end-squirrel, .end-nut, .found-table tr.filled td, .found-table tr.flash td, .num-box.wrong, .nut-counter.bump, .strip-row.flash,
  .action-submit.pulse, .demo-overlay, .demo-hand.pressed::after { animation: none; }
}

/* ---------- Results page ---------- */
main.results-page { max-width: 980px; }
.results-table { width: 100%; border-collapse: collapse; }
.results-table th, .results-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--border); }
.results-table th { font-size: 0.85rem; color: var(--muted); }
.results-table td.num { font-variant-numeric: tabular-nums; }
.results-scroll { overflow-x: auto; }

/* Landing page note for adults */
.landing-note { margin: 0; padding: 20px 24px; border-radius: 20px; background: rgb(255 255 255 / 0.78); }
.landing-hero-squirrel { display: none; }
@media (min-width: 1060px) {
  .landing-hero-squirrel { position: absolute; right: 48px; bottom: 0; display: block; width: 300px; height: auto; }
  .landing .gradient-hero > :not(.landing-hero-squirrel) { max-width: 60%; }
}
