/* =========================================================================
   Course kit — shared look of every academy course, built on the
   Kandiq design system tokens (canvas + glass for overview, solid for work,
   one blue accent, Manrope). Sizes are rem-based and the root grows with
   the screen. The page is the only scroll container.
   ========================================================================= */

:root {
  color-scheme: light;
  /* colour */
  --canvas: #edf1f8;
  --glow-1: rgb(143 176 255 / 55%);
  --glow-2: rgb(47 91 224 / 18%);
  --glass: rgb(255 255 255 / 64%);
  --glass-strong: rgb(255 255 255 / 86%);
  --glass-border: rgb(255 255 255 / 92%);
  --surface-1: #fff;
  --surface-2: #f7f9fc;
  --surface-3: #eef2f8;
  --border: #e1e6ef;
  --border-strong: #7f8ba1;
  --fg: #0f172a;
  --fg-muted: #4e5b72;
  --fg-subtle: #5f6b82;
  --accent: #2f5be0;
  --accent-hover: #244bc4;
  --accent-fg: #fff;
  --accent-soft: rgb(47 91 224 / 10%);
  --link: #2f5be0;
  --focus: #2f5be0;
  --success: #1c7a4b;
  --success-soft: #e5f4eb;
  --warning: #955800;
  --warning-soft: #fff1d2;
  --danger: #b42f25;
  --danger-soft: #fce8e6;
  --info: #2f5be0;
  --info-soft: #e9effe;
  --neutral-soft: #eef1f5;
  --sidebar: #0e1726;
  --sidebar-raised: #16213a;
  --sidebar-active: rgb(255 255 255 / 10%);
  --sidebar-line: rgb(255 255 255 / 8%);
  --sidebar-fg: #fff;
  --sidebar-muted: #a7b3c9;
  --sidebar-accent: #8fb0ff;
  /* shape */
  --radius-sm: .5rem;
  --radius-control: .75rem;
  --radius-card: 1rem;
  --radius-glass: 1.375rem;
  --radius-panel: 1.75rem;
  --radius-pill: 9999px;
  --shadow-glass: 0 10px 30px rgb(15 23 42 / 6%);
  --shadow-card: 0 1px 2px rgb(15 23 42 / 5%);
  --shadow-pop: 0 24px 64px rgb(15 23 42 / 18%);
  --blur-glass: blur(24px) saturate(160%);
  --control-md: 2.75rem;
  --control-sm: 2.25rem;
  --nav-width: 16.5rem;
  --content: 82rem;
  --gutter: clamp(1rem, 2.6vw, 2.5rem);
  --font-sans: "Manrope", system-ui, sans-serif;
}

/* 15px on laptops, growing to 18px on large monitors */
html { font-size: clamp(15px, 0.3vw + 10.7px, 18px); -webkit-text-size-adjust: 100%; }
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  min-height: 100vh;
  font: 400 1rem/1.47 var(--font-sans);
  color: var(--fg);
  background-color: var(--canvas);
  background-image: radial-gradient(60rem 40rem at 88% -12%, var(--glow-1), transparent 60%), radial-gradient(50rem 35rem at 6% 112%, var(--glow-2), transparent 62%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
img, svg, video { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: var(--link); font-weight: 600; }

.coral { color: var(--accent); }
.lime { color: var(--sidebar-accent); }
.muted { color: var(--fg-muted); }
.small { font-size: .867rem; line-height: 1.38; }
.center { text-align: center; }

/* ---------- layout ---------- */

.shell { display: grid; grid-template-columns: var(--nav-width) minmax(0, 1fr); gap: 1rem; min-height: 100vh; padding-left: 1rem; }

.sidebar {
  position: sticky;
  top: 1rem;
  align-self: start;
  height: calc(100vh - 2rem);
  overflow-y: auto;
  scrollbar-width: none;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
  padding: 1.5rem .9rem 1.1rem;
  background: var(--sidebar);
  color: var(--sidebar-muted);
  border: 1px solid var(--sidebar-line);
  border-radius: var(--radius-panel);
  box-shadow: var(--shadow-glass);
}
.sidebar::-webkit-scrollbar { display: none; }
.sidebar-head { padding: 0 .5rem; }
.kicker { display: block; font-size: .8rem; line-height: 1.33; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--sidebar-accent); }
.course-title { font-size: 1.467rem; line-height: 1.2; font-weight: 800; letter-spacing: -.02em; color: var(--sidebar-fg); margin: .5rem 0 1rem; }
.course-title .coral { color: var(--sidebar-accent); }
.progress { height: .5rem; background: var(--sidebar-raised); border-radius: var(--radius-pill); overflow: hidden; }
.progress span { display: block; height: 100%; width: 100%; background: var(--sidebar-accent); border-radius: var(--radius-pill); transform: scaleX(0); transform-origin: left; transition: transform .2s ease-out; }
.progress-label { font-size: .867rem; color: var(--sidebar-muted); margin: .5rem 0 0; }

