/* PharmPy Practice - main stylesheet. Calm, clinical-clean; book blue #004C99. */

@font-face {
  font-family: 'Source Sans 3';
  src: url('../fonts/7cfa318856/source-sans-3-latin-wght-normal.woff2') format('woff2');
  font-weight: 200 900; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Source Sans 3';
  src: url('../fonts/7cfa318856/source-sans-3-latin-wght-italic.woff2') format('woff2');
  font-weight: 200 900; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'JetBrains Mono';
  src: url('../fonts/7cfa318856/jetbrains-mono-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 800; font-style: normal; font-display: swap;
}

/* ------------------------------------------------------------------ tokens */
:root {
  --font: 'Source Sans 3', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --radius: 10px;
  --radius-sm: 6px;
  --ease: cubic-bezier(.2, .7, .2, 1);

  --bg: #f6f8fb;
  --surface: #ffffff;
  --surface-2: #eef3f9;
  --code-bg: #f3f6fa;
  --text: #17222e;
  --muted: #4f5e6e;
  --border: #d7dfe8;
  --border-strong: #b9c6d4;
  --primary: #004c99;
  --primary-hover: #003d7a;
  --primary-ink: #ffffff;
  --primary-soft: #e5eef8;
  --accent: #0e7490;
  --focus: #1a73d9;

  --ok: #17663b; --ok-bg: #eaf6ef; --ok-border: #a5d8b9; --ok-icon: #1f8a4f;
  --no: #8a4510; --no-bg: #fdf3ea; --no-border: #efc8a2; --no-icon: #c26a1d;
  --skip: #4f5a66; --skip-bg: #eef1f4; --skip-border: #cfd6de;
  --att: #1d4f86; --att-bg: #e8f0fa; --att-border: #b8cde6;
  --err: #8f2d3c;

  --tok-keyword: #7c3aad; --tok-string: #0f6b3a; --tok-number: #a34a00; --tok-comment: #545f6b;
  --tok-func: #004c99; --tok-bool: #b3261e; --tok-op: #3d4a57; --tok-def: #0e5f75;
  --shadow: 0 1px 2px rgba(16, 34, 56, .06), 0 2px 8px rgba(16, 34, 56, .05);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #0c141e; --surface: #121c28; --surface-2: #192635; --code-bg: #0f1823;
    --text: #e3eaf2; --muted: #a2b2c3; --border: #273748; --border-strong: #3a4e64;
    --primary: #74b1f2; --primary-hover: #93c3f5; --primary-ink: #04203c; --primary-soft: #16304d;
    --accent: #5cc5d9; --focus: #8cc2ff;
    --ok: #7fdca6; --ok-bg: #10291b; --ok-border: #2b6845; --ok-icon: #5fcf8f;
    --no: #f5bd8a; --no-bg: #2f1f10; --no-border: #77502a; --no-icon: #f0a35c;
    --skip: #b4c0cc; --skip-bg: #1c2632; --skip-border: #3a4a5b;
    --att: #a9cbf3; --att-bg: #142a44; --att-border: #2f5684;
    --err: #f2a3ae;
    --tok-keyword: #c9a2f5; --tok-string: #8fd9a8; --tok-number: #f5b97a; --tok-comment: #8b9aaa;
    --tok-func: #8ec2f7; --tok-bool: #f59f98; --tok-op: #c3cfdb; --tok-def: #7fd4e6;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
:root[data-theme='dark'] {
  --bg: #0c141e; --surface: #121c28; --surface-2: #192635; --code-bg: #0f1823;
  --text: #e3eaf2; --muted: #a2b2c3; --border: #273748; --border-strong: #3a4e64;
  --primary: #74b1f2; --primary-hover: #93c3f5; --primary-ink: #04203c; --primary-soft: #16304d;
  --accent: #5cc5d9; --focus: #8cc2ff;
  --ok: #7fdca6; --ok-bg: #10291b; --ok-border: #2b6845; --ok-icon: #5fcf8f;
  --no: #f5bd8a; --no-bg: #2f1f10; --no-border: #77502a; --no-icon: #f0a35c;
  --skip: #b4c0cc; --skip-bg: #1c2632; --skip-border: #3a4a5b;
  --att: #a9cbf3; --att-bg: #142a44; --att-border: #2f5684;
  --err: #f2a3ae;
  --tok-keyword: #c9a2f5; --tok-string: #8fd9a8; --tok-number: #f5b97a; --tok-comment: #8b9aaa;
  --tok-func: #8ec2f7; --tok-bool: #f59f98; --tok-op: #c3cfdb; --tok-def: #7fd4e6;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3);
  color-scheme: dark;
}

/* ------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0; font-family: var(--font); font-size: 1.0625rem; line-height: 1.6;
  color: var(--text); background: var(--bg); min-height: 100vh; display: flex; flex-direction: column;
}
main { flex: 1; outline: none; }
a { color: var(--primary); text-underline-offset: 2px; }
a:hover { color: var(--primary-hover); }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5em; font-weight: 650; letter-spacing: -.005em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.1rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 .9em; }
code, pre, kbd { font-family: var(--mono); font-size: .9em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link { position: absolute; left: 12px; top: -48px; background: var(--primary); color: var(--primary-ink); padding: 8px 14px; border-radius: var(--radius-sm); z-index: 100; }
.skip-link:focus { top: 10px; }

/* ----------------------------------------------------------------- header */
.site-header {
  position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(8px); border-bottom: 1px solid var(--border); border-top: 3px solid #004c99;
}
.header-inner { max-width: 1180px; margin: 0 auto; padding: 10px 20px; display: flex; align-items: center; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--primary); font-weight: 700; font-size: 1.15rem; }
.brand-mark { width: 30px; height: 30px; }
.brand-light { font-weight: 450; color: var(--muted); }
.header-tools { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--surface-2); }

