:root {
  --paper: #f2f4fa;
  --white: #ffffff;
  --ink: #0b0d17;
  --ink-2: #4a4f63;
  --blue: #2a3cff;
  --blue-soft: #e6e8f0;
  --lime: #d6ff3d;
  --pink: #ff8fd0;
  --pink-soft: #ffe0f2;
  /* level colors: A1 lime, A2 cobalt, B1 orange */
  --a1: #d6ff3d; --a2: #2a3cff; --b1: #ff8a3d;
  --line: 2px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  /* one control height everywhere; only primary actions are taller */
  --ctl: 44px;
  --ctl-lg: 52px;
  --ctl-sm: 40px;   /* secondary icons in the sheet header */
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(11,13,23,.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11,13,23,.04) 1px, transparent 1px);
  background-size: 32px 32px;
  color: var(--ink);
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.5;
}
body.no-scroll { overflow: hidden; }
html, body { overflow-x: clip; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2, h3 { margin: 0; line-height: 1; letter-spacing: -0.02em; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 56px; padding: 0 clamp(16px, 4vw, 48px);
  background: var(--white); border-bottom: var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; text-decoration: none; font-size: 18px; }
.logo-mark { display: block; width: 34px; height: 34px; flex: none; }
.logo-tld { color: var(--blue); }
.topnav { display: flex; gap: 6px; }
.topnav a { text-decoration: none; font-family: var(--mono); font-size: 13px; text-transform: uppercase; padding: 5px 10px; border: 2px solid transparent; }
.topnav a:hover { border: var(--line); background: var(--lime); }

main { max-width: 1180px; margin: 0 auto; padding: 0 clamp(16px, 4vw, 48px); }

/* ---------- intro (compact) ---------- */
.tool-section { padding: 22px 0 8px; max-width: 820px; margin: 0 auto; }
.intro { display: flex; align-items: center; gap: 12px 28px; flex-wrap: wrap; margin-bottom: 18px; }
.intro p { flex: 1 1 260px; }
h1 { font-size: clamp(36px, 4.6vw, 52px); font-weight: 800; letter-spacing: -0.04em; white-space: nowrap; }
.h1-hl { display: inline-block; background: var(--lime); border: var(--line); box-shadow: var(--shadow-sm); padding: 0 .14em .04em; transform: rotate(-2deg); }
.intro p { margin: 0; color: var(--ink-2); max-width: 520px; font-size: 17px; line-height: 1.4; }

/* level badge */
.lvl {
  display: inline-grid; place-items: center; min-width: 26px; height: 18px; padding: 0 4px;
  font-family: var(--mono); font-size: 11px; font-weight: 600; line-height: 1; border: 1.5px solid var(--ink); color: var(--ink);
}
.lvl-A1 { background: var(--a1); }
.lvl-A2 { background: var(--a2); color: var(--white); }
.lvl-B1 { background: var(--b1); }

/* ---------- trainer ---------- */
/* main progress block: the key indicator on the page */
.hero-prog { padding: 18px 20px 20px; border-bottom: var(--line); background: var(--paper); }
.hp-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.goal-btn {
  display: inline-flex; align-items: center; gap: 8px; height: var(--ctl); padding: 0 12px; white-space: nowrap;
  border: var(--line); background: var(--white); font: 600 14px var(--mono); box-shadow: var(--shadow-sm);
  transition: transform .08s, box-shadow .08s;
}
.goal-btn:hover { transform: translate(-1px, -1px); box-shadow: var(--shadow); }
.goal-btn .g-lab { color: var(--ink-2); text-transform: uppercase; font-size: 12px; letter-spacing: .06em; }
.goal-btn .g-caret { margin-left: 2px; }
.goal-btn:active { transform: translate(2px, 2px); box-shadow: none; }
.hp-nums { display: flex; gap: 32px; margin-top: 22px; }
.hp-num { display: grid; gap: 8px; }
.hp-big { font-size: clamp(48px, 7vw, 60px); font-weight: 800; letter-spacing: -0.04em; line-height: .85; }
.hp-key { display: flex; align-items: center; gap: 6px; font: 13px var(--mono); color: var(--ink-2); }
.hp-key .sw { margin: 0; }
.hp-key .info-btn { margin-left: 2px; }
.pbar {
  position: relative; height: 26px; margin-top: 22px; border: var(--line); background: var(--white); overflow: hidden; box-shadow: var(--shadow-sm);
}
/* track = the levels inside the goal, in the same colours as the level badges; black = learned, hatched = learning */
.ptrack { position: absolute; inset: 0; }
.pprog { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: repeating-linear-gradient(45deg, #6f7386 0 3px, #b9bcc9 3px 6px); border-right: 2px solid var(--ink); transition: width .4s; }
.pfill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--ink); transition: width .4s; }
.pprog[style*="width: 0"] { border-right: 0; }
.pticks { display: grid; margin-top: 10px; font-family: var(--mono); font-size: 13px; color: var(--ink-2); }
.pticks span { display: flex; align-items: center; gap: 6px; }
.pticks .lvl { height: 20px; font-size: 12px; }
.tag-tricky { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; background: var(--pink); color: var(--ink); border: 1.5px solid var(--ink); padding: 1px 6px; }
.inline-ico { font-size: .95em; }
.linkbtn { border: 0; background: none; padding: 0; font: inherit; color: var(--ink); text-decoration: underline; text-underline-offset: 2px; }
.btn.btn-big { height: var(--ctl-lg); padding: 0 28px; font-size: 18px; }
.panel .small { font-size: 14px; margin-top: 14px; }

.trainer { border: var(--line); background: var(--white); box-shadow: var(--shadow); }
kbd { font-family: var(--mono); font-size: 11px; border: 1.5px solid currentColor; padding: 0 4px; opacity: .7; }
@media (hover: none), (pointer: coarse), (max-width: 640px) { kbd { display: none; } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: var(--ctl); padding: 0 18px; border: var(--line); font-weight: 600; font-size: 16px; line-height: 1; text-decoration: none;
  box-shadow: var(--shadow-sm); transition: transform .08s, box-shadow .08s; background: var(--white);
}
.btn:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow); }
.btn:active { transform: translate(3px, 3px); box-shadow: none; }
.btn-ink { background: var(--ink); color: var(--white); }
.btn-lime { background: var(--lime); }
.btn-pink { background: var(--pink); }
.icon-btn {
  display: grid; place-items: center; width: var(--ctl); height: var(--ctl); padding: 0; flex: none;
  border: var(--line); background: var(--white); font: 800 18px/1 var(--display); color: var(--ink);
  box-shadow: var(--shadow-sm); transition: transform .08s, box-shadow .08s;
}
.icon-btn:hover:not(:disabled) { transform: translate(-1px, -1px); box-shadow: var(--shadow); }
.icon-btn:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: none; }
.icon-btn:disabled { opacity: .3; cursor: default; box-shadow: none; }