.module-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .2rem; }
.module-list button {
  width: 100%;
  min-height: var(--control-md);
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .45rem .9rem;
  border: 0;
  border-radius: var(--radius-control);
  background: transparent;
  color: var(--sidebar-muted);
  text-align: left;
  cursor: pointer;
  font-size: .933rem;
  font-weight: 500;
  line-height: 1.3;
  transition: background-color .15s, color .15s;
}
.module-list button:hover { background: var(--sidebar-raised); color: var(--sidebar-fg); }
.module-list button[aria-current="step"] { background: var(--sidebar-active); color: var(--sidebar-fg); font-weight: 600; }
.module-list .dot { flex: none; width: 1.6rem; height: 1.6rem; border-radius: var(--radius-pill); border: 1.5px solid rgb(255 255 255 / 22%); display: grid; place-items: center; font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.module-list .done .dot { background: var(--sidebar-accent); border-color: transparent; color: var(--sidebar); }
.link-btn { background: none; border: 0; color: var(--sidebar-muted); font-size: .867rem; text-decoration: underline; cursor: pointer; padding: 0; }
.reset { margin: auto .5rem 0; padding-top: .9rem; border-top: 1px solid var(--sidebar-line); align-self: stretch; text-align: left; }

.main { display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }
.mobile-bar { display: none; }
.module { flex: 1; width: 100%; max-width: calc(var(--content) + 2 * var(--gutter)); margin: 0 auto; padding: 2.1rem var(--gutter) 2.25rem; outline: none; min-width: 0; }
.pager {
  position: sticky;
  bottom: 1rem;
  z-index: 5;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  width: min(calc(100% - 2 * var(--gutter)), var(--content));
  margin: 0 auto 1rem;
  padding: .6rem;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-glass);
  box-shadow: var(--shadow-pop);
  -webkit-backdrop-filter: var(--blur-glass);
  backdrop-filter: var(--blur-glass);
}

/* ---------- typography (h1 30, h2 20, h3 17, body 15, label 14, caption 13, overline 12) ---------- */

.module h2 { font-size: 2rem; line-height: 1.2; font-weight: 700; letter-spacing: -.02em; margin: .4rem 0 1.25rem; }
.module h3 { font-size: 1.333rem; line-height: 1.4; font-weight: 700; letter-spacing: -.01em; margin: 2.2rem 0 .8rem; }
.module h4 { font-size: 1.133rem; line-height: 1.41; font-weight: 600; margin: 0 0 .3rem; }
.module p { margin: 0 0 .8rem; }
.module .lead, .module > p { max-width: 75ch; }
.eyebrow { display: inline-block; font-size: .8rem; line-height: 1.33; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); }
.lead { font-size: 1.067rem; line-height: 1.63; color: var(--fg-muted); }
ul.ticks { padding-left: 0; list-style: none; margin: .5rem 0 1rem; }
ul.ticks li { padding-left: 1.6rem; position: relative; margin: .5rem 0; }
ul.ticks li::before { content: ""; position: absolute; left: .3rem; top: .6em; width: .5rem; height: .5rem; border-radius: 50%; background: var(--accent); }
kbd { border: 1px solid currentColor; border-radius: .3rem; padding: 0 .35rem; font-size: .9em; }

/* ---------- buttons ---------- */

.btn, .btn-outline, .btn-ghost {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: var(--control-md);
  padding: .55rem 1.33rem;
  border-radius: var(--radius-control);
  border: 1px solid transparent;
  font-size: .933rem;
  font-weight: 600;
  line-height: 1.3;
  cursor: pointer;
  text-align: center;
  transition: background-color .15s, border-color .15s, color .15s;
}
.btn { background: var(--accent); color: var(--accent-fg); }
.btn:hover { background: var(--accent-hover); }
.btn-outline { background: var(--surface-2); color: var(--fg); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { background: var(--surface-3); }
.btn-ghost { background: transparent; color: var(--link); padding: .4rem .55rem; min-height: var(--control-sm); }
.btn-ghost:hover { background: var(--accent-soft); }
.btn:disabled, .btn-outline:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn:disabled:hover { background: var(--accent); }
.row { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.why-line { font-size: .867rem; color: var(--fg-muted); }

/* ---------- surfaces ---------- */

.card { background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 1.6rem; box-shadow: var(--shadow-card); min-width: 0; }
.card + .card { margin-top: 1.07rem; }
.grid { display: grid; gap: 1.07rem; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); }
.glass { background: var(--glass); border: 1px solid var(--glass-border); border-radius: var(--radius-glass); box-shadow: var(--shadow-glass); -webkit-backdrop-filter: var(--blur-glass); backdrop-filter: var(--blur-glass); }

.hero, .quote, .sentence {
  background: var(--sidebar);
  color: var(--sidebar-fg);
  border-radius: var(--radius-glass);
  box-shadow: var(--shadow-glass);
}
.hero { padding: clamp(1.6rem, 3vw, 2.4rem); margin: .4rem 0 1.6rem; }
.hero p { color: #d6deec; }
.hero h2 { color: var(--sidebar-fg); }
.hero strong { color: var(--sidebar-fg); }

.quote { padding: clamp(1.6rem, 3vw, 2.4rem); margin: 1.8rem 0; text-align: center; }
.quote blockquote { margin: 0 auto; max-width: 48rem; font-size: clamp(1.2rem, 1.6vw, 1.5rem); line-height: 1.45; font-weight: 600; letter-spacing: -.01em; }
.quote .jp { font-size: 1.35rem; margin-bottom: .25rem; }
.quote .romaji { font-size: .867rem; color: var(--sidebar-muted); margin-bottom: 1rem; }
.quote cite { display: block; margin-top: 1rem; font-size: .933rem; font-weight: 700; font-style: normal; color: var(--sidebar-accent); }

.callout { background: var(--accent-soft); padding: .95rem 1.1rem; border-radius: var(--radius-control); margin: 1.1rem 0; }
.callout.tip { background: var(--neutral-soft); }

.reveal-card { cursor: pointer; text-align: left; width: 100%; border: 1px solid var(--border); background: var(--surface-1); border-radius: var(--radius-card); padding: 1.25rem 1.4rem; color: inherit; box-shadow: var(--shadow-card); transition: border-color .15s; }
.reveal-card:hover { border-color: var(--border-strong); }
.reveal-card .answer { display: none; margin-top: .8rem; padding-top: .8rem; border-top: 1px solid var(--border); color: var(--fg-muted); }
.reveal-card[aria-expanded="true"] { border-color: var(--accent); }
.reveal-card[aria-expanded="true"] .answer { display: block; }
.reveal-card .hint { display: inline-flex; margin-top: .5rem; font-size: .933rem; font-weight: 600; color: var(--link); }
.reveal-card[aria-expanded="true"] .hint { display: none; }

/* choice buttons (kq-choice) */
.chips { display: flex; flex-wrap: wrap; gap: .53rem; }
.chip {
  display: inline-flex;
  align-items: center;
  min-height: var(--control-md);
  padding: .5rem 1.07rem;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--fg);
  font-size: .933rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background-color .15s, border-color .15s;
}
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border: 1.5px solid var(--accent); }

