/* ============================================================
   IBM AI ENGINEERING — Track Stylesheet
   Sibling of the Human Data Lead / AI Safety / Agentic tracks.
   Same dark course chrome, distinct warm accent (amber + rose)
   so the four tracks are instantly distinguishable.
   Adds: hero plates, animated explainers, resource rails.
   ============================================================ */

:root {
  --bg-primary: #0b0d14;
  --bg-secondary: #14161f;
  --bg-card: #1a1d29;
  --bg-code: #161922;
  --bg-highlight: #232736;
  --bg-success: rgba(52, 211, 153, 0.08);
  --bg-warning: rgba(251, 191, 36, 0.08);
  --bg-info: rgba(96, 165, 250, 0.08);
  --bg-action: rgba(139, 92, 246, 0.08);

  --text-primary: #e2e8f0;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-heading: #f1f5f9;

  --accent-blue: #60a5fa;
  --accent-purple: #a78bfa;
  --accent-green: #34d399;
  --accent-orange: #fb923c;
  --accent-yellow: #fbbf24;
  --accent-red: #f87171;
  --accent-pink: #f472b6;
  --accent-cyan: #22d3ee;

  --accent-amber: #ff7338;      /* track accent 1 */
  --accent-rose:  #fb7185;      /* track accent 2 */

  --border-subtle: #232736;
  --border-card: #2b3040;
  --border-accent: #3a4055;

  --syntax-keyword: #c084fc;
  --syntax-string: #34d399;
  --syntax-comment: #64748b;
  --syntax-function: #60a5fa;
  --syntax-number: #fb923c;
  --syntax-operator: #94a3b8;
  --syntax-builtin: #f472b6;

  --max-width: 830px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  --grad-track: linear-gradient(135deg, var(--accent-amber), var(--accent-rose));
  --ink: #150c02;               /* text colour on the gradient */
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  font-size: 17px;
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  min-height: 100vh;
}
body::before {
  content: ''; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 512 512' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  background-size: 200px; opacity: 0.022;
}

.course-container { max-width: var(--max-width); margin: 0 auto; padding: 0 1.5rem 5rem; position: relative; z-index: 1; }