.py-status { display: flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); min-height: 24px; }
.py-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--border-strong); flex: none; }
.py-status[data-state='ready'] .py-dot { background: var(--ok-icon); }
.py-status[data-state='busy'] .py-dot { background: var(--primary); }
.py-status[data-state='failed'] .py-dot { background: var(--no-icon); }
.py-meter { width: 90px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.py-meter > span { display: block; height: 100%; width: 0; background: var(--primary); transition: width .3s var(--ease); }
@media (max-width: 560px) { .py-status .py-label-long { display: none; } .py-meter { width: 56px; } }

.site-footer { border-top: 1px solid var(--border); color: var(--muted); font-size: .9rem; padding: 18px 20px; text-align: center; }
.site-footer p { margin: 0; }

/* ----------------------------------------------------------------- layout */
.page { max-width: 1180px; margin: 0 auto; padding: 28px 20px 60px; }
.narrow { max-width: 760px; }
.breadcrumb { font-size: .92rem; color: var(--muted); margin-bottom: 14px; }
.breadcrumb ol { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.breadcrumb li + li::before { content: '/'; margin-right: 6px; color: var(--border-strong); }
.breadcrumb a { color: var(--muted); }

/* home */
.hero { padding: 8px 0 18px; max-width: 760px; }
.hero p { color: var(--muted); font-size: 1.1rem; }
.chapter-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 18px; box-shadow: var(--shadow); }
.chapter-card h2 { font-size: 1.2rem; }
.chapter-card .chapter-num { color: var(--muted); font-weight: 500; font-size: .95rem; display: block; }
.lesson-list { list-style: none; margin: 0; padding: 0; }
.lesson-list li { border-top: 1px solid var(--border); }
.lesson-link { display: flex; gap: 14px; align-items: center; padding: 12px 4px; text-decoration: none; color: var(--text); }
.lesson-link:hover .lesson-title { color: var(--primary); text-decoration: underline; }
.lesson-title { font-weight: 600; }
.lesson-meta { color: var(--muted); font-size: .92rem; }
.lesson-link .mini-bar { margin-left: auto; flex: none; }
.coming-soon { color: var(--muted); font-style: italic; }

/* lesson */
.lesson-layout { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 40px; align-items: start; }
@media (max-width: 960px) { .lesson-layout { grid-template-columns: 1fr; } .toc { display: none; } }
.toc { position: sticky; top: 84px; font-size: .95rem; }
.toc h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 8px; }
.toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--border); }
.toc li a { display: flex; align-items: baseline; gap: 8px; padding: 6px 0 6px 12px; margin-left: -2px; border-left: 2px solid transparent; color: var(--muted); text-decoration: none; line-height: 1.35; }
.toc li a:hover { color: var(--primary); border-left-color: var(--primary); }
.toc .toc-count { margin-left: auto; font-size: .82rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lesson-main { max-width: 780px; }
.lesson-head { margin-bottom: 26px; }
.lesson-sub { color: var(--muted); font-size: .97rem; display: flex; flex-wrap: wrap; gap: 4px 16px; margin-bottom: 14px; }
.deviation-note { font-size: .93rem; background: var(--surface-2); border-left: 3px solid var(--accent); padding: 8px 12px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text); margin-bottom: 16px; }

