/* FrenchQuest — bold, rounded, high-contrast UI with Duolingo-style motion. */

:root {
  --green: #58cc02;
  --green-dark: #4aa802;
  --green-soft: #e8f8dc;
  --blue: #1cb0f6;
  --blue-dark: #1899d6;
  --blue-soft: #ddf4ff;
  --red: #ff4b4b;
  --red-dark: #e03e3e;
  --red-soft: #ffe0e0;
  --gold: #ffc800;
  --gold-dark: #e0ac00;
  --purple: #ce82ff;
  --ink: #2b2d33;
  --muted: #777d8a;
  --bg: #f7f8fa;
  --card: #ffffff;
  --line: #e4e7ec;
  --line-strong: #cfd4dc;
  --locked: #e9ecf1;
  --radius: 18px;
  --shadow: 0 2px 0 var(--line-strong);
  --ease-pop: cubic-bezier(.34, 1.56, .64, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --green-soft: #1d3312;
    --blue-soft: #0f2d3d;
    --red-soft: #3a1717;
    --ink: #eef1f5;
    --muted: #9aa2b1;
    --bg: #15171c;
    --card: #1d2026;
    --line: #2c313a;
    --line-strong: #3a414d;
    --locked: #262b33;
  }
}
:root[data-theme="dark"] {
  --green-soft: #1d3312; --blue-soft: #0f2d3d; --red-soft: #3a1717;
  --ink: #eef1f5; --muted: #9aa2b1; --bg: #15171c; --card: #1d2026;
  --line: #2c313a; --line-strong: #3a414d; --locked: #262b33;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}
button, input, textarea, select { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; line-height: 1.2; letter-spacing: -0.01em; }
p { margin: 0; }

#fx { position: fixed; inset: 0; pointer-events: none; z-index: 60; }
.app { min-height: 100%; }

/* ---------------------------------------------------------------- buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: none; border-radius: 14px; padding: 13px 20px;
  font-weight: 800; font-size: 15px; letter-spacing: .02em; text-transform: uppercase;
  cursor: pointer; background: var(--locked); color: var(--muted);
  transition: transform .08s ease, filter .15s ease, box-shadow .08s ease;
  box-shadow: 0 4px 0 var(--line-strong);
}
.btn:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--line-strong); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--green); color: #fff; box-shadow: 0 4px 0 var(--green-dark); }
.btn-primary:active:not(:disabled) { box-shadow: 0 1px 0 var(--green-dark); }
.btn-blue { background: var(--blue); color: #fff; box-shadow: 0 4px 0 var(--blue-dark); }
.btn-blue:active:not(:disabled) { box-shadow: 0 1px 0 var(--blue-dark); }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 4px 0 var(--red-dark); }
.btn-gold { background: var(--gold); color: #4a3a00; box-shadow: 0 4px 0 var(--gold-dark); }
.btn-ghost { background: transparent; box-shadow: none; color: var(--muted); border: 2px solid var(--line); }
.btn-ghost:active { transform: translateY(2px); }
.btn-sm { padding: 9px 14px; font-size: 13px; border-radius: 12px; box-shadow: 0 3px 0 var(--line-strong); }
.btn-wide { width: 100%; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* ------------------------------------------------------- language switch */
.langpick {
  display: inline-flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: var(--locked); flex: none;
}
.langbtn {
  border: none; background: transparent; color: var(--muted); cursor: pointer;
  font-weight: 800; font-size: 12px; letter-spacing: .06em; padding: 5px 10px; border-radius: 999px;
  transition: background .18s ease, color .18s ease, transform .12s var(--ease-pop);
}
.langbtn:hover { color: var(--ink); }
.langbtn.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, .14); }
.langbtn:active { transform: scale(.94); }
.page-top { display: flex; justify-content: flex-start; padding-bottom: 4px; }