/* ---- Top bar ---- */
.topbar { border-bottom: 1px solid var(--border-subtle); background: rgba(11,13,20,.82); backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 50; }
.topbar-inner { max-width: var(--max-width); margin: 0 auto; padding: 0.75rem 1.5rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.brand { display: flex; align-items: center; gap: 7px; font-weight: 800; font-size: 14px; letter-spacing: -.03em; color: #eaf1fc; text-decoration: none; border: none; }
.brand-bar { width: 2.5px; height: 18px; background: var(--accent-amber); border-radius: 2px; }
.topbar-title { font-size: 11px; font-weight: 600; color: var(--text-muted); letter-spacing: .1em; text-transform: uppercase; }
.topbar-title a { color: var(--text-muted); }

/* ---- Hero plate ---- */
.course-hero { position: relative; margin: 0 -1.5rem 2.5rem; overflow: hidden; }
.course-hero img { width: 100%; display: block; aspect-ratio: 16/7; object-fit: cover; }
.course-hero::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,13,20,.25) 0%, rgba(11,13,20,.72) 55%, var(--bg-primary) 100%);
}
.course-hero .hero-text { position: absolute; inset: auto 0 0 0; padding: 0 1.5rem 1.6rem; z-index: 2; }
.course-hero .hero-text h1 { font-size: clamp(1.6rem, 5vw, 2.3rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.15; color: #fff; margin: 0 0 .4rem; border: none; padding: 0; }
.course-hero .hero-text .subtitle { color: #cbd5e1; font-size: 1rem; max-width: 60ch; }

.course-badge {
  display: inline-block; background: var(--grad-track); color: var(--ink);
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase;
  padding: 0.3rem 0.9rem; border-radius: 100px; margin-bottom: 0.9rem;
}

/* ---- Meta row ---- */
.day-meta { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 2rem; flex-wrap: wrap; }
.day-number { background: var(--grad-track); color: var(--ink); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.32rem 0.9rem; border-radius: 100px; }
.day-duration, .day-type { color: var(--text-muted); font-size: 0.82rem; }
.day-type { padding: 0.18rem 0.65rem; border: 1px solid var(--border-subtle); border-radius: 100px; }

/* ---- Flight link (course pages; the dashboard has its own inline copy) ---- */
.flight-link { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .95rem; border-radius: 100px;
  background: rgba(11,13,20,.5); border: 1px solid rgba(255,115,56,.45); color: #fbbf24; font-size: .78rem; font-weight: 700;
  letter-spacing: .02em; text-decoration: none; transition: background .2s, border-color .2s, transform .2s; }
.flight-link:hover { background: rgba(255,115,56,.16); border-color: var(--accent-amber); transform: translateY(-1px); }
.primer-link { display: inline-flex; align-items: center; gap: .5rem; padding: .45rem .95rem; border-radius: 100px;
  background: rgba(11,13,20,.5); border: 1px solid rgba(96,165,250,.45); color: #93c5fd; font-size: .78rem; font-weight: 700;
  letter-spacing: .02em; text-decoration: none; transition: background .2s, border-color .2s, transform .2s; }
.primer-link:hover { background: rgba(96,165,250,.14); border-color: var(--accent-blue); transform: translateY(-1px); }

/* ---- Typography ---- */
h2 { font-size: 1.45rem; font-weight: 700; color: var(--text-heading); letter-spacing: -0.02em; margin: 3rem 0 1rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-subtle); scroll-margin-top: 4rem; }
h3 { font-size: 1.12rem; font-weight: 600; color: var(--text-heading); margin: 2rem 0 0.7rem; }
h4 { font-size: 0.92rem; font-weight: 600; color: var(--accent-amber); text-transform: uppercase; letter-spacing: 0.06em; margin: 1.7rem 0 0.5rem; }
p { margin-bottom: 1rem; }
strong { color: var(--text-heading); font-weight: 600; }
em { color: var(--text-secondary); }
a { color: var(--accent-amber); text-decoration: none; border-bottom: 1px solid transparent; transition: border-color .2s; }
a:hover { border-bottom-color: var(--accent-amber); }
ul, ol { margin: 0.5rem 0 1.2rem 1.4rem; }
li { margin-bottom: 0.45rem; line-height: 1.6; }
li::marker { color: var(--accent-rose); }
hr { border: none; border-top: 1px solid var(--border-subtle); margin: 2.5rem 0; }
blockquote { border-left: 3px solid var(--accent-amber); margin: 1.3rem 0; padding: 0.6rem 0 0.6rem 1.2rem; background: rgba(255,115,56,.05); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--text-secondary); }
blockquote p:last-child { margin-bottom: 0; }

/* ---- Callouts ---- */
.callout { border-radius: var(--radius-md); padding: 1.1rem 1.3rem; margin: 1.5rem 0; border-left: 3px solid; }
.callout-title { font-weight: 700; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 0.45rem; }
.callout.info    { background: var(--bg-info);    border-left-color: var(--accent-blue); }   .callout.info .callout-title    { color: var(--accent-blue); }
.callout.do      { background: var(--bg-success); border-left-color: var(--accent-green); }  .callout.do .callout-title      { color: var(--accent-green); }
.callout.warning { background: var(--bg-warning); border-left-color: var(--accent-yellow); } .callout.warning .callout-title { color: var(--accent-yellow); }
.callout.danger  { background: rgba(248,113,113,.08); border-left-color: var(--accent-red); } .callout.danger .callout-title { color: var(--accent-red); }
.callout.key     { background: rgba(255,115,56,.07); border-left-color: var(--accent-amber); } .callout.key .callout-title  { color: var(--accent-amber); }
.callout.trap    { background: rgba(251,113,133,.07); border-left-color: var(--accent-rose); } .callout.trap .callout-title { color: var(--accent-rose); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }

/* ---- Takeaways / self-check ---- */
.takeaways { background: rgba(255,115,56,.05); border: 1px solid rgba(255,115,56,.2); border-radius: var(--radius-lg); padding: 1.3rem 1.6rem; margin: 2rem 0; }
.takeaways-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-amber); margin-bottom: 0.7rem; }
.takeaways ul { margin-bottom: 0; }

