/* =========================================================
   Jasmína — Štúdium 3. AE
   Minimalist B&W · smooth & sleek animations
   ========================================================= */

:root {
  --bg: #ffffff;
  --bg-soft: #fafafa;
  --bg-elev: #ffffff;
  --ink: #0a0a0a;
  --ink-2: #1c1c1c;
  --ink-3: #4a4a4a;
  --ink-4: #8a8a8a;
  --line: #e5e5e5;
  --line-2: #f0f0f0;
  --accent: #0a0a0a;
  --accent-soft: #f3f3f3;
  --good: #0a0a0a;
  --good-soft: #ececec;
  --bad: #0a0a0a;
  --bad-soft: #f5f5f5;
  --radius: 4px;
  --radius-lg: 8px;
  --maxw: 920px;
  --shadow: none;
  --font-serif: "Cormorant Garamond", "Source Serif Pro", Georgia, "Times New Roman", serif;
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

[data-theme="dark"] {
  --bg: #0a0a0a;
  --bg-soft: #111111;
  --bg-elev: #141414;
  --ink: #f5f5f5;
  --ink-2: #ededed;
  --ink-3: #b8b8b8;
  --ink-4: #7a7a7a;
  --line: #262626;
  --line-2: #1c1c1c;
  --accent: #ffffff;
  --accent-soft: #1c1c1c;
  --good-soft: #1c1c1c;
  --bad-soft: #1c1c1c;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-feature-settings: "ss01", "cv11";
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background .3s ease, color .3s ease;
}
a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }

::selection { background: var(--ink); color: var(--bg); }

/* =================== Topbar =================== */
.topbar {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 18px 28px;
  display: flex; align-items: center; gap: 14px;
}
.brand {
  font-family: var(--font-serif);
  font-weight: 500; font-size: 1.35rem; letter-spacing: -.01em;
  display: flex; align-items: baseline; gap: 10px;
  font-style: italic;
}
.brand .mark {
  font-family: var(--font-mono);
  font-style: normal; font-size: .72rem;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-4);
  border: 1px solid var(--line); padding: 3px 8px; border-radius: 2px;
}
.spacer { flex: 1; }
.theme-toggle {
  border: 1px solid var(--line); background: transparent; color: var(--ink);
  width: 38px; height: 38px; border-radius: 50%; cursor: pointer;
  display: grid; place-items: center;
  transition: background .2s, border-color .2s, transform .15s;
  padding: 0;
}
.theme-toggle:hover { background: var(--accent-soft); border-color: var(--ink); }
.theme-toggle svg { width: 16px; height: 16px; }

/* =================== Layout =================== */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 36px 28px 80px; }

/* Hero / intro */
.hero {
  margin-bottom: 36px; padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}
.hero .eyebrow {
  font-family: var(--font-mono); font-size: .72rem;
  letter-spacing: .25em; text-transform: uppercase; color: var(--ink-4);
  margin-bottom: 12px;
}
.hero h1 {
  font-family: var(--font-serif); font-weight: 400;
  font-size: clamp(2.1rem, 5vw, 3.2rem);
  letter-spacing: -.02em; line-height: 1.05; margin: 0 0 14px;
}
.hero h1 em { font-style: italic; color: var(--ink-3); }
.hero p { color: var(--ink-3); max-width: 60ch; margin: 0; font-size: 1rem; }

/* =================== Subject nav =================== */
.subject-nav {
  display: flex; flex-wrap: wrap; gap: 0;
  margin-bottom: 24px; border-bottom: 1px solid var(--line);
}
.chip {
  border: none; background: transparent; color: var(--ink-4);
  padding: 14px 22px 16px; cursor: pointer;
  font-family: var(--font-sans);
  font-size: .85rem; font-weight: 500;
  letter-spacing: .04em; text-transform: uppercase;
  position: relative; transition: color .2s;
}
.chip:hover { color: var(--ink); }
.chip.active { color: var(--ink); }
.chip.active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px;
  height: 2px; background: var(--ink);
}

/* =================== File select =================== */
.file-select {
  margin-bottom: 28px;
  display: flex; align-items: center; gap: 16px;
}
.file-select label {
  font-family: var(--font-mono);
  font-size: .68rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-4); white-space: nowrap;
}
.file-select select {
  flex: 1;
  padding: 12px 16px; border-radius: var(--radius);
  border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); font-size: .95rem; font-weight: 500;
  font-family: inherit; cursor: pointer; appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a8a8a' stroke-width='1.5'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
  transition: border-color .2s;
}
.file-select select:hover, .file-select select:focus { border-color: var(--ink); outline: none; }

/* =================== Tabs =================== */
.tabs {
  display: flex; gap: 0; margin-bottom: 32px;
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 4px; background: var(--bg-soft);
}
.tab {
  flex: 1; text-align: center; padding: 11px 14px;
  border-radius: 2px; cursor: pointer; font-weight: 500;
  font-family: inherit; font-size: .88rem;
  letter-spacing: .04em;
  color: var(--ink-3); border: none; background: transparent;
  transition: all .2s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--ink); color: var(--bg); }