/* messages (kq-msg) */
.feedback { margin-top: .9rem; padding: .95rem 1.1rem; border-radius: var(--radius-control); font-weight: 500; color: var(--fg); display: block; }
.feedback.ok { background: var(--success-soft); }
.feedback.bad { background: var(--danger-soft); }
.feedback.info { background: var(--info-soft); }
.feedback.ok::before, .feedback.bad::before { display: inline-block; margin-right: .4rem; font-weight: 800; }
.feedback.ok::before { content: "✓"; color: var(--success); }
.feedback.bad::before { content: "✗"; color: var(--danger); }
.feedback:empty { display: none; }
.feedback strong { font-weight: 700; }

/* pills */
.tag, .brand-tag { display: inline-flex; align-items: center; gap: .4rem; min-height: 1.73rem; padding: 0 .67rem; border-radius: var(--radius-pill); font-size: .867rem; line-height: 1.2; font-weight: 600; white-space: nowrap; background: var(--neutral-soft); color: var(--fg-muted); vertical-align: middle; }
.tag.warn { background: var(--danger-soft); color: var(--danger); }
.brand-tag { background: var(--info-soft); color: var(--info); text-transform: none; letter-spacing: 0; }
.brand-tag.gotap { background: var(--neutral-soft); color: var(--fg); }

/* ---------- fields (kq-field) ---------- */

input[type="text"], input[type="number"], select, textarea {
  min-height: var(--control-md);
  padding: .55rem .93rem;
  border-radius: var(--radius-control);
  border: 1px solid var(--border-strong);
  background: var(--surface-1);
  color: var(--fg);
  font-size: 1rem;
  min-width: 0;
  max-width: 100%;
}
input[type="text"], textarea { width: 100%; }
input::placeholder, textarea::placeholder { color: var(--fg-subtle); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: var(--focus); }
input[type="range"] { accent-color: var(--accent); width: 100%; }
textarea { min-height: 5.5rem; padding: .8rem .93rem; line-height: 1.47; resize: none; overflow: hidden; }
.field { display: flex; flex-direction: column; gap: .4rem; margin-bottom: 1.07rem; font-size: .933rem; font-weight: 600; min-width: 0; }
.field .small, .field .muted { font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 2fr 1.3fr .8fr .8fr auto; gap: .6rem; align-items: end; }
.form-grid label { font-size: .933rem; font-weight: 600; display: flex; flex-direction: column; gap: .4rem; }
.form-grid input, .form-grid select { width: 100%; }
.phase-block { border-top: 1px solid var(--border); padding-top: 1.07rem; margin-top: 1.07rem; }
.phase-block:first-child { border-top: 0; margin-top: 0; padding-top: 0; }
.count { font-size: .867rem; color: var(--fg-muted); font-weight: 600; font-variant-numeric: tabular-nums; }

/* checkboxes (kq-check) */
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist label { display: flex; gap: .8rem; align-items: flex-start; padding: .65rem .8rem; border-radius: var(--radius-control); cursor: pointer; }
.checklist label:hover { background: var(--surface-2); }
.checklist input[type="checkbox"] { appearance: none; -webkit-appearance: none; width: 1.33rem; height: 1.33rem; margin: .07rem 0 0; border-radius: .4rem; border: 1.5px solid var(--border-strong); background: var(--surface-1); display: grid; place-content: center; flex: none; cursor: pointer; }
.checklist input[type="checkbox"]:checked { background: var(--accent); border-color: var(--accent); }
.checklist input[type="checkbox"]:checked::after { content: ""; width: .67rem; height: .4rem; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); }
.card.checklist { padding: .6rem; }