.selfcheck { background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--radius-lg); padding: 1.3rem 1.6rem; margin: 2rem 0; }
.selfcheck-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-rose); margin-bottom: 0.7rem; }
.selfcheck ol { margin-bottom: 0; }

/* ---- Code ---- */
pre { background: var(--bg-code); border: 1px solid var(--border-card); border-radius: var(--radius-md); padding: 1.1rem 1.3rem; margin: 1rem 0 1.5rem; overflow-x: auto; font-size: 0.86rem; line-height: 1.65; }
code { font-family: 'JetBrains Mono', 'Cascadia Code', Consolas, monospace; font-size: 0.86rem; }
pre code { color: #dbe4f0; }
p code, li code, td code, blockquote code { background: var(--bg-highlight); padding: 0.13rem 0.42rem; border-radius: 4px; font-size: 0.82rem; color: var(--accent-rose); border: 1px solid var(--border-subtle); }
.tok-kw { color: var(--syntax-keyword); }
.tok-str { color: var(--syntax-string); }
.tok-com { color: var(--syntax-comment); font-style: italic; }
.tok-fn { color: var(--syntax-function); }
.tok-num { color: var(--syntax-number); }
.tok-bi { color: var(--syntax-builtin); }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; margin: 1rem 0 1.5rem; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
th { background: var(--bg-highlight); color: var(--text-heading); font-weight: 600; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; padding: 0.65rem 0.9rem; text-align: left; border-bottom: 2px solid var(--border-accent); }
td { padding: 0.65rem 0.9rem; border-bottom: 1px solid var(--border-subtle); vertical-align: top; }
tr:hover td { background: var(--bg-secondary); }

/* ============================================================
   ANIMATED EXPLAINER — progressive build-up, NotebookLM style
   ============================================================ */
.explainer {
  background: linear-gradient(180deg, rgba(255,115,56,.045), rgba(251,113,133,.025));
  border: 1px solid rgba(255,115,56,.2);
  border-radius: var(--radius-lg);
  margin: 2rem 0; overflow: hidden;
}
.explainer-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.85rem 1.2rem; border-bottom: 1px solid rgba(255,115,56,.15); }
.explainer-label { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--accent-amber); }
.explainer-title { font-size: 0.95rem; font-weight: 700; color: var(--text-heading); }
.explainer-stage { position: relative; padding: 1.1rem 1.2rem 0; }
.explainer-stage svg { width: 100%; height: auto; display: block; overflow: visible; }

/* progressive reveal: everything above the current step is hidden */
.explainer-stage [data-step] { opacity: 0; transition: opacity .5s ease, transform .5s cubic-bezier(.22,1,.36,1); transform: translateY(6px); }
.explainer-stage [data-step].shown { opacity: 1; transform: none; }
.explainer-stage [data-step].just-in { animation: ex-pop .6s cubic-bezier(.22,1,.36,1); }
@keyframes ex-pop { 0% { opacity: 0; transform: scale(.94); } 100% { opacity: 1; transform: none; } }