/* start card on the landing */
.start { margin: 0 auto; padding: 26px 20px 24px; }
.start.panel .big { font-size: clamp(34px, 5vw, 48px); }

/* panels */
.panel { text-align: center; max-width: 520px; }
.panel .big { font-size: clamp(52px, 8vw, 84px); font-weight: 800; letter-spacing: -0.04em; line-height: 1; }
.panel p { color: var(--ink-2); margin: 12px 0 0; }
.panel .row { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 20px; }
/* round result */
.result { width: min(440px, 100%); }
.r-chip { display: inline-block; max-width: 100%; padding: 3px 8px; border: 1.5px solid var(--ink); background: var(--white); font: 600 12px var(--mono); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.result .big { margin-top: 14px; }
.panel .r-cap { margin-top: 6px; }
.r-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 22px; }
.r-tile { display: grid; gap: 8px; padding: 12px 6px; border: var(--line); background: var(--white); box-shadow: var(--shadow-sm); }
.r-tile b { font-size: 28px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }
.r-tile span { display: flex; align-items: center; justify-content: center; gap: 5px; font: 12px var(--mono); color: var(--ink-2); white-space: nowrap; }
.r-tile .sw { margin: 0; }
.r-bar { position: relative; height: 14px; margin-top: 16px; border: var(--line); background: var(--white); overflow: hidden; }
.r-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); }
.r-bar i.p { background: repeating-linear-gradient(45deg, #6f7386 0 3px, #b9bcc9 3px 6px); }
.r-of { margin-top: 6px; font: 12px var(--mono); color: var(--ink-2); text-align: right; }
.missed { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; margin-top: 12px; }
.missed span { border: 1.5px solid var(--ink); background: var(--pink-soft); padding: 2px 8px; font-size: 14px; }

/* ---------- sections ---------- */
section[id] { scroll-margin-top: 72px; }
.topics-section, .how-section { padding: 64px 0 16px; }
.section-head { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
.section-num { font-family: var(--mono); font-weight: 600; font-size: 14px; background: var(--ink); color: var(--lime); padding: 5px 8px; }
h2 { font-size: clamp(30px, 4.2vw, 46px); font-weight: 800; }
.section-sub { margin: 8px 0 0; color: var(--ink-2); max-width: 640px; }

.source-note { font-family: var(--mono); font-size: 12px; color: var(--ink-2); margin: 18px 0 0; max-width: 760px; }

/* how */
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); border: var(--line); background: var(--white); }
.how-item { padding: 20px; border-right: var(--line); }
.how-item:last-child { border-right: 0; }
.how-item b { font-family: var(--mono); background: var(--ink); color: var(--lime); padding: 2px 8px; }
.how-item h3 { font-size: 24px; margin: 14px 0 8px; }
.how-item p { margin: 0; color: var(--ink-2); font-size: 15px; }

/* footer */
.footer {
  margin-top: 64px; border-top: var(--line); background: var(--ink); color: var(--white);
  padding: 26px clamp(16px, 4vw, 48px); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-family: var(--mono); font-size: 13px;
}
.footer a { color: var(--lime); }

/* ---------- collections: level → groups. Desktop: grid of covers; phone: compact list ---------- */
.lvl-block + .lvl-block { margin-top: 48px; }
.lvl-head h3 { font-size: 28px; display: flex; align-items: center; gap: 10px; }
.lvl-head p { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; }
.grp { margin-top: 22px; }
.grp-head {
  display: flex; justify-content: space-between; margin-bottom: 12px; padding-bottom: 6px; border-bottom: 1.5px solid rgba(11,13,23,.15);
  font: 600 12px var(--mono); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2);
}
.grp-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 18px 16px; }
.coll { display: flex; flex-direction: column; gap: 6px; padding: 0; border: 0; background: none; text-align: left; min-width: 0; }
.cover {
  position: relative; display: grid; place-items: center; aspect-ratio: 4 / 3; overflow: hidden; flex: none;
  border: var(--line); box-shadow: var(--shadow-sm); transition: transform .08s, box-shadow .08s;
  background-image: repeating-linear-gradient(-45deg, rgba(11,13,23,.07) 0 2px, transparent 2px 12px);
}
.coll:hover .cover { transform: translate(-2px, -2px); box-shadow: var(--shadow); }
.coll:active .cover { transform: translate(2px, 2px); box-shadow: none; }
.cover-A1 { background-color: var(--a1); }
.cover-A2 { background-color: #c9cfff; }
.cover-B1 { background-color: #ffc39b; }
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.c-emoji { font-size: 44px; line-height: 1; filter: drop-shadow(2px 2px 0 rgba(11,13,23,.25)); }
.c-count { position: absolute; top: 6px; left: 6px; padding: 1px 6px; background: var(--ink); color: var(--white); font: 600 12px/1.4 var(--mono); }
.c-body { display: grid; gap: 6px; min-width: 0; margin-top: 4px; }
.c-title { font-size: 16px; font-weight: 800; line-height: 1.15; letter-spacing: -0.01em; }
.c-foot { display: grid; gap: 5px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); }
.c-foot b { color: var(--ink); }
.c-bar { position: relative; height: 6px; border: 1.5px solid var(--ink); background: var(--white); overflow: hidden; }
.c-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); }
.c-bar i.p { background: repeating-linear-gradient(45deg, #6f7386 0 3px, #b9bcc9 3px 6px); }
.c-go { display: none; }
@media (max-width: 1100px) { .grp-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (max-width: 820px) { .grp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 640px) {
  .lvl-block + .lvl-block { margin-top: 36px; }
  .lvl-head h3 { font-size: 24px; }
  .grp { margin-top: 18px; }
  .grp + .grp { margin-top: 36px; }
  .grp-grid { grid-template-columns: 1fr; gap: 10px; }
  .coll {
    flex-direction: row; align-items: center; gap: 12px; padding: 8px 12px 8px 8px;
    border: var(--line); background: var(--white); box-shadow: var(--shadow-sm); transition: transform .08s, box-shadow .08s;
  }
  .coll:hover { transform: translate(-1px, -1px); box-shadow: var(--shadow); }
  .coll:active { transform: translate(2px, 2px); box-shadow: none; }
  .coll .cover, .coll:hover .cover, .coll:active .cover { width: 48px; height: 48px; aspect-ratio: auto; border-width: 1.5px; box-shadow: none; transform: none; }
  .c-emoji { font-size: 26px; filter: none; }
  .c-count { display: none; }
  .c-body { flex: 1; margin: 0; gap: 5px; }
  .c-foot { grid-template-columns: auto 1fr; align-items: center; gap: 10px; }
  .c-bar { max-width: 120px; }
  .c-go { display: block; font-weight: 800; }
}

/* ---------- practice sheet (full screen) ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 60; display: flex; flex-direction: column; height: 100dvh;
  background-color: var(--paper);
  background-image: linear-gradient(rgba(11,13,23,.04) 1px, transparent 1px), linear-gradient(90deg, rgba(11,13,23,.04) 1px, transparent 1px);
  background-size: 32px 32px; animation: sheet-up .28s cubic-bezier(.2,.8,.2,1); overflow: hidden;
}
.sheet:focus { outline: none; }
@keyframes sheet-up { from { transform: translateY(100%); } }
.sheet-top {
  display: grid; grid-template-columns: var(--ctl-sm) 1fr auto; align-items: center; gap: 20px;
  padding: 10px clamp(12px, 3vw, 24px) 13px; padding-top: max(10px, env(safe-area-inset-top)); background: var(--white); border-bottom: var(--line);
}
.sheet-mid { min-width: 0; }
.sheet-right { display: flex; gap: 8px; justify-self: end; }

/* settings dialog (above the sheet) */
.settings { position: fixed; inset: 0; z-index: 80; display: flex; align-items: center; justify-content: center; padding: 16px; }
.set-backdrop { position: absolute; inset: 0; background: rgba(11,13,23,.5); }
.set-box {
  position: relative; width: min(440px, 100%); padding: 18px 18px 16px;
  background: var(--white); border: var(--line); box-shadow: var(--shadow); animation: sheet-up .2s ease-out;
}
.set-box:focus { outline: none; }
.set-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.set-title { font-size: 22px; font-weight: 800; letter-spacing: -0.02em; }
.set-sub { margin: 14px 0 8px; font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.set-opts { display: grid; gap: 10px; }
.set-opt {
  display: grid; gap: 4px; padding: 12px 14px; text-align: left; border: var(--line); background: var(--white);
  box-shadow: var(--shadow-sm); transition: transform .08s, box-shadow .08s;
}
.set-opt b { font-size: 18px; }
.set-opt span { font-size: 14px; color: var(--ink-2); line-height: 1.35; }
.set-opt:hover { transform: translate(-1px, -1px); box-shadow: var(--shadow); }
.set-opt.is-on { background: var(--ink); color: var(--white); }
.set-opt.is-on b { color: var(--lime); }
.set-opt.is-on span { color: rgba(255,255,255,.75); }
.set-note { margin: 12px 0 0; font-size: 13px; color: var(--ink-2); }
.goal-opt { grid-template-columns: 1fr auto; align-items: center; gap: 12px; }
.goal-opt > span:first-child { display: grid; gap: 4px; }
.goal-opt .g-n { font: 600 14px var(--mono); color: inherit; white-space: nowrap; }
.set-opt.is-on .g-n { color: var(--lime); }
.goal-opt.is-soon { opacity: .45; border-style: dashed; box-shadow: none; cursor: default; }
.goal-opt.is-soon:hover { transform: none; box-shadow: none; }
.s-title { font-weight: 800; font-size: 16px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.s-count { margin-top: 2px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sheet-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; padding: 18px 16px 8px; }
.sheet.is-result .sheet-stage { overflow: auto; }
.sheet.is-result .sheet-bottom { visibility: hidden; }
.sheet-bottom {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 16px; padding-bottom: max(14px, env(safe-area-inset-bottom));
}
.sheet-bottom .btn { flex: 0 1 170px; white-space: nowrap; }
/* header = secondary (smaller), bottom row = the main actions (bigger) */
.sheet-top .icon-btn { width: var(--ctl-sm); height: var(--ctl-sm); }
.sheet-top .icon-btn svg { width: 18px; height: 18px; }
.sheet-bottom .btn { height: var(--ctl-lg); font-size: 17px; }
.sheet-bottom .icon-btn { width: var(--ctl-lg); height: var(--ctl-lg); }
.sheet-bottom .icon-btn svg { width: 22px; height: 22px; }

/* deck */
.deck { position: relative; width: min(400px, 100%); height: min(100%, 500px); min-height: 220px; }
.ghost, .card { position: absolute; inset: 0 0 22px 0; border: var(--line); background: var(--white); }
.ghost.g1 { transform: translateY(11px) scale(.95); box-shadow: var(--shadow-sm); }
.ghost.g2 { transform: translateY(22px) scale(.9); }
.ghost { transition: opacity .25s; }
.deck.is-turning .ghost, .deck:has(.demo-flip) .ghost { opacity: 0; transition-duration: .08s; }
.card {
  border: 0; background: none; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab;
  transition: transform .25s cubic-bezier(.2,.8,.2,1); animation: card-in .22s ease-out; z-index: 1;
}
.card:focus-visible { outline: 3px solid var(--blue); outline-offset: 4px; }
.card.is-drag { transition: none; cursor: grabbing; }
.card.is-flying { transition: transform .26s ease-in; }
.card.is-back { animation: card-back .25s ease-out; }
@keyframes card-in { from { transform: translateY(10px) scale(.96); } }
@keyframes card-back { from { transform: translateX(-60%) rotate(-12deg); opacity: 0; } }
.flip-inner { position: absolute; inset: 0; transition: transform .45s cubic-bezier(.2,.8,.2,1); transform-style: preserve-3d; }
.card.is-flipped .flip-inner { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 10px; padding: 24px;
  border: var(--line); box-shadow: var(--shadow); background: var(--white);
}
.face-back { transform: rotateY(180deg); background: var(--ink); color: var(--white); }
.face .lang { font-family: var(--mono); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; opacity: .7; }
.face .word { font-size: clamp(34px, 8vw, 54px); font-weight: 800; letter-spacing: -0.03em; text-align: center; line-height: 1.05; overflow-wrap: anywhere; }
.face .hint { font-family: var(--mono); font-size: 13px; opacity: .75; text-align: center; }
.face .tap { position: absolute; bottom: 14px; font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); opacity: .7; }
.stamp {
  position: absolute; top: 22px; z-index: 2; padding: 6px 14px; pointer-events: none;
  border: var(--line); box-shadow: var(--shadow-sm); font: 800 20px/1.1 var(--display); text-transform: uppercase; letter-spacing: .02em;
}
.stamp-ok { left: 18px; background: var(--lime); transform: rotate(-8deg); opacity: var(--ok, 0); }
.stamp-no { right: 18px; background: var(--pink); transform: rotate(8deg); opacity: var(--no, 0); }

/* first-run hints */
.coach {
  position: absolute; inset: 0; z-index: 5; display: flex; align-items: flex-end; justify-content: center;
  padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); background: rgba(242,244,250,.35);
}
.coach-box {
  width: min(440px, 100%); padding: 20px 20px 16px; text-align: center;
  background: var(--white); border: var(--line); box-shadow: var(--shadow); animation: sheet-up .25s ease-out;
}
.coach-icon { font-size: 34px; line-height: 1; font-weight: 800; }
.coach-box p { margin: 10px 0 0; font-size: 19px; line-height: 1.35; }
.coach-legend { display: flex; justify-content: center; gap: 10px; margin-top: 14px; font: 600 14px var(--mono); }
.coach-legend span { border: var(--line); padding: 4px 10px; }
.cl-no { background: var(--pink); } .cl-ok { background: var(--lime); }
.coach-box .coach-keys { font-size: 13px; color: var(--ink-2); margin-top: 12px; }
.coach-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 18px; }
.coach-dots { display: flex; gap: 6px; }
.coach-dots i { width: 10px; height: 10px; border: 1.5px solid var(--ink); }
.coach-dots i.on { background: var(--ink); }
.card.demo-flip .flip-inner { animation: demo-flip 3s ease-in-out infinite; }
@keyframes demo-flip { 0%, 30% { transform: none; } 45%, 80% { transform: rotateY(180deg); } 95%, 100% { transform: none; } }
.card.demo-swipe { animation: demo-swipe 3.2s ease-in-out infinite; }
.card.demo-swipe .stamp-ok { animation: demo-ok 3.2s ease-in-out infinite; }
.card.demo-swipe .stamp-no { animation: demo-no 3.2s ease-in-out infinite; }
@keyframes demo-swipe { 0%, 10% { transform: none; } 25%, 35% { transform: translateX(70px) rotate(4deg); } 50%, 60% { transform: none; } 75%, 85% { transform: translateX(-70px) rotate(-4deg); } 100% { transform: none; } }
@keyframes demo-ok { 0%, 12% { opacity: 0; } 25%, 35% { opacity: 1; } 48%, 100% { opacity: 0; } }
@keyframes demo-no { 0%, 62% { opacity: 0; } 75%, 85% { opacity: 1; } 98%, 100% { opacity: 0; } }

/* ---------- responsive ---------- */
@media (max-width: 640px) {
  .topnav { display: none; }
  .tool-section { padding-top: 14px; }
  .intro { margin-bottom: 12px; }
  h1 { font-size: 34px; }
  .intro p { font-size: 15px; }
  .how-grid { grid-template-columns: 1fr; }
  .sheet-top { gap: 16px; }
  .sheet-bottom { gap: 8px; padding-left: 12px; padding-right: 12px; }
  .sheet-bottom .btn { flex: 1 1 0; padding: 0 10px; min-width: 0; }
  .start { padding: 20px 16px 20px; }
  .hero-prog { padding: 14px 14px 16px; }
  .pticks { font-size: 12px; }
  .hp-nums { gap: 28px; margin-top: 20px; }
  .settings { align-items: flex-end; padding: 0; }
  .set-box { width: 100%; padding-bottom: max(16px, env(safe-area-inset-bottom)); border-left: 0; border-right: 0; border-bottom: 0; box-shadow: none; }
  .how-item { border-right: 0; border-bottom: var(--line); }
  .how-item:last-child { border-bottom: 0; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- info button + popover ---------- */
.info-btn {
  display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 6px; padding: 0; vertical-align: 1px;
  border: 1.5px solid var(--ink); border-radius: 50%; background: var(--white); font: 700 11px/1 var(--mono); cursor: pointer;
}
.info-btn:hover, .info-btn[aria-expanded="true"] { background: var(--ink); color: var(--white); }
.popover {
  position: fixed; z-index: 70; width: min(340px, calc(100vw - 16px)); padding: 16px 16px 14px;
  background: var(--white); border: var(--line); box-shadow: var(--shadow); font-size: 14px; line-height: 1.45;
}
.popover::before {
  content: ""; position: absolute; top: -8px; left: calc(var(--arrow, 40px) - 7px); width: 12px; height: 12px;
  background: var(--white); border-left: var(--line); border-top: var(--line); transform: rotate(45deg);
}
.pop-title { font-weight: 800; font-size: 17px; margin-bottom: 4px; padding-right: 28px; }
.popover p { margin: 0 0 10px; color: var(--ink-2); }
.pop-close { position: absolute; top: 8px; right: 8px; width: 26px; height: 26px; padding: 0; border: 1.5px solid var(--ink); background: var(--white); font-size: 12px; }
.ladder { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 0 0 10px; font-family: var(--mono); font-size: 11px; }
.ladder span { border: 1.5px solid var(--ink); padding: 2px 6px; background: var(--paper); }
.ladder span:first-child { background: var(--pink-soft); }
.ladder i { font-style: normal; color: var(--ink-2); }
.popover ul { margin: 0 0 10px; padding: 0; list-style: none; display: grid; gap: 6px; }
.popover li { position: relative; }
.sw { display: inline-block; width: 16px; height: 9px; border: 1px solid var(--ink); margin-right: 6px; vertical-align: 0; }
.sw-prog { background: repeating-linear-gradient(45deg, #6f7386 0 3px, #b9bcc9 3px 6px); }
.sw-learn { background: var(--ink); }
.pop-note { font-size: 12px; margin: 0 !important; }