.rating { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(5rem, 1fr) 1.6rem; gap: .8rem; align-items: center; padding: .55rem 0; border-bottom: 1px solid var(--border); }
.rating:last-of-type { border-bottom: 0; }
.rating input[type="range"] { min-width: 0; }
.rating output { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- questions: pick an answer, then check ---------- */

.q-progress { margin: 0 0 .4rem; }
.q-text { font-size: 1.133rem; line-height: 1.45; font-weight: 600; margin-bottom: 1rem; }
.q-text .sort-task { margin-top: .5rem; }
.choice-opts { display: grid; gap: .6rem; grid-template-columns: repeat(var(--cols, 1), minmax(0, 1fr)); }
.opt {
  display: flex;
  gap: .8rem;
  align-items: flex-start;
  width: 100%;
  min-height: var(--control-md);
  padding: .7rem 1rem;
  text-align: left;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-control);
  background: var(--surface-1);
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.4;
  cursor: pointer;
  transition: background-color .15s, border-color .15s;
}
.opt::before { content: ""; flex: none; width: 1.2rem; height: 1.2rem; margin-top: .1rem; border-radius: 50%; border: 1.5px solid var(--border-strong); background: var(--surface-1); display: grid; place-items: center; font-size: .75rem; font-weight: 800; }
.opt:hover:not(:disabled) { background: var(--surface-2); }
.opt[aria-checked="true"] { background: var(--accent-soft); border: 1.5px solid var(--accent); }
.opt[aria-checked="true"]::before { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 42%, var(--surface-1) 47%); }
.opt:disabled { cursor: default; }
.opt.correct { background: var(--success-soft); border: 1.5px solid var(--success); }
.opt.correct::before { content: "✓"; border-color: var(--success); background: var(--success); color: #fff; }
.opt.wrong { background: var(--danger-soft); border: 1.5px solid var(--danger); }
.opt.wrong::before { content: "✗"; border-color: var(--danger); background: var(--danger); color: #fff; }
.choice-actions { margin-top: 1rem; }

/* final quizzes */
.q { margin-bottom: 1.6rem; }
.q fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.q legend { font-size: 1.067rem; font-weight: 700; margin-bottom: .6rem; }
.q label { display: flex; gap: .7rem; align-items: flex-start; min-height: var(--control-md); padding: .65rem .9rem; border: 1px solid var(--border-strong); border-radius: var(--radius-control); margin-bottom: .45rem; background: var(--surface-1); cursor: pointer; }
.q label:hover { background: var(--surface-2); }
.q label:has(input:checked) { background: var(--accent-soft); border: 1.5px solid var(--accent); }
.q input { margin-top: .25rem; accent-color: var(--accent); }
.q label.correct { background: var(--success-soft); border: 1.5px solid var(--success); }
.q label.wrong { background: var(--danger-soft); border: 1.5px solid var(--danger); }
.q .why { font-size: .933rem; color: var(--fg-muted); margin: .5rem 0 0; }
.done-badge { width: 5.33rem; height: 5.33rem; border-radius: 50%; background: var(--sidebar-accent); color: var(--sidebar); display: grid; place-items: center; font-size: 2.4rem; font-weight: 800; margin: 0 auto 1rem; }

/* ---------- media ---------- */

.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 24rem); gap: clamp(1rem, 2.4vw, 2.1rem); align-items: start; margin: .5rem 0 1.1rem; }
.split .grid.tips { grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.fig { margin: 0; border-radius: var(--radius-card); overflow: hidden; background: var(--surface-1); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.fig img { display: block; width: 100%; height: auto; }
.fig figcaption { font-size: .933rem; line-height: 1.4; font-weight: 600; font-style: italic; color: var(--fg-muted); padding: .7rem 1rem .8rem; }
.fig.flat { margin: .6rem 0; }
.fig-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1.07rem; margin-top: 1.3rem; }
.fig-row .fig img { aspect-ratio: 4 / 3; object-fit: cover; }
.step-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 1.6rem; align-items: center; }
.step-img { display: block; width: 100%; height: auto; aspect-ratio: 50 / 29; object-fit: cover; border-radius: var(--radius-control); }
.quote-img { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); padding: 0; overflow: hidden; text-align: left; align-items: center; }
.quote-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.quote-img > div { padding: 1.8rem clamp(1.3rem, 3vw, 2.6rem); }

.embed { position: relative; width: 100%; border-radius: var(--radius-card); overflow: hidden; background: var(--sidebar); border: 1px solid var(--border); box-shadow: var(--shadow-card); }
.embed.video { aspect-ratio: 16 / 9; }
.embed.doc { height: min(78vh, 56rem); background: var(--surface-1); }
.embed iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.embed-bar { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: .5rem 1rem; margin: .6rem 0 0; font-size: .933rem; }
.embed-bar a { text-decoration: none; }
.embed-bar a:hover { text-decoration: underline; }
.video-block { margin: 2rem 0; padding: 1.4rem; }
.video-head { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; margin-bottom: .4rem; }
.video-head h4 { margin: 0; font-size: 1.133rem; font-weight: 700; }
.video-why { color: var(--fg-muted); margin: 0 0 1rem; max-width: 75ch; }