/* draw-on strokes */
.explainer-stage .draw { stroke-dasharray: var(--len, 400); stroke-dashoffset: var(--len, 400); }
.explainer-stage .shown .draw, .explainer-stage .draw.shown { animation: ex-draw 1s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes ex-draw { to { stroke-dashoffset: 0; } }

.explainer-stage .flow { stroke-dasharray: 5 7; animation: ex-flow 1.1s linear infinite; }
@keyframes ex-flow { to { stroke-dashoffset: -24; } }
.explainer-stage .pulse { animation: ex-pulse 2s ease-in-out infinite; }
@keyframes ex-pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

.ex-cap { padding: 0.9rem 1.2rem 1rem; min-height: 4.6rem; }
.ex-cap-step { font-size: 0.62rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--accent-rose); margin-bottom: 0.3rem; }
.ex-cap-text { font-size: 0.93rem; color: var(--text-primary); line-height: 1.6; }
.ex-cap-text code { font-size: 0.8rem; }

.explainer-controls { display: flex; align-items: center; gap: 0.6rem; padding: 0 1.2rem 1rem; }
.ex-btn { background: var(--bg-highlight); border: 1px solid var(--border-card); color: var(--text-primary); border-radius: 8px; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; transition: background .18s, border-color .18s; font-size: 13px; padding: 0; }
.ex-btn:hover { background: var(--border-card); border-color: var(--border-accent); }
.ex-btn.primary { background: var(--grad-track); border: none; color: var(--ink); width: auto; padding: 0 0.9rem; font-weight: 700; font-size: 0.78rem; gap: 0.4rem; }
.ex-dots { display: flex; gap: 5px; margin-left: auto; }
.ex-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-accent); border: none; padding: 0; cursor: pointer; transition: background .2s, transform .2s; }
.ex-dot.on { background: var(--accent-amber); transform: scale(1.25); }
.ex-dot.done { background: rgba(255,115,56,.45); }

/* SVG text defaults inside explainers */
.explainer-stage text { font-family: 'Inter', sans-serif; font-size: 12px; fill: var(--text-secondary); }
.explainer-stage .t-mono { font-family: 'JetBrains Mono', monospace; }
.explainer-stage .t-head { fill: var(--text-heading); font-weight: 700; }
.explainer-stage .t-amber { fill: var(--accent-amber); }
.explainer-stage .t-rose { fill: var(--accent-rose); }
.explainer-stage .t-dim { fill: var(--text-muted); }

/* ---- Resources rail ---- */
.resources { margin: 2rem 0; }
.resources-title { font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.12em; color: var(--accent-amber); margin-bottom: 0.8rem; padding-bottom: 0.5rem; border-bottom: 1px solid var(--border-subtle); }
.resource-list { display: grid; gap: 0.6rem; }
.resource { display: flex; align-items: flex-start; gap: 0.85rem; background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--radius-md); padding: 0.85rem 1rem; transition: border-color .2s, transform .15s; }
.resource:hover { border-color: var(--border-accent); transform: translateY(-1px); }
.rtype { flex-shrink: 0; font-size: 0.58rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.24rem 0.5rem; border-radius: 5px; margin-top: 0.15rem; min-width: 62px; text-align: center; }
.rtype.paper  { background: rgba(167,139,250,.14); color: var(--accent-purple); }
.rtype.video  { background: rgba(248,113,113,.14); color: var(--accent-red); }
.rtype.article{ background: rgba(96,165,250,.14); color: var(--accent-blue); }
.rtype.docs   { background: rgba(52,211,153,.14); color: var(--accent-green); }
.rtype.course { background: rgba(255,115,56,.14); color: var(--accent-amber); }
.rtype.tool   { background: rgba(34,211,238,.14); color: var(--accent-cyan); }
.rbody { flex: 1; min-width: 0; }
.rtitle { font-weight: 600; color: var(--text-heading); font-size: 0.92rem; display: block; }
.rtitle a { border-bottom: none; color: var(--text-heading); }
.rtitle a:hover { color: var(--accent-amber); }
.rmeta { font-size: 0.74rem; color: var(--text-muted); margin-top: 0.05rem; }
.rwhy { font-size: 0.83rem; color: var(--text-secondary); margin-top: 0.3rem; }

