/* Trilhar web app. Rules: /design.md (checked by `npm run lint:design`).
   Colour tokens come from the brand (vendor/brand.css, copied from brand/brand.css). Below are the app's own aliases
   and the few tokens the brand does not have yet. Mostly neutral: violet only for the one main action per screen and
   the current state; subject colours only as small dots. Radii: --r-md for buttons/inputs/options, --r-lg for cards/
   sheets/panels/video, --r-sm for thumbnails, --r-pill for small status chips; at most two per screen. */
:root {
  --bg: var(--paper); --fg: var(--ink);
  --accent: var(--anil); --accent-fg: #fff;
  --ok-bg: var(--ok-soft); --no: var(--bad); --no-bg: var(--bad-soft);
  /* green text, and green fills under white text (5.4:1); to move into brand.css */
  --ok-deep: #23794a;
  /* edges of inputs and quiz options (3:1 against card / soft) */
  --line-strong: #8f8c84;
  /* the feed is always dark: these are its surfaces, in both themes */
  --night: #141412; --night-2: #1c1c19; --on-night: #f1efe8; --on-night-muted: rgba(241, 239, 232, 0.72);
  /* type scale (design.md): 15 small, 17 body, 20 lead, 24 h3, 30 h2, 40 h1; uppercase labels 13 */
  --fs-label: 13px; --fs-sm: 15px; --fs-body: 17px; --fs-lead: 20px; --fs-h3: 24px; --fs-h2: 30px; --fs-h1: 40px;
  /* spacing scale */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 32px; --s7: 48px;
  --tabbar-h: 60px;
  /* height of the feed's top overlay; clips start below it, so it never covers the video */
  --overlay-h: calc(64px + env(safe-area-inset-top));
  /* the path's overworld (map.tsx): neutral island ground with a pale shore, a pale road with grey dots, violet dots
     only on the stretch already walked; the tiles' lips are a darker step of their fill. --r-island is the one
     organic outline outside the radius scale (design.md, «Corners»). */
  --ground: var(--soft); --shore: color-mix(in srgb, var(--soft) 45%, var(--paper));
  --road-bed: var(--card); --road-edge: var(--line); --road-dot: var(--line-strong); --road-walked: var(--accent);
  --lip-todo: var(--line-strong); --lip-ok: color-mix(in srgb, var(--ok-deep) 65%, #000); --lip-now: var(--anil-deep);
  --r-island: 44% 56% 52% 48% / 46px 60px 52px 40px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --accent-fg: var(--night); --no: #f2a7a1; --line-strong: #6e6b63;
    --road-bed: color-mix(in srgb, var(--soft) 40%, var(--line)); --road-edge: color-mix(in srgb, var(--line) 80%, var(--line-strong));
    --lip-ok: color-mix(in srgb, var(--ok-deep) 45%, #000); --lip-now: color-mix(in srgb, var(--anil) 55%, #000);
  }
}
:root[data-theme="dark"] {
  --accent-fg: var(--night); --no: #f2a7a1; --line-strong: #6e6b63;
  --road-bed: color-mix(in srgb, var(--soft) 40%, var(--line)); --road-edge: color-mix(in srgb, var(--line) 80%, var(--line-strong));
  --lip-ok: color-mix(in srgb, var(--ok-deep) 45%, #000); --lip-now: color-mix(in srgb, var(--anil) 55%, #000);
}

/* everything that sits directly on the night (the feed, its desktop panels, the dark tab bar) uses night tokens.
   Feed cards (.fcard) stay outside this scope, so they follow the system theme. */
.panel, .feed-top, .rail, .fcard.end, .fcard.join, .feed-msg, .feed-back, .home-hero, .shell.full .tabbar {
  --fg: var(--on-night); --muted: var(--on-night-muted); --accent: var(--anil-light); --accent-fg: var(--night);
  --line: rgba(255, 255, 255, 0.12); --line-strong: rgba(255, 255, 255, 0.45); --soft: rgba(255, 255, 255, 0.06); --card: var(--night-2);
  color: var(--fg);
}
/* the overworld in the night panel (the compact path next to the desktop feed): its tokens, worked out on the night */
.panel {
  --ground: color-mix(in srgb, var(--on-night) 7%, var(--night)); --shore: color-mix(in srgb, var(--on-night) 3%, var(--night));
  --road-bed: color-mix(in srgb, var(--on-night) 13%, var(--night)); --road-edge: color-mix(in srgb, var(--on-night) 20%, var(--night));
  --road-dot: color-mix(in srgb, var(--on-night) 45%, var(--night)); --road-walked: var(--accent); --lip-todo: var(--road-dot);
  --lip-ok: color-mix(in srgb, var(--ok-deep) 45%, #000); --lip-now: color-mix(in srgb, var(--anil-light) 55%, #000);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 400 var(--fs-body)/1.5 var(--brand-font); -webkit-font-smoothing: antialiased; overflow-x: hidden; }
main { max-width: 720px; margin: 0 auto; padding: var(--s2) max(var(--s4), env(safe-area-inset-right)) calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s6)) max(var(--s4), env(safe-area-inset-left)); }
h1 { font-size: var(--fs-h2); line-height: 1.15; margin: var(--s2) 0 var(--s3); }
h2 { font-size: var(--fs-h3); line-height: 1.2; margin: var(--s5) 0 var(--s2); }
h3 { font-size: var(--fs-lead); margin: var(--s5) 0 var(--s2); }
a { color: var(--accent); text-decoration: none; text-underline-offset: 3px; }
/* links show their colour, not an underline; the underline appears on hover and keyboard focus */
/* a link inside running text is underlined: colour alone is not enough (axe link-in-text-block) */
:where(p, li, td, dd) a:not([class]) { text-decoration: underline; }
a:not([class]):hover, a:not([class]):focus-visible, button.link:hover, button.link:focus-visible { text-decoration: underline; }
img, video { max-width: 100%; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.small { font-size: var(--fs-sm); }
.error { color: var(--no); }
.pad { padding: var(--s4); }
.center { justify-content: center; }
.kicker { display: block; font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); margin: 0 0 var(--s1); }
.kicker.accent { color: var(--muted); }
.note { background: var(--soft); padding: var(--s3) var(--s4); border-radius: var(--r-md); }
.note.ok { background: var(--soft); }
.row-gap { display: flex; flex-wrap: wrap; gap: var(--s3); }
.with-seixo-row { display: flex; gap: var(--s3); align-items: center; margin: var(--s3) 0; }
.empty { display: flex; gap: var(--s3); align-items: center; color: var(--muted); }
.seixo { display: inline-block; line-height: 0; flex: none; }
.seixo svg { width: 100%; height: auto; display: block; }

/* buttons and inputs: one violet action per screen; secondaries are ink with a strong line */
button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 700 var(--fs-body)/1.2 var(--brand-font);
  border: 0; border-radius: var(--r-md); padding: 10px 20px; cursor: pointer; min-height: 48px;
  background: var(--accent); color: var(--accent-fg); text-decoration: none;
}
button.secondary, .button.secondary { background: transparent; color: var(--fg); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
button.danger { background: var(--bad); color: #fff; }
button.link { background: none; color: var(--accent); padding: 10px 0; min-height: 44px; text-decoration: none; font-weight: 400; }
button:disabled { opacity: 0.55; cursor: default; }
.small-btn { min-height: 44px; padding: 4px 14px; font-size: var(--fs-sm); }
.form { display: grid; gap: var(--s3); max-width: 420px; margin-bottom: var(--s3); }
.form label, label.form { display: grid; gap: var(--s1); font-size: var(--fs-sm); }
/* 17 px inputs: no iOS zoom on focus */
input, select, textarea { font: 400 var(--fs-body)/1.4 var(--brand-font); padding: 10px 12px; border: 1.5px solid var(--line-strong); border-radius: var(--r-md); background: var(--card); color: var(--fg); min-height: 48px; max-width: 100%; }
textarea { width: 100%; }

/* header (pages outside the feed) */
.top { display: flex; justify-content: space-between; align-items: center; min-height: 56px; padding: calc(var(--s2) + env(safe-area-inset-top)) max(var(--s4), env(safe-area-inset-right)) var(--s2) max(var(--s4), env(safe-area-inset-left)); max-width: 720px; margin: 0 auto; }
.brand, .top-tabs a { min-height: 44px; display: inline-flex; align-items: center; }
.brand { text-decoration: none; }
.brand img { height: 28px; width: auto; display: block; }
.top-tabs { display: flex; gap: var(--s3); align-items: center; }
.top-tabs a { color: var(--fg); }
.guest-line { margin: 0 0 var(--s3); }

/* bottom tab bar: icon + short label */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(4, 1fr);
  /* solid, not see-through: dark thumbnails scrolling under a translucent bar pulled the grey labels under 4.5:1 */
  background: var(--bg); border-top: 1px solid var(--line);
}
.tabbar a { display: grid; place-items: center; align-content: center; gap: 2px; font-size: var(--fs-label); font-weight: 700; text-decoration: none; color: var(--muted); }
.tabbar a.on { color: var(--fg); }
.tabbar a.on .ico { color: var(--accent); }
.tabbar .rail-logo { display: none; }
.ico { width: 24px; height: 24px; }

/* ---------- the feed (always dark) ---------- */
.shell.full { background: var(--night); color: var(--on-night); }
.feed-wrap { position: relative; height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom)); max-width: 520px; margin: 0 auto; background: #000; overflow: hidden; }
.feed { height: 100%; overflow-y: auto; overflow-x: hidden; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; }
.feed::-webkit-scrollbar { display: none; }
.feed-item { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; display: grid; place-items: center; overflow: hidden; }
.feed-item:not(.feed-clip) { padding: calc(var(--overlay-h) + var(--s2)) 76px var(--s4) var(--s4); background: var(--night); }
.feed-end, .feed-join { padding-right: var(--s4) !important; }
.feed-msg { display: grid; place-items: center; align-content: center; gap: var(--s2); height: calc(100dvh - var(--tabbar-h) - env(safe-area-inset-bottom)); background: var(--night); }
/* a run or one video is the whole phone screen, with no tab bar; a computer keeps the rail, dark (web/app.tsx Shell) */
@media (max-width: 1023px) { .shell.full .tabbar { display: none; } }
.shell.full .tabbar { background: var(--night); }
.shell.full .feed-wrap, .shell.full .feed-msg { height: 100dvh; }
.shell.full .toast { bottom: calc(env(safe-area-inset-bottom) + var(--s6)); }

/* top overlay: switch, path meter, countdown */
.feed-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 5; height: var(--overlay-h); padding: calc(6px + env(safe-area-inset-top)) var(--s4) 0;
  background: var(--night); pointer-events: none;
}
.feed-top > * { pointer-events: auto; }
.switch { display: flex; justify-content: center; gap: var(--s5); }
.switch a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 700; font-size: var(--fs-body); text-decoration: none; color: var(--muted); border-bottom: 2.5px solid transparent; }
.switch a.on { color: var(--fg); border-bottom-color: var(--fg); }
.meter { display: block; height: 4px; border-radius: 0; background: var(--line); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: 0; min-width: 4px; }
.meter.light { height: 6px; border-radius: 0; margin: var(--s2) 0; }
.feed-back { display: flex; align-items: center; gap: var(--s2); }
/* the run's head: back, the stage, which step of it, and a thin bar of the stage done (feed.tsx HomeFeed) */
.run-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
.run-count { flex: none; margin-left: auto; font-size: var(--fs-label); color: var(--muted); }
/* the stage name opens the stage's steps (feed.tsx HomeFeed) */
.run-stage { display: inline-flex; align-items: center; gap: 6px; min-width: 0; min-height: 44px; padding: 0; background: none; color: inherit; font: inherit; text-align: left; border-radius: 0; }
.run-stage-chev { flex: none; color: var(--muted); font-size: var(--fs-label); }
.step-row .step-type { display: block; font-size: var(--fs-label); color: var(--muted); }
.step-row { padding-block: var(--s3); }
.step-row.done { color: var(--muted); }
.step-row .srow-value { flex: none; white-space: nowrap; }
.step-row[aria-current] .srow-value { color: var(--accent); font-weight: 700; }
.feed-back-title { min-width: 0; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.icon-btn { min-height: 44px; width: 44px; padding: 0; border-radius: 50%; background: var(--soft); color: var(--fg); }

/* clip: the whole 9:16 frame, between the top overlay and the bottom; captions are never covered */
.clip { position: relative; width: 100%; height: 100%; cursor: pointer; background: #000; }
.clip video { position: absolute; left: 0; right: 0; top: var(--overlay-h); bottom: 0; width: 100%; height: calc(100% - var(--overlay-h)); object-fit: contain; object-position: center top; }
.clip::after { content: ""; position: absolute; inset: auto 0 0 0; height: 40%; background: linear-gradient(transparent, rgba(0, 0, 0, 0.6) 45%, rgba(0, 0, 0, 0.88)); pointer-events: none; }
.clip-info { position: absolute; z-index: 1; left: var(--s4); right: 84px; bottom: var(--s4); display: grid; gap: var(--s1); justify-items: start; color: #fff; text-shadow: 0 1px 3px rgba(0, 0, 0, 0.8); }
.clip-meta { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }
.clip-title { font-size: var(--fs-lead); line-height: 1.2; }
.area-dot { font-size: var(--fs-label); font-weight: 700; display: inline-flex; align-items: center; gap: 6px; }
.area-dot::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: rgba(255, 255, 255, 0.6); }
.area-dot.bio::before { background: var(--bio); }
.area-dot.geo::before { background: var(--geo); }
.area-dot.mat::before { background: var(--mat); }
.area-dot.fis::before { background: var(--fis); }
.area-dot.qui::before { background: var(--qui); }
.area-dot.por::before { background: var(--por); }
.pill { font-size: var(--fs-label); background: rgba(0, 0, 0, 0.55); padding: 4px 12px; border-radius: var(--r-pill); }
.clip-ctrls { display: flex; gap: var(--s2); margin-bottom: var(--s1); }
.clip-btn { display: grid; place-items: center; width: 44px; height: 44px; min-height: 0; padding: 10px; border-radius: 50%; background: rgba(0, 0, 0, 0.45); color: #fff; }
.clip-btn .ico { width: 24px; height: 24px; }
.clip-resume { min-height: 44px; padding: 0 var(--s3); border-radius: var(--r-pill); background: rgba(0, 0, 0, 0.45); color: #fff; font-weight: 700; }
.clip-progress { position: absolute; z-index: 2; left: 0; right: 0; bottom: 0; height: 3px; background: rgba(255, 255, 255, 0.2); }
.clip-progress i { display: block; height: 100%; background: rgba(255, 255, 255, 0.85); }
.done-chip { display: inline-block; font-size: var(--fs-label); font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); background: var(--ok-deep); color: #fff; text-shadow: none; vertical-align: middle; }

/* cards inside the feed: one per screen; they follow the system theme */
.fcard { width: 100%; max-width: 440px; max-height: 100%; overflow-y: auto; background: var(--card); color: var(--fg); border-radius: var(--r-lg); padding: 20px; box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.08), 0 20px 50px rgba(0, 0, 0, 0.35); }
.fcard h2 { margin: var(--s1) 0 10px; font-size: var(--fs-h3); }
.fcard .q { font-weight: 700; font-size: var(--fs-body); margin: 0 0 var(--s3); }
.fcard.idea { font-size: var(--fs-lead); font-weight: 700; line-height: 1.35; }
.fcard.idea ul { padding-left: 20px; margin: var(--s2) 0 0; display: grid; gap: var(--s3); }
.fcard.idea li::marker { color: var(--accent); }
.fcard.end, .fcard.join { text-align: center; background: transparent; box-shadow: none; display: grid; justify-items: center; gap: var(--s1); }
.fcard.end p, .fcard.join p { color: var(--muted); }
/* the path's next step after a video: its title over the one button */
.fcard.end .end-step { margin: 0 0 var(--s2); color: var(--fg); font-size: var(--fs-lead); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.fcard.end .kicker { margin: var(--s2) 0 0; }
/* «Seguinte» at the end of a step in a run */
.run-next { margin: var(--s3) 0 0; }
.run-next button { font-size: var(--fs-body); text-align: left; }
.clip-info .run-next { margin: var(--s1) 0 0; }
/* «Como foi?» above «Seguinte» (felt.tsx): small and quiet, in the body weight also on the bold key-idea card */
.felt { margin: var(--s4) 0 0; font-size: var(--fs-sm); font-weight: 400; line-height: 1.4; }
.felt p { margin: 0; }
.felt > * + p:not(:empty) { margin-top: var(--s2); }
.felt .chips { padding: var(--s2) 0 0; }
.felt .chips button { border-radius: var(--r-pill); font-weight: 400; }
.fcard.milestone .big-date { font-size: var(--fs-h2); font-weight: 700; color: var(--fg); margin: 0; }

/* side rail: only buttons that do something */
.rail { position: absolute; right: var(--s2); bottom: 28px; z-index: 3; display: grid; gap: 14px; justify-items: center; }
.seixo-space { width: 56px; height: 54px; }
.rail-btn { display: grid; justify-items: center; gap: 3px; background: none; color: #fff; padding: 0; min-height: 0; border-radius: 0; font-size: var(--fs-label); font-weight: 700; text-decoration: none; text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8); }
.rail-btn .ico { width: 44px; height: 44px; padding: 10px; border-radius: 50%; background: rgba(0, 0, 0, 0.45); }

/* sheets and toasts */
/* bottom sheets: a native modal <dialog> (Sheet in router.tsx); only dialogs, so the IAVE answer sheet (fieldset.sheet) is not one */
dialog.sheet { position: fixed; inset: auto 0 0 0; border: 0; padding: 0; background: var(--card); color: var(--fg); border-radius: var(--r-lg) var(--r-lg) 0 0; max-height: 70dvh; overflow-y: auto; max-width: 520px; width: 100%; margin: 0 auto; }
dialog.sheet::backdrop { background: rgba(0, 0, 0, 0.5); }
.sheet-in { padding: 20px var(--s4) calc(20px + env(safe-area-inset-bottom)); }
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s4)); transform: translateX(-50%); background: var(--fg); color: var(--bg); padding: var(--s2) var(--s4); border-radius: var(--r-md); z-index: 40; font-size: var(--fs-sm); }
.links li { margin: var(--s1) 0; }
.links a, .node-steps a { color: var(--accent); display: inline-block; padding: 10px 0; min-height: 44px; }

/* ---------- quiz options (feed, video page, practice) ---------- */
.opts { list-style: none; padding: 0; margin: 0; display: grid; gap: var(--s2); }
.opt { width: 100%; justify-content: flex-start; text-align: left; background: var(--soft); color: var(--fg); border-radius: var(--r-md); font-weight: 400; padding: 10px 14px; box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.opt .letter { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; background: var(--card); font-weight: 700; font-size: var(--fs-sm); margin-right: var(--s2); }
.opt.picked { box-shadow: inset 0 0 0 2px var(--accent); }
.opt-mark { margin-left: auto; padding-left: var(--s2); font-weight: 700; }
.opt.wrong .opt-mark { color: var(--bad); }
.opt.right .opt-mark { color: var(--ok-deep); }
.opt.right { background: var(--ok-bg); box-shadow: inset 0 0 0 2px var(--ok-deep); }
.opt.right .letter { background: var(--ok-deep); color: #fff; }
.opt.wrong { background: var(--soft); box-shadow: inset 0 0 0 2px var(--bad); }
.opt:disabled { opacity: 1; }
.opt[aria-disabled="true"] { cursor: default; }
.feedback { margin-top: var(--s3); padding: var(--s3) 14px; border-radius: var(--r-md); }
.feedback.ok { background: var(--ok-bg); }
.feedback.no { background: var(--quase-bg); }
.feedback.with-seixo { display: flex; gap: 10px; align-items: flex-start; }
.quiz { padding: var(--s4) 0; border-bottom: 1px solid var(--line); }
.quiz .q { font-weight: 700; margin-top: 0; }
.ok-text { color: var(--ok-deep); }
.no-text { color: var(--no); }

/* ---------- Explorar ---------- */
.explore { max-width: 720px; margin: 0 auto; }
.explore > .switch { padding: var(--s2) 0 var(--s1); }
.gallery-head { padding: var(--s1) 0 var(--s2); }
.gallery-head h1 { margin-bottom: 10px; }
/* the filter chips wrap: every choice in sight, none behind a sideways scroll */
.chips { display: flex; flex-wrap: wrap; gap: var(--s2); padding-bottom: var(--s2); }
.subject-tabs { display: flex; gap: var(--s4); overflow-x: auto; scrollbar-width: none; margin: var(--s2) 0 0; }
.subject-tabs button { background: none; border: 0; box-shadow: none; padding: 0; min-height: 44px; border-radius: 0; font: 700 var(--fs-lead)/1.2 var(--brand-font); color: var(--muted); white-space: nowrap; }
.subject-tabs button.on { color: var(--fg); }
.soon-list { list-style: none; padding: 0; margin: var(--s2) 0 0; display: grid; gap: var(--s2); }
.soon-list li { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.fchip { min-height: 44px; padding: 4px var(--s4); border-radius: var(--r-md); font-size: var(--fs-sm); background: var(--soft); color: var(--fg); flex: none; box-shadow: none; }
.fchip.on { background: var(--fg); color: var(--bg); }
.dgroup { margin-top: var(--s2); }
.sticky-head { position: sticky; top: env(safe-area-inset-top); z-index: 2; margin: 0 calc(-1 * var(--s4)); padding: 10px var(--s4); font-size: var(--fs-body); background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px); display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.sticky-head .small { flex-basis: 100%; margin-left: 18px; }
/* a path's subject colours, one half per area (web/paths.tsx Dot) */
.dot { display: inline-flex; width: 10px; height: 10px; border-radius: 50%; overflow: hidden; background: var(--muted); flex: none; }
.dot > i { flex: 1; }
.dot > .bio { background: var(--bio); }
.dot > .geo { background: var(--geo); }
.dot > .mat { background: var(--mat); }
.dot > .fis { background: var(--fis); }
.dot > .qui { background: var(--qui); }
.dot > .por { background: var(--por); }
/* a tile: the poster (or a test's face) with the title below it, never on it: posters carry their own words (owner 2026-10-19) */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3) var(--s2); }
.tile { display: grid; align-content: start; gap: 6px; min-width: 0; color: var(--fg); text-decoration: none; }
.tile-art { position: relative; display: block; aspect-ratio: 9 / 16; overflow: hidden; border-radius: var(--r-sm); background: var(--night-2); color: #fff; }
.tile-art img, .tile-fill { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* a thin edge, so a white poster does not melt into a light page */
.tile-art::after { content: ""; position: absolute; inset: 0; border-radius: inherit; box-shadow: inset 0 0 0 1px var(--line); pointer-events: none; }
.tile-fill { background: var(--night-2); }
.tile-dur { display: block; font-size: var(--fs-label); font-weight: 400; color: var(--muted); }
.tile-soon, .tile-badge { position: absolute; top: 6px; right: 6px; font-size: var(--fs-label); font-weight: 700; padding: 2px 8px; border-radius: var(--r-pill); background: rgba(0, 0, 0, 0.6); color: #fff; }
.tile-title { font-size: var(--fs-label); font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.tile:hover .tile-title, .tile:focus-visible .tile-title { text-decoration: underline; }
/* every tile kind grows a little under the mouse or keyboard focus (a path tile: when its title link has focus) */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .tile-art { transition: transform 0.2s ease-out; }
  .tile:hover .tile-art, .tile:focus-visible .tile-art, .tile:has(.tile-title a:focus-visible) .tile-art { transform: scale(1.03); }
}
.tile.dim img, .tile.dim .tile-fill { filter: grayscale(0.7) brightness(0.55); }
.tile.dim .tile-title { color: var(--muted); }
.tile-kind { position: absolute; top: var(--s2); left: var(--s2); font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: rgba(255, 255, 255, 0.7); }
.tile-big { position: absolute; top: 34%; left: 0; right: 0; text-align: center; font-size: var(--fs-h2); font-weight: 700; }
.tile-small { position: absolute; top: calc(34% + 40px); left: 0; right: 0; text-align: center; font-size: var(--fs-label); opacity: 0.8; }

/* ---------- interactive tiles (explore.tsx InteractiveTile) ----------
   The page's stage as a square still (interactives/<slug>/still-*.webp), on the card colour so it reads as a window onto
   the page, light or dark with the app. «Interativo» above it, «2D»/«3D» as a small chip under it. On hover, a page with «Vê
   comigo» plays it in an iframe over the still, in the same square (IxLive). */
.ix-tile .tile-art { background: var(--card); color: var(--fg); }
.ix-tile .tile-kind { color: var(--muted); }
.ix-chip { position: absolute; bottom: var(--s2); right: var(--s2); padding: 0 6px; border-radius: var(--r-pill); box-shadow: inset 0 0 0 1px var(--line); font-size: var(--fs-label); font-weight: 700; color: var(--muted); }
.tile-art .ix-still, .ix-live { position: absolute; inset: auto; left: 0; top: 50%; width: 100%; height: auto; aspect-ratio: 1; transform: translateY(-50%); }
.ix-still.dk { display: none; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ix-still.lt { display: none; } :root:not([data-theme="light"]) .ix-still.dk { display: block; } }
:root[data-theme="dark"] .ix-still.lt { display: none; }
:root[data-theme="dark"] .ix-still.dk { display: block; }
.ix-live { overflow: hidden; pointer-events: none; }
.ix-live iframe { position: absolute; top: 0; left: 0; width: 360px; height: 360px; border: 0; background: var(--card); transform-origin: 0 0; opacity: 0; transition: opacity 0.25s; }
.ix-live iframe.on { opacity: 1; }

/* ---------- Explorar: the search (explore.tsx SearchField; results reuse .dgroup, .grid and the tiles) ---------- */
.explore-search { position: relative; margin: var(--s2) 0 0; max-width: 520px; }
.explore-search input { display: block; width: 100%; padding-right: 48px; }
/* our own × only: no second one from the browser */
.explore-search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.explore-search-clear { position: absolute; top: 0; right: 0; width: 48px; min-height: 48px; padding: 0; background: none; box-shadow: none; color: var(--muted); font-size: var(--fs-lead); font-weight: 400; }
.explore-search-clear:hover { color: var(--fg); }
.search-none { margin-top: var(--s3); }
/* «Também em …»: one quiet line per other subject with results */
.search-also { list-style: none; margin: var(--s2) 0 0; padding: 0; }

/* ---------- the trail ---------- */
.trail-page h1 { font-size: var(--fs-h2); }
.countdown { display: flex; gap: 14px; align-items: center; background: var(--soft); color: var(--fg); border-radius: var(--r-lg); padding: 14px 18px; margin: var(--s3) 0; }
.countdown b { font-size: var(--fs-h2); line-height: 1; }
.countdown span { font-size: var(--fs-sm); color: var(--muted); }
.node-title { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.chip { font-size: var(--fs-label); font-weight: 700; padding: 1px 8px; border-radius: var(--r-pill); background: var(--soft); color: var(--muted); }
.chip.next { background: var(--accent); color: var(--accent-fg); }
.node-steps { list-style: none; margin: var(--s1) 0 14px 48px; padding: 0; }
.node-steps li { position: relative; display: grid; grid-template-columns: 22px 1fr auto; gap: var(--s2); align-items: center; padding: 6px 0; border-bottom: 1px solid var(--line); }
.node-steps li.done .tick { color: var(--ok-deep); font-weight: 700; }
.node-steps li.soon { color: var(--muted); }
.node-steps li.next { background: var(--soft); margin: var(--s1) -10px; padding: 6px 10px; border-radius: var(--r-md); border-bottom: 0; }
.step-body { display: grid; gap: 1px; }
/* the path as an overworld (src/web/map.tsx): shared stages → a fork into one island per school year → a join →
   shared stages → the exam (a small castle). The road is an SVG drawn from the tiles' real centres (behind the
   tiles); the islands are plain blocks, so the layout stays fluid. Stacking: island ground < road < tiles and words.
   Deliberate exceptions to «no coloured backgrounds on large areas» and the radius scale (design.md): the island
   ground is a pale neutral (--ground) with an organic outline (--r-island), so a year reads as one place. */
.ow { --tile: 44px; position: relative; isolation: isolate; container-type: inline-size; margin: var(--s4) -8px var(--s5); }
.ow ol { list-style: none; margin: 0; padding: 0; }
.ow-zone { padding-left: 8px; }
.road { position: absolute; left: 0; top: 0; pointer-events: none; overflow: visible; z-index: 1; }
.road .bed-edge { fill: none; stroke: var(--road-edge); stroke-width: 20; stroke-linecap: round; }
.road .bed { fill: none; stroke: var(--road-bed); stroke-width: 15; stroke-linecap: round; }
.road .dots { fill: none; stroke: var(--road-dot); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 0 11; }
.road .walked { stroke: var(--road-walked); }
.road .late.bed, .road .late.bed-edge { stroke: none; }
.road .late.dots { stroke-dasharray: 0 15; }
.lv, .ow-sign-row, .ow-castle { position: relative; z-index: 2; }

/* the islands: side by side (a fork); stacked when the map is too narrow (small phones, big text, the desktop panel) */
.ow-lanes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 40px 0 44px; align-items: start; }
.ow-lanes.n1 { grid-template-columns: minmax(0, 1fr); }
.ow-lanes.n3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@container (max-width: 340px) { .ow-lanes { grid-template-columns: minmax(0, 1fr); gap: 44px; } }
@container (max-width: 560px) { .ow-lanes.n3 { grid-template-columns: minmax(0, 1fr); gap: 44px; } }
.island { position: relative; padding: 16px 4px 20px; }
.island::before { content: ""; position: absolute; inset: 0; z-index: 0; background: var(--ground); box-shadow: 0 0 0 8px var(--shore); border-radius: var(--r-island); }
.island.later::before { background: transparent; box-shadow: none; border: 2px dashed var(--line-strong); }

/* the year sign: a board on a post (the brand's signpost); a real heading */
.ow-sign-row { display: flex; justify-content: flex-end; padding: 0 4px 10px 0; }
.ow-sign { display: inline-grid; justify-items: end; text-align: right; position: relative; margin: 0; padding: 6px 12px 7px; background: var(--card); border-radius: var(--r-sm); box-shadow: inset 0 0 0 2px var(--line-strong), 0 3px 0 var(--line-strong); font-size: var(--fs-body); line-height: 1.2; }
.ow-sign::after { content: ""; position: absolute; right: 18px; top: 100%; width: 4px; height: 14px; margin-top: 3px; background: var(--line-strong); border-radius: 0 0 var(--r-xs) var(--r-xs); }
.ow-sign small { font-size: var(--fs-label); font-weight: 400; color: var(--muted); }
.ow-sign .tag { font-size: var(--fs-label); font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.island.later .ow-sign { color: var(--muted); }

/* level tiles: round with a lip; the number is the tema; done = green + ✓; now = violet and bigger; a test = square */
.lv { display: flex; padding: 10px 0; }
.lv.in { padding-left: 10px; }
.lvb { display: flex; align-items: center; justify-content: flex-start; gap: var(--s3); min-height: 56px; padding: 0; text-align: left; background: none; color: var(--fg); font-weight: 400; border-radius: var(--r-md); }
.lvb:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.ow-tile { position: relative; flex: none; width: var(--tile); height: var(--tile); border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-body); background: var(--card); color: var(--fg); box-shadow: inset 0 0 0 2.5px var(--line-strong), 0 5px 0 var(--lip-todo); transition: transform 0.15s ease-out; }
.lvb:hover .ow-tile, .lvb:focus-visible .ow-tile { transform: translateY(-2px); }
.lvb:active .ow-tile { transform: translateY(2px); box-shadow: inset 0 0 0 2.5px var(--line-strong), 0 2px 0 var(--lip-todo); }
.ow-tile > svg { width: 24px; height: 24px; }
.lv.done .ow-tile { background: var(--ok-deep); color: #fff; box-shadow: 0 5px 0 var(--lip-ok); }
.ow-badge { position: absolute; top: -5px; right: -6px; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: var(--fs-label); line-height: 1; background: var(--card); color: var(--ok-deep); box-shadow: inset 0 0 0 2px var(--ok-deep); }
.lv.now .ow-tile { --tile: 54px; font-size: var(--fs-lead); background: var(--accent); color: var(--accent-fg); box-shadow: 0 5px 0 var(--lip-now), 0 0 0 7px color-mix(in srgb, var(--accent) 20%, transparent); }
.lv.later:not(.done) .ow-tile { box-shadow: inset 0 0 0 2px var(--line), 0 4px 0 var(--line); color: var(--muted); }
.lv.test .ow-tile { --tile: 48px; border-radius: var(--r-md); }
.lv.now.test .ow-tile { --tile: 54px; }
/* beside the run (feed.tsx): the stage of the step in view */
.lv.here .ow-tile { outline: 3px solid var(--fg); outline-offset: 4px; }
.lbl { display: grid; gap: 1px; min-width: 0; }
.lbl b { font-size: var(--fs-body); line-height: 1.2; overflow-wrap: anywhere; hyphens: auto; }
.lbl .meta { font-size: var(--fs-sm); color: var(--muted); line-height: 1.3; }
.lv.later .lbl b { color: var(--muted); }
.lbl .chip { display: table; margin-top: 2px; }
.island .lvb { gap: var(--s2); }
.island .lbl b { font-size: var(--fs-sm); }
.island .lbl .meta { font-size: var(--fs-label); }
/* Seixo stands on the current tile (one per screen; never in the compact panel) */
.lv.with-seixo { padding-top: 50px; }
.ow-tile .seixo.on-tile { position: absolute; left: 50%; bottom: calc(100% - 4px); transform: translateX(-50%); pointer-events: none; }

/* the exam: a small castle with a rose flag (a small highlight only) */
.ow-castle { display: grid; justify-items: center; text-align: center; gap: var(--s1); padding-top: var(--s5); }
.ow-castle svg { width: 84px; height: 84px; display: block; }
.ow-castle p { margin: 0; }
.ow-castle .c-wall { fill: var(--card); stroke: var(--fg); stroke-width: 3; stroke-linejoin: round; }
.ow-castle .c-door { fill: var(--fg); }
.ow-castle .c-pole { stroke: var(--fg); stroke-width: 3; stroke-linecap: round; }
.ow-castle .c-flag { fill: var(--rosa); }

/* a node's steps: a bottom sheet (native modal <dialog>: focus trap, Esc, focus back to the tile) */
dialog.node-sheet { position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 520px; max-height: 78dvh; overflow-y: auto; border: 0; padding: 0; background: var(--card); color: var(--fg); border-radius: var(--r-lg) var(--r-lg) 0 0; }
dialog.node-sheet::backdrop { background: rgba(0, 0, 0, 0.5); }
dialog.node-sheet[open] { animation: sheet-up 0.22s ease-out; }
@keyframes sheet-up { from { transform: translateY(24px); opacity: 0; } }
.node-sheet-in { padding: 20px var(--s4) calc(20px + env(safe-area-inset-bottom)); }
.node-sheet .grab { width: 40px; height: 4px; border-radius: var(--r-xs); background: var(--line); margin: -8px auto 12px; }
.node-sheet-head { display: flex; align-items: flex-start; gap: var(--s3); }
.node-sheet-head > div { flex: 1; min-width: 0; }
.node-sheet-head p { margin: 0; }
.node-sheet h2 { margin: 0 0 var(--s1); overflow-wrap: anywhere; }
.node-sheet .node-steps { margin: var(--s3) 0 0; }
.step-error { grid-column: 1 / -1; }
.year-line:focus, .class-line:focus, .year-ask:focus { outline: none; }
.year-line:focus-visible, .class-line:focus-visible, .year-ask:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { dialog.node-sheet[open] { animation: none; } .ow-tile { transition: none; } }
.mdates { margin: var(--s4) 0; }
.mdates ul { list-style: none; margin: 0; padding: 0; }
.mdates li { display: grid; gap: 1px; padding: var(--s2) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.mdates li.done { color: var(--muted); }
.year-ask { display: grid; gap: var(--s2); justify-items: start; padding: var(--s3) var(--s4); margin: var(--s3) 0; background: var(--soft); border-radius: var(--r-lg); }
.year-ask p { margin: 0; }
.year-ask button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.about { margin: var(--s5) 0; color: var(--muted); }
.about summary { cursor: pointer; font-weight: 700; color: var(--fg); min-height: 44px; display: flex; align-items: center; }

/* ---------- Eu / progress ---------- */
.me-head { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding-top: var(--s2); }
.me-head h1 { margin: 0; }
.me-path { display: grid; gap: 2px; padding: var(--s4) 0; color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); }
/* one line of numbers, not three boxes */
.stats { display: flex; flex-wrap: wrap; gap: var(--s1) var(--s5); margin: var(--s2) 0 var(--s3); color: var(--muted); font-size: var(--fs-sm); }
.stats b { font-size: var(--fs-lead); color: var(--fg); }
.mastery { list-style: none; padding: 0; margin: 0; }
.mastery li { display: grid; grid-template-columns: 1fr 96px 72px; gap: 10px; align-items: center; padding: var(--s2) 0; border-bottom: 1px solid var(--line); font-size: var(--fs-sm); }
.bar { position: relative; height: 8px; background: var(--soft); border-radius: 0; overflow: hidden; }
.bar i { position: absolute; inset: 0 auto 0 0; background: var(--accent); }
.bar-label { font-size: var(--fs-label); color: var(--muted); text-align: right; }

/* lists elsewhere: no bordered card stacks */
.card { display: grid; gap: 2px; padding: 14px 0; color: var(--fg); text-decoration: none; border-bottom: 1px solid var(--line); min-height: 44px; }
.card b { font-size: var(--fs-body); }
.score-card { text-align: center; justify-items: center; background: var(--soft); border-radius: var(--r-md); padding: 20px; border: 0; }
.score-card .score { font-size: var(--fs-h2); }
.soonbox { display: grid; gap: var(--s1); place-items: center; text-align: center; padding: var(--s6) var(--s4); border-radius: var(--r-lg); background: var(--soft); color: var(--muted); }
.player { width: 100%; max-height: 75vh; background: #000; border-radius: var(--r-lg); aspect-ratio: 9 / 16; }
.doc { background: var(--soft); border-radius: var(--r-md); padding: var(--s1) 14px; margin: var(--s3) 0; overflow-x: auto; }
.doc img, .q img { max-width: 100%; height: auto; }
.doc table { border-collapse: collapse; width: 100%; font-size: 15px; margin: var(--s1) 0; }
.doc th, .doc td { border: 1px solid var(--line-strong); padding: 6px 8px; text-align: left; vertical-align: top; }
.doc th { font-weight: 700; background: var(--card); }
.pair { display: flex; gap: var(--s2); align-items: center; margin: 6px 0; flex-wrap: wrap; }
.assoc-rows, .assoc-list { margin: 0 0 var(--s3); padding: 0; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); }
.assoc-rows p { margin: 0; }
.assoc-rows select { flex: 1 1 0; min-width: 0; width: 100%; } /* a long option must not widen the row past the screen */
.assoc-list { gap: var(--s1); }
.keep-anonymous { border: 1px solid var(--line); border-radius: var(--r-md); padding: var(--s3) var(--s4); margin: 0; display: grid; gap: var(--s2); }
.keep-anonymous legend { font-weight: 700; padding: 0 var(--s1); }
.keep-anonymous p { margin: 0; }
.form .keep-anonymous label { display: flex; gap: var(--s3); align-items: flex-start; min-height: 44px; cursor: pointer; font-size: var(--fs-body); }
.keep-anonymous label > span { display: grid; gap: 2px; }
.check { display: flex; align-items: center; gap: var(--s2); min-height: 44px; }
.check input { min-height: 0; width: 20px; height: 20px; margin: 0; padding: 0; accent-color: var(--accent); flex: none; }
.keep-anonymous input[type="radio"] { min-height: 0; width: 20px; height: 20px; margin: 2px 0 0; padding: 0; accent-color: var(--accent); flex: none; }
.lvl { min-height: 44px; display: flex; gap: var(--s2); align-items: center; }
.etapa { display: grid; gap: var(--s2); padding: var(--s3) 0; border-top: 1px solid var(--line); }
.etapa p { margin: 0; }
.etapa-marks .opt { flex-direction: column; align-items: flex-start; gap: 2px; }
.etapa-marks { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--s2); }
/* tables inside a step or its explanation (sign charts): ruled like .doc, and scroll sideways on a phone instead of widening the page */
.etapa table, .feedback table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; font-size: 15px; margin: var(--s1) 0; font-variant-numeric: tabular-nums; }
.etapa th, .etapa td, .feedback th, .feedback td { border: 1px solid var(--line-strong); padding: 4px 8px; text-align: center; vertical-align: middle; }
.etapa th, .feedback th { font-weight: 700; background: var(--card); }
.timer { position: sticky; top: env(safe-area-inset-top); background: var(--soft); padding: 6px var(--s3); border-radius: var(--r-md); z-index: 2; }
.domain h2 { font-size: var(--fs-lead); }

/* ---------- loading skeletons (no layout jump) ---------- */
.sk { background: linear-gradient(90deg, var(--soft) 25%, var(--line) 50%, var(--soft) 75%); background-size: 200% 100%; animation: sk 1.4s ease-in-out infinite; border-radius: var(--r-sm); }
.sk-wrap { display: grid; gap: var(--s3); padding: var(--s4) 0; }
/* a failed request (LoadError, router.tsx): the message and a quiet retry, where the skeleton was */
.load-error { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s3); padding: var(--s4) 0; }
.load-error p { margin: 0; }
/* on the night (feed, its panels) the red is too dark to read: the message is plain text there */
.feed-msg .load-error, .panel .load-error { justify-content: center; text-align: center; padding: var(--s4); }
.feed-msg .load-error .error, .panel .load-error .error { color: var(--fg); }
.sk-title { height: 36px; width: 70%; }
.sk-line { height: 18px; }
.sk-tile { aspect-ratio: 9 / 16; }
.sk-feed { width: min(440px, 88vw); aspect-ratio: 9 / 16; max-height: 80%; border-radius: var(--r-lg); --soft: var(--night-2); --line: color-mix(in srgb, var(--night-2) 70%, #fff 8%); }
@keyframes sk { from { background-position: 200% 0; } to { background-position: -200% 0; } }

/* ---------- exam pages: documents beside the questions when there is room ---------- */
.group-docs .doc:first-child { margin-top: 0; }
@media (min-width: 1100px) {
  main:has(.exam-group.has-docs) { max-width: 1180px; }
  .exam-group.has-docs .group-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: var(--s6); align-items: start; }
  .exam-group.has-docs .group-docs { position: sticky; top: calc(env(safe-area-inset-top) + 56px); max-height: calc(100vh - 72px); overflow-y: auto; }
}

/* ---------- welcome (marketing/home.md) and legal pages ---------- */
/* a landing page, not a reading column: wide on a tablet or computer (prose keeps a 65-character measure) */
@media (min-width: 768px) { main:has(> .welcome), body:has(.welcome) .top { max-width: 960px; } }
@media (min-width: 1024px) { main:has(> .welcome), body:has(.welcome) .top { max-width: 1120px; } }
/* blocks are set apart by space, not by lines; two soft bands («valor», «fecho») */
.welcome { display: grid; gap: var(--s6); padding-top: var(--s4); }
.w-hero { display: grid; gap: var(--s6); align-items: center; }
.w-hero h1 { font-size: var(--fs-h1); line-height: 1.1; margin: 0 0 var(--s3); }
.w-hero .lead p { font-size: var(--fs-lead); margin: 0; max-width: 34em; }
.w-act { display: grid; justify-items: start; gap: var(--s2); margin-top: var(--s5); }
.w-ctas { display: flex; flex-wrap: wrap; gap: var(--s3); }
.w-stat { font-weight: 700; font-size: var(--fs-sm); margin: 0; }
.w-note, .w-act .consent { margin: 0; }
.w-block h2 { margin: 0 0 var(--s3); }
.w-prose p { max-width: 65ch; }
.w-prose > :last-child { margin-bottom: 0; }
.w-block.subtle { color: var(--muted); font-size: var(--fs-sm); }
.w-block.subtle h2 { font-size: var(--fs-body); color: var(--fg); }
.w-band { background: var(--soft); border-radius: var(--r-lg); padding: var(--s5) var(--s4); }
.w-cols { display: grid; gap: var(--s5); }
.w-cols h3 { font-size: var(--fs-lead); margin: 0 0 var(--s2); }
.w-cols p { margin: 0; }
.w-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: var(--s3); margin-top: var(--s4); }
.w-card { display: grid; gap: 2px; padding: var(--s4); border-radius: var(--r-md); background: var(--soft); }
.w-fecho { display: grid; justify-items: center; text-align: center; }
.w-fecho-head { display: flex; flex-direction: column; align-items: center; gap: var(--s2); margin-bottom: var(--s3); }
.w-fecho-head h2 { margin: 0; }
.w-fecho-seixo { width: 132px; height: auto; flex: none; }
.w-fecho .w-prose p { margin-inline: auto; }
.w-fecho .w-act { justify-items: center; }
.w-fecho .w-ctas { justify-content: center; }
/* links in the welcome's running text and the consent line: bold at rest (colour alone is not enough), underline on hover */
.welcome .w-prose a:not([class]), .consent a { text-decoration: none; font-weight: 700; }
.welcome .w-prose a:not([class]):hover, .welcome .w-prose a:not([class]):focus-visible, .consent a:hover, .consent a:focus-visible { text-decoration: underline; }
@media (max-width: 767px) {
  /* one column; the buttons take the width, one above the other */
  .w-act { justify-items: stretch; }
  .w-ctas { flex-direction: column; }
  .w-fecho .w-act { justify-items: stretch; }
}
@media (min-width: 768px) {
  .welcome { gap: var(--s7); padding-top: var(--s6); }
  .w-hero:has(.intro-teaser) { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .w-band { padding: var(--s6); }
  .w-fecho-head { flex-direction: row; gap: var(--s4); }
}
@media (min-width: 900px) { .w-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s6); } }
@media (min-width: 1024px) {
  .welcome { gap: calc(var(--s7) + var(--s4)); }
  .w-hero:has(.intro-teaser) { grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); }
  .w-hero h1 { font-size: calc(var(--fs-h1) * 1.3); }
  .w-band { padding: var(--s7); }
}
.welcome .faq { max-width: 760px; }

/* contour lines, as on a topographic map, behind the hero and the interactive (design.md: the one decorative background).
   One seamless tile (public/topo.svg) used as a mask, so the lines take --line-strong and follow the theme */
.w-hero, .w-scene { position: relative; isolation: isolate; }
/* They fade out at the top and bottom (no hard edge) and, on screens wider than about 1300px, at the sides, so the tile
   never shows twice side by side */
.w-hero::before, .w-scene::before, .js .w-scene:not(.flat) .w-scene-pin::before { content: ""; position: absolute; z-index: -1; top: calc(-1 * var(--s6)); bottom: calc(-1 * var(--s6)); left: 50%; width: 100vw; transform: translateX(-50%); pointer-events: none;
  background-color: var(--line-strong); opacity: 0.55;
  --topo-edges: linear-gradient(90deg, transparent calc(50% - 1300px), #000 calc(50% - 650px), #000 calc(50% + 650px), transparent calc(50% + 1300px)), linear-gradient(transparent, #000 120px, #000 calc(100% - 120px), transparent);
  -webkit-mask: url(/topo.svg) 0 0 / 1200px repeat, var(--topo-edges); mask: url(/topo.svg) 0 0 / 1200px repeat, var(--topo-edges);
  -webkit-mask-composite: source-in; mask-composite: intersect; }
.w-hero::before { -webkit-mask-position: -200px -380px, 0 0, 0 0; mask-position: -200px -380px, 0 0, 0 0; }
/* while the story plays the lines sit on the pinned stage, one screen tall and still: no tile scrolling past again and again
   under the stage, and one layer the phone draws once (scrolling a 600vh mask cost a phone about 20 dropped frames a pass) */
.js .w-scene:not(.flat)::before { content: none; }
.js .w-scene:not(.flat) .w-scene-pin { isolation: isolate; }
.js .w-scene:not(.flat) .w-scene-pin::before { top: 0; bottom: 0; will-change: transform; -webkit-mask-position: -500px -150px, 0 0, 0 0; mask-position: -500px -150px, 0 0, 0 0; }
/* the lines grow from the tile's nine hilltops: a cover in the page colour opens on load (hero) and when the interactive is ready (scene); off with reduced motion */
@property --topo-r { syntax: "<length>"; inherits: false; initial-value: 400px; }
@media (prefers-reduced-motion: no-preference) {
  .w-hero::after, .w-scene-pin:has(.w-scene-take)::after { content: ""; position: absolute; z-index: -1; inset: calc(-1 * var(--s6)) auto; left: 50%; width: 100vw; transform: translateX(-50%); pointer-events: none;
    background-color: var(--bg); opacity: 0;
    --hill: radial-gradient(ellipse calc(var(--topo-r, 400px) * 1.3) calc(var(--topo-r, 400px) * 0.85), transparent 70%, #000);
    --hills: -480px -341px, 40px -364px, 380px -371px, -151px -53px, 266px 57px, 568px -10px, -471px 368px, -71px 381px, 385px 370px;
    -webkit-mask: var(--hill), var(--hill), var(--hill), var(--hill), var(--hill), var(--hill), var(--hill), var(--hill), var(--hill);
    mask: var(--hill), var(--hill), var(--hill), var(--hill), var(--hill), var(--hill), var(--hill), var(--hill), var(--hill);
    -webkit-mask-size: 1200px 1200px; mask-size: 1200px 1200px; -webkit-mask-position: var(--hills); mask-position: var(--hills);
    -webkit-mask-composite: source-in; mask-composite: intersect; }
  .w-hero::after { --hills: -680px -721px, -160px -744px, 180px -751px, -351px -433px, 66px -323px, 368px -390px, -671px -12px, -271px 1px, 185px -10px; animation: w-topo 1.4s ease-out; }
  /* the stage's lines sit 500px left and 150px up in the tile */
  .w-scene-pin:has(.w-scene-take)::after { top: 0; bottom: 0; --hills: -980px -491px, -460px -514px, -120px -521px, -651px -203px, -234px -93px, 68px -160px, -971px 218px, -571px 231px, -115px 220px; }
  .w-scene-pin:has(.w-scene-take:disabled)::after { opacity: 1; --topo-r: 1px; }
  .w-scene-pin:has(.w-scene-take:enabled)::after { animation: w-topo 1.4s ease-out; }
}
@keyframes w-topo { from { --topo-r: 1px; opacity: 1; } to { opacity: 1; } }

/* «valor»: three stops on one trail, as on the map */
@media (min-width: 900px) {
  .w-cols { position: relative; padding-top: var(--s6); }
  .w-cols::before { content: ""; position: absolute; top: 7px; left: 8px; right: 33%; border-top: 3px dotted var(--line-strong); }
  .w-cols > div { position: relative; }
  .w-cols > div::before { content: ""; position: absolute; top: calc(-1 * var(--s6)); left: 0; width: 16px; height: 16px; box-sizing: border-box; border-radius: 50%; background: var(--card); box-shadow: inset 0 0 0 3px var(--fg); }
}

/* the «interativo» block (scene.tsx): the «Falhas em 3D» stage stays on screen while seven beats play with the scroll */
.w-scene-head { display: grid; grid-template-columns: auto auto minmax(0, 1fr) auto; align-items: center; column-gap: var(--s2); }
.w-scene-head > :not(h2, .w-scene-skip, .w-scene-shuffle) { grid-column: 1 / -1; }
.w-scene-head h2 { grid-area: 1 / 1; }
.w-scene-head .w-scene-skip { grid-area: 1 / 4; }
/* the shuffle by the heading: another reviewed interactive on the stage, at random */
.w-scene-shuffle { grid-area: 1 / 2; width: 44px; height: 44px; min-height: 44px; padding: 0; margin: 0 0 var(--s1); border-radius: 50%; background: var(--card); color: var(--fg); box-shadow: 0 0 0 1px var(--line-strong); }
.w-scene-shuffle:hover { box-shadow: 0 0 0 1px var(--fg); }
.w-scene-shuffle svg { width: 22px; height: 22px; }
.w-scene-head h2 { margin: 0 0 var(--s1); }
.w-scene-head .w-scene-skip { color: var(--muted); text-decoration: underline; padding: 0; min-width: 44px; justify-content: flex-end; font-size: var(--fs-sm); white-space: nowrap; }   /* «Saltar»: quiet, first in the tab order */
.w-scene-head .w-prose p { margin: 0; }
.w-scene-text { margin: var(--s4) 0 0; padding-left: var(--s5); display: grid; gap: var(--s2); max-width: 65ch; }
/* tall as soon as the page has JS (html.js, index.html), so the page does not grow under the reader at hydration */
.js .w-scene:not(.flat) .w-scene-track { height: 600vh; }   /* seven beats */
.js .w-scene:not(.flat) .w-scene-pin { position: sticky; top: 0; height: 100vh; height: 100svh; box-sizing: border-box; display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4) 0; }
.w-scene-stage { position: relative; flex: 1; min-height: 0; border-radius: var(--r-lg); overflow: hidden; background: color-mix(in srgb, var(--card) 55%, transparent); box-shadow: 0 0 0 1px var(--line); cursor: pointer; }
.w-scene-stage iframe { display: block; width: 100%; height: 100%; border: 0; pointer-events: none; }   /* the demo plays: the page scrolls through it */
.w-scene-stage iframe { transition: opacity 0.4s ease-out; }
.w-scene-stage iframe.wait { opacity: 0; }   /* still loading: the still below shows instead */
.w-scene-still img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; pointer-events: none; transition: opacity 0.4s ease-out; }
.w-scene-still.gone img { opacity: 0; }
.w-scene.yours .w-scene-stage, .w-scene.other .w-scene-stage { cursor: auto; box-shadow: 0 0 0 2px var(--accent); }
.w-scene.yours .w-scene-stage iframe, .w-scene.other .w-scene-stage iframe { pointer-events: auto; }
/* another interactive (the shuffle): the scroll drives nothing, so the track is one screen, and the falhas text and
   question go. A 2D stage is cut if its frame is the wrong shape: the frame takes the shape that page needs (scene.tsx, ar) */
.js .w-scene.other:not(.flat) .w-scene-track { height: auto; }
.w-scene.other .w-scene-head .w-prose, .w-scene.other .w-scene-after { display: none; }
.w-scene.other .w-scene-stage { container-type: size; display: grid; place-items: center; }
.w-scene.other .w-scene-stage iframe.fit { --ar: var(--ar-w); width: min(100cqw, 100cqh * var(--ar)); height: min(100cqh, 100cqw / var(--ar)); }
@container (max-width: 560px) { .w-scene.other .w-scene-stage iframe.fit { --ar: var(--ar-n); } }
.w-scene-take { position: absolute; right: var(--s3); bottom: var(--s3); z-index: 1; }
.w-scene-hint { position: absolute; left: 50%; bottom: var(--s3); z-index: 1; transform: translateX(-50%); display: flex; align-items: center; gap: var(--s1); white-space: nowrap; padding: var(--s2) var(--s3); border: 0; border-radius: var(--r-pill); background: var(--fg); color: var(--bg); font: inherit; font-weight: 700; cursor: pointer; box-shadow: 0 4px 16px rgb(0 0 0 / 0.25); }
.w-scene-hint svg { width: 18px; height: 18px; animation: w-hint 1.6s ease-in-out infinite; }
@keyframes w-hint { 50% { transform: translateY(4px); } }
.w-scene-bar { display: flex; align-items: center; gap: var(--s2); padding: var(--s2); border-radius: var(--r-lg); background: var(--soft); min-height: 84px; box-sizing: border-box; }
.w-scene-cap { flex: 1; margin: 0; font-size: var(--fs-lead); line-height: 1.4; text-align: center; transition: opacity 0.3s cubic-bezier(0.22, 1, 0.36, 1); }
.w-scene-cap.out { opacity: 0; }
.w-scene-arrow { flex: none; width: 44px; height: 44px; min-height: 44px; padding: 0; border-radius: 50%; background: var(--card); color: var(--fg); font-size: var(--fs-h3); font-weight: 400; line-height: 1; box-shadow: none; }
.w-scene-arrow:disabled { opacity: 0.35; }
.w-scene-try { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--s2); }
.w-scene-try button[aria-pressed="true"] { box-shadow: inset 0 0 0 2px var(--accent); }
.w-scene-foot { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "left quiet"; align-items: center; gap: var(--s1) var(--s3); }
.w-scene-foot > :first-child { grid-area: left; }
.w-scene-foot .link { grid-area: quiet; color: var(--muted); text-decoration: underline; padding: 0; }
.w-scene-open { display: inline-flex; align-items: center; min-height: 44px; justify-self: start; }
.w-scene-open:hover, .w-scene-open:focus-visible { text-decoration: underline; }
.w-scene-dots { display: flex; gap: 6px; }
.w-scene-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); transition: background 0.3s, transform 0.3s; }
.w-scene-dots i.on { background: var(--fg); transform: scale(1.25); }
.w-scene-after { max-width: 720px; margin: var(--s6) auto 0; }
.w-scene-after h3 { margin: 0 0 var(--s3); }
.quiz-local { background: var(--card); border-radius: var(--r-lg); padding: var(--s4); box-shadow: 0 0 0 1px var(--line); }
.quiz-local .q { font-weight: 700; margin: 0 0 var(--s3); }
@media (max-width: 640px) {
  .js .w-scene:not(.flat) .w-scene-pin { gap: var(--s2); padding: var(--s3) 0; }
  .w-scene-cap { font-size: var(--fs-body); }
  .w-scene-bar { min-height: 96px; padding: var(--s1); }
  .w-scene-try { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .w-scene-try > span { grid-column: 1 / -1; text-align: center; }
  .w-scene-more { display: none; }
  .w-scene-take { top: var(--s2); left: var(--s2); right: auto; bottom: auto; }
  .w-scene-hint { bottom: var(--s2); padding: 6px var(--s2); font-size: var(--fs-sm); }
  .w-scene-hint svg { width: 16px; height: 16px; }
}
@media (prefers-reduced-motion: reduce) { .w-scene-cap, .w-scene-dots i, .w-scene-stage iframe, .w-scene-still img { transition: none; } .w-scene-hint svg { animation: none; } }

/* each block rises a few pixels as it comes into view, once, tied to the scroll (no script; off with reduced motion) */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .welcome > .w-block:not(.w-scene) { animation: w-rise linear both; animation-timeline: view(); animation-range: entry 0% entry 60%; }
  }
}
@keyframes w-rise { from { transform: translateY(24px); } to { transform: none; } }   /* no fade: text below the view keeps its full contrast */
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { min-height: 48px; display: flex; align-items: center; cursor: pointer; font-weight: 700; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; font-size: var(--fs-lead); color: var(--muted); }
.faq details[open] summary::after { content: "–"; }
.consent { margin: var(--s2) 0 0; }