/* =================== Cards =================== */
.card {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 36px 38px; margin-bottom: 18px;
}
.card > h2 {
  font-family: var(--font-serif); font-weight: 400; font-style: italic;
  margin: 0 0 6px; font-size: 1.85rem; letter-spacing: -.01em; line-height: 1.15;
}
.card > .subtitle {
  color: var(--ink-4); font-size: .82rem;
  font-family: var(--font-mono); letter-spacing: .08em;
  text-transform: uppercase; margin-bottom: 30px;
  padding-bottom: 22px; border-bottom: 1px solid var(--line);
}

/* =================== Learn typography =================== */
.learn h3 {
  font-family: var(--font-serif); font-weight: 500;
  margin: 38px 0 14px; font-size: 1.5rem; letter-spacing: -.005em;
  color: var(--ink); position: relative; padding-left: 22px;
}
.learn h3::before {
  content: ""; position: absolute; left: 0; top: 12px;
  width: 12px; height: 1px; background: var(--ink);
}
.learn h3:first-child { margin-top: 0; }
.learn p { margin: 0 0 16px; color: var(--ink-2); font-size: 1rem; }
.learn ul { margin: 0 0 18px; padding-left: 22px; }
.learn li { margin-bottom: 8px; color: var(--ink-2); }
.learn li::marker { color: var(--ink-4); }
.learn .term {
  font-weight: 600; color: var(--ink);
  border-bottom: 1px solid var(--ink); padding-bottom: 1px;
}
.learn em { color: var(--ink-3); }
.learn strong { color: var(--ink); font-weight: 600; }
.learn .box {
  border-left: 2px solid var(--ink); background: var(--bg-soft);
  padding: 16px 20px; border-radius: 0 var(--radius) var(--radius) 0;
  margin: 18px 0; font-size: .95rem; color: var(--ink-2);
}
.learn .box.tip { border-left-style: dashed; }

/* Gallery — karikatúry / portraits */
.gallery {
  display: grid; gap: 16px; margin: 28px 0 8px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}
.gallery.wide {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.gallery figure {
  margin: 0; border: 1px solid var(--line); border-radius: var(--radius);
  overflow: hidden; background: var(--bg-soft);
  transition: border-color .2s, transform .2s;
  display: flex; flex-direction: column;
}
.gallery figure:hover { border-color: var(--ink); transform: translateY(-2px); }
.gallery img {
  width: 100%; aspect-ratio: 1/1; object-fit: cover;
  display: block;
  filter: grayscale(1) contrast(1.04);
}
.gallery.wide img { aspect-ratio: 4/3; }
.gallery figcaption {
  padding: 10px 12px 12px;
  font-family: var(--font-mono); font-size: .7rem;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); border-top: 1px solid var(--line);
  background: var(--bg);
}
.gallery figcaption .label {
  display: block; color: var(--ink); font-weight: 600;
  letter-spacing: .02em; text-transform: none;
  font-family: var(--font-sans); font-size: .82rem; margin-bottom: 2px;
}

/* =================== Exercises =================== */
.ex { margin-bottom: 30px; }
.ex-type {
  font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-4); margin-bottom: 8px;
}
.ex-q {
  font-weight: 500; margin-bottom: 18px; font-size: 1.02rem;
  color: var(--ink); line-height: 1.5;
}
.ex-q .num {
  display: inline-grid; place-items: center;
  width: 28px; height: 28px; padding: 0;
  background: var(--ink); color: var(--bg);
  border-radius: 50%; font-size: .78rem; font-weight: 600;
  font-family: var(--font-mono); margin-right: 12px;
  vertical-align: 1px;
}