/* ---- Module nav / TOC ---- */
.toc { background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--radius-lg); padding: 1.1rem 1.4rem; margin: 0 0 2.5rem; }
.toc-title { font-size: 0.68rem; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.6rem; }
.toc ol { margin: 0 0 0 1.1rem; }
.toc li { margin-bottom: 0.3rem; font-size: 0.9rem; }
.toc a { color: var(--text-secondary); }
.toc a:hover { color: var(--accent-amber); }

/* ---- Scroll reveal ---- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .6s ease, transform .6s cubic-bezier(.22,1,.36,1); }
.reveal.in { opacity: 1; transform: none; }

/* ---- Reading progress ---- */
/* scaleX rather than width — this updates on every scroll frame, and animating
   width would thrash layout on each one */
.readbar { position: fixed; top: 0; left: 0; height: 2px; width: 100%; background: var(--grad-track); z-index: 60; transform: scaleX(0); transform-origin: 0 50%; will-change: transform; }

/* ---- Footer nav ---- */
.day-nav { display: flex; justify-content: space-between; align-items: center; margin-top: 4rem; padding-top: 2rem; border-top: 1px solid var(--border-subtle); gap: 1rem; flex-wrap: wrap; }
.day-nav a { display: inline-flex; align-items: center; gap: 0.5rem; padding: 0.65rem 1.2rem; background: var(--bg-card); border: 1px solid var(--border-card); border-radius: var(--radius-md); color: var(--text-primary); font-size: 0.88rem; font-weight: 500; transition: background .2s, border-color .2s; }
.day-nav a:hover { background: var(--bg-highlight); border-color: var(--border-accent); }
.day-nav .next { margin-left: auto; background: var(--grad-track); border: none; color: var(--ink); font-weight: 700; }
.day-nav .next:hover { opacity: .92; }

/* ---- Mark complete ---- */
.complete-row { margin-top: 2.5rem; text-align: center; }
.complete-btn { background: var(--bg-card); border: 1px solid var(--border-card); color: var(--text-secondary); font-family: inherit; font-size: 0.85rem; font-weight: 600; padding: 0.7rem 1.4rem; border-radius: var(--radius-md); cursor: pointer; transition: all .2s; }
.complete-btn:hover { border-color: var(--accent-green); color: var(--accent-green); }
.complete-btn.done { background: rgba(52,211,153,.12); border-color: rgba(52,211,153,.4); color: var(--accent-green); }