/* ------------------------------------------------------------------ cards */
.card {
  background: var(--card); border: 2px solid var(--line); border-radius: var(--radius);
  padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.center { text-align: center; }
.stack { display: grid; gap: 14px; }
.row { display: flex; align-items: center; gap: 12px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }

/* ------------------------------------------------------------------ chrome */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  padding: 12px 20px; background: color-mix(in srgb, var(--card) 88%, transparent);
  backdrop-filter: blur(10px); border-bottom: 2px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 18px; letter-spacing: -.02em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center;
  background: linear-gradient(145deg, var(--green), #8ee000); color: #fff; font-size: 16px;
}
.stat { display: flex; align-items: center; gap: 6px; font-weight: 800; font-size: 15px; }
.stat-ico { font-size: 18px; line-height: 1; }
.stat-gold { color: var(--gold-dark); }
.stat-red { color: var(--red); }
.stat-blue { color: var(--blue-dark); }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px;
  background: var(--blue-soft); color: var(--blue-dark); font-weight: 800; font-size: 13px;
}
.pill-green { background: var(--green-soft); color: var(--green-dark); }
.pill-red { background: var(--red-soft); color: var(--red-dark); }
.pill-gold { background: #fff4cc; color: #8a6b00; }
.pill-grey { background: var(--locked); color: var(--muted); }

.page { max-width: 820px; margin: 0 auto; padding: 22px 18px 90px; }

/* ------------------------------------------------------------- unit header */
.unit-head { display: flex; gap: 18px; align-items: center; }
.ring { position: relative; width: 74px; height: 74px; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring .track { stroke: var(--line); }
.ring .fill { stroke: var(--green); stroke-linecap: round; transition: stroke-dashoffset .9s var(--ease-pop); }
.ring-label { position: absolute; inset: 0; display: grid; place-items: center; font-weight: 900; font-size: 15px; }
.cycle-dots { display: flex; gap: 6px; }
.cycle-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--locked); transition: background .3s, transform .3s var(--ease-pop); }
.cycle-dot.on { background: var(--gold); transform: scale(1.12); }

/* --------------------------------------------------------------- the path */
.path { display: grid; gap: 4px; margin: 6px 0 4px; }
.path-row { display: flex; align-items: center; gap: 14px; min-height: 76px; }
.node-wrap { position: relative; display: grid; place-items: center; perspective: 900px; }
/*
 * A puck, not a disc: the face is an ellipse of about 1.55:1 — matching the
 * reference — and the solid offset shadow below it reads as the side wall,
 * so the whole thing looks like a counter lying on the path.
 */
.node {
  position: relative; flex: none;
  width: 66px; height: 42px; border-radius: 50%; border: none; cursor: pointer;
  display: grid; place-items: center; font-weight: 900; font-size: 19px; color: #fff;
  background: var(--locked); color: var(--muted);
  box-shadow: 0 10px 0 var(--line-strong);
  transition: transform .12s ease, box-shadow .12s ease;
}

/*
 * The gloss, measured off the reference: a flat face with a broad soft light
 * spreading out from the star — near-white at the star's edge, back to the base
 * colour around three quarters of the way to the rim. It is painted as a
 * gradient layer on the node rather than a filter on the star, so the circle's
 * own border-radius clips it instead of letting it bleed onto the page.
 */