.progress { display: flex; align-items: center; gap: 12px; font-size: .95rem; color: var(--muted); }
.progress-bar { flex: 1; max-width: 360px; height: 8px; background: var(--surface-2); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.progress-bar > span { display: block; height: 100%; width: 0; background: var(--ok-icon); border-radius: 4px; transition: width .6s var(--ease); }
.mini-bar { width: 90px; height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; border: 1px solid var(--border); }
.mini-bar > span { display: block; height: 100%; background: var(--ok-icon); }

.prose { overflow-wrap: anywhere; }
.prose code { background: var(--code-bg); border: 1px solid var(--border); border-radius: 4px; padding: .05em .35em; font-size: .86em; }
.prose pre.code-static { background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 14px; overflow-x: auto; line-height: 1.5; }
.prose pre code { background: none; border: 0; padding: 0; font-size: .88rem; }
.prose ul, .prose ol { padding-left: 1.4em; margin: 0 0 .9em; }
.prose li { margin: .2em 0; }
.prose table { border-collapse: collapse; margin: 0 0 1em; font-size: .97rem; width: 100%; max-width: 520px; }
.prose th, .prose td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; }
.prose th { background: var(--surface-2); font-weight: 600; }
.prose blockquote { margin: 0 0 1em; padding: 10px 14px; border-left: 3px solid var(--border-strong); background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.prose blockquote p:last-child { margin-bottom: 0; }
.prose blockquote.watch-out { border-left-color: var(--no-icon); background: var(--no-bg); }
.prose blockquote.watch-out strong:first-child { color: var(--no); }

.intro { font-size: 1.08rem; }
.point { padding-top: 14px; margin-top: 30px; border-top: 1px solid var(--border); }
.point-label { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); font-weight: 650; margin-bottom: 4px; }
.theory { margin-bottom: 18px; }
.exercises-label { font-size: .82rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 650; margin: 22px 0 10px; display: flex; align-items: center; gap: 10px; }
.exercises-label::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.recap { margin-top: 36px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; }
.recap ul { margin: 0; padding-left: 1.2em; }
.lesson-end { margin-top: 26px; display: flex; flex-wrap: wrap; gap: 10px; }