/* /entrar (SignIn, ForgotPassword): one narrow centred column; on wider screens it sits on a card */
.auth { max-width: 420px; margin: 0 auto; }
.auth .form { max-width: none; }
.auth .form > button:not(.link) { width: 100%; }
.auth-forgot { justify-self: end; margin-top: calc(-1 * var(--s2)); }
.auth-switch { text-align: center; margin: var(--s3) 0 0; }
.auth-guest { display: grid; gap: var(--s2); margin-top: var(--s4); }
.auth-guest > p { margin: 0; }
.auth-or { display: flex; align-items: center; gap: var(--s3); }
.auth-or::before, .auth-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
@media (min-width: 600px) {
  .auth { margin-top: var(--s5); padding: var(--s5) var(--s6); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
  .auth h1 { margin-top: 0; }
}
.legal { max-width: 680px; }

/* ---------- site footer (footer.tsx): the welcome's contour lines raised into a relief, then the links ----------
   Neutral, like the map's islands: the ground is --soft, and the hills are a clay still (public/welcome/relief-*.webp, one
   per theme, from brand/clay): each terrace a step lighter, with a darker lip; only the signpost has the brand colour
   (violet on light, rosa on dark, as in the logo). */
:root { --relief-ground: var(--soft); --relief-h: clamp(140px, 17vw, 220px); }
/* the footer sits at the bottom of the screen even on a short page */
.shell:has(> .site-footer) { min-height: 100dvh; display: flex; flex-direction: column; }
.shell:has(> .site-footer) > .top, .shell:has(> .site-footer) > main { width: 100%; }
.shell:has(> .site-footer) > main { flex: 1 0 auto; padding-bottom: var(--s6); }
.site-footer { overflow: clip; }
/* the drawing keeps one scale for its height: a phone sees the summit with the signpost near the middle, a wide screen
   more ground on both sides */
.relief { position: relative; height: var(--relief-h); }
.relief svg { position: absolute; bottom: 0; left: 50%; height: 100%; width: calc(var(--relief-h) * 5); transform: translateX(-62%); overflow: visible; display: block; }
.relief-ground { fill: var(--relief-ground); }
/* the still is 6.5 : 1, as tall as the relief; its signpost is a little right of its middle */
.relief img { position: absolute; bottom: 0; left: 50%; height: 100%; width: auto; max-width: none; translate: -51.5% 0; display: block; }
.site-footer-base {
  position: relative; background: var(--relief-ground);
  padding: var(--s3) max(var(--s4), env(safe-area-inset-right)) calc(var(--s6) + env(safe-area-inset-bottom)) max(var(--s4), env(safe-area-inset-left));
}
/* clear of the phone's tab bar */
.shell:has(> .tabbar) .site-footer-base { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s5)); }
.site-footer-in { max-width: 720px; margin: 0 auto; display: grid; gap: var(--s3); color: var(--muted); }
.site-footer-brand p { margin: 0; }
.footer-logo img { display: block; height: 40px; width: auto; }
.site-footer nav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; column-gap: var(--s5); }
/* the footer's links are a row of their own (not links inside a sentence): no underline at rest, a 44 px target */
.site-footer a { display: inline-flex; align-items: center; min-height: 44px; color: var(--fg); text-decoration: none; }
.site-footer a:hover, .site-footer a:focus-visible { text-decoration: underline; }
.site-footer-end { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; column-gap: var(--s5); padding-top: var(--s2); border-top: 1px solid var(--line); }
.site-footer-end address { font-style: normal; }
.site-footer-end p { margin: 0; }
@media (min-width: 768px) {
  .site-footer-in { grid-template-columns: auto minmax(0, 1fr); column-gap: var(--s6); align-items: start; }
  .site-footer nav ul { justify-content: flex-end; }
  .site-footer-end { grid-column: 1 / -1; }
  body:has(.welcome) .site-footer-in { max-width: 960px; }
}
@media (min-width: 1024px) {
  .shell:has(> .tabbar) .site-footer-base { padding-bottom: calc(var(--s6) + env(safe-area-inset-bottom)); }
  body:has(.welcome) .site-footer-in { max-width: 1120px; }
}
/* the hills rise into place from behind the footer's base as the footer scrolls in.
   Only where the browser ties animation to scrolling, and not with reduced motion: elsewhere the relief is just there */