/* Buttons */
.btn {
  border: 1px solid var(--ink); background: var(--ink); color: var(--bg);
  cursor: pointer; padding: 10px 20px; border-radius: var(--radius);
  font-family: inherit; font-weight: 500; font-size: .85rem;
  letter-spacing: .04em; transition: all .15s ease;
}
.btn:hover { background: var(--bg); color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost:hover { background: var(--ink); color: var(--bg); }
.btn.sm { padding: 7px 14px; font-size: .78rem; }
.btn:disabled { opacity: .35; cursor: default; }
.btn:disabled:hover { background: var(--ink); color: var(--bg); }

/* Errorfix — clickable tokens */
.tokens { line-height: 2.2; font-size: 1rem; }
.tok {
  cursor: pointer; padding: 2px 5px; border-radius: 3px;
  border-bottom: 1px dashed transparent; transition: background .15s, border-color .15s;
}
.tok:hover { background: var(--accent-soft); }
.tok.picked { background: var(--ink); color: var(--bg); }
.tok.ok { background: transparent; border-bottom: 1px solid var(--ink); font-weight: 600; }
.tok.bad {
  background: var(--bg-soft); color: var(--ink-4);
  text-decoration: line-through; border-bottom-color: var(--ink-4);
}
.fix-line { margin-top: 10px; font-size: .9rem; color: var(--ink-3); }
.fix-line .arrow { color: var(--ink-4); margin: 0 8px; }
.fix-line .correct { color: var(--ink); font-weight: 600; border-bottom: 1px solid var(--ink); }
.fix-line .bad-label { color: var(--ink-4); text-decoration: line-through; }

/* Matching */
.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.match-col { display: flex; flex-direction: column; gap: 8px; }
.match-item {
  border: 1px solid var(--line); background: var(--bg);
  border-radius: var(--radius); padding: 12px 14px;
  cursor: pointer; font-size: .9rem; font-weight: 500;
  transition: all .15s; position: relative; color: var(--ink-2);
}
.match-item:hover { border-color: var(--ink); color: var(--ink); }
.match-item.sel { border-color: var(--ink); background: var(--accent-soft); }
.match-item.matched { border-color: var(--ink); color: var(--ink); }
.match-item .badge {
  position: absolute; top: -10px; right: -10px;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ink); color: var(--bg);
  font-size: .7rem; font-weight: 600;
  font-family: var(--font-mono);
  display: grid; place-items: center;
  border: 2px solid var(--bg);
}
.match-item.ok { border-color: var(--ink); border-style: solid; font-weight: 600; }
.match-item.bad { border-color: var(--ink-4); border-style: dashed; color: var(--ink-4); }

/* Fillblank */
.fill-text { line-height: 2.4; font-size: 1rem; color: var(--ink-2); }
.blank {
  border: none; border-bottom: 1.5px solid var(--ink); background: transparent;
  color: var(--ink); font: inherit; font-weight: 600;
  text-align: center; min-width: 96px; padding: 1px 6px; margin: 0 3px;
}
.blank:focus { outline: none; background: var(--accent-soft); border-radius: 4px 4px 0 0; }
.blank.ok { border-bottom-style: solid; }
.blank.bad { border-bottom-style: dashed; color: var(--ink-4); }
.blank-answer { color: var(--ink); font-weight: 600; font-size: .85rem; border-bottom: 1px solid var(--ink); }

/* Odd one out */
.odd-list { display: flex; flex-wrap: wrap; gap: 8px; }
.odd-item {
  border: 1px solid var(--line); background: var(--bg);
  border-radius: 999px; padding: 9px 18px;
  cursor: pointer; font-weight: 500; font-size: .88rem;
  color: var(--ink-2); transition: all .15s;
}
.odd-item:hover { border-color: var(--ink); color: var(--ink); }
.odd-item.sel { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.odd-item.ok { border-color: var(--ink); color: var(--ink); font-weight: 600; }
.odd-item.bad { border-style: dashed; border-color: var(--ink-4); color: var(--ink-4); }

/* Ordering */
.order-list { display: flex; flex-direction: column; gap: 8px; }
.order-item {
  border: 1px solid var(--line); background: var(--bg);
  border-radius: var(--radius); padding: 10px 14px;
  display: flex; align-items: center; gap: 14px;
  font-weight: 500; font-size: .92rem; color: var(--ink-2);
}
.order-item .order-input {
  width: 48px; padding: 8px; text-align: center;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--bg); color: var(--ink);
  font: inherit; font-weight: 600;
  font-family: var(--font-mono);
}
.order-item .order-input:focus { outline: none; border-color: var(--ink); }
.order-item.ok { border-color: var(--ink); }
.order-item.bad { border-style: dashed; border-color: var(--ink-4); color: var(--ink-4); }
.order-item .pos {
  color: var(--ink); font-weight: 600; margin-left: auto;
  font-family: var(--font-mono); font-size: .8rem;
}

/* MCQ */
.mcq-opts { display: flex; flex-direction: column; gap: 10px; }
.mcq-opt {
  border: 1px solid var(--line); background: var(--bg);
  border-radius: var(--radius); padding: 13px 16px;
  cursor: pointer; font-weight: 500; font-size: .94rem;
  color: var(--ink-2); transition: all .15s;
  display: flex; gap: 12px; align-items: center;
}
.mcq-opt:hover { border-color: var(--ink); color: var(--ink); }
.mcq-opt .pick {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1.5px solid var(--ink-4); flex: 0 0 auto;
  transition: all .15s;
}
.mcq-opt.sel { border-color: var(--ink); background: var(--bg-soft); color: var(--ink); }
.mcq-opt.sel .pick { border-color: var(--ink); background: var(--ink); box-shadow: inset 0 0 0 3px var(--bg); }
.mcq-opt.ok { border-color: var(--ink); font-weight: 600; }
.mcq-opt.ok .pick { border-color: var(--ink); background: var(--ink); }
.mcq-opt.bad { border-style: dashed; border-color: var(--ink-4); color: var(--ink-4); }