/* ---- Responsive ---- */
@media (max-width: 640px) {
  html { font-size: 15px; }
  .course-container { padding: 0 1rem 3rem; }
  .course-hero { margin: 0 -1rem 2rem; }
  .course-hero .hero-text { padding: 0 1rem 1.2rem; }
  .day-nav { flex-direction: column; }
  .day-nav a { width: 100%; justify-content: center; }
  .day-nav .next { margin-left: 0; }
  .resource { flex-direction: column; gap: 0.5rem; }
  .explainer-stage { padding: 0.8rem 0.8rem 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .reveal { opacity: 1; transform: none; }
  .explainer-stage [data-step] { opacity: 1; transform: none; }
}

@media print {
  body { background: #fff; color: #111; }
  .topbar, .day-nav, .explainer-controls, .readbar, .complete-row { display: none; }
  .explainer-stage [data-step] { opacity: 1 !important; transform: none !important; }
}

/* ============================================================
   PAGE TUTOR — floating ask-about-this-page panel
   ============================================================ */
#dvp-tutor { position: fixed; right: 20px; bottom: 20px; z-index: 200; font-size: 15px; }

.tut-fab {
  display: inline-flex; align-items: center; gap: .55rem;
  background: var(--grad-track); color: var(--ink); border: none;
  border-radius: 100px; padding: .7rem 1.1rem .7rem .8rem;
  font-family: inherit; font-size: .84rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  transition: transform .2s cubic-bezier(.22,1,.36,1), box-shadow .2s, opacity .2s;
}
.tut-fab:hover { transform: translateY(-2px); box-shadow: 0 12px 34px rgba(0,0,0,.55); }
.tut-fab-mark {
  width: 20px; height: 20px; border-radius: 50%; background: rgba(21,12,2,.22);
  display: inline-flex; align-items: center; justify-content: center; font-weight: 800; font-size: .8rem;
}
#dvp-tutor.is-open .tut-fab { opacity: 0; pointer-events: none; }

.tut-panel {
  position: absolute; right: 0; bottom: 0; width: min(420px, calc(100vw - 40px));
  height: min(560px, calc(100vh - 120px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-secondary); border: 1px solid var(--border-card);
  border-radius: var(--radius-lg); box-shadow: 0 24px 60px rgba(0,0,0,.6);
  animation: tut-in .26s cubic-bezier(.22,1,.36,1);
}
@keyframes tut-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.tut-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .85rem 1rem .85rem 1.1rem; border-bottom: 1px solid var(--border-subtle); }
.tut-eyebrow { font-size: .6rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-amber); }
.tut-title { font-size: .92rem; font-weight: 700; color: var(--text-heading); }
.tut-close { background: none; border: none; color: var(--text-muted); font-size: .9rem; cursor: pointer; padding: .3rem .4rem; border-radius: 6px; }
.tut-close:hover { color: var(--text-heading); background: var(--bg-highlight); }

.tut-log { flex: 1; overflow-y: auto; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .8rem; }
.tut-empty { color: var(--text-muted); font-size: .86rem; }
.tut-empty p { margin-bottom: .8rem; }
.tut-suggest { display: flex; flex-direction: column; gap: .4rem; align-items: flex-start; }
.tut-chip {
  background: var(--bg-card); border: 1px solid var(--border-card); color: var(--text-secondary);
  border-radius: 100px; padding: .35rem .8rem; font-family: inherit; font-size: .76rem;
  cursor: pointer; text-align: left; transition: border-color .2s, color .2s;
}
.tut-chip:hover { border-color: var(--accent-amber); color: var(--accent-amber); }
.tut-chip-quiz { border-color: rgba(255,115,56,.45); color: var(--accent-amber); font-weight: 700; }

.tut-msg { font-size: .88rem; line-height: 1.6; }
.tut-msg p { margin: 0 0 .6rem; }
.tut-msg p:last-child { margin-bottom: 0; }
.tut-msg ul { margin: .3rem 0 .6rem 1.1rem; }
.tut-msg li { margin-bottom: .25rem; }
.tut-msg pre { margin: .5rem 0; padding: .7rem .85rem; font-size: .78rem; border-radius: 8px; }
.tut-msg code { font-size: .8rem; }
.tut-you {
  align-self: flex-end; max-width: 85%; background: var(--bg-highlight);
  border: 1px solid var(--border-card); border-radius: 12px 12px 3px 12px; padding: .55rem .8rem;
  color: var(--text-heading);
}
.tut-ai { align-self: flex-start; max-width: 100%; color: var(--text-primary); border-left: 2px solid rgba(255,115,56,.35); padding-left: .8rem; }
.tut-err { color: var(--accent-red); }

.tut-dots { display: inline-flex; gap: 4px; align-items: center; height: 1.2rem; }
.tut-dots i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent-amber); animation: tut-blink 1.2s ease-in-out infinite; }
.tut-dots i:nth-child(2) { animation-delay: .18s; }
.tut-dots i:nth-child(3) { animation-delay: .36s; }
@keyframes tut-blink { 0%,80%,100% { opacity: .25; } 40% { opacity: 1; } }