/* ------------------------------------------------------------- buttons */
.btn {
  font: inherit; font-size: .97rem; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 7px 16px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; line-height: 1.2;
  transition: background-color .15s, border-color .15s;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn svg { width: 17px; height: 17px; flex: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-quiet { background: transparent; border-color: transparent; color: var(--primary); padding-left: 10px; padding-right: 10px; }
.btn-quiet:hover { background: var(--primary-soft); }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row .spacer { flex: 1; }

/* ------------------------------------------------------------- example */
.example { margin: 14px 0 18px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.example-bar { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px; border-bottom: 1px solid var(--border); background: var(--surface-2); font-size: .88rem; color: var(--muted); }
.example-bar .label { font-weight: 650; text-transform: uppercase; letter-spacing: .06em; font-size: .76rem; }
.example-bar .btn-row { margin-left: auto; }
.example-bar .btn { min-height: 34px; padding: 4px 12px; font-size: .9rem; }

/* ------------------------------------------------------------- editor */
.editor { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--code-bg); overflow: hidden; }
.example .editor { border: 0; border-radius: 0; }
.editor .cm-editor { font-size: 15px; }
.editor .cm-editor.cm-focused { outline: none; }
.editor:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 55%, transparent); border-color: var(--focus); }
.editor-help { font-size: .84rem; color: var(--muted); margin: 6px 0 0; }
kbd { border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 4px; padding: 0 .35em; font-size: .8em; background: var(--surface); }

.stdin-field { margin-top: 10px; }
.stdin-field label, .field-label { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 4px; }
textarea, input[type='text'] {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
textarea { width: 100%; padding: 8px 10px; font-family: var(--mono); font-size: .92rem; line-height: 1.5; resize: vertical; }
textarea:focus, input[type='text']:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 45%, transparent); }

.output { margin-top: 10px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--code-bg); }
.example .output { margin: 0; border: 0; border-top: 1px solid var(--border); border-radius: 0; }
.output-head { font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 650; color: var(--muted); padding: 6px 12px 0; }
.output pre { margin: 0; padding: 6px 12px 10px; white-space: pre-wrap; word-break: break-word; font-size: .9rem; line-height: 1.5; max-height: 320px; overflow: auto; }
.output .seg-in { color: var(--accent); font-style: italic; }
.output .seg-err { color: var(--err); }
.output .empty { color: var(--muted); font-style: italic; font-family: var(--font); }
.output .note { font-family: var(--font); font-size: .9rem; color: var(--muted); padding: 0 12px 10px; margin: 0; }
.err-card { margin: 0 12px 12px; padding: 10px 12px; background: var(--no-bg); border: 1px solid var(--no-border); border-radius: var(--radius-sm); font-size: .95rem; }
.err-card .err-title { font-weight: 650; color: var(--no); margin: 0 0 4px; }
.err-card p { margin: 0 0 4px; }
.err-card details { margin-top: 6px; font-size: .88rem; color: var(--muted); }
.err-card details pre { padding: 6px 0 0; max-height: none; }

/* ------------------------------------------------------------- exercise card */
.ex-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; margin: 0 0 16px; box-shadow: var(--shadow); scroll-margin-top: 80px; }
.ex-card:focus { outline: none; }
.ex-card:focus-visible { outline: 3px solid var(--focus); }
.ex-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 8px; }
.ex-kind { display: block; font-size: .78rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 650; color: var(--accent); }
.ex-head h3 { margin: 2px 0 0; }
.ex-head .chip { margin-left: auto; flex: none; }
.ex-body { margin-top: 10px; }
.ex-actions { margin-top: 14px; }
.ex-more { margin-top: 6px; }
.ex-examples { font-size: .95rem; margin: 0 0 12px; }
.ex-examples h4 { font-size: .85rem; margin: 0 0 4px; color: var(--muted); }
.ex-examples ul { margin: 0; padding-left: 1.2em; }
.ex-card[data-status='skipped'] .ex-body, .ex-card[data-status='skipped'] .ex-actions,
.ex-card[data-status='skipped'] .ex-more, .ex-card[data-status='skipped'] .hints,
.ex-card[data-status='skipped'] .solution, .ex-card[data-status='skipped'] .ex-prompt { display: none; }
.done-note { font-size: .93rem; color: var(--ok); margin: 10px 0 0; display: flex; align-items: center; gap: 6px; }
.done-note svg { width: 16px; height: 16px; }