/* Open / flashcard */
.open-answer {
  margin-top: 14px; border-left: 2px solid var(--ink);
  background: var(--bg-soft); padding: 14px 18px;
  border-radius: 0 var(--radius) var(--radius) 0;
  font-size: .95rem; display: none; color: var(--ink-2);
}
.open-answer.show { display: block; animation: fade .25s ease; }
.open-answer strong { color: var(--ink); }
@keyframes fade { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.self-grade { display: flex; gap: 8px; margin-top: 10px; }
.input-line {
  width: 100%; padding: 11px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--bg);
  color: var(--ink); font: inherit; margin-bottom: 8px;
}
.input-line:focus { outline: none; border-color: var(--ink); }
textarea.input-line { resize: vertical; min-height: 70px; }

/* Action row + result tag */
.ex-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 14px; }
.result-tag {
  font-weight: 600; font-size: .78rem;
  padding: 4px 12px; border-radius: 999px;
  font-family: var(--font-mono); letter-spacing: .06em; text-transform: uppercase;
}
.result-tag.good { background: var(--ink); color: var(--bg); }
.result-tag.poor { background: transparent; color: var(--ink-3); border: 1px solid var(--line); }

hr.ex-div { border: none; border-top: 1px solid var(--line-2); margin: 26px 0; }

/* Score bar */
.scorebar {
  position: sticky; bottom: 16px; margin-top: 16px;
  background: var(--bg); border: 1px solid var(--ink);
  border-radius: 999px; padding: 12px 22px;
  display: flex; align-items: center; gap: 16px;
  font-weight: 500; font-size: .9rem;
}
.scorebar .score-num { font-family: var(--font-mono); font-weight: 600; }
.scorebar .bar { flex: 1; height: 4px; background: var(--line); border-radius: 999px; overflow: hidden; }
.scorebar .bar > i {
  display: block; height: 100%; width: 0;
  background: var(--ink); transition: width .4s ease;
}
#scoreMeta { font-family: var(--font-mono); letter-spacing: .04em; }

.empty { color: var(--ink-4); text-align: center; padding: 60px 10px; font-style: italic; font-family: var(--font-serif); }

footer {
  text-align: center; color: var(--ink-4);
  font-family: var(--font-mono); font-size: .72rem;
  letter-spacing: .12em; text-transform: uppercase;
  padding: 60px 0 20px;
}

/* =================== Responsive =================== */
/* =========================================================
   SPLASH — full-screen greeting
   ========================================================= */
.splash {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex; flex-direction: column;
  justify-content: center; align-items: center;
  padding: 140px 28px 140px;
  overflow: hidden;
  text-align: left;
  isolation: isolate;
}
.splash-bg {
  position: absolute; inset: 0;
  pointer-events: none; z-index: -1;
}
.splash-bg .orb {
  position: absolute;
  width: 520px; height: 520px; border-radius: 50%;
  filter: blur(80px);
  opacity: .35;
}
[data-theme="dark"] .splash-bg .orb { opacity: .22; }
.splash-bg .orb-1 {
  background: radial-gradient(circle, var(--ink) 0%, transparent 70%);
  top: -180px; left: -120px;
  animation: orbFloat 14s ease-in-out infinite alternate;
}
.splash-bg .orb-2 {
  background: radial-gradient(circle, var(--ink) 0%, transparent 70%);
  bottom: -200px; right: -160px;
  animation: orbFloat 18s ease-in-out infinite alternate-reverse;
}
.splash-bg .grid-lines {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(to right, var(--line) 1px, transparent 1px),
    linear-gradient(to bottom, var(--line) 1px, transparent 1px);
  background-size: 80px 80px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
  opacity: .5;
}
@keyframes orbFloat {
  from { transform: translate(0, 0) scale(1); }
  to   { transform: translate(60px, 40px) scale(1.1); }
}

.splash-inner {
  max-width: 760px; width: 100%;
  position: relative;
  margin-top: clamp(20px, 7vh, 90px);
}

.splash-eyebrow {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-mono);
  font-size: .72rem; letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-3);
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  margin-bottom: 32px;
  background: color-mix(in srgb, var(--bg) 70%, transparent);
  backdrop-filter: blur(6px);
  animation: fadeUp .8s var(--ease-out) both;
}
.dot-pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--ink); display: inline-block;
  box-shadow: 0 0 0 0 var(--ink);
  animation: dotPulse 2s ease-out infinite;
}
@keyframes dotPulse {
  0%   { box-shadow: 0 0 0 0 color-mix(in srgb, var(--ink) 50%, transparent); }
  70%  { box-shadow: 0 0 0 10px transparent; }
  100% { box-shadow: 0 0 0 0 transparent; }
}