@supports (animation-timeline: view()) {
  @media (prefers-reduced-motion: no-preference) {
    .site-footer { view-timeline: --relief block; }
    .relief img { animation: relief-rise linear both; animation-timeline: --relief; animation-range: entry 0% entry 80%; }
  }
}
@keyframes relief-rise { from { transform: translateY(40%); } }
.legal-body table { width: 100%; border-collapse: collapse; margin: var(--s3) 0; font-size: var(--fs-sm); display: block; overflow-x: auto; }
.legal-body th, .legal-body td { text-align: left; padding: var(--s2) 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.legal-body th { font-weight: 700; }
.legal-body code { font-size: 0.9em; word-break: break-all; }

/* playback speed */
.speed-chip { min-height: 44px; padding: 6px 14px; background: var(--soft); color: var(--fg); border-radius: var(--r-md); font-weight: 700; }
.speed-chip .speed-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.player-bar { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); margin: var(--s2) 0; }
.rail-btn.speed .speed-val { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%; background: rgba(0, 0, 0, 0.45); font-size: var(--fs-sm); font-weight: 700; }

/* ---------- phones: thin rail of icons in the frame's right margin; clip label stays below the caption band ---------- */
@media (max-width: 767px) {
  .rail { right: 4px; bottom: var(--s3); gap: 4px; }
  .rail-btn { font-size: 0; gap: 0; text-shadow: none; }
  .rail-btn .ico { background: rgba(0, 0, 0, 0.35); }
  .rail-btn.speed .speed-val { background: rgba(0, 0, 0, 0.35); }
  .rail-btn.speed .speed-label { display: none; }
  .rail .seixo { width: 44px !important; height: 42px !important; }
  .seixo-space { width: 44px; height: 42px; }
  .feed-item:not(.feed-clip) { padding-right: 56px; }
  .clip-info { right: 56px; bottom: var(--s3); gap: 2px; }
  .clip-title { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; font-size: var(--fs-body); }
}