details.extra { margin: 4px 0 16px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: transparent; }
details.extra > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; color: var(--text); list-style: none; display: flex; gap: 10px; align-items: center; }
details.extra > summary::-webkit-details-marker { display: none; }
details.extra > summary::before { content: ''; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .2s; flex: none; }
details.extra[open] > summary::before { transform: rotate(45deg); }
details.extra .extra-tag { font-size: .76rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; border: 1px solid var(--border); border-radius: 999px; padding: 1px 8px; }
details.extra > summary .chip { margin-left: auto; }
details.extra .ex-card { margin: 0 12px 12px; box-shadow: none; }

/* mcq */
.mcq-options { border: 0; padding: 0; margin: 0; display: grid; gap: 8px; }
.mcq-option { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); cursor: pointer; background: var(--surface); transition: border-color .15s, background-color .15s; }
.mcq-option:hover { border-color: var(--border-strong); background: var(--surface-2); }
.mcq-option input { margin: 5px 0 0; accent-color: var(--primary); width: 17px; height: 17px; flex: none; }
.mcq-option:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.mcq-option:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 1px; }
.mcq-option.is-answer { border-color: var(--ok-border); background: var(--ok-bg); }
.mcq-option .answer-tag { margin-left: auto; font-size: .82rem; color: var(--ok); font-weight: 650; white-space: nowrap; }

/* predict + fill */
.code-view { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--code-bg); margin-bottom: 12px; overflow: hidden; }
.fill-code { margin: 0 0 12px; background: var(--code-bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 0; font-family: var(--mono); font-size: 15px; line-height: 2.1; overflow-x: auto; }
.fill-line { display: flex; white-space: pre; padding: 0 14px 0 0; }
.fill-line .ln { width: 2.6em; text-align: right; padding-right: 12px; color: var(--tok-comment); user-select: none; flex: none; }
.fill-code input.blank {
  font-family: var(--mono); font-size: 15px; padding: 1px 6px; min-width: 4ch; border: 0; border-bottom: 2px solid var(--primary);
  border-radius: 4px 4px 0 0; background: var(--primary-soft); color: var(--text);
}
.fill-code input.blank:focus { outline: 2px solid var(--focus); outline-offset: 1px; box-shadow: none; }

/* hints + solution */
.hints { margin-top: 12px; }
.hints ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 6px; }
.hints li { background: var(--surface-2); border-radius: var(--radius-sm); padding: 8px 12px; font-size: .97rem; animation: fade-in .3s var(--ease); }
.hints li .hint-num { font-weight: 650; color: var(--accent); margin-right: 6px; }
.solution { margin-top: 14px; border-top: 1px dashed var(--border-strong); padding-top: 12px; animation: fade-in .3s var(--ease); }
.solution h4 { margin: 0 0 8px; font-size: 1rem; }
.solution-note { font-size: .92rem; color: var(--muted); }