.node::before {
  content: '';
  position: absolute; inset: 0; border-radius: 50%; pointer-events: none;
  background: radial-gradient(ellipse 62% 74% at 50% 46%,
    rgba(255, 255, 255, .44) 24%,
    rgba(255, 255, 255, .31) 50%,
    rgba(255, 255, 255, .10) 68%,
    rgba(255, 255, 255, 0) 80%);
}
.node > svg {
  position: relative; display: block;
  filter: drop-shadow(0 0 3px rgba(255, 255, 255, .5));
}
.node:active:not(:disabled) { transform: translateY(6px); box-shadow: 0 4px 0 var(--line-strong); }
.node:disabled { cursor: not-allowed; }
.node.done { background: var(--green); color: #fff; box-shadow: 0 10px 0 var(--green-dark); }
.node.current { background: var(--blue); color: #fff; box-shadow: 0 10px 0 var(--blue-dark); }
.node.exam { background: var(--gold); color: #4a3a00; box-shadow: 0 11px 0 var(--gold-dark); width: 74px; height: 48px; }
.node.exam:disabled { background: var(--locked); color: var(--muted); box-shadow: 0 11px 0 var(--line-strong); }
.node.current::after {
  content: ''; position: absolute; inset: -9px; border-radius: 50%;
  border: 3px solid var(--blue); opacity: .45; animation: halo 1.9s ease-out infinite;
}
.node-hw {
  position: absolute; top: -4px; right: -6px; width: 26px; height: 26px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; background: var(--card);
  border: 2px solid var(--line); box-shadow: 0 1px 2px rgba(0,0,0,.12);
  padding: 0; font-family: inherit; cursor: pointer;
  transition: transform .14s var(--ease-pop);
}
.node-hw:hover { transform: scale(1.18); }
.node-hw:active { transform: scale(.94); }
.node-hw.due { border-color: var(--gold); background: #fff8df; animation: nudge 1.6s ease-in-out infinite; }
.node-hw.ok { border-color: var(--green); background: var(--green-soft); }
.node-hw.bad { border-color: var(--red); background: var(--red-soft); }
.node-meta { font-weight: 700; }
.node-meta .sub { font-size: 13px; color: var(--muted); font-weight: 600; }

/* ------------------------------------------------------------- level grid */
.level-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.level-card {
  text-align: left; cursor: pointer; background: var(--card); border: 3px solid var(--line);
  border-radius: 16px; padding: 14px; transition: border-color .15s, transform .15s var(--ease-pop);
}
.level-card:hover { transform: translateY(-3px); }
.level-card.sel { border-color: var(--green); background: var(--green-soft); }
.level-code { font-size: 22px; font-weight: 900; }

/* --------------------------------------------------------------- exercises */
.player { max-width: 720px; margin: 0 auto; padding: 16px 18px 120px; }
.player-top { display: flex; align-items: center; gap: 14px; margin-bottom: 22px; }
.bar { flex: 1; height: 16px; border-radius: 999px; background: var(--locked); overflow: hidden; }
.bar > span { display: block; height: 100%; border-radius: 999px; background: var(--green);
  transition: width .45s var(--ease-pop); position: relative; }
.bar > span::after { content:''; position:absolute; inset:3px 6px auto 6px; height:4px; border-radius:999px; background:rgba(255,255,255,.35); }
.hearts { display: flex; gap: 3px; font-size: 18px; }
.heart-lost { filter: grayscale(1); opacity: .35; transform: scale(.85); transition: all .3s; }
.ex-instruction { font-size: 22px; font-weight: 900; margin-bottom: 18px; }
.ex-prompt { font-size: 26px; font-weight: 800; margin: 10px 0 20px; }
.ex-prompt-sm { font-size: 19px; font-weight: 700; margin: 10px 0 18px; }
.choices { display: grid; gap: 10px; }
.choice {
  text-align: left; background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px;
  border-radius: 14px; padding: 15px 16px; cursor: pointer; font-weight: 700;
  transition: transform .1s, border-color .15s, background .15s;
}
.choice:hover { border-color: var(--line-strong); }
.choice.sel { border-color: var(--blue); background: var(--blue-soft); color: var(--blue-dark); }
.choice.right { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); }
.choice.wrong { border-color: var(--red); background: var(--red-soft); color: var(--red-dark); }
.inp {
  width: 100%; padding: 14px 16px; border-radius: 14px; border: 2px solid var(--line);
  background: var(--card); font-size: 17px; font-weight: 600;
}
.inp:focus { outline: none; border-color: var(--blue); }
textarea.inp { min-height: 140px; resize: vertical; line-height: 1.6; }
.tokens { display: flex; flex-wrap: wrap; gap: 8px; min-height: 56px; padding: 10px;
  border-bottom: 2px dashed var(--line); margin-bottom: 16px; }
.token {
  background: var(--card); border: 2px solid var(--line); border-bottom-width: 4px; border-radius: 12px;
  padding: 8px 13px; font-weight: 700; cursor: pointer; transition: transform .12s var(--ease-pop), opacity .12s;
}
.token:hover { transform: translateY(-2px); }
.token.used { opacity: .25; pointer-events: none; }
.speak {
  width: 92px; height: 92px; border-radius: 22px; border: none; cursor: pointer; font-size: 34px;
  background: var(--blue); color: #fff; box-shadow: 0 5px 0 var(--blue-dark); display: grid; place-items: center;
}
.speak:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--blue-dark); }
.speak.playing { animation: pulse .7s ease-in-out infinite; }
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

.footbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  border-top: 2px solid var(--line); background: var(--card);
  padding: 14px 18px calc(14px + env(safe-area-inset-bottom));
}
.footbar-inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 14px; }
.verdict { flex: 1; font-weight: 800; }
.verdict .expected { font-weight: 700; color: var(--muted); font-size: 14px; display: block; }
.footbar.ok { background: var(--green-soft); border-color: var(--green); }
.footbar.ko { background: var(--red-soft); border-color: var(--red); }
.footbar.ok .verdict { color: var(--green-dark); }
.footbar.ko .verdict { color: var(--red-dark); }