/* ---------- tablet ---------- */
@media (min-width: 768px) {
  main:has(.explore) { max-width: 1000px; }
  .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  /* the rail gets its own gutter beside the video and the cards, outside the frame */
  .feed-wrap { max-width: 600px; }
  .feed-item, .feed-item:not(.feed-clip) { padding-right: 76px; }
  .feed-clip { background: var(--night); }
  .rail { right: 10px; }
  .clip-info { right: var(--s4); }
}

/* ---------- desktop: slim left rail; feed as a centred column with side panels ---------- */
@media (min-width: 1024px) {
  :root { --rail-w: 92px; }
  .shell:has(> .tabbar) { padding-left: var(--rail-w); }
  .tabbar {
    top: 0; right: auto; width: var(--rail-w); height: 100dvh; padding: var(--s4) 0; border-top: 0; border-right: 1px solid var(--line);
    display: flex; flex-direction: column; align-items: center; gap: 6px; grid-template-columns: none;
  }
  .tabbar .tab { width: 76px; height: 64px; border-radius: var(--r-md); }
  .tabbar .tab:hover { background: var(--soft); }
  .tabbar .rail-logo { display: grid; place-items: center; margin-bottom: 14px; }
  .tabbar .rail-logo img { width: 40px; height: 40px; display: block; }
  .shell:has(> .tabbar) .top { display: none; }
  main { padding-top: var(--s5); padding-bottom: var(--s7); }
  main:has(.explore) { max-width: 1240px; }
  .explore { max-width: none; }
  .explore > .switch { justify-content: flex-start; }
  .grid { grid-template-columns: repeat(5, 1fr); }
  .toast, .marks-bar { bottom: var(--s6); }

  /* the run's head sits in the panel, so the video starts at the top */
  .feed-desktop { --overlay-h: 0px; display: grid; grid-template-columns: minmax(440px, 540px) minmax(280px, 400px); justify-content: center; height: 100dvh; background: var(--night); }
  .feed-desktop .clip-meta, .feed-desktop .clip-title { display: none; }
  .ctx-links { display: flex; gap: var(--s4); align-items: center; margin: var(--s2) 0 0; padding-top: var(--s3); border-top: 1px solid var(--line); }
  .ctx-links .link { min-height: 0; padding: 0; font-size: inherit; }
  .feed-desktop .feed-wrap { height: 100dvh; max-width: none; width: 100%; }
  .panel { height: 100dvh; overflow-y: auto; padding: 28px 28px 40px; }
  /* the panel does not scroll: the chapter list does, so the head and the links stay in sight */
  .panel-right { display: flex; flex-direction: column; overflow: hidden; border-left: 1px solid var(--line); }
  .panel-head .feed-back-title { white-space: normal; }
  .panel-head { flex: none; max-width: 360px; padding-bottom: var(--s4); margin-bottom: var(--s4); border-bottom: 1px solid var(--line); }
  .context { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--s2); max-width: 360px; overflow-y: auto; }
  .context > * { flex: none; }
  .context .chapters { flex: 0 1 auto; min-height: 0; overflow-y: auto; position: relative; }
  .chapters li.now button { color: var(--accent); font-weight: 700; }
  .chapters li.now .ch-t { color: var(--accent); }
  .context h2 { margin: 0; font-size: var(--fs-h3); }
  .ctx-block { margin-top: var(--s2); padding-top: var(--s3); border-top: 1px solid var(--line); }
  .ctx-block ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 6px; }
  .kbd-hint { margin-top: var(--s4); }
  .feed-msg { height: 100dvh; }
}
/* 1024–1279 px: a narrower feed and less padding, so the side panel keeps about 240 px for text */
@media (min-width: 1024px) and (max-width: 1279px) {
  .feed-desktop { grid-template-columns: minmax(400px, 460px) minmax(240px, 360px); }
  .panel { padding: 20px 18px 32px; }
}
@media (min-width: 1280px) {
  .grid { grid-template-columns: repeat(6, 1fr); }
}