/* ---------- interactive widgets ---------- */

.compare { position: relative; aspect-ratio: 3 / 2; border-radius: var(--radius-glass); overflow: hidden; margin: .6rem 0 .5rem; background: var(--sidebar); --pos: 50%; box-shadow: var(--shadow-glass); }
.compare img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.compare .after { clip-path: inset(0 0 0 var(--pos)); }
.compare .handle { position: absolute; top: 0; bottom: 0; left: var(--pos); width: 3px; margin-left: -1.5px; background: #fff; pointer-events: none; box-shadow: 0 0 12px rgb(0 0 0 / 50%); }
.compare .handle::after { content: "⇆"; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: var(--control-md); height: var(--control-md); border-radius: 50%; background: #fff; color: var(--fg); display: grid; place-items: center; font-weight: 700; box-shadow: var(--shadow-pop); }
.compare .tag-l, .compare .tag-r { position: absolute; top: 1rem; padding: .35rem .75rem; border-radius: var(--radius-pill); background: rgb(14 23 38 / 72%); font-size: .867rem; font-weight: 700; color: #fff; pointer-events: none; }
.compare .tag-l br, .compare .tag-r br { display: none; }
.compare .tag-l { left: 1rem; }
.compare .tag-r { right: 1rem; }
.compare input[type="range"] { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: ew-resize; margin: 0; }

.order-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: .5rem; }
.order-list li { display: flex; align-items: center; gap: .75rem; min-height: var(--control-md); background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-control); padding: .4rem .5rem .4rem .75rem; }
.order-list li.right { border-color: var(--success); background: var(--success-soft); }
.order-list li.wrong { border-color: var(--danger); background: var(--danger-soft); }
.order-list .pos { flex: none; width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--surface-3); color: var(--fg); display: grid; place-items: center; font-size: .867rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.order-list .lbl { flex: 1; font-weight: 600; min-width: 0; }
.order-list button { flex: none; width: var(--control-sm); height: var(--control-sm); border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--surface-2); cursor: pointer; }
.order-list button:hover:not(:disabled) { background: var(--surface-3); }
.order-list button:disabled { opacity: .35; cursor: default; }