/* ------------------------------------------------------------- status chips */
.chip { display: inline-flex; align-items: center; gap: 5px; font-size: .8rem; font-weight: 650; padding: 2px 10px 2px 8px; border-radius: 999px; border: 1px solid var(--border); color: var(--muted); background: var(--surface); white-space: nowrap; line-height: 1.6; }
.chip svg { width: 13px; height: 13px; flex: none; }
.chip[data-status='attempted'] { color: var(--att); background: var(--att-bg); border-color: var(--att-border); }
.chip[data-status='done'] { color: var(--ok); background: var(--ok-bg); border-color: var(--ok-border); }
.chip[data-status='skipped'] { color: var(--skip); background: var(--skip-bg); border-color: var(--skip-border); }
.chip.changed { animation: chip-fade .35s var(--ease); }
@keyframes chip-fade { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------- feedback (5A) */
.feedback:empty { display: none; }
.feedback { margin-top: 14px; }
.fb { border-radius: var(--radius); border: 1px solid; padding: 14px 16px; position: relative; }
.fb-head { display: flex; gap: 12px; align-items: flex-start; }
.fb-icon { width: 34px; height: 34px; flex: none; }
.fb-title { font-weight: 700; font-size: 1.08rem; margin: 3px 0 0; }
.fb-reason { margin: 2px 0 0; }
.fb-tests { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; font-size: .95rem; }
.fb-tests li { display: flex; gap: 8px; align-items: flex-start; }
.fb-tests li > svg { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.fb-tests .t-detail { display: block; color: var(--muted); font-size: .92rem; }
.fb-tests .t-detail pre { margin: 4px 0 0; background: var(--surface); border: 1px solid var(--border); border-radius: 4px; padding: 4px 8px; white-space: pre-wrap; font-size: .85rem; color: var(--text); }
.fb-explain { overflow: hidden; }
.fb-explain-inner { padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--ok-border); }
.fb-explain-inner > :last-child { margin-bottom: 0; }
.fb-actions { margin-top: 12px; }

.fb-correct { background: var(--ok-bg); border-color: var(--ok-border); animation: wash-in .45s var(--ease) both; }
.fb-correct .fb-title { color: var(--ok); }
.fb-correct .ring { stroke: var(--ok-icon); stroke-dasharray: 101; stroke-dashoffset: 101; animation: draw .32s var(--ease) forwards; }
.fb-correct .tick { stroke: var(--ok-icon); stroke-dasharray: 24; stroke-dashoffset: 24; animation: draw .2s var(--ease) .26s forwards; }
.fb-correct .fb-tests li { opacity: 0; animation: rise .22s var(--ease) forwards; animation-delay: calc(.18s + var(--i, 0) * 55ms); }
.fb-correct .fb-tests svg { color: var(--ok-icon); }
.fb-correct .fb-explain { display: grid; grid-template-rows: 0fr; animation: open-rows .3s var(--ease) .25s forwards; }
.fb-correct .fb-explain > div { min-height: 0; }
.fb-correct .fb-actions { opacity: 0; animation: fade-in .2s var(--ease) .4s forwards; }

.fb-wrong { background: var(--no-bg); border-color: var(--no-border); animation: slide-in .2s var(--ease) both, nudge .25s ease-in-out .2s 1; }
.fb-wrong .fb-title { color: var(--no); }
.fb-wrong .fb-icon { color: var(--no-icon); }
.fb-wrong .fb-tests .pass svg { color: var(--ok-icon); }
.fb-wrong .fb-tests .fail svg { color: var(--no-icon); }

.fb-skipped { background: var(--skip-bg); border-color: var(--skip-border); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; animation: fade-in .25s var(--ease); }
.fb-skipped p { margin: 0; color: var(--text); }
.fb-skipped .chip { flex: none; }
.fb-skipped .btn { margin-left: auto; }

.fb-note { background: var(--surface-2); border-color: var(--border); color: var(--text); animation: fade-in .2s var(--ease); }

@keyframes draw { to { stroke-dashoffset: 0; } }
@keyframes wash-in { from { background-color: transparent; border-color: transparent; } }
@keyframes rise { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes open-rows { to { grid-template-rows: 1fr; } }
@keyframes slide-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes nudge { 0%, 100% { translate: 0; } 25% { translate: -6px; } 60% { translate: 5px; } 85% { translate: -2px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0s !important; animation-delay: 0s !important; transition-duration: 0s !important; scroll-behavior: auto !important; }
  .fb-correct .ring, .fb-correct .tick { stroke-dashoffset: 0; }
  .fb-correct .fb-tests li, .fb-correct .fb-actions { opacity: 1; }
  .fb-correct .fb-explain { grid-template-rows: 1fr; }
  .fb-wrong { animation: none; }
}

/* ------------------------------------------------------------- small screens */
@media (max-width: 600px) {
  .page { padding: 18px 14px 48px; }
  .header-inner { padding: 8px 14px; }
  .ex-card { padding: 14px 14px; }
  .brand { font-size: 1.02rem; }
  .example-bar { flex-wrap: wrap; }
}

/* ---------------------------------------------------------------- accounts */
.account-nav { display: flex; align-items: center; gap: 12px; font-size: .95rem; }
.account-nav a { text-decoration: none; font-weight: 600; }
.account-nav a:hover { text-decoration: underline; }
.account-email { display: inline-block; max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
@media (max-width: 560px) { .account-email { max-width: 9ch; } }
.account-page h1 { margin-bottom: .6em; }
.account-form { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px 22px; margin: 18px 0; box-shadow: var(--shadow); max-width: 480px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 4px; }
.field input[type=email], .field input[type=password], .field input[type=search], .field input[type=text], .field select {
  width: 100%; font: inherit; padding: 9px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); min-height: 44px;
}
.field input:focus-visible, .field select:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
.field.check { display: flex; gap: 10px; align-items: center; }
.field.check label { margin: 0; font-weight: 500; }
.field.check input { width: 20px; height: 20px; }
.field-help { font-size: .88rem; color: var(--muted); margin: 4px 0 0; }
.form-status:empty { display: none; }
.form-status { margin-top: 12px; }
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--radius-sm); border: 1px solid; margin: 0 0 12px; font-size: .97rem; }
.notice svg { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.notice-ok { background: var(--ok-bg); border-color: var(--ok-border); color: var(--ok); }
.notice-no { background: var(--no-bg); border-color: var(--no-border); color: var(--no); }
.notice-info { background: var(--surface-2); border-color: var(--border); color: var(--text); }
.account-alt { font-size: .97rem; }
.account-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0 0 14px; }
.account-facts dt { color: var(--muted); }
.account-facts dd { margin: 0; overflow-wrap: anywhere; }
.sync-line { color: var(--muted); font-size: .95rem; }
.danger-zone { margin-top: 36px; padding-top: 18px; border-top: 1px solid var(--border); }
.danger-zone h2 { font-size: 1.15rem; }
.danger-form .btn-primary { background: var(--err); border-color: var(--err); color: var(--surface); }
.danger-form .btn-primary:hover { filter: brightness(.92); background: var(--err); }