/* the compact trail inside the dark desktop panel uses the night tokens of .panel */
.trail-page.compact h1 { font-size: var(--fs-h3); }
.trail-page.compact .countdown { padding: 10px 14px; display: grid; gap: 2px; }
.trail-page.compact .countdown b { font-size: var(--fs-h3); }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; }
  .sk { animation: none; }
}

/* ---------- account page: calm settings list ---------- */
main:has(.settings) { max-width: 560px; }
.settings { display: grid; gap: var(--s5); padding-top: var(--s2); }
.settings-head { display: flex; gap: var(--s3); align-items: center; }
.settings-head > div { display: grid; gap: 2px; }
.settings-head b { font-size: var(--fs-lead); }
.settings-cta { background: var(--soft); border-radius: var(--r-lg); padding: var(--s4); display: grid; gap: var(--s2); justify-items: start; }
.settings-cta h2 { margin: 0; font-size: var(--fs-lead); }
.settings-cta p { margin: 0; }
.sgroup h2.kicker { margin: 0 0 var(--s2) var(--s4); }
.sgroup-box { background: var(--soft); border-radius: var(--r-lg); overflow: hidden; }
.srow {
  width: 100%; min-height: 52px; display: flex; justify-content: space-between; align-items: center; gap: var(--s3);
  padding: 0 var(--s4); background: none; color: var(--fg); font-weight: 400; border-radius: 0; text-align: left; text-decoration: none;
}
.srow + .srow { box-shadow: inset 0 1px 0 var(--line); }
.srow:hover { background: color-mix(in srgb, var(--fg) 4%, transparent); }
.srow-value { display: inline-flex; align-items: center; gap: var(--s1); color: var(--muted); }
.chev { width: 18px; height: 18px; }
/* --bad on --soft is 4.2:1 in light mode; a step towards ink gets it past 4.5:1 (dark mode stays light red) */
.danger-row { color: color-mix(in srgb, var(--no) 80%, var(--fg)); }
.segmented { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; background: var(--soft); border-radius: var(--r-md); padding: 4px; margin: var(--s3) 0; }
.segmented button { min-height: 44px; background: none; color: var(--fg); border-radius: var(--r-sm); }
.segmented button.on { background: var(--card); box-shadow: inset 0 0 0 1.5px var(--line-strong); }
dialog.sheet h2 { margin-top: 0; }