.splash-title {
  font-family: var(--font-serif); font-weight: 400;
  font-size: clamp(3.5rem, 11vw, 7.5rem);
  letter-spacing: -.035em; line-height: 1.05;
  margin: 0 0 48px;
}
.splash-line {
  display: block;
  overflow: visible;
  padding-bottom: .12em;
}
.splash-line > * { display: inline-block; }
.splash-line:first-child {
  color: var(--ink-3);
  animation: splashRise 1s .15s var(--ease-out) both;
}
.splash-name {
  position: relative;
  padding-bottom: .25em;
}
.splash-name em {
  font-style: italic;
  background: linear-gradient(120deg, var(--ink) 0%, var(--ink-3) 40%, var(--ink) 80%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: splashRise 1s .35s var(--ease-out) both,
             shimmer 7s 1.4s linear infinite;
}
.splash-name::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  height: .07em;
  width: clamp(180px, 46%, 460px);
  background: var(--ink);
  transform-origin: left center;
  transform: scaleX(0);
  transition: transform .9s var(--ease-out);
}
.splash-name.is-drawn::after { transform: scaleX(1); }
@keyframes splashRise {
  from { opacity: 0; transform: translateY(36px); }
  to   { opacity: 1; transform: none; }
}

.splash-sub {
  max-width: 56ch; color: var(--ink-3);
  font-size: clamp(1.02rem, 1.6vw, 1.15rem);
  line-height: 1.6; margin: 0 0 40px;
  animation: fadeUp 1s .7s var(--ease-out) both;
}

.splash-meta {
  display: inline-flex; align-items: center; gap: 28px;
  padding: 20px 28px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
  animation: fadeUp 1s .9s var(--ease-out) both;
  flex-wrap: wrap;
}
.splash-stat { display: flex; flex-direction: column; gap: 2px; min-width: 80px; }
.splash-stat-num {
  font-family: var(--font-serif); font-style: italic; font-weight: 500;
  font-size: 2.2rem; line-height: 1; color: var(--ink);
  letter-spacing: -.02em;
}
.splash-stat-lbl {
  font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-4);
}
.splash-divider {
  width: 1px; height: 32px; background: var(--line);
}

/* Scroll-down button */
.scroll-down {
  position: absolute; bottom: 8%; left: 50%;
  transform: translateX(-50%);
  display: flex; flex-direction: column; align-items: center; gap: 14px;
  background: transparent; border: none; cursor: pointer;
  color: var(--ink-3); font-family: var(--font-mono);
  font-size: .68rem; letter-spacing: .25em; text-transform: uppercase;
  padding: 12px 18px;
  transition: color var(--t-mid) var(--ease-out), transform var(--t-mid) var(--ease-out);
  animation: fadeUp 1s 1.3s var(--ease-out) both;
}
.scroll-down:hover { color: var(--ink); transform: translateX(-50%) translateY(2px); }
.scroll-down-label { transition: letter-spacing var(--t-mid) var(--ease-out); }
.scroll-down:hover .scroll-down-label { letter-spacing: .32em; }
.scroll-down-arrow {
  width: 38px; height: 38px;
  border: 1px solid var(--line); border-radius: 50%;
  display: grid; place-items: center;
  transition: border-color var(--t-mid) var(--ease-out), background var(--t-mid) var(--ease-out);
  animation: arrowBounce 2s var(--ease-in-out) infinite;
}
.scroll-down:hover .scroll-down-arrow {
  border-color: var(--ink);
  background: var(--ink);
  color: var(--bg);
}
.scroll-down-arrow svg { width: 16px; height: 16px; }
@keyframes arrowBounce {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(6px); }
}

/* Splash fades out as user scrolls past */
.splash.scrolled .scroll-down { opacity: 0; pointer-events: none; transition: opacity .3s; }

/* Signature — subtle author credit */
.splash-signature {
  position: absolute;
  left: 40px; bottom: 40px;
  display: flex; align-items: center; gap: 14px;
  font-family: var(--font-mono); font-size: .68rem;
  letter-spacing: .22em; text-transform: uppercase;
  color: var(--ink-4);
  animation: fadeIn 1.2s 1.8s var(--ease-out) both;
}
.signature-stroke {
  display: inline-block; width: 28px; height: 1px; background: var(--ink-4);
  transform-origin: left; transform: scaleX(0);
  animation: drawSignature 1s 2s var(--ease-out) forwards;
}
@keyframes drawSignature {
  to { transform: scaleX(1); }
}
.splash-signature em {
  font-family: var(--font-serif); font-style: italic; font-weight: 500;
  letter-spacing: -.01em; text-transform: none;
  font-size: .95rem; color: var(--ink); margin-left: 4px;
  position: relative;
}
.splash-signature em::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px;
  height: 1px; background: var(--ink);
  transform-origin: left; transform: scaleX(0);
  transition: transform .4s var(--ease-out);
}
.splash-signature:hover em::after { transform: scaleX(1); }