/* ------------------------------------------------------------------ exam */
.q-card { border-top: 2px solid var(--line); padding: 18px 0; }
.q-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.q-num { width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--blue); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; }
.q-pts { margin-left: auto; font-size: 12px; font-weight: 800; color: var(--muted); white-space: nowrap; }
.diff { display: inline-flex; gap: 2px; }
.diff i { width: 6px; height: 6px; border-radius: 50%; background: var(--line-strong); display: block; }
.diff i.on { background: var(--gold); }
.score-big { font-size: 56px; font-weight: 900; line-height: 1; }

/* ------------------------------------------------------------- drop zone */
.drop {
  border: 3px dashed var(--line-strong); border-radius: 18px; padding: 26px; text-align: center;
  transition: background .2s, border-color .2s, transform .2s var(--ease-pop); cursor: pointer;
}
.drop.hot { border-color: var(--blue); background: var(--blue-soft); transform: scale(1.015); }
.drop-ico { font-size: 34px; }
.scan-log { display: grid; gap: 6px; margin-top: 12px; font-size: 14px; }
.scan-step { display: flex; gap: 8px; align-items: center; opacity: 0; transform: translateY(6px);
  animation: riseIn .4s var(--ease-pop) forwards; }
.hw-task { border-top: 2px solid var(--line); padding: 14px 0; }
.ok-ico { color: var(--green-dark); font-weight: 900; }
.ko-ico { color: var(--red-dark); font-weight: 900; }

/* ----------------------------------------------------------------- chests */
.chest-stage {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center;
  background: var(--chest-bg, #16202b);
  transition: background .6s ease;
  cursor: pointer; user-select: none; -webkit-user-select: none;
  --glow: #99a3b2; --chest-bg: #16202b;
}

/* Four-point sparkles scattered round the chest, as in the reference art. */
.chest-sparkles { position: absolute; inset: 0; pointer-events: none; }
.chest-spark {
  position: absolute; width: 16px; height: 16px; opacity: 0;
  background: var(--glow);
  clip-path: polygon(50% 0%, 61% 39%, 100% 50%, 61% 61%, 50% 100%, 39% 61%, 0% 50%, 39% 39%);
  transition: opacity .5s ease;
}
.chest-stage.revealed .chest-spark { opacity: .85; animation: sparkTwinkle 2.2s ease-in-out infinite; }
.chest-spark:nth-child(2n) { width: 11px; height: 11px; animation-delay: .5s; }
.chest-spark:nth-child(3n) { width: 20px; height: 20px; animation-delay: 1.1s; }
@keyframes sparkTwinkle {
  0%, 100% { transform: scale(1); opacity: .85; }
  50% { transform: scale(.72); opacity: .45; }
}
.chest-inner { position: relative; display: grid; justify-items: center; gap: 4px; padding: 20px; text-align: center; }

/* Light behind the chest, which only comes up once the rarity is known. */
.chest-rays {
  position: absolute; top: 40px; width: 460px; height: 460px; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--glow) 55%, transparent) 0%,
    color-mix(in srgb, var(--glow) 12%, transparent) 42%, transparent 68%);
  opacity: 0; transform: scale(.5); transition: opacity .5s ease, transform .6s var(--ease-pop);
  pointer-events: none;
}
.chest-stage.revealed .chest-rays { opacity: .85; transform: scale(1); }
.chest-stage.opened .chest-rays { opacity: 1; transform: scale(1.25); }