/* AI disclosure and "Reportar erro" */
.ai-note { font-size: var(--fs-label); color: var(--muted); margin: var(--s2) 0 0; line-height: 1.4; }
.ai-note a { color: var(--accent); }
.clip-info .ai-note { color: rgba(255, 255, 255, 0.8); margin: 0; }
/* on the dark video the brand violet is too dark to read (#16): a light, underlined link */
.clip-info .ai-note a { color: var(--on-night); text-decoration: underline; }
.report-btn { background: none; color: var(--muted); padding: 10px 0; min-height: 44px; font-weight: 400; font-size: var(--fs-sm); text-decoration: none; border-radius: 0; }
/* on a tinted feedback box the muted grey is too faint (axe: contrast) */
.feedback .report-btn { color: inherit; }
.reason-chips { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s2) 0 var(--s3); }

/* phones: the clip label keeps to the band below the captions, which the video draws from 72 % of its height down to
   about 79 % (shared/style.css #capbar): play, sound and the title on one row, the disclosure, then «Seguinte» on one
   line. At 360 × 640 it starts below them. No area row; in a run, «✓ visto» once seen, else when it counts. */
@media (max-width: 767px) {
  .clip-info .area-dot { display: none; }
  .clip-info { bottom: var(--s2); grid-template-columns: auto minmax(0, 1fr); column-gap: var(--s2); align-items: center; }
  .clip-info .clip-meta { grid-area: 1 / 1 / 2 / -1; }
  .clip-info .clip-meta:not(:has(.done-chip, .clip-hint)) { display: none; }
  .clip-info .clip-ctrls { grid-area: 2 / 1; margin: 0; }
  .clip-info .clip-title { grid-area: 2 / 2; }
  .clip-info > .ai-note, .clip-info > .pill { grid-area: 3 / 1 / 4 / -1; justify-self: start; line-height: 1.25; }
  .clip-info .clip-after { grid-area: 4 / 1 / 5 / -1; min-width: 0; max-width: 100%; }
  .clip-info .clip-after:empty { display: none; }
  .clip-info .run-next { margin: 0; }
  .clip-info .run-next button { display: inline-flex; align-items: center; max-width: 100%; min-height: 44px; padding-block: 0; white-space: nowrap; }
  .clip-info .run-next-label { overflow: hidden; text-overflow: ellipsis; }
}
/* short phones (360 × 640): the disclosure takes two lines there, so the block keeps its 44 px controls but drops its spacing to stay below the captions */
@media (max-width: 767px) and (max-height: 700px) {
  .clip-info { bottom: 2px; gap: 0; }
  .clip-info > .ai-note { line-height: 1.1; }
  .clip-info > .ai-note a { text-underline-offset: 1px; }
  /* no room for the «aos 90%» row there */
  .clip-info .clip-meta:not(:has(.done-chip, .clip-resume)) { display: none; }
}
/* phones: «Continuar aos m:ss» sits beside play and sound, in the title's place, until it is used: no extra row */
@media (max-width: 767px) {
  .clip-info:has(.clip-resume) .clip-title { display: none; }
  .clip-info:has(.clip-resume) .clip-meta { grid-area: 2 / 2; }
}
/* tablet and up: rail labels wrap inside the gutter instead of spilling onto the video */
@media (min-width: 768px) {
  .feed-item, .feed-item:not(.feed-clip) { padding-right: 88px; }
  .rail { right: 6px; }
  .rail-btn { max-width: 76px; text-align: center; line-height: 1.15; }
}
/* the first-card hint (FeedView): under the run's head, over the middle of the card */
.feed-hint { position: absolute; top: calc(var(--overlay-h) + var(--s3)); left: 50%; z-index: 4; transform: translateX(-50%); display: flex; align-items: center; gap: var(--s1); white-space: nowrap; padding: var(--s2) var(--s3); border: 0; border-radius: var(--r-pill); background: #fff; color: var(--night); font: inherit; font-size: var(--fs-sm); font-weight: 700; cursor: pointer; box-shadow: 0 4px 16px rgb(0 0 0 / 0.35); animation: tile-peek-in 0.3s ease-out; }
.feed-hint svg { width: 16px; height: 16px; animation: w-hint 1.6s ease-in-out infinite; }
.feed-hint.up svg { animation-name: w-hint-up; }
@keyframes w-hint-up { 50% { transform: translateY(-4px); } }
@media (prefers-reduced-motion: reduce) { .feed-hint, .feed-hint svg { animation: none; } }
/* ▲ ▼ with a mouse, halfway down the rail's gutter */
.feed-nav { display: none; }
@media (min-width: 768px) and (hover: hover) and (pointer: fine) {
  .feed-hint { left: calc(50% - 44px); }
  .feed-nav { position: absolute; right: 6px; top: 50%; z-index: 3; width: 76px; transform: translateY(-50%); display: grid; gap: var(--s2); justify-items: center; }
  .feed-nav .rail-btn:disabled { opacity: 0.3; }
}

/* lighter rail: 44 px hit areas with a smaller, more translucent disc; on phones it stays above the clip title */
.rail-btn .ico { padding: 12px; background: rgba(0, 0, 0, 0.3); }
.rail-btn.speed .speed-val { background: rgba(0, 0, 0, 0.3); }
dialog.sheet .sgroup-box { margin: var(--s3) 0; }
dialog.sheet .srow .ico { width: 20px; height: 20px; color: var(--muted); }
@media (max-width: 767px) {
  .feed-clip .rail { bottom: 104px; }
  /* short phones (360×640) leave black bars beside the 9:16 frame: keep 52 px of them on the right for the rail
     (4 px edge + 44 px buttons + 4 px gap), else stay centred. When the frame fills the width, this is 0. */
  .clip video { object-position: clamp(0px, calc(100% - 52px), 50%) top; }
  .rail-btn .ico, .rail-btn.speed .speed-val { background: rgba(0, 0, 0, 0.25); }
}

/* the welcome hero's videos (intro.tsx VideoStack): a stack of posters, the front one plays, the others fan out behind it */
.vstack { justify-self: center; width: min(200px, 60vw); display: grid; gap: var(--s3); margin: 0; }
.vstack-cards { position: relative; aspect-ratio: 9 / 16; margin-right: 18%; }
.vstack-card {
  position: absolute; inset: 0; padding: 0; min-height: 0; border-radius: var(--r-lg); overflow: hidden; background: var(--night-2);
  transform-origin: 50% 100%; transition: transform 0.35s ease, opacity 0.35s ease, filter 0.35s ease; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}
.vstack-card img, .vstack-card .intro-thumb { display: block; width: 100%; height: 100%; object-fit: cover; }
.vstack-card[data-d="0"] { z-index: 3; }
.vstack-card[data-d="1"] { z-index: 2; transform: translateX(10%) rotate(4deg) scale(0.94); filter: brightness(0.92); }
.vstack-card[data-d="2"] { z-index: 1; transform: translateX(19%) rotate(8deg) scale(0.88); filter: brightness(0.84); }
.vstack-card[data-d="3"] { z-index: 0; transform: translateX(19%) rotate(8deg) scale(0.88); opacity: 0; pointer-events: none; }
.vstack-card:not([data-d="0"]) { pointer-events: none; }
.vstack-card[data-d="0"]:hover { transform: translateY(-4px); }
.vstack-play { position: absolute; inset: 0; width: 100%; height: 100%; padding: 0; min-height: 0; background: transparent; border-radius: inherit; box-shadow: none; }
.vstack-play:focus-visible { outline-offset: -4px; }
.vstack-card .intro-play { position: absolute; inset: 0; margin: auto; width: 56px; height: 56px; background: var(--card); color: var(--fg); box-shadow: none; font-size: var(--fs-lead); }
.vstack-nav { display: flex; align-items: center; justify-content: center; gap: var(--s3); margin-right: 18%; }
.vstack-nav .icon-btn { font-size: var(--fs-h3); line-height: 1; }
.vstack .intro-text { text-align: center; margin: 0 18% 0 0; }
@media (prefers-reduced-motion: reduce) { .vstack-card { transition: none; } }
@media (min-width: 768px) { .vstack { width: 260px; } }
@media (min-width: 1024px) { .vstack { width: 340px; } }
.intro-thumb { background: var(--night-2); }
.intro-text { display: grid; gap: 2px; min-width: 0; }
.intro-text b { font-size: var(--fs-body); }
.intro-play { width: 44px; height: 44px; flex: none; display: grid; place-items: center; border-radius: 50%; }
dialog.modal-player { border: 0; padding: var(--s4); background: transparent; width: min(420px, 100%); max-height: 100dvh; overflow: visible; }
dialog.modal-player[open] { display: grid; gap: var(--s3); justify-items: center; }
dialog.modal-player::backdrop { background: rgba(0, 0, 0, 0.75); }
.modal-player video { width: 100%; max-height: 78dvh; aspect-ratio: 9 / 16; background: #000; border-radius: var(--r-lg); }
.modal-player .secondary { color: #fff; box-shadow: inset 0 0 0 1.5px rgba(255, 255, 255, 0.6); }

/* Quiz rápido */
.quick-cta { display: flex; justify-content: space-between; align-items: center; gap: var(--s3); padding: var(--s4); margin: var(--s3) 0; background: var(--soft); border-radius: var(--r-lg); }
.quick-cta > div { display: grid; gap: 2px; }
.quick { display: grid; gap: var(--s3); }
.quick .quiz { border-bottom: 0; padding-top: 0; }
.quick-progress { display: grid; grid-auto-flow: column; gap: 4px; }
.quick-progress i { height: 4px; background: var(--line); }
.quick-progress i.done { background: var(--fg); }
.quick-progress i.cur { background: var(--accent); }
.quick-end { display: grid; justify-items: center; text-align: center; gap: var(--s2); padding-top: var(--s5); }
.refs .links { margin: 0; padding-left: 18px; }

.refs .links { list-style: none; padding-left: 0; }

/* ---------- owner view (/admin) and its charts (src/web/charts.tsx) ----------
   Laid out like an analytics tool (references: Amplitude and PostHog dashboards): a side menu of pages, KPI cards with
   the change and a small trend, chart cards in a two-column grid, a funnel and a retention-style heat grid. Cards are
   flat (a hairline, no shadow); faint bars behind list rows; zeros muted so real numbers stand out. Much wider than the
   student pages. Below 960px the side menu is a row of tabs and the grid one column. */
main:has(> .admin) { max-width: 1280px; }
.admin { display: grid; gap: var(--s4); padding-bottom: var(--s6); }
.admin-main { display: grid; gap: var(--s4); min-width: 0; align-content: start; }
.admin-side { display: flex; gap: var(--s4); overflow-x: auto; border-bottom: 1px solid var(--line); }
.admin-side .kicker { display: none; }
.admin-side a { min-height: 44px; display: inline-flex; align-items: center; flex: none; font-weight: 700; font-size: var(--fs-sm); text-decoration: none; color: var(--muted); border-bottom: 2.5px solid transparent; }
.admin-side a:hover { color: var(--fg); }
.admin-side a.on { color: var(--fg); border-bottom-color: var(--fg); }
@media (min-width: 960px) {
  .admin { grid-template-columns: 168px minmax(0, 1fr); gap: var(--s6); align-items: start; }
  .admin-side { flex-direction: column; gap: 2px; position: sticky; top: var(--s4); border: 0; overflow: visible; }
  .admin-side .kicker { display: block; padding: var(--s2) var(--s3); margin: 0; }
  .admin-side a { min-height: 36px; padding: 0 var(--s3); border: 0; border-radius: var(--r-md); font-weight: 400; }
  .admin-side a.on { background: var(--soft); font-weight: 700; }
}
.admin-grid { display: grid; gap: var(--s4); }
@media (min-width: 1100px) { .admin-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.admin h1 { margin: 0; overflow-wrap: anywhere; }
.admin-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s2) var(--s4); }
.admin-head > div { min-width: 0; }
.admin-head p { margin: var(--s1) 0 0; }
.admin-tools { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2) var(--s4); }
.admin-tools form { display: contents; }
.admin-tools input { flex: 1 1 260px; min-height: 40px; padding: 6px 12px; font-size: var(--fs-sm); }
.seg { display: inline-flex; gap: 2px; padding: 2px; border: 1px solid var(--line); border-radius: var(--r-md); }
.admin-span { display: flex; flex-wrap: wrap; gap: var(--s2); }
.seg button { min-height: 32px; padding: 2px 10px; border-radius: var(--r-sm); background: none; box-shadow: none; color: var(--muted); font-size: var(--fs-sm); }
.seg button:hover { color: var(--fg); }
.seg button.on { background: var(--soft); color: var(--fg); }
.admin-table { overflow-x: auto; }
.admin-table table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); font-variant-numeric: tabular-nums; }
.admin-table th, .admin-table td { text-align: left; padding: 10px var(--s2); border-bottom: 1px solid var(--line); white-space: nowrap; }
.admin-table th { color: var(--muted); font-size: var(--fs-label); font-weight: 400; }
.admin-table .num { text-align: right; }
.admin-table .zero { color: var(--muted); opacity: 0.6; }
.admin-table .acc { max-width: 0; width: 100%; overflow: hidden; text-overflow: ellipsis; }
.admin-table .acc a { color: var(--fg); text-decoration: none; }
.admin-table tbody tr { cursor: pointer; }
.admin-table tbody tr:hover { background: var(--soft); }
.admin-table tbody.static tr { cursor: auto; }
.admin-table tbody.static tr:hover { background: none; }
/* a share as a tint (retention-style grid): --h is 0..100 */
.admin-table td.heat { background: color-mix(in srgb, var(--viz-1) calc(var(--h) * 0.5%), transparent); }
.admin-use { display: inline-flex; align-items: center; gap: var(--s2); }
.admin-strip rect.on { fill: var(--viz-1); }
.admin-strip rect.off { fill: var(--line); }
.admin-trend { font-weight: 700; }
.admin-trend.up { color: var(--ok); }
.admin-trend.down, .admin-trend.stopped { color: var(--no); }
.admin-quiet > summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); padding: var(--s2) 0; }
.viz { margin: 0; padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); display: grid; gap: var(--s3); align-content: start; min-width: 0; }
.viz figcaption { font-size: var(--fs-sm); display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.viz-aside { flex: none; }
.viz-aside a { color: var(--muted); text-decoration: none; }
.viz-aside a:hover { color: var(--fg); }
.viz-line.viz-prev { stroke: var(--muted); stroke-width: 1.5; stroke-dasharray: 4 4; }
.swatch.prev { background: var(--muted); }
.viz-spark { display: block; width: 100%; height: 28px; margin-top: var(--s2); }
.viz-delta.up { color: var(--ok); }
.viz-delta.down { color: var(--no); }
.viz-funnel { list-style: none; margin: 0; padding: 0; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--s2); font-variant-numeric: tabular-nums; }
.viz-funnel li { display: grid; gap: 2px; align-content: start; min-width: 0; }
.viz-funnel-col { height: 120px; display: flex; align-items: flex-end; margin-bottom: var(--s1); border-radius: var(--r-xs); background: var(--soft); overflow: hidden; }
.viz-funnel-col i { display: block; width: 100%; min-height: 2px; background: var(--viz-1); }
.viz-plot { position: relative; }
.viz-plot svg { display: block; width: 100%; height: auto; touch-action: pan-y; }
.viz-grid { stroke: var(--line); stroke-width: 1; }
.viz-tick { fill: var(--muted); font-size: var(--fs-label); font-variant-numeric: tabular-nums; }
.viz-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.viz-line.viz-1 { stroke: var(--viz-1); }
.viz-line.viz-2 { stroke: var(--viz-2); }
.viz-wash.viz-1 { fill: var(--viz-1); opacity: 0.1; }
.viz-dot { stroke: var(--card); stroke-width: 2; }
.viz-dot.viz-1 { fill: var(--viz-1); }
.viz-dot.viz-2 { fill: var(--viz-2); }
.viz-cross { stroke: var(--line-strong); stroke-width: 1; }
.viz-tip { position: absolute; top: 0; transform: translateX(-50%); background: var(--card); border: 1px solid var(--line-strong); border-radius: var(--r-sm); padding: var(--s1) var(--s2); display: grid; gap: 2px; font-size: var(--fs-sm); pointer-events: none; white-space: nowrap; z-index: 1; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.swatch.viz-1 { background: var(--viz-1); }
.swatch.viz-2 { background: var(--viz-2); }
.viz-legend { display: flex; flex-wrap: wrap; gap: var(--s3); margin: 0; color: var(--muted); }
.viz-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.viz-bars li { position: relative; display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); padding: 6px var(--s2); font-size: var(--fs-sm); }
.viz-bar { position: absolute; inset: 0 auto 0 0; border-radius: var(--r-xs); background: color-mix(in srgb, var(--viz-1) 22%, transparent); }
.viz-bar-label, .viz-bar-value { position: relative; }
.viz-bar-label { min-width: 0; overflow-wrap: anywhere; }
.viz-bar-value { flex: none; font-variant-numeric: tabular-nums; text-align: right; }
.viz-more { justify-self: start; min-height: 0; padding: 0; }
.viz-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s4); }
.viz-tiles > div { display: grid; gap: 2px; align-content: start; padding: var(--s4); border: 1px solid var(--line); border-radius: var(--r-md); background: var(--card); min-width: 0; }
.viz-tiles b { font-size: var(--fs-h2); line-height: 1.1; font-variant-numeric: tabular-nums; }
.viz-table summary { cursor: pointer; color: var(--muted); }
.viz-table table { border-collapse: collapse; width: 100%; margin-top: var(--s2); font-variant-numeric: tabular-nums; }
.viz-table th, .viz-table td { text-align: left; padding: 4px var(--s2); border-bottom: 1px solid var(--line); }
@media (max-width: 599px) { .admin-table .wide { display: none; } }
@media (min-width: 768px) { .viz-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* ---------- real IAVE exams: the answer sheet (src/web/iave.tsx) ---------- */
.iave .row-gap { flex-wrap: wrap; }
fieldset.sheet { border: 0; padding: 0; margin: 0; min-width: 0; }
.sheet-group { margin: var(--s4) 0; }
.sheet-group h2 { margin-top: 0; }
.sheet-row { padding: var(--s3) 0; border-bottom: 1px solid var(--line); display: grid; gap: var(--s2); }
.sheet-row p { margin: 0; }
.sheet-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); }
.sheet-pairs { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); }
.sheet-text { display: block; white-space: pre-wrap; background: var(--soft); border-radius: var(--r-sm); padding: var(--s2); margin-top: 4px; }
.sheet-row .segmented { grid-template-columns: repeat(auto-fit, minmax(48px, 1fr)); max-width: 360px; margin: 0; }
.sheet-set { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; gap: var(--s2); }
.sheet-set .segmented { max-width: none; }
/* system colours in content (e.g. an SVG label halo with stroke="Canvas") follow the theme */
:root { color-scheme: light dark; }
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* ---------- following paths (src/web/paths.tsx): first-visit picker, «Os meus caminhos» ---------- */
.picker, .my-paths { display: grid; gap: var(--s3); }
.picker-list { display: grid; gap: var(--s2); }
.picker-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--s3); text-align: left; min-height: 64px; padding: var(--s3) var(--s4); background: var(--card); color: var(--fg); border: 1.5px solid var(--line-strong); border-radius: var(--r-lg); }
.picker-card.on { border-color: var(--accent); box-shadow: inset 0 0 0 1.5px var(--accent); }
.picker-tick { font-weight: 700; color: var(--accent); min-width: 1em; }
.my-path-add { display: flex; justify-content: space-between; align-items: center; gap: var(--s2); margin: 0; }
.my-path-add > a { display: inline-flex; align-items: center; gap: var(--s2); }