@media (max-width: 640px) {
  .splash-signature { left: 20px; bottom: 90px; font-size: .62rem; }
  .signature-stroke { width: 20px; }
  .splash-signature em { font-size: .85rem; }
}

/* When splash is present, add spacing above the app */
.wrap { scroll-margin-top: 24px; }

@media (max-width: 640px) {
  .splash { padding: 60px 20px 100px; }
  .splash-eyebrow { font-size: .65rem; padding: 6px 12px; margin-bottom: 24px; }
  .splash-title { font-size: clamp(3rem, 16vw, 5rem); margin-bottom: 28px; }
  .splash-sub { font-size: 1rem; margin-bottom: 32px; }
  .splash-meta { gap: 18px; padding: 16px 20px; }
  .splash-stat-num { font-size: 1.8rem; }
  .splash-divider { display: none; }
  .scroll-down { bottom: 24px; }
}

/* =========================================================
   Animations — global easings & keyframes
   ========================================================= */
:root {
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --ease-in-out: cubic-bezier(.65, 0, .35, 1);
  --ease-spring: cubic-bezier(.34, 1.56, .64, 1);
  --t-fast: .18s;
  --t-mid: .35s;
  --t-slow: .6s;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}
@keyframes slideRight {
  from { opacity: 0; transform: translateX(-10px); }
  to   { opacity: 1; transform: none; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(.96); }
  to   { opacity: 1; transform: none; }
}
@keyframes shineSweep {
  0%   { transform: translateX(-120%) skewX(-12deg); }
  100% { transform: translateX(220%)  skewX(-12deg); }
}
@keyframes drawLine {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50%      { transform: scale(1.04); }
}
@keyframes blink {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0; }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-4px); }
  40%, 80% { transform: translateX(4px); }
}

/* Smooth focus globally */
*:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
  border-radius: 3px;
}

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

/* =========================================================
   Hero personalization
   ========================================================= */
.brand-name {
  font-family: var(--font-serif); font-weight: 500; font-style: italic;
  background: linear-gradient(120deg, var(--ink) 0%, var(--ink-3) 50%, var(--ink) 100%);
  background-size: 200% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 6s linear infinite;
}
@keyframes shimmer {
  to { background-position: 200% center; }
}

.hero {
  animation: fadeUp .8s var(--ease-out) both;
}
.hero .eyebrow {
  animation: slideRight .7s var(--ease-out) both;
}
.hero h1 {
  animation: fadeUp .9s .08s var(--ease-out) both;
}
.hero h1 em {
  display: inline-block;
  position: relative;
}
.hero h1 em::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 4px;
  height: 2px; background: var(--ink);
  transform-origin: left; transform: scaleX(0);
  animation: drawLine .9s .9s var(--ease-out) forwards;
}
.hero-lead {
  animation: fadeUp 1s .18s var(--ease-out) both;
  font-size: 1.05rem;
}
.hero-meta {
  display: flex; flex-wrap: wrap; gap: 28px;
  margin-top: 22px;
  animation: fadeUp 1s .3s var(--ease-out) both;
}
.hero-stat {
  font-family: var(--font-mono); font-size: .72rem;
  letter-spacing: .18em; text-transform: uppercase;
  color: var(--ink-4); display: inline-flex; align-items: baseline; gap: 8px;
}
.hero-stat-num {
  font-family: var(--font-serif); font-style: italic;
  font-size: 1.6rem; color: var(--ink);
  letter-spacing: -.02em;
}

/* =========================================================
   Topbar refinement
   ========================================================= */
.topbar {
  animation: fadeIn .5s var(--ease-out) both;
}
.brand {
  transition: transform var(--t-fast) var(--ease-out);
}
.brand:hover { transform: translateY(-1px); }
.theme-toggle svg {
  transition: transform var(--t-mid) var(--ease-spring);
}
.theme-toggle:hover svg { transform: rotate(-18deg) scale(1.08); }

/* =========================================================
   Subject nav — smooth underline slide
   ========================================================= */
.chip { transition: color var(--t-mid) var(--ease-out); }
.chip::after {
  /* the active underline is the .chip.active::after — but animate the underline width */
}
.chip.active::after {
  animation: drawLine .45s var(--ease-out) both;
  transform-origin: center;
}

/* =========================================================
   Tabs — sliding indicator feel
   ========================================================= */
.tab { transition: background var(--t-mid) var(--ease-out), color var(--t-mid) var(--ease-out); }
.tab.active {
  animation: scaleIn .25s var(--ease-out) both;
}

/* =========================================================
   Card mount + exercise stagger
   ========================================================= */
.card {
  animation: fadeUp .55s var(--ease-out) both;
  transition: border-color var(--t-mid) var(--ease-out);
}
.card > h2 { animation: fadeUp .55s .05s var(--ease-out) both; }
.card > .subtitle { animation: fadeUp .55s .1s var(--ease-out) both; }