.tut-form { display: flex; gap: .5rem; align-items: flex-end; padding: .75rem .9rem .9rem; border-top: 1px solid var(--border-subtle); }
.tut-input {
  flex: 1; resize: none; background: var(--bg-primary); border: 1px solid var(--border-card);
  border-radius: 10px; padding: .6rem .75rem; color: var(--text-primary);
  font-family: inherit; font-size: .86rem; line-height: 1.5; outline: none; max-height: 140px;
}
.tut-input:focus { border-color: rgba(255,115,56,.5); }
.tut-send {
  flex-shrink: 0; width: 36px; height: 36px; border: none; border-radius: 9px;
  background: var(--grad-track); color: var(--ink); font-size: 1rem; font-weight: 700; cursor: pointer;
}
.tut-send:hover { opacity: .9; }

@media (max-width: 640px) {
  #dvp-tutor { right: 12px; bottom: 12px; }
  .tut-panel { width: calc(100vw - 24px); height: min(70vh, calc(100vh - 100px)); }
  .tut-fab-label { display: none; }
  .tut-fab { padding: .75rem; }
}
@media print { #dvp-tutor { display: none; } }

/* ============================================================
   TRACK SEARCH — Ctrl+K overlay
   ============================================================ */
.search-btn { display: inline-flex; align-items: center; gap: .45rem; background: var(--bg-card); border: 1px solid var(--border-card);
  color: var(--text-muted); border-radius: 8px; padding: .35rem .6rem; font-family: inherit; font-size: .72rem; font-weight: 600;
  cursor: pointer; transition: border-color .2s, color .2s; margin-left: auto; margin-right: .9rem; }
.search-btn:hover { border-color: var(--accent-amber); color: var(--text-primary); }
.search-btn kbd { font-family: 'JetBrains Mono', monospace; font-size: .6rem; color: var(--text-muted);
  border: 1px solid var(--border-subtle); border-radius: 4px; padding: .1rem .3rem; }
@media (max-width: 640px) { .search-btn span, .search-btn kbd { display: none; } .search-btn { margin-right: .6rem; } }

#dvp-search { position: fixed; inset: 0; z-index: 300; }
.srch-backdrop { position: absolute; inset: 0; background: rgba(5,7,12,.62); backdrop-filter: blur(4px); }
.srch-panel { position: relative; max-width: 640px; margin: 9vh auto 0; background: var(--bg-secondary);
  border: 1px solid var(--border-card); border-radius: var(--radius-lg); box-shadow: 0 30px 80px rgba(0,0,0,.6);
  display: flex; flex-direction: column; max-height: 72vh; overflow: hidden;
  animation: srch-in .22s cubic-bezier(.22,1,.36,1); }
@keyframes srch-in { from { opacity: 0; transform: translateY(-10px) scale(.985); } to { opacity: 1; transform: none; } }
.srch-inputrow { display: flex; align-items: center; gap: .7rem; padding: .9rem 1.1rem; border-bottom: 1px solid var(--border-subtle); color: var(--text-muted); }
.srch-input { flex: 1; background: none; border: none; outline: none; color: var(--text-heading);
  font-family: inherit; font-size: 1rem; }
.srch-input::-webkit-search-cancel-button { display: none; }
.srch-inputrow kbd { font-family: 'JetBrains Mono', monospace; font-size: .62rem; color: var(--text-muted);
  border: 1px solid var(--border-subtle); border-radius: 4px; padding: .12rem .35rem; }
.srch-results { overflow-y: auto; flex: 1; }
.srch-item { display: block; padding: .75rem 1.1rem; border-bottom: 1px solid var(--border-subtle);
  text-decoration: none; border-left: 2px solid transparent; }
.srch-item.is-sel { background: var(--bg-highlight); border-left-color: var(--accent-amber); }
.srch-item-top { display: flex; align-items: center; gap: .55rem; }
.srch-kind { font-size: .56rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  padding: .16rem .45rem; border-radius: 4px; flex-shrink: 0; }
.srch-kind.term { background: rgba(255,115,56,.15); color: var(--accent-amber); }
.srch-kind.section { background: rgba(96,165,250,.14); color: var(--accent-blue); }
.srch-title { font-weight: 700; color: var(--text-heading); font-size: .92rem; }
.srch-crumb { font-size: .7rem; color: var(--text-muted); margin: .15rem 0 .25rem; }
.srch-snip { font-size: .8rem; color: var(--text-secondary); line-height: 1.5; }
.srch-snip mark { background: rgba(255,115,56,.25); color: var(--accent-amber); border-radius: 2px; padding: 0 1px; }
.srch-empty { padding: 1.4rem 1.2rem; color: var(--text-muted); font-size: .86rem; }
.srch-hint { padding: .55rem 1.1rem; font-size: .68rem; color: var(--text-muted); border-top: 1px solid var(--border-subtle); }
@media (max-width: 640px) { .srch-panel { margin: 4vh .8rem 0; max-height: 84vh; } }

/* ============================================================
   PAGE NOTES — floating scratchpad, bottom-left
   ============================================================ */
#dvp-notes { position: fixed; left: 20px; bottom: 20px; z-index: 200; }
.nts-fab { display: inline-flex; align-items: center; gap: .5rem; position: relative;
  background: var(--bg-card); border: 1px solid var(--border-card); color: var(--text-secondary);
  border-radius: 100px; padding: .65rem 1rem; font-family: inherit; font-size: .8rem; font-weight: 700;
  cursor: pointer; box-shadow: 0 8px 28px rgba(0,0,0,.45);
  transition: transform .2s cubic-bezier(.22,1,.36,1), border-color .2s, color .2s, opacity .2s; }
.nts-fab:hover { transform: translateY(-2px); border-color: var(--accent-amber); color: var(--text-primary); }
.nts-dot { position: absolute; top: 6px; right: 8px; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent-amber); }
#dvp-notes.is-open .nts-fab { opacity: 0; pointer-events: none; }