/* diagnostic result: right answers per domínio, the weakest first (src/web/practice.tsx) */
.checkpoint-domains { list-style: none; padding: 0; margin: var(--s3) 0 0; display: grid; gap: var(--s1); width: 100%; text-align: left; }
.checkpoint-head { margin: var(--s3) 0 0; width: 100%; text-align: left; font-weight: 700; }
.checkpoint-head + .checkpoint-domains { margin-top: var(--s1); }
.checkpoint-head.muted { font-weight: 400; }
.checkpoint-domains li > :last-child { white-space: nowrap; }
.checkpoint-domains li { display: flex; justify-content: space-between; gap: var(--s3); border-top: 1px solid var(--line); padding-top: var(--s1); }

/* ---------- «Eu», Início with no path, and /caminhos (src/web/paths.tsx, home.tsx, app.tsx MePage) ---------- */
/* screen-reader-only text (e.g. «Mudar» → «Mudar os teus caminhos») */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.section-head h2 { margin-bottom: var(--s2); }
.section-head > a, .me-head > a:not(.button) { display: inline-flex; align-items: center; min-height: 44px; }
/* cards sit in grids with a gap; no extra margins */
.path-card { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: var(--s3); padding: var(--s3); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.path-cover { position: relative; display: block; aspect-ratio: 9 / 16; border-radius: var(--r-md); overflow: hidden; background: var(--soft); align-self: start; }
.path-cover img, .cover-fill { display: block; width: 100%; height: 100%; object-fit: cover; }
.cover-fill { background: var(--soft); }
.path-body { display: grid; gap: 4px; align-content: start; min-width: 0; }
.path-body p { margin: 0; }
.path-body .kicker { display: flex; align-items: center; gap: 6px; margin: 0; }
.path-heading { margin: 0; font-size: inherit; line-height: 1.2; }
.path-title { display: inline-block; padding: 6px 0; font-size: var(--fs-lead); font-weight: 700; color: var(--fg); overflow-wrap: anywhere; hyphens: auto; }
.path-title:hover, .path-title:focus-visible { text-decoration: underline; }
.path-body .meter.light { margin: var(--s1) 0 0; }
/* the next step: the main action of the card */
.path-next { display: grid; gap: 2px; margin-top: var(--s2); padding: var(--s2) var(--s3); min-height: 44px; background: var(--soft); border-radius: var(--r-md); color: var(--fg); overflow-wrap: anywhere; }
.path-next .kicker { margin: 0; }
.path-next a, a.path-next { color: var(--accent); font-weight: 700; }
.path-next a { display: inline-block; padding: 2px 0; }
.path-body button.link { justify-self: start; text-align: left; }
.save-anonymous { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--s2) var(--s3); padding: var(--s3) var(--s4); margin: var(--s3) 0; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.save-anonymous > div { display: grid; gap: 2px; flex: 1 1 14em; }
.save-anonymous { background: var(--soft); border-color: transparent; }
/* Início: held above the tab bar while scrolling, settles at the end; solid so the page does not show through */
.save-anonymous.sticky { position: sticky; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s2)); z-index: 10; flex-wrap: nowrap; padding: var(--s2) var(--s3); background: var(--card); border-color: var(--line); box-shadow: 0 4px 16px rgb(0 0 0 / 0.08); }
.save-anonymous.sticky > div { flex: 1 1 auto; }
.save-anonymous.sticky .button { white-space: nowrap; min-height: 44px; padding-block: 0; }
@media (min-width: 1024px) { .save-anonymous.sticky { bottom: var(--s3); } }
/* «Começa aqui»: the first stage as a numbered list, one button */
.subject-progress { margin-bottom: var(--s5); }
.subject-progress-head { display: flex; align-items: center; gap: var(--s2); }
.subject-progress h4 { font-size: var(--fs-body); margin: var(--s4) 0 var(--s1); scroll-margin-top: var(--s5); }
.subject-progress h4 .small { font-weight: 400; }
.subject-progress .mastery li { grid-template-columns: minmax(0, 1fr) 96px 44px; overflow-wrap: anywhere; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
/* «Eu»: paths, «Para hoje» and progress; on a computer «Para hoje» sits beside the other two */
.me-cols { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-areas: "paths" "today" "progress"; }
.me-paths { grid-area: paths; }
.me-progress { grid-area: progress; }
.today { grid-area: today; margin: var(--s5) 0 0; padding: var(--s3) var(--s4) var(--s1); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); }
.today h2 { margin: 0; font-size: var(--fs-lead); }
.today > p { margin: 2px 0 var(--s2); }
.today-answer { margin: 0 0 var(--s2); }
.today-list { list-style: none; padding: 0; margin: 0; }
.today-list > li { display: grid; justify-items: start; padding: var(--s2) 0; border-top: 1px solid var(--line); scroll-margin-top: var(--s5); }
/* the count drops under a long title on a narrow screen */
.today-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 var(--s2); width: 100%; }
.today-head .dot { align-self: center; }
.today-head b { flex: 1 1 12em; min-width: 0; overflow-wrap: anywhere; }
.today-head .small { flex: none; }
.today-go { display: inline-flex; align-items: center; min-height: 44px; font-weight: 700; }
.today details { width: 100%; }
.today summary { cursor: pointer; color: var(--muted); font-size: var(--fs-sm); min-height: 44px; display: flex; align-items: center; }
.today details ul { list-style: none; padding: 0; margin: 0 0 var(--s2); display: grid; gap: var(--s2); font-size: var(--fs-sm); }
.today details li { display: grid; gap: 2px; padding-left: var(--s3); border-left: 2px solid var(--line); }
@media (min-width: 1024px) {
  main:has(.me-cols) { max-width: 1120px; }
  .me-cols { grid-template-columns: minmax(0, 1.5fr) minmax(300px, 1fr); grid-template-areas: "paths today" "progress today"; column-gap: var(--s6); align-items: start; }
  .today { position: sticky; top: var(--s5); max-height: calc(100dvh - 2 * var(--s5)); overflow-y: auto; }
}
.more summary::-webkit-details-marker { display: none; }
.more summary::after { content: "▾"; }
.more[open] summary::after { content: "▴"; }