.verify-banner { background: var(--no-bg); border-bottom: 1px solid var(--no-border); color: var(--text); }
.banner-inner { max-width: 1180px; margin: 0 auto; padding: 8px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; font-size: .95rem; }
.banner-inner > svg { width: 18px; height: 18px; color: var(--no-icon); flex: none; }
.banner-inner p { margin: 0; flex: 1 1 320px; }
.banner-status { color: var(--muted); }

/* -------------------------------------------------------------- instructor */
.filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: flex-end; margin: 14px 0; }
.filters .field { margin: 0; min-width: 220px; }
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.progress-table, .detail-table { border-collapse: collapse; width: 100%; font-size: .93rem; }
.progress-table th, .progress-table td, .detail-table th, .detail-table td { border-bottom: 1px solid var(--border); padding: 8px 12px; text-align: left; vertical-align: top; }
.progress-table thead th, .detail-table thead th { background: var(--surface-2); font-weight: 650; }
.progress-table tbody th { font-weight: 500; white-space: nowrap; }
.progress-table td { white-space: nowrap; font-variant-numeric: tabular-nums; }
.th-ch, .th-n { color: var(--muted); font-weight: 500; }
.cnt { color: var(--muted); }
.cnt-done { color: var(--ok); font-weight: 650; }
.cnt-sol { color: var(--att); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--primary); text-decoration: underline; cursor: pointer; text-underline-offset: 2px; }
.detail-card { margin-top: 22px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px; }
.detail-card h2 { margin: 0; font-size: 1.15rem; overflow-wrap: anywhere; }
.detail-lesson { margin-top: 14px; overflow-x: auto; }
.detail-lesson h3 { font-size: 1rem; }