.chest-holder { position: relative; }
.chest-art { display: block; filter: drop-shadow(0 10px 16px rgba(0, 0, 0, .28)); }
.chest-stage.revealed .chest-art { filter: drop-shadow(0 0 26px color-mix(in srgb, var(--glow) 70%, transparent)); }

/* The lid lifts straight up off the chest — no tilt. */
.chest-lid { transition: transform .55s var(--ease-pop); }
.chest-stage.opened .chest-lid { transform: translateY(-42px); }

/* Light out of the open chest, held back until the lid moves. */
.chest-light {
  opacity: 0; transform: scale(.55); transform-origin: 100px 96px;
  transition: opacity .45s ease .08s, transform .6s var(--ease-pop) .08s;
  filter: blur(2px);
}
.chest-stage.opened .chest-light { opacity: .92; transform: scale(1); }
.chest-stage.opened .chest-art { animation: chestPop .6s var(--ease-pop); }

@keyframes chestPop {
  0% { transform: scale(1); }
  35% { transform: scale(1.14) translateY(-10px); }
  100% { transform: scale(1); }
}

/* Every tap jolts it a little harder than a plain wobble. */
.shake-hard { animation: chestShake .42s cubic-bezier(.36, .07, .19, .97); }
@keyframes chestShake {
  10%, 90% { transform: translateX(-4px) rotate(-2deg); }
  20%, 80% { transform: translateX(6px) rotate(2.5deg); }
  30%, 50%, 70% { transform: translateX(-9px) rotate(-3.5deg); }
  40%, 60% { transform: translateX(9px) rotate(3.5deg); }
}