/* the still of the figure a video quiz points at, shown above its stem outside the video */
.quiz-fig-btn { display: block; width: 100%; padding: 0; min-height: 0; background: none; box-shadow: none; cursor: zoom-in; }
.quiz-fig-big { display: block; width: 100%; height: auto; margin-bottom: var(--s3); }
.quiz-fig { display: block; width: 100%; max-height: 42vh; object-fit: contain; border-radius: var(--r-md); background: var(--soft); margin: var(--s1) 0 var(--s2); }

/* ---------- real IAVE exams on a desktop: the PDF beside the answer sheet (iave.tsx WithPdf, ≥ 1024 px) ---------- */
@media (min-width: 1024px) {
  main:has(.iave-split) { max-width: 1600px; }
  .iave-split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(360px, 2fr); grid-template-rows: minmax(0, 1fr); gap: var(--s4); height: 100dvh; padding: var(--s3) 0; }
  .iave-pdf { display: block; width: 100%; height: 100%; border: 1px solid var(--line); border-radius: var(--r-md); background: var(--soft); }
  .iave-side { min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-right: var(--s2); }
  .iave-side > :first-child { margin-top: 0; }
}

/* ---------- Explorar: the «Caminhos» tab (explore.tsx) ----------
   It uses the gallery's .grid and the tile styles above; only these bits are its own. */
.explore-paths { padding-top: var(--s2); }
.explore-paths .grid { list-style: none; margin: 0; padding: 0; }
.path-poster h3.tile-title { margin: 0; }
.path-poster .tile-title a { color: var(--fg); }
.path-poster .dot { vertical-align: -1px; }
.path-poster > .button, .path-poster > button { justify-self: start; }

/* ---------- tests and paths on tiles: a real glimpse (test-art.tsx; explore.tsx PathArt) ----------
   A test shows a small page with what it opens with (an exam, its paper's header); a path, its first stages and steps.
   The type follows the tile's width (cqi), so one rule fits Explorar's grid, Início's rows and Início's card. The hover
   preview (hover-preview.ts) rolls the same box upward once: a test's first items over its page, a path's later steps. */
.ta, .pa-art { position: absolute; inset: 0; container-type: inline-size; }
/* the kind above the page, in the flow: it may wrap, and it shrinks a little on a phone's narrow tile */
.ta { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s2) 7% 6%; }
.ta-kind { font-size: min(var(--fs-label), 9.5cqi); font-weight: 700; letter-spacing: 0.08em; line-height: 1.2; text-transform: uppercase; color: var(--ink); }
.ta-box { position: relative; flex: 1; min-height: 0; }
/* a test's tile is a cover, like a video's poster: a white page on a soft ground, violet for our own tests and practice,
   neutral for an official exam; the kind is always written too (design.md «Use colour sparingly») */
.tile-art:has(.ta) { background: var(--anil-soft); color: var(--ink); }
.tile-art:has(.ta[data-kind="iave"]) { background: var(--soft); }
.ta-page, .ta-peek { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 0.5em; padding: 7cqi; overflow: hidden;
  border-radius: var(--r-sm); background: #fff; color: var(--night); font-size: calc(0.34em + 4cqi); line-height: 1.35; hyphens: auto; overflow-wrap: break-word;
  -webkit-mask-image: linear-gradient(to bottom, #000 80%, transparent); mask-image: linear-gradient(to bottom, #000 80%, transparent); }
.ta-head { font-weight: 700; }
.ta-paper { align-items: center; text-align: center; -webkit-mask-image: none; mask-image: none; }
.ta-paper b { margin-top: auto; font-size: 1.35em; line-height: 1.2; }
.ta-issuer { margin-top: auto; font-weight: 700; }
.ta-peek { container-type: size; animation: tile-peek-in 0.2s ease-out both; -webkit-mask-image: linear-gradient(to bottom, transparent, #000 10%, #000 80%, transparent); mask-image: linear-gradient(to bottom, transparent, #000 10%, #000 80%, transparent); }
.ta-roll, .pa-roll { display: flex; flex-direction: column; gap: 0.7em; }
.ta-roll { animation: tile-roll calc(var(--n) * 1.4s) linear 0.5s both; }
.pa-roll { padding: calc(var(--s2) + 2cqi) 8cqi; gap: 0.55em; font-size: calc(0.34em + 4cqi); line-height: 1.25; color: var(--on-night); }
.pa-art { overflow: hidden; container-type: size; -webkit-mask-image: linear-gradient(to bottom, #000 75%, transparent); mask-image: linear-gradient(to bottom, #000 75%, transparent); }
.pa-roll.live { animation: tile-roll calc(var(--n) * 0.9s) linear 0.3s both; }
.pa-stage { margin-top: 0.4em; font-size: 0.8em; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--on-night-muted); }
.pa-stage:first-child { margin-top: 0; }
.pa-step { display: grid; grid-template-columns: 1.7em minmax(0, 1fr); gap: 0.45em; align-items: start; overflow-wrap: break-word; hyphens: auto; }
.pa-step i { display: grid; place-items: center; width: 1.7em; height: 1.7em; border-radius: 50%; font-style: normal; font-size: 0.85em; font-weight: 700; box-shadow: inset 0 0 0 1.5px var(--on-night-muted); }
.pa-step.soon { color: var(--on-night-muted); }
/* up by the list's height less the box's (never down, for a short list) */
@keyframes tile-roll { to { transform: translateY(min(0px, calc(100cqh - 100%))); } }
@keyframes tile-peek-in { from { opacity: 0; } }
/* in the dark the page is cream, like the video posters beside it, not pure white */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ta-page, :root:not([data-theme="light"]) .ta-peek { background: var(--on-night); } }
:root[data-theme="dark"] .ta-page, :root[data-theme="dark"] .ta-peek { background: var(--on-night); }
@media (prefers-reduced-motion: reduce) { .ta-roll, .pa-roll.live, .ta-peek { animation: none; } }

/* ---------- desktop video step (feed.tsx Clip `ask`, ContextPanel chapters) ---------- */
.quiz-review { margin: var(--s3) 0 0; }
.chapters { list-style: none; margin: 0; padding: 0; display: grid; }
.chapters button { min-height: 36px; padding: var(--s1) 0; color: var(--fg); text-align: left; }
.chapters .ch-t { display: inline-block; min-width: 3.2em; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- a ficha as a page (ficha.tsx; HTML from scripts/ficha-page.mjs) ---------- */
.ficha { max-width: 720px; }
.ficha-toc { display: flex; flex-wrap: wrap; gap: var(--s2); margin: var(--s4) 0 var(--s2); }
.ficha-toc a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s3); border-radius: var(--r-md); background: var(--soft); color: var(--fg); text-decoration: none; font-size: var(--fs-sm); }
.ficha-toc a:hover, .ficha-toc a:focus-visible { text-decoration: underline; }
.ficha-body h2 { scroll-margin-top: var(--s4); margin-top: var(--s6); }
.ficha-body h3 { font-size: var(--fs-body); margin-top: var(--s5); }
.ficha-body li { margin: var(--s1) 0; }
.ficha-body img { max-width: 100%; height: auto; }
.ficha-body blockquote { margin: var(--s3) 0; padding: var(--s3) var(--s4); background: var(--soft); border-radius: var(--r-md); }
.ficha-body .table-wrap { overflow-x: auto; margin: var(--s3) 0; }
.ficha-body table { border-collapse: collapse; width: 100%; font-size: var(--fs-sm); }
.ficha-body th, .ficha-body td { border: 1px solid var(--line-strong); padding: 6px 8px; text-align: left; vertical-align: top; }
.ficha-body th { background: var(--soft); }
/* the drawings are made for paper: a light card keeps them readable in dark mode */
.ficha-body .ficha-fig { background: #fff; color: var(--night); border-radius: var(--r-md); padding: var(--s3); margin: var(--s3) 0; overflow-x: auto; }
.ficha-body .ficha-fig svg { display: block; max-width: 100%; height: auto; margin: 0 auto; }
/* a ficha is long reading: one step up the scale where the line has room (owner, 2026-11-02) */
@media (min-width: 768px) {
  .ficha-body { font-size: var(--fs-lead); line-height: 1.55; }
  .ficha-body h3 { font-size: var(--fs-lead); }
  .ficha-body table, .ficha-toc a { font-size: var(--fs-body); }
}
/* marks and notes (marks.tsx): sol with dark text in both themes, so the text stays readable; a note is underlined */
::highlight(ficha-mark), ::highlight(ficha-note) { background-color: var(--sol); color: var(--night); }
::highlight(ficha-note) { text-decoration: underline dotted 2px; }
.marks-bar { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + var(--s4)); transform: translateX(-50%); z-index: 40; display: flex; gap: var(--s2); padding: var(--s2); background: var(--card); border-radius: var(--r-lg); box-shadow: 0 4px 16px rgba(0, 0, 0, 0.18); white-space: nowrap; }
.shell.full .marks-bar { bottom: calc(env(safe-area-inset-bottom) + var(--s6)); }
/* with a mouse: beside the selection, placed by SelectionBar in page coordinates */
.marks-bar.floating, .shell.full .marks-bar.floating { position: absolute; bottom: auto; transform: none; }
.marks-quote { margin: 0 0 var(--s3); padding: var(--s2) var(--s3); background: var(--soft); border-radius: var(--r-md); font-size: var(--fs-sm); }
.marks-note { display: grid; gap: var(--s1); }
.marks-note textarea { width: 100%; }
::highlight(ficha-flash) { background-color: var(--sol-deep); color: var(--night); }
.marks-slot:empty { display: none; }
.marks-list-title { font-size: var(--fs-body); margin: 0 0 var(--s2); }
.marks-list { list-style: none; padding: 0; margin: 0 0 var(--s3); }
.marks-list-item { display: grid; justify-content: stretch; gap: var(--s1); width: 100%; text-align: left; background: none; color: var(--fg); font-weight: 400; padding: var(--s3) 0; border-top: 1px solid var(--line); border-radius: 0; min-height: 44px; }
.marks-list-item:hover q, .marks-list-item:focus-visible q { text-decoration: underline; }
/* «Destaques e notas» in Eu: each ficha's list, its items links to the place in the ficha */
a.marks-list-item { text-decoration: none; }
.marks-page { max-width: 42rem; }
.marks-ficha h3 { font-size: var(--fs-body); margin: var(--s5) 0 var(--s1); }
.me-marks { margin: var(--s2) 0 0; }
.me-marks a { display: inline-flex; align-items: center; min-height: 44px; }
.marks-gone { margin-top: var(--s6); }
.marks-gone ul { list-style: none; padding: 0; }
.marks-gone li { padding: var(--s2) 0; border-top: 1px solid var(--line); }
.marks-gone li p { margin: var(--s1) 0 0; }
.ficha-sol { margin: var(--s5) 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.ficha-sol > summary { min-height: 44px; display: flex; align-items: center; font-weight: 700; cursor: pointer; }

/* ---------- video tiles: the hover preview (video-preview.tsx), over the poster in the same box ---------- */
.tile-clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.2s; pointer-events: none; }
.tile-clip.on { opacity: 1; }

/* the reminder's hours (reminders.tsx HourPicker): all 7 in one row, also at 320px */
.segmented.hours { grid-template-columns: repeat(7, minmax(0, 1fr)); max-width: 420px; margin: 0; }
/* the iPhone's steps for «Adicionar ao ecrã principal» */
.install-steps { margin: 0; padding-left: 1.4em; display: grid; gap: var(--s1); }
.share-icon { vertical-align: -3px; }