.nts-panel { position: absolute; left: 0; bottom: 0; width: min(400px, calc(100vw - 40px));
  height: min(480px, calc(100vh - 120px)); display: flex; flex-direction: column; overflow: hidden;
  background: var(--bg-secondary); border: 1px solid var(--border-card); border-radius: var(--radius-lg);
  box-shadow: 0 24px 60px rgba(0,0,0,.6); animation: nts-in .26s cubic-bezier(.22,1,.36,1); }
@keyframes nts-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }
.nts-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .85rem 1rem .85rem 1.1rem; border-bottom: 1px solid var(--border-subtle); }
.nts-eyebrow { font-size: .6rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-amber); }
.nts-title { font-size: .88rem; font-weight: 700; color: var(--text-heading); }
.nts-close { background: none; border: none; color: var(--text-muted); font-size: .9rem; cursor: pointer;
  padding: .3rem .4rem; border-radius: 6px; }
.nts-close:hover { color: var(--text-heading); background: var(--bg-highlight); }
.nts-text { flex: 1; resize: none; background: var(--bg-primary); border: none; outline: none;
  padding: 1rem 1.1rem; color: var(--text-primary); font-family: inherit; font-size: .88rem; line-height: 1.65; }
.nts-foot { display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: .6rem 1rem; border-top: 1px solid var(--border-subtle); }
.nts-status { font-size: .7rem; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.nts-export { background: none; border: 1px solid var(--border-card); color: var(--text-secondary);
  border-radius: 8px; padding: .35rem .7rem; font-family: inherit; font-size: .72rem; font-weight: 600; cursor: pointer;
  transition: border-color .2s, color .2s; }
.nts-export:hover { border-color: var(--accent-amber); color: var(--accent-amber); }

@media (max-width: 640px) {
  #dvp-notes { left: 12px; bottom: 12px; }
  .nts-panel { width: calc(100vw - 24px); }
  .nts-fab-label { display: none; }
  .nts-fab { padding: .75rem; }
}
@media print { #dvp-notes { display: none; } }