.chest-title {
  color: #fff; font-size: 26px; margin-top: 18px;
  text-transform: uppercase; letter-spacing: .12em; font-weight: 900;
}
.chest-stage.revealed .chest-title { color: var(--title, #fff); }
.chest-stage.rarity-mega .chest-title { font-size: 32px; letter-spacing: .04em; }
.chest-sub { color: rgba(255, 255, 255, .72); font-size: 15px; font-weight: 600; min-height: 22px; }

.chest-dots { display: flex; gap: 10px; margin-top: 16px; }
.chest-dot {
  width: 11px; height: 11px; border-radius: 50%; background: rgba(255, 255, 255, .22);
  transition: background .2s ease, transform .2s var(--ease-pop);
}
.chest-dot.on { background: var(--glow); transform: scale(1.3); }

.chest-foot { margin-top: 18px; min-width: 260px; }
.chest-reward { display: flex; align-items: center; justify-content: center; gap: 10px; }
.chest-gem-ico { font-size: 34px; }
.chest-gems { font-size: 44px; font-weight: 900; color: #fff; }

/* The chest waiting on the dashboard. */
.chest-card { border-color: var(--gold) !important; background: color-mix(in srgb, var(--gold) 9%, var(--card)); }
.chest-card .chest-mini { flex: none; display: grid; animation: nudge 1.8s ease-in-out infinite; }

/* --------------------------------------------------------------- overlays */
/* The class sets display:grid, which would beat [hidden] from the UA sheet and
   leave an invisible layer swallowing every click — so hide it explicitly. */
.overlay[hidden] { display: none; }
.overlay {
  position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; padding: 20px;
  background: rgba(16, 18, 22, .55); backdrop-filter: blur(3px);
  animation: fadeIn .22s ease both;
}
.sheet {
  background: var(--card); border-radius: 24px; padding: 28px; max-width: 460px; width: 100%;
  text-align: center; animation: popIn .45s var(--ease-pop) both; position: relative; overflow: hidden;
}
.sheet-wide { max-width: 640px; text-align: left; }
.sheet h2 { font-size: 26px; margin-bottom: 8px; }
.sheet-emoji { font-size: 60px; display: block; animation: bounceIn .6s var(--ease-pop) both; }
.burst { position: absolute; inset: -40%; background: conic-gradient(from 0deg, transparent 0 8deg, color-mix(in srgb, var(--gold) 45%, transparent) 8deg 16deg, transparent 16deg 32deg);
  animation: spin 9s linear infinite; opacity: .35; pointer-events: none; }
.levelbadge {
  width: 110px; height: 110px; margin: 6px auto 12px; border-radius: 28px; display: grid; place-items: center;
  font-size: 34px; font-weight: 900; color: #fff;
  background: linear-gradient(145deg, var(--purple), var(--blue));
  box-shadow: 0 10px 30px color-mix(in srgb, var(--blue) 40%, transparent);
  animation: badgeIn .7s var(--ease-pop) both;
}
.xp-count { font-size: 40px; font-weight: 900; color: var(--gold-dark); }
.flame { display: inline-block; animation: flicker 1.5s ease-in-out infinite; }

/* Top-right, not centred: a centred toast sat on top of the card it announces. */
.toasts { position: fixed; top: 72px; right: 16px; z-index: 80;
  display: grid; gap: 8px; width: min(360px, calc(100% - 32px)); justify-items: stretch; }
@media (max-width: 560px) { .toasts { left: 16px; right: 16px; width: auto; } }
.toast {
  background: var(--card); border: 2px solid var(--line); border-left-width: 6px; border-radius: 14px;
  padding: 12px 14px; font-weight: 700; box-shadow: 0 8px 24px rgba(0,0,0,.14);
  animation: dropIn .35s var(--ease-pop) both;
}
.toast.good { border-left-color: var(--green); }
.toast.bad { border-left-color: var(--red); }
.toast.info { border-left-color: var(--blue); }
.toast.out { animation: dropOut .3s ease forwards; }

/* --------------------------------------------------------------- feed */
.feed { display: grid; gap: 8px; }
.feed-item { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; padding: 8px 0; border-top: 1px solid var(--line); }
.feed-item:first-child { border-top: none; }
.feed-ico { font-size: 16px; }
.feed-day { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; }

/* The card a lesson badge just jumped to, so the eye lands on it. */
@keyframes cardFlash {
  0%, 100% { box-shadow: 0 0 0 0 transparent; }
  25%, 75% { box-shadow: 0 0 0 5px color-mix(in srgb, var(--gold) 55%, transparent); }
}
.card.flash { animation: cardFlash 1.5s ease-in-out 2; }

/* ----------------------------------------------------------- transitions */
.screen { animation: screenIn .3s ease both; }
.pop-in { animation: popIn .4s var(--ease-pop) both; }
.rise { animation: riseIn .45s var(--ease-pop) both; }
.rise-2 { animation: riseIn .45s .06s var(--ease-pop) both; }
.rise-3 { animation: riseIn .45s .12s var(--ease-pop) both; }
.shake { animation: shake .4s ease; }
.bump { animation: bump .5s var(--ease-pop); }

@keyframes screenIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { 0% { opacity: 0; transform: scale(.88) translateY(14px); } 100% { opacity: 1; transform: none; } }
@keyframes riseIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes dropIn { from { opacity: 0; transform: translateY(-16px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes dropOut { to { opacity: 0; transform: translateY(-14px) scale(.96); } }
@keyframes bounceIn { 0% { transform: scale(0) rotate(-20deg); } 60% { transform: scale(1.25) rotate(6deg); } 100% { transform: scale(1); } }
@keyframes badgeIn { 0% { transform: scale(.4) rotate(-12deg); opacity: 0; } 70% { transform: scale(1.12) rotate(4deg); } 100% { transform: none; opacity: 1; } }
@keyframes shake { 10%, 90% { transform: translateX(-3px); } 20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); } }
@keyframes bump { 0% { transform: scale(1); } 35% { transform: scale(1.3); } 100% { transform: scale(1); } }
/*
 * The lesson you just finished: it lifts, turns over twice and drops back onto
 * the path, brightening in the air and settling to its normal green.
 *
 * It turns deliberately — roughly two seconds for the two turns — so both
 * flips read rather than blurring past.
 *
 * Everything here animates `translate`, `rotate`, `scale`, `opacity` and
 * `filter` — properties the compositor can run on its own. The first version
 * keyframed `background` and `box-shadow`, which repaint the element on every
 * frame and made the flip stutter. Each part also carries its own easing:
 * the lift decelerates going up and accelerates coming down, while the spin
 * runs at its own even pace, which is what reads as "smooth".
 */
.node-wrap.landing { z-index: 2; }

/* The shadow it casts on the path — shrinks as it rises, spreads on impact. */
.node-wrap.landing::before {
  content: '';
  position: absolute; left: 50%; bottom: -16px;
  width: 58px; height: 11px; margin-left: -29px;
  border-radius: 50%; background: rgba(0, 0, 0, .28); filter: blur(3px);
  animation: nodeShadow 2.1s both;
}
@keyframes nodeShadow {
  0%   { opacity: .34; scale: 1 1;    animation-timing-function: cubic-bezier(.16, .84, .44, 1); }
  40%  { opacity: .10; scale: .5 .55; animation-timing-function: cubic-bezier(.55, .06, .68, .19); }
  72%  { opacity: .40; scale: 1.18 1; animation-timing-function: ease-out; }
  82%  { opacity: .28; scale: .92 .9; }
  100% { opacity: .30; scale: 1 1; }
}

.node-wrap.landing .node {
  animation:
    nodeLift 2.1s both,
    nodeSpin 1.95s cubic-bezier(.38, .02, .36, 1) both,
    nodeSquash 2.1s both,
    nodeSettle 2.1s ease-out both;
  will-change: translate, rotate, scale, filter;
}

/* Up with gravity easing, down with gravity easing, then a small rebound. */
@keyframes nodeLift {
  0%   { translate: 0 0;     animation-timing-function: cubic-bezier(.16, .84, .44, 1); }
  40%  { translate: 0 -42px; animation-timing-function: cubic-bezier(.55, .06, .68, .19); }
  72%  { translate: 0 0;     animation-timing-function: cubic-bezier(.16, .84, .44, 1); }
  84%  { translate: 0 -9px;  animation-timing-function: cubic-bezier(.55, .06, .68, .19); }
  94%  { translate: 0 0;     animation-timing-function: ease-out; }
  100% { translate: 0 0; }
}

/* Two full turns at one even pace — no mid-flip stalls. */
@keyframes nodeSpin {
  0%   { rotate: x 0deg; }
  100% { rotate: x 720deg; }
}

/* Squash on contact, a little overshoot, then settle. */
@keyframes nodeSquash {
  0%, 68% { scale: 1 1; }
  74%     { scale: 1.13 .85; }
  82%     { scale: .95 1.06; }
  90%     { scale: 1.03 .97; }
  100%    { scale: 1 1; }
}

/* Catches the light while it is in the air, back to normal once it lands. */
@keyframes nodeSettle {
  0%   { filter: brightness(1.22) saturate(1.1); }
  66%  { filter: brightness(1.18) saturate(1.08); }
  100% { filter: brightness(1) saturate(1); }
}

@keyframes halo { 0% { transform: scale(.95); opacity: .5; } 100% { transform: scale(1.3); opacity: 0; } }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
@keyframes nudge { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-3px); } }
@keyframes flicker { 0%, 100% { transform: scale(1) rotate(-2deg); } 50% { transform: scale(1.14) rotate(3deg); } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important;
    transition-duration: .01ms !important; }
}

@media (max-width: 560px) {
  .page { padding: 16px 14px 90px; }
  .ex-prompt { font-size: 22px; }
  .node { width: 58px; height: 37px; font-size: 17px; }
  .topbar { gap: 10px; padding: 10px 14px; }
  .brand span.brand-text { display: none; }
}