.ex {
  animation: fadeUp .5s var(--ease-out) both;
}
.ex:nth-child(2)  { animation-delay: .04s; }
.ex:nth-child(3)  { animation-delay: .08s; }
.ex:nth-child(4)  { animation-delay: .12s; }
.ex:nth-child(5)  { animation-delay: .16s; }
.ex:nth-child(6)  { animation-delay: .20s; }
.ex:nth-child(7)  { animation-delay: .24s; }
.ex:nth-child(8)  { animation-delay: .28s; }
.ex:nth-child(9)  { animation-delay: .32s; }

/* h3 in learn — pretty underline reveal */
.learn h3 {
  animation: slideRight .5s var(--ease-out) both;
}
.learn h3::before {
  transform-origin: left;
  animation: drawLine .6s .2s var(--ease-out) both;
}
.learn p, .learn ul, .learn .box {
  animation: fadeIn .6s var(--ease-out) both;
}

/* Term — animated underline on hover */
.learn .term {
  position: relative;
  border-bottom: none;
  background-image: linear-gradient(var(--ink), var(--ink));
  background-size: 100% 1px;
  background-position: 0 100%;
  background-repeat: no-repeat;
  transition: background-size var(--t-mid) var(--ease-out);
}
.learn .term:hover {
  background-size: 100% 2px;
}

/* =========================================================
   Gallery — smooth tilt + B&W zoom on hover
   ========================================================= */
.gallery figure {
  animation: scaleIn .5s var(--ease-out) both;
  transition: border-color var(--t-mid) var(--ease-out),
              transform var(--t-mid) var(--ease-out),
              box-shadow var(--t-mid) var(--ease-out);
  position: relative;
  overflow: hidden;
}
.gallery figure:nth-child(2)  { animation-delay: .04s; }
.gallery figure:nth-child(3)  { animation-delay: .08s; }
.gallery figure:nth-child(4)  { animation-delay: .12s; }
.gallery figure:nth-child(5)  { animation-delay: .16s; }
.gallery figure:nth-child(6)  { animation-delay: .20s; }
.gallery figure:nth-child(7)  { animation-delay: .24s; }
.gallery figure:nth-child(8)  { animation-delay: .28s; }
.gallery figure:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 28px -12px rgba(0,0,0,.25);
}
.gallery img {
  transition: transform var(--t-slow) var(--ease-out),
              filter var(--t-slow) var(--ease-out);
}
.gallery figure:hover img {
  transform: scale(1.06);
  filter: grayscale(.85) contrast(1.08);
}
.gallery figure::after {
  /* subtle shine */
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(110deg, transparent 30%, rgba(255,255,255,.18) 50%, transparent 70%);
  transform: translateX(-120%) skewX(-12deg);
  pointer-events: none; opacity: 0;
}
.gallery figure:hover::after {
  opacity: 1;
  animation: shineSweep 1s var(--ease-out) forwards;
}

/* =========================================================
   Buttons — micro press
   ========================================================= */
.btn {
  position: relative; overflow: hidden;
  transition: background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }

/* =========================================================
   Tokens / Errorfix
   ========================================================= */
.tok { transition: background var(--t-fast) var(--ease-out),
                   color var(--t-fast) var(--ease-out),
                   border-bottom-color var(--t-fast) var(--ease-out),
                   transform var(--t-fast) var(--ease-out); }
.tok:hover { transform: translateY(-1px); }
.tok.picked { animation: scaleIn .2s var(--ease-spring) both; }
.fix-line { animation: fadeUp .3s var(--ease-out) both; }

/* =========================================================
   Matching — animated badge
   ========================================================= */
.match-item { transition: border-color var(--t-fast) var(--ease-out),
                          background var(--t-fast) var(--ease-out),
                          color var(--t-fast) var(--ease-out),
                          transform var(--t-fast) var(--ease-out); }
.match-item:hover { transform: translateY(-1px); }
.match-item .badge {
  animation: scaleIn .25s var(--ease-spring) both;
}

/* =========================================================
   Blanks — typing affordance
   ========================================================= */
.blank { transition: background var(--t-fast) var(--ease-out),
                     border-bottom-color var(--t-mid) var(--ease-out),
                     color var(--t-mid) var(--ease-out); }
.blank.bad { animation: shake .35s var(--ease-out); }

/* =========================================================
   MCQ / Odd / Ordering — slight bounce
   ========================================================= */
.mcq-opt, .odd-item, .order-item {
  transition: border-color var(--t-fast) var(--ease-out),
              background var(--t-fast) var(--ease-out),
              color var(--t-fast) var(--ease-out),
              transform var(--t-fast) var(--ease-out);
}
.mcq-opt:hover, .odd-item:hover { transform: translateY(-1px); }
.mcq-opt.sel { animation: scaleIn .22s var(--ease-out) both; }
.odd-item.sel { animation: scaleIn .22s var(--ease-spring) both; }
.order-item.bad, .mcq-opt.bad, .odd-item.bad { animation: shake .35s var(--ease-out); }