.gantt { margin-top: 1rem; }
.gantt-row, .gantt-scale { display: grid; grid-template-columns: minmax(7rem, 28%) minmax(0, 1fr); gap: .75rem; align-items: center; }
.gantt-row { padding: .5rem 0; border-bottom: 1px solid var(--border); }
.gantt-row .who { font-size: .867rem; color: var(--fg-muted); }
.gantt-track { position: relative; height: 1.9rem; background: repeating-linear-gradient(90deg, var(--surface-3) 0 1px, transparent 1px calc(100% / var(--days))); border-radius: var(--radius-sm); }
.gantt-bar { position: absolute; top: 3px; bottom: 3px; left: calc(var(--s) / var(--days) * 100%); width: calc(var(--d) / var(--days) * 100%); background: var(--accent); border-radius: .4rem; color: #fff; font-size: .75rem; font-weight: 700; display: flex; align-items: center; padding: 0 .45rem; white-space: nowrap; overflow: hidden; }
.gantt-bar.clash { background: repeating-linear-gradient(45deg, var(--danger) 0 6px, #cf4a3f 6px 12px); }
.gantt-scale { font-size: .8rem; color: var(--fg-subtle); }
.gantt-scale .days { display: flex; justify-content: space-between; }

/* tables (kq-table); stacked into cards on small screens via data-label */
table.raci, table.planner { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; font-size: .933rem; }
table.raci th, table.planner th { text-align: left; font-size: .867rem; line-height: 1.38; font-weight: 600; color: var(--fg-muted); background: var(--surface-2); padding: .65rem .8rem; border-bottom: 1px solid var(--border); }
table.raci th:first-child, table.planner th:first-child { border-top-left-radius: var(--radius-control); }
table.raci th:last-child, table.planner th:last-child { border-top-right-radius: var(--radius-control); }
table.raci td, table.planner td { padding: .75rem .8rem; border-bottom: 1px solid var(--border); vertical-align: top; overflow-wrap: anywhere; }
table.raci tr:last-child td, table.planner tr:last-child td { border-bottom: 0; }
table.raci td, table.raci th { text-align: center; vertical-align: middle; }
table.raci td:first-child, table.raci th:first-child { text-align: left; width: 34%; }
table.raci select { width: 100%; font-weight: 700; padding: .4rem .5rem; }
table.raci tr.bad td { background: var(--danger-soft); }
table.raci tr.good td { background: var(--success-soft); }
.raci-note { font-size: .867rem; margin: .2rem 0 0; color: var(--danger); font-weight: 600; text-align: left; }
table.planner tr.incomplete td { background: var(--danger-soft); }
table.planner textarea { min-height: 3.6rem; font-size: .933rem; }
table.planner select { width: 100%; }
table.planner td:last-child, table.planner th:last-child { width: 3.4rem; }

.flip { perspective: 900px; background: none; border: 0; padding: 0; cursor: pointer; min-height: 12rem; text-align: left; font: inherit; color: inherit; }
.flip-inner { position: relative; height: 100%; min-height: 12rem; transition: transform .2s ease-out; transform-style: preserve-3d; }
.flip[aria-pressed="true"] .flip-inner { transform: rotateY(180deg); }
.flip-face { position: absolute; inset: 0; backface-visibility: hidden; border-radius: var(--radius-glass); padding: 1.4rem; display: flex; flex-direction: column; justify-content: center; }
.flip-face p { margin: 0; }
.flip-front { background: var(--sidebar); color: var(--sidebar-fg); font-size: 1.267rem; line-height: 1.35; font-weight: 600; }
.flip-front em { color: var(--sidebar-accent); font-style: normal; }
.flip-back { background: var(--surface-1); border: 1.5px solid var(--accent); transform: rotateY(180deg); font-size: 1rem; }

.gc-wrap { display: grid; grid-template-columns: minmax(15rem, 21rem) minmax(0, 1fr); gap: 2rem; align-items: center; }
.gc { width: 100%; height: auto; display: block; }
.gc circle { cursor: pointer; transition: opacity .15s; stroke: var(--canvas); stroke-width: 3; }
.gc circle:hover, .gc circle:focus-visible { opacity: .88; outline: none; }
.gc text { pointer-events: none; font: 800 22px var(--font-sans); }
.gc text:nth-of-type(1) { fill: var(--fg); }
.gc text:nth-of-type(2), .gc text:nth-of-type(3) { fill: #fff; }
.gc-ring { fill: #d7deeb; }
.gc-mid { fill: var(--sidebar); }
.gc-core { fill: var(--accent); }
.gc [aria-pressed="true"] { stroke: var(--sidebar-accent); stroke-width: 6; }
.gc-detail h4 { font-size: 1.333rem; font-weight: 700; margin: .2rem 0 .3rem; }

.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.07rem; }
.duo .card h4 { font-size: .8rem; line-height: 1.33; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--fg-muted); margin-bottom: .5rem; }
.duo .bad-col { background: var(--danger-soft); border-color: transparent; }
.duo .good-col { background: var(--success-soft); border-color: transparent; }

.meter { height: .53rem; background: var(--surface-3); border-radius: var(--radius-pill); overflow: hidden; margin: .5rem 0 .3rem; }
.meter span { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: var(--radius-pill); transform: scaleX(0); transform-origin: left; transition: transform .2s ease-out; }
.status { font-weight: 700; font-size: .933rem; }
.status.ok { color: var(--success); }
.status.bad { color: var(--danger); }

.sentence { padding: 1.2rem 1.4rem; font-size: 1.133rem; line-height: 1.55; margin-top: 1rem; color: #d6deec; }
.sentence b { color: #fff; }
.sentence .gap { color: var(--sidebar-accent); font-style: italic; }
.checks { list-style: none; padding: 0; margin: .9rem 0 0; display: flex; flex-direction: column; gap: .35rem; font-size: .933rem; }
.checks li { display: flex; gap: .5rem; }
.checks li::before { content: "○"; color: var(--fg-subtle); font-weight: 800; }
.checks li.pass { color: var(--success); }
.checks li.pass::before { content: "✓"; color: var(--success); }
.checks li.fail { color: var(--danger); }
.checks li.fail::before { content: "✗"; color: var(--danger); }

.loop { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }
.loop .chip { cursor: default; }
.loop .chip:hover { background: var(--surface-1); }
.loop .arrow { color: var(--fg-subtle); font-weight: 700; }

.timer { font-size: clamp(2.9rem, 5vw, 4.2rem); line-height: 1; font-weight: 700; letter-spacing: -.03em; text-align: center; margin: .8rem 0; font-variant-numeric: tabular-nums; }
.breath { width: 10.5rem; height: 10.5rem; margin: 1rem auto; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 1rem var(--accent-soft); transform: scale(.55); transition: transform 4s ease-in-out; display: grid; place-items: center; color: #fff; font-weight: 700; text-align: center; }
.breath.in { transform: scale(1); }
.blind { position: fixed; inset: 0; z-index: 50; background: #060912; color: var(--sidebar-muted); display: grid; place-content: center; text-align: center; font-size: 1.75rem; cursor: pointer; padding: 1.5rem; }
.blind-sub { font-size: 1rem; }

.matrix { display: grid; grid-template-columns: 2.2rem 1fr 1fr; grid-template-rows: auto 1fr 1fr; gap: .5rem; max-width: 38rem; margin: 0 auto; }
.matrix .axis { font-size: .8rem; font-weight: 700; text-transform: uppercase; text-align: center; letter-spacing: .06em; color: var(--fg-muted); align-self: end; padding-bottom: .3rem; }
.matrix .axis.v { writing-mode: vertical-rl; transform: rotate(180deg); align-self: center; padding: 0; }
.quad { background: var(--sidebar); color: var(--sidebar-fg); border: 0; border-radius: var(--radius-card); min-height: 8rem; padding: 1rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .55rem; transition: background-color .15s; }
.quad:hover, .quad[aria-pressed="true"] { background: var(--sidebar-raised); box-shadow: inset 0 0 0 2px var(--sidebar-accent); }
.quad .num { width: 2.6rem; height: 2.6rem; border-radius: 50%; border: 2px solid var(--sidebar-accent); display: grid; place-items: center; font-weight: 700; }
.quad .lbl { font-weight: 600; font-size: .933rem; }
.quad-detail { margin-top: 1.1rem; }
.quad-detail:empty { display: none; }
.sort-task { font-size: 1.333rem; line-height: 1.35; font-weight: 700; text-align: center; padding: 1.2rem; border: 1.5px dashed var(--border-strong); border-radius: var(--radius-card); background: var(--surface-2); }

.tabs { display: flex; flex-wrap: wrap; gap: .4rem 1.8rem; border-bottom: 1px solid var(--border); margin: .5rem 0 1.2rem; }
.tab { position: relative; padding: .65rem 0 .8rem; border: 0; background: none; font-size: .933rem; font-weight: 600; color: var(--fg-muted); cursor: pointer; display: inline-flex; gap: .5rem; align-items: center; }
.tab:hover { color: var(--fg); }
.tab[aria-selected="true"] { color: var(--fg); }
.tab[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; border-radius: 2px; background: var(--accent); }

.steps { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .5rem; margin: 1rem 0; }
.step-btn { display: flex; flex-direction: column; gap: .35rem; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; color: var(--fg-muted); min-width: 0; }
.step-btn::before { content: ""; display: block; height: 4px; border-radius: var(--radius-pill); background: var(--surface-3); }
.step-btn .n { font-size: .8rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.step-btn .t { font-size: .933rem; font-weight: 600; overflow-wrap: anywhere; }
.step-btn:hover { color: var(--fg); }
.step-btn[aria-selected="true"] { color: var(--fg); }
.step-btn[aria-selected="true"]::before { background: var(--accent); }

.split-list { list-style: none; padding: 0; margin: .8rem 0 0; display: flex; flex-direction: column; gap: .45rem; }
.split-list li { display: flex; justify-content: space-between; align-items: center; gap: .75rem; min-height: var(--control-md); padding: .45rem .5rem .45rem 1rem; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-control); }
.split-list li.long { border-color: var(--danger); }

ol.rules { counter-reset: r; list-style: none; padding: .6rem; }
ol.rules li { counter-increment: r; }
ol.rules label::before { content: counter(r); order: 2; flex: none; width: 1.73rem; height: 1.73rem; border-radius: 50%; background: var(--surface-3); color: var(--fg); display: grid; place-items: center; font-size: .867rem; font-weight: 700; }
ol.rules label input { order: 1; }
ol.rules label span { order: 3; }

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  table.planner thead { display: none; }
  table.planner, table.planner tbody, table.planner tr, table.planner td { display: block; width: 100% !important; }
  table.planner tr { border: 1px solid var(--border); border-radius: var(--radius-card); padding: .6rem; margin-bottom: .8rem; background: var(--surface-1); }
  table.planner td { border: 0 !important; padding: .4rem .3rem; }
  table.planner td[data-label]::before { content: attr(data-label); display: block; font-size: .867rem; font-weight: 600; color: var(--fg-muted); margin-bottom: .25rem; }
}

@media (max-width: 860px) {
  .shell { grid-template-columns: minmax(0, 1fr); padding-left: 0; }
  .sidebar { position: fixed; top: .5rem; bottom: .5rem; left: .5rem; height: auto; width: min(19rem, 86vw); z-index: 40; transform: translateX(calc(-100% - 1rem)); transition: transform .2s ease-out; box-shadow: var(--shadow-pop); }
  .sidebar.open { transform: none; }
  .mobile-bar { display: flex; justify-content: space-between; align-items: center; gap: .75rem; margin: .5rem; padding: .5rem .6rem; background: var(--glass-strong); border: 1px solid var(--glass-border); border-radius: var(--radius-glass); -webkit-backdrop-filter: var(--blur-glass); backdrop-filter: var(--blur-glass); position: sticky; top: .5rem; z-index: 6; font-size: .867rem; color: var(--fg-muted); }
  .module { padding-top: 1.2rem; }
  .pager { bottom: .5rem; margin-bottom: .5rem; }
  .pager button { white-space: nowrap; padding-inline: .9rem; }
  .split, .step-grid, .gc-wrap, .duo, .quote-img { grid-template-columns: minmax(0, 1fr); }
  .split > .fig { max-width: 28rem; }
  .split > .fig img { max-height: 21rem; object-fit: cover; }
  .quote-img img { max-height: 18rem; object-position: center 25%; }
  .gc-wrap .gc { max-width: 17rem; margin: 0 auto; }
  .form-grid { grid-template-columns: 1fr 1fr; }
  .form-grid label:first-child { grid-column: 1 / -1; }
  .choice-opts { grid-template-columns: minmax(0, 1fr); }
  /* Many steps on a phone: a row that scrolls sideways, words never cut in two. */
  .steps { gap: .3rem; grid-template-columns: none !important; grid-auto-flow: column; grid-auto-columns: minmax(6.25rem, 1fr); overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: .25rem; }
  .step-btn { scroll-snap-align: start; }
  .step-btn .n { font-size: .7rem; letter-spacing: .02em; }
  .step-btn .t { font-size: .8rem; }

  table.raci thead { display: none; }
  table.raci, table.raci tbody, table.raci tr, table.raci td { display: block; width: 100% !important; }
  table.raci tr { border: 1px solid var(--border); border-radius: var(--radius-card); padding: .6rem; margin-bottom: .8rem; background: var(--surface-1); }
  table.raci td { border: 0 !important; display: grid; grid-template-columns: minmax(0, 1fr) 6.5rem; gap: .5rem; align-items: center; text-align: left; padding: .3rem .25rem; }
  table.raci td:first-child { display: block; }
  table.raci td[data-label]::before { content: attr(data-label); font-size: .933rem; color: var(--fg-muted); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---------- slides from the original presentation ---------- */

.slides { margin-top: 2.2rem; }
.slide-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr)); gap: .9rem; }
.slide-thumb { position: relative; display: block; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-card); overflow: hidden; background: var(--surface-1); cursor: zoom-in; box-shadow: var(--shadow-card); transition: transform .18s ease-out, box-shadow .18s ease-out, border-color .18s; }
.slide-thumb img { display: block; width: 100%; aspect-ratio: 16 / 9; object-fit: contain; background: #fff; }
.slide-thumb:hover { transform: translateY(-2px); box-shadow: var(--shadow-glass); border-color: var(--accent); }
.slide-num { position: absolute; left: .5rem; bottom: .5rem; min-width: 1.8rem; padding: .1rem .45rem; border-radius: var(--radius-pill); background: rgb(14 23 38 / 78%); color: #fff; font-size: .8rem; font-weight: 700; font-variant-numeric: tabular-nums; text-align: center; }

.lightbox { width: min(96vw, 80rem); max-height: 94vh; padding: 0; border: 0; border-radius: var(--radius-glass); background: var(--surface-1); box-shadow: var(--shadow-pop); }
.lightbox::backdrop { background: rgb(14 23 38 / 72%); backdrop-filter: blur(4px); }
.lightbox figure { margin: 0; display: flex; flex-direction: column; max-height: 94vh; }
.lightbox img { display: block; width: 100%; height: auto; max-height: calc(94vh - 4.5rem); object-fit: contain; background: #fff; }
.lightbox figcaption { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: .8rem 1rem; border-top: 1px solid var(--border); font-weight: 600; color: var(--fg-muted); }
.lb-actions { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ---------- motion: sections rise in when a module opens ---------- */

@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.rise { animation: rise .45s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 70ms); }
.reveal-card { transition: transform .2s ease-out, box-shadow .2s ease-out, background-color .2s; }
.reveal-card:hover { transform: translateY(-2px); }
.feedback.ok, .feedback.bad { animation: rise .3s ease-out both; }

/* ---------- spot the better design ---------- */

.pick .q-text { font-weight: 600; margin: 0 0 1rem; }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 16rem), 1fr)); gap: 1rem; }
.pick-opt { position: relative; display: flex; flex-direction: column; padding: .5rem; border: 2px solid var(--border); border-radius: var(--radius-card); background: var(--surface-1); cursor: pointer; text-align: left; transition: transform .2s cubic-bezier(.2, .7, .2, 1), border-color .2s, box-shadow .2s, opacity .3s; }
.pick-opt img { display: block; width: 100%; aspect-ratio: 16 / 7; object-fit: contain; background: #fff; border-radius: var(--radius-sm); }
.pick-opt:hover:not(:disabled) { transform: translateY(-3px); box-shadow: var(--shadow-glass); }
.pick-opt[aria-checked="true"] { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); transform: scale(1.02); }
.pick-tag { display: inline-block; margin-top: .45rem; font-size: .867rem; font-weight: 700; color: var(--fg-muted); }
.pick-opt.right { border-color: var(--success); box-shadow: 0 0 0 4px var(--success-soft); animation: pop .5s cubic-bezier(.2, .7, .2, 1) both; }
.pick-opt.right .pick-tag::after { content: " · Better"; color: var(--success); }
.pick-opt.wrong { border-color: var(--danger); animation: shake .4s ease-out both; }
.pick-opt.wrong .pick-tag::after { content: " · Your choice"; color: var(--danger); }
.pick-opt.dim { opacity: .55; }
.pick-opt:disabled { cursor: default; }

@keyframes pop { 0% { transform: scale(1); } 45% { transform: scale(1.04); } 100% { transform: scale(1.02); } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
@keyframes fade-zoom { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }

/* more motion: answers, steps and images arrive gently */
.reveal-card[aria-expanded="true"] .answer { animation: rise .35s ease-out both; }
[data-step-detail] > * { animation: rise .35s ease-out both; }
[data-step-detail] > *:nth-child(2) { animation-delay: .05s; }
[data-step-detail] > *:nth-child(3) { animation-delay: .1s; }
.module .fig img { animation: fade-zoom .6s cubic-bezier(.2, .7, .2, 1) both; }
.slide-thumb { animation: rise .4s cubic-bezier(.2, .7, .2, 1) both; }
.slide-thumb:nth-child(2) { animation-delay: .05s; } .slide-thumb:nth-child(3) { animation-delay: .1s; }
.slide-thumb:nth-child(4) { animation-delay: .15s; } .slide-thumb:nth-child(5) { animation-delay: .2s; }
.slide-thumb:nth-child(n+6) { animation-delay: .25s; }
.lightbox[open] figure { animation: fade-zoom .3s ease-out both; }