/* =========================================================
   Result tag pop-in
   ========================================================= */
.result-tag { animation: scaleIn .35s var(--ease-spring) both; }

/* =========================================================
   Scorebar
   ========================================================= */
.scorebar {
  animation: fadeUp .5s var(--ease-out) both;
  transition: border-color var(--t-mid) var(--ease-out);
}
.scorebar .bar > i {
  background: linear-gradient(90deg, var(--ink-3), var(--ink));
}

/* =========================================================
   IMG CAPTION — interactive picture quiz
   ========================================================= */
.imgcap-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 18px;
  margin-top: 6px;
}
.imgcap {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--bg);
  overflow: hidden;
  display: flex; flex-direction: column;
  animation: fadeUp .5s var(--ease-out) both;
  transition: border-color var(--t-mid) var(--ease-out),
              transform var(--t-mid) var(--ease-out),
              box-shadow var(--t-mid) var(--ease-out);
}
.imgcap:hover {
  border-color: var(--ink);
  transform: translateY(-3px);
  box-shadow: 0 14px 30px -16px rgba(0,0,0,.28);
}
.imgcap img {
  width: 100%; aspect-ratio: 4/3; object-fit: cover;
  display: block;
  filter: grayscale(1) contrast(1.05);
  transition: transform var(--t-slow) var(--ease-out),
              filter var(--t-slow) var(--ease-out);
}
.imgcap:hover img { transform: scale(1.05); filter: grayscale(.8) contrast(1.1); }
.imgcap-body {
  padding: 14px 16px 16px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  display: flex; flex-direction: column; gap: 8px;
}
.imgcap-idx {
  font-family: var(--font-mono); font-size: .7rem;
  letter-spacing: .18em; text-transform: uppercase; color: var(--ink-4);
}
.imgcap-input {
  width: 100%;
  border: none; border-bottom: 1.5px solid var(--line);
  background: transparent; color: var(--ink);
  font: inherit; font-weight: 500; font-size: .95rem;
  padding: 6px 2px; outline: none;
  transition: border-color var(--t-mid) var(--ease-out),
              padding var(--t-mid) var(--ease-out);
}
.imgcap-input::placeholder { color: var(--ink-4); font-weight: 400; }
.imgcap-input:focus { border-bottom-color: var(--ink); padding-left: 4px; }
.imgcap-hint {
  font-family: var(--font-mono); font-size: .7rem;
  color: var(--ink-4); letter-spacing: .04em;
}
.imgcap-correct {
  font-size: .85rem; font-weight: 600; color: var(--ink);
  border-left: 2px solid var(--ink);
  padding: 6px 10px; background: var(--bg-soft);
  border-radius: 0 var(--radius) var(--radius) 0;
  animation: fadeUp .3s var(--ease-out) both;
}
.imgcap.ok { border-color: var(--ink); }
.imgcap.ok .imgcap-input { color: var(--ink); border-bottom-color: var(--ink); }
.imgcap.ok::after {
  content: ""; position: absolute;
  /* check mark drawn via inset */
}
.imgcap.bad { border-style: dashed; border-color: var(--ink-4); animation: shake .35s var(--ease-out); }
.imgcap.bad .imgcap-input { color: var(--ink-4); border-bottom-color: var(--ink-4); }

/* =========================================================
   Smooth content area transition (when switching tab/file)
   ========================================================= */
#content { animation: fadeIn var(--t-mid) var(--ease-out); }
#content.switching { opacity: 0; transform: translateY(8px); transition: opacity .15s, transform .15s; }

/* =========================================================
   Cursor follow accent dot (decorative)
   ========================================================= */
.brand .mark {
  transition: border-color var(--t-mid) var(--ease-out),
              color var(--t-mid) var(--ease-out);
}
.brand:hover .mark { border-color: var(--ink); color: var(--ink); }

/* =========================================================
   Open answer reveal — already animated, smooth it more
   ========================================================= */
.open-answer.show { animation: fadeUp .4s var(--ease-out) both; }

@media (max-width: 640px) {
  .wrap { padding: 24px 18px 60px; }
  .topbar-inner { padding: 14px 18px; }
  .card { padding: 24px 20px; }
  .match-grid { gap: 8px; }
  .match-item, .mcq-opt { font-size: .85rem; }
  .brand { font-size: 1.1rem; }
  .brand .mark { display: none; }
  .tab { font-size: .78rem; padding: 9px 10px; }
  .chip { padding: 12px 14px 14px; font-size: .78rem; }
  .file-select { flex-direction: column; align-items: stretch; gap: 8px; }
  .hero h1 { font-size: 2.1rem; }
  .gallery { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
  .learn h3 { font-size: 1.25rem; }
  .hero-meta { gap: 18px; }
  .hero-stat-num { font-size: 1.3rem; }
  .imgcap-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
}
