/* ============================================================
   AI Тетрадката — chalkboard + notebook classroom aesthetic
   Fonts: Caveat (chalk/script), Neucha (handwritten body),
          PT Serif (textbook), JetBrains Mono (prompts)
   ============================================================ */

:root {
  --board: #2c423a;          /* chalkboard green */
  --board-deep: #24362f;
  --chalk: #f4f1e6;
  --chalk-dim: rgba(244, 241, 230, 0.72);
  --paper: #faf6ec;          /* notebook page */
  --paper-shade: #f1ecdd;
  --ink: #2b3240;            /* handwriting ink */
  --ink-soft: #4c5568;
  --rule-blue: rgba(96, 130, 182, 0.28);   /* notebook lines */
  --rule-red: rgba(196, 90, 90, 0.5);      /* margin rule */
  --accent: #b0492f;         /* red pencil, the single accent */
  --tape: rgba(255, 244, 200, 0.65);
  --font-chalk: "Caveat", cursive;
  --font-hand: "Neucha", cursive;
  --font-book: "PT Serif", serif;
  --font-mono: "JetBrains Mono", monospace;
  --pad-x: clamp(20px, 5vw, 80px);
}

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

html { scroll-behavior: smooth; scroll-padding-top: 70px; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: 19px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 3px; }
img { max-width: 100%; display: block; }

.hand { font-family: var(--font-hand); }

/* ============ NAV: paper strip ============ */
.tnav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 60px;
  padding: 0 var(--pad-x);
  background: rgba(250, 246, 236, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 2px solid rgba(43, 50, 64, 0.12);
}
.tnav__logo {
  font-family: var(--font-book); font-weight: 700; font-size: 1.25rem;
  color: var(--ink); text-decoration: none;
}
.tnav__logo span { color: var(--accent); }
.tnav__links { display: flex; gap: clamp(14px, 3vw, 34px); }
.tnav__links a, .tnav__back {
  font-family: var(--font-hand); font-size: 1.02rem;
  color: var(--ink-soft); text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.25s, border-color 0.25s;
}
.tnav__links a:hover, .tnav__back:hover { color: var(--accent); border-bottom-color: var(--accent); }

/* ============ CHALKBOARD ============ */
.board {
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(255, 255, 255, 0.05) 0%, transparent 55%),
    radial-gradient(ellipse at 20% 100%, rgba(0, 0, 0, 0.25) 0%, transparent 50%),
    linear-gradient(160deg, var(--board) 0%, var(--board-deep) 100%);
  color: var(--chalk);
  position: relative;
  padding: 0 var(--pad-x);
}
/* chalk dust texture */
.board::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.07;
  pointer-events: none;
}
.board__frame {
  position: relative;
  max-width: 1160px;
  margin: 0 auto;
  border: 12px solid #7a5a3d;
  border-image: linear-gradient(150deg, #8a6845, #6a4c32 60%, #7d5c3e) 1;
  box-shadow:
    inset 0 0 60px rgba(0, 0, 0, 0.35),
    0 14px 40px rgba(0, 0, 0, 0.22);
  padding: clamp(44px, 7vh, 84px) clamp(24px, 5vw, 72px);
}
.board__tray {
  max-width: 1160px;
  margin: 0 auto;
  height: 16px;
  background: linear-gradient(#8a6845, #5f452e);
  border-radius: 0 0 8px 8px;
  position: relative;
  display: flex; align-items: center; gap: 14px;
  padding-left: 40px;
}
.board__chalkpiece {
  width: 46px; height: 7px; border-radius: 3px;
  background: linear-gradient(var(--chalk), #d9d4c2);
  transform: rotate(-1.5deg);
}
.board__duster {
  width: 64px; height: 10px; border-radius: 2px;
  background: linear-gradient(#4b3a28, #33271a);
}

.chalk-script {
  font-family: var(--font-chalk);
  color: var(--chalk-dim);
  text-shadow: 0 0 8px rgba(244, 241, 230, 0.25);
}

/* hero board */
.hero-board { padding-top: 60px; }
.hero-board .board__frame { min-height: min(78vh, 680px); }
.hero-board__welcome {
  font-size: clamp(1.4rem, 3vw, 2rem);
  margin: 0 0 20px;
  transform: rotate(-1.2deg);
}
.hero-board__title {
  font-family: var(--font-chalk);
  font-weight: 700;
  font-size: clamp(3.4rem, 10vw, 7.4rem);
  line-height: 0.95;
  margin: 0;
  letter-spacing: 0.01em;
  text-shadow: 0 0 14px rgba(244, 241, 230, 0.28);
}
.hero-board__ai {
  display: inline-block;
  transform: rotate(-4deg) translateY(-6px);
  color: var(--chalk);
  border: 3px solid var(--chalk-dim);
  border-radius: 50%;
  padding: 2px 20px 8px;
  margin-right: 10px;
  font-size: 0.62em;
  vertical-align: middle;
}
.hero-board__underline {
  width: min(420px, 70%);
  color: var(--chalk-dim);
  margin: 6px 0 26px;
}
.hero-board__sub {
  font-family: var(--font-hand);
  font-size: clamp(1.1rem, 2.2vw, 1.35rem);
  color: var(--chalk-dim);
  max-width: 33ch;
  margin: 0 0 34px;
}

.chalk-btn {
  display: inline-block;
  font-family: var(--font-chalk);
  font-weight: 600;
  font-size: 1.45rem;
  color: var(--chalk);
  text-decoration: none;
  border: 2.5px solid var(--chalk);
  border-radius: 14px 18px 15px 17px / 17px 14px 18px 15px; /* hand-drawn wobble */
  padding: 10px 30px 13px;
  transform: rotate(-0.6deg);
  transition: transform 0.25s, background 0.25s, color 0.25s;
}
.chalk-btn:hover { transform: rotate(0.4deg) scale(1.04); background: rgba(244, 241, 230, 0.12); }
.chalk-btn:active { transform: scale(0.97); }
.chalk-btn--solid { background: var(--chalk); color: var(--board-deep); text-shadow: none; }
.chalk-btn--solid:hover { background: #fff; }

/* pinned photo + note on the board */
.hero-board__pins {
  position: absolute;
  right: clamp(18px, 5vw, 70px);
  top: clamp(40px, 9vh, 90px);
  display: flex; flex-direction: column; gap: 26px;
  width: clamp(170px, 20vw, 250px);
}
.pinned { position: relative; margin: 0; }
.pinned::before {
  content: "";
  position: absolute; top: -12px; left: 50%;
  transform: translateX(-50%) rotate(-2deg);
  width: 78px; height: 26px;
  background: var(--tape);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
}
.pinned--photo {
  background: #fdfcf7;
  padding: 10px 10px 6px;
  transform: rotate(2.4deg);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.3);
}
.pinned--photo img { background: #e8e2d2; }
.pinned--photo figcaption {
  text-align: center; color: #5c5647; font-size: 1.05rem; padding: 6px 0 2px;
}
.pinned--note {
  background: #fbf0b8;
  padding: 18px 16px;
  transform: rotate(-2deg);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28);
}
.pinned--note p { margin: 0; color: #4c4632; font-size: 1.18rem; line-height: 1.4; }

.chalk-doodle {
  position: absolute;
  font-size: 2rem;
  color: var(--chalk-dim);
  opacity: 0.8;
}
.chalk-doodle--star { left: 6%; bottom: 14%; transform: rotate(-10deg); }
.chalk-doodle--arrow { right: 30%; bottom: 10%; font-size: 2.6rem; transform: rotate(15deg); }

/* ============ NOTEBOOK PAPER SECTIONS ============ */
.paper { padding: clamp(64px, 10vh, 110px) var(--pad-x); position: relative; }
.paper__inner { max-width: 1060px; margin: 0 auto; position: relative; }

/* lined page with red margin */
.paper--lined {
  background:
    linear-gradient(to right, transparent 0, transparent calc(var(--pad-x) + 26px), var(--rule-red) calc(var(--pad-x) + 26px), var(--rule-red) calc(var(--pad-x) + 28px), transparent calc(var(--pad-x) + 28px)),
    repeating-linear-gradient(to bottom, var(--paper) 0, var(--paper) 35px, var(--rule-blue) 35px, var(--rule-blue) 36px),
    var(--paper);
}
.paper--flip {
  background:
    linear-gradient(to left, transparent 0, transparent calc(var(--pad-x) + 26px), var(--rule-red) calc(var(--pad-x) + 26px), var(--rule-red) calc(var(--pad-x) + 28px), transparent calc(var(--pad-x) + 28px)),
    repeating-linear-gradient(to bottom, var(--paper) 0, var(--paper) 35px, var(--rule-blue) 35px, var(--rule-blue) 36px),
    var(--paper);
}
.paper--plain { background: var(--paper-shade); }
.paper--book { background: var(--paper); }

.hand-title {
  font-family: var(--font-chalk);
  font-weight: 700;
  font-size: clamp(2.3rem, 5.5vw, 3.6rem);
  color: var(--ink);
  margin: 0 0 10px;
  transform: rotate(-0.8deg);
}
.hand-title::after {
  content: "";
  display: block;
  width: 130px; height: 4px;
  margin-top: 4px;
  background: var(--accent);
  border-radius: 2px 4px 3px 5px;
  transform: rotate(0.6deg);
  opacity: 0.65;
}
.paper__lead {
  font-size: 1.15rem;
  color: var(--ink-soft);
  max-width: 58ch;
  margin: 0 0 44px;
}

/* start list: notebook numbering */
.startlist { list-style: none; margin: 0; padding: 0; max-width: 720px; }
.startlist__item {
  display: grid;
  grid-template-columns: 56px 1fr;
  gap: 14px;
  padding: 22px 0 26px;
  position: relative;
}
.startlist__item + .startlist__item { border-top: 2px dashed rgba(43, 50, 64, 0.15); }
.startlist__num {
  font-size: 2rem;
  color: var(--accent);
  width: 46px; height: 46px;
  border: 2.5px solid var(--accent);
  border-radius: 48% 52% 46% 54% / 52% 48% 54% 46%;
  display: flex; align-items: center; justify-content: center;
  transform: rotate(-3deg);
  line-height: 1;
  padding-bottom: 4px;
}
.startlist__item h3 {
  font-family: var(--font-hand);
  font-size: 1.45rem;
  margin: 0 0 8px;
  color: var(--ink);
}
.startlist__item p { margin: 0 0 6px; color: var(--ink-soft); font-size: 1.05rem; }
.margin-note {
  position: absolute;
  right: -220px; top: 30px;
  width: 190px;
  color: var(--accent);
  font-size: 1.15rem;
  transform: rotate(-4deg);
  opacity: 0.9;
}

/* ============ NOTE CARDS (graph paper) ============ */
.cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(26px, 4vw, 44px);
}
.notecard {
  position: relative;
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 17px, rgba(96, 130, 182, 0.14) 17px, rgba(96, 130, 182, 0.14) 18px),
    repeating-linear-gradient(to right, transparent 0, transparent 17px, rgba(96, 130, 182, 0.14) 17px, rgba(96, 130, 182, 0.14) 18px),
    #fdfbf3;
  border: 1px solid rgba(43, 50, 64, 0.12);
  box-shadow: 0 10px 26px rgba(60, 55, 40, 0.13);
  padding: 30px 26px 22px;
  display: flex; flex-direction: column;
}
.notecard--tilt-l { transform: rotate(-0.7deg); }
.notecard--tilt-r { transform: rotate(0.8deg); }
.notecard__tape {
  position: absolute; top: -13px; left: 50%;
  transform: translateX(-50%) rotate(-1.5deg);
  width: 96px; height: 28px;
  background: var(--tape);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.notecard h3 {
  font-size: 1.6rem;
  margin: 0 0 4px;
  color: var(--ink);
}
.notecard__use { color: var(--ink-soft); font-size: 1rem; margin: 0 0 16px; }
.notecard__prompt {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.55;
  color: #3a4152;
  background: rgba(255, 255, 255, 0.65);
  border: 1px dashed rgba(43, 50, 64, 0.25);
  border-radius: 4px;
  padding: 14px 16px;
  margin: 0 0 16px;
  white-space: pre-wrap;
  flex: 1;
}
.copy-btn {
  align-self: flex-end;
  font-family: var(--font-hand);
  font-size: 1.08rem;
  color: var(--accent);
  background: none;
  border: 2px solid var(--accent);
  border-radius: 12px 15px 13px 16px / 15px 12px 16px 13px;
  padding: 7px 18px;
  cursor: pointer;
  transition: background 0.25s, color 0.25s, transform 0.2s;
}
.copy-btn:hover { background: var(--accent); color: #fdfbf3; }
.copy-btn:active { transform: scale(0.96); }
.copy-btn.is-copied { background: var(--accent); color: #fdfbf3; }

/* ============ DOODLES: hand-drawn margin illustrations ============ */
.doodle {
  display: block;
  color: var(--ink);
  opacity: 0.85;
}
.doodle svg { width: 100%; height: auto; display: block; overflow: visible; }
.doodle g, .doodle path { transform-box: fill-box; }

/* margin doodles sit in the notebook margin next to section titles */
.doodle--plane, .doodle--bulb, .doodle--pencil, .doodle--quill,
.doodle--coffee, .doodle--cap, .doodle--scale, .doodle--lens {
  position: absolute;
  right: clamp(-10px, 1vw, 30px);
  top: -18px;
  width: clamp(110px, 12vw, 150px);
  pointer-events: auto;
}
.doodle--bulb { width: clamp(80px, 9vw, 104px); top: -34px; }
.doodle--coffee { color: #2f2416; width: clamp(96px, 10vw, 120px); top: 6px; right: clamp(8px, 2vw, 26px); }
.doodle--plane { transform: rotate(-4deg); }

/* inline doodles float inside lesson content */
.doodle--inline {
  float: right;
  width: clamp(140px, 20vw, 190px);
  margin: 4px 0 10px 22px;
  shape-outside: margin-box;
}

/* --- interactions (each one tells the lesson's story) --- */

/* bulb: lights up when you hover the curriculum */
.bulb-rays { opacity: 0; transition: opacity 0.35s; }
.bulb-glass { transition: fill 0.35s; fill: transparent; }
.doodle--bulb:hover .bulb-rays { opacity: 1; }
.doodle--bulb:hover .bulb-glass { fill: rgba(240, 205, 90, 0.4); }

/* plane: takes off toward its dotted path */
.doodle--plane { transition: transform 0.5s cubic-bezier(0.34, 1.4, 0.64, 1); }
.doodle--plane:hover { transform: rotate(-7deg) translate(10px, -8px); }

/* chat UI: the input caret blinks like a real one */
.cursor-blink { animation: caret 1.1s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }

/* memory sheets: the front page slides, the dashed one fades further */
.mem-front, .mem-back { transition: transform 0.45s, opacity 0.45s; }
.doodle--memory:hover .mem-front { transform: translate(7px, -5px) rotate(1.5deg); }
.doodle--memory:hover .mem-back { opacity: 0.5; transform: translate(-4px, 3px); }

/* masks: they lean toward each other, trading moods */
.mask { transition: transform 0.45s cubic-bezier(0.34, 1.4, 0.64, 1); }
.doodle--masks:hover .mask--happy { transform: rotate(-8deg) translateY(-4px); }
.doodle--masks:hover .mask--serious { transform: rotate(8deg) translateY(4px); }

/* MCP: hover plugs the plug into the socket, then a spark */
.plug { transition: transform 0.45s cubic-bezier(0.65, 0, 0.35, 1); }
.spark { opacity: 0; transition: opacity 0.2s 0.4s; }
.doodle--mcp:hover .plug { transform: translateX(26px); }
.doodle--mcp:hover .spark { opacity: 1; }

/* agent: the loop arrow makes a full lap around the robot */
.agent-loop { transform-origin: 50% 50%; }
.doodle--agent:hover .agent-loop { animation: agent-lap 1.3s cubic-bezier(0.65, 0, 0.35, 1); }
@keyframes agent-lap { to { transform: rotate(360deg); } }

/* toolbox: tools hop out one after another */
.tool { transition: transform 0.35s cubic-bezier(0.34, 1.6, 0.64, 1); }
.doodle--toolbox:hover .tool--pencil { transform: translateY(-7px); }
.doodle--toolbox:hover .tool--screwdriver { transform: translateY(-10px); transition-delay: 0.07s; }
.doodle--toolbox:hover .tool--brush { transform: translateY(-6px); transition-delay: 0.14s; }

/* pencil: scribbles one more wave */
.pencil-body { transition: transform 0.4s; }
.doodle--pencil:hover .pencil-body { transform: translate(-6px, 6px) rotate(-2deg); }

/* quill: a happy wiggle */
.doodle--quill { transition: transform 0.4s; }
.doodle--quill:hover { transform: rotate(-6deg); }

/* coffee: steam rises on its own, saturday morning pace */
.steam { animation: steam-rise 2.6s ease-in-out infinite; }
.steam--late { animation-delay: 1.3s; }
@keyframes steam-rise {
  0% { opacity: 0; transform: translateY(4px); }
  35% { opacity: 0.8; }
  100% { opacity: 0; transform: translateY(-7px); }
}

/* graduation cap: the tassel swings */
.tassel { transform-origin: top center; }
.doodle--cap:hover .tassel { animation: tassel-swing 0.9s ease-in-out; }
@keyframes tassel-swing {
  25% { transform: rotate(14deg); }
  60% { transform: rotate(-9deg); }
  100% { transform: rotate(0); }
}

/* scale: weighs the two sides */
.beam { transform-origin: 50% 20%; }
.doodle--scale:hover .beam { animation: beam-weigh 1.1s ease-in-out; }
@keyframes beam-weigh {
  30% { transform: rotate(4deg); }
  70% { transform: rotate(-3deg); }
  100% { transform: rotate(0); }
}

/* magnifier: sweeps across the dictionary page */
.lens { transition: transform 0.5s ease-in-out; }
.doodle--lens:hover .lens { transform: translate(-34px, 6px); }

@media (max-width: 1100px) {
  .doodle--plane, .doodle--bulb, .doodle--pencil, .doodle--quill,
  .doodle--coffee, .doodle--cap, .doodle--scale, .doodle--lens {
    position: static;
    width: 92px;
    margin-bottom: 6px;
  }
}
@media (max-width: 520px) {
  .doodle--inline { width: 128px; margin-left: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .cursor-blink, .steam { animation: none; }
  .steam { opacity: 0.6; }
}

/* ============ LESSONS: curriculum map + accordion ============ */
.lessonmap {
  list-style: none;
  margin: 0 0 52px;
  padding: 22px clamp(18px, 3vw, 34px);
  max-width: 640px;
  background: #fdfbf3;
  border: 1px solid rgba(43, 50, 64, 0.14);
  box-shadow: 0 10px 26px rgba(60, 55, 40, 0.12);
  transform: rotate(-0.5deg);
}
.lessonmap li + li { border-top: 2px dotted rgba(43, 50, 64, 0.16); }
.lessonmap button {
  display: grid;
  grid-template-columns: 84px 1fr 30px;
  gap: 14px;
  align-items: baseline;
  width: 100%;
  padding: 13px 4px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-hand);
  color: var(--ink);
  transition: color 0.25s;
}
.lessonmap button:hover { color: var(--accent); }
.lessonmap__num { font-size: 0.72rem; letter-spacing: 0.08em; color: var(--accent); text-transform: uppercase; }
.lessonmap__title { font-size: 1.15rem; }
.lessonmap__check {
  font-size: 1.5rem;
  color: var(--accent);
  opacity: 0;
  transform: rotate(-8deg);
  transition: opacity 0.3s;
}
.lessonmap li.is-read .lessonmap__check { opacity: 1; }

.lessons { max-width: none; }

/* open lesson: text left, big interactive illustration right */
.lesson__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(28px, 4vw, 60px);
  align-items: start;
}
.lesson__visual { padding-top: 6px; }

/* ---- widget base: a taped graph-paper card ---- */
.widget {
  position: relative;
  background:
    repeating-linear-gradient(to bottom, transparent 0, transparent 17px, rgba(96, 130, 182, 0.13) 17px, rgba(96, 130, 182, 0.13) 18px),
    repeating-linear-gradient(to right, transparent 0, transparent 17px, rgba(96, 130, 182, 0.13) 17px, rgba(96, 130, 182, 0.13) 18px),
    #fdfbf3;
  border: 1px solid rgba(43, 50, 64, 0.14);
  box-shadow: 0 12px 30px rgba(60, 55, 40, 0.15);
  padding: 30px 24px 24px;
  transform: rotate(0.6deg);
}
.widget__tape {
  position: absolute; top: -13px; left: 50%;
  transform: translateX(-50%) rotate(-1.5deg);
  width: 96px; height: 28px;
  background: var(--tape);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12);
}
.widget__title { font-size: 1.2rem; color: var(--ink); margin: 0 0 16px; }

/* ---- chat explorer (lesson 1) ---- */
.chatx__frame {
  position: relative;
  display: grid;
  grid-template-columns: 88px 1fr;
  border: 2.5px solid var(--ink);
  border-radius: 8px 10px 9px 11px / 10px 8px 11px 9px;
  background: #fffdf6;
  min-height: 230px;
  overflow: hidden;
}
.chatx__side {
  border-right: 2px solid rgba(43, 50, 64, 0.25);
  padding: 10px 8px;
  display: flex; flex-direction: column; gap: 10px;
  background: rgba(43, 50, 64, 0.04);
}
.chatx__newchat {
  font-family: var(--font-hand);
  font-size: 0.82rem;
  border: 1.5px dashed var(--ink-soft);
  border-radius: 6px;
  background: none;
  padding: 5px 4px;
  color: var(--ink);
  cursor: default;
}
.chatx__historylist { display: flex; flex-direction: column; gap: 8px; }
.chatx__historylist span {
  font-family: var(--font-hand);
  font-size: 0.76rem;
  color: var(--ink-soft);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-bottom: 1px solid rgba(43, 50, 64, 0.14);
  padding-bottom: 4px;
}
.chatx__main { display: flex; flex-direction: column; }
.chatx__topbar { border-bottom: 2px solid rgba(43, 50, 64, 0.18); padding: 8px 12px; }
.chatx__model { font-family: var(--font-hand); font-size: 0.85rem; color: var(--ink); }
.chatx__messages { flex: 1; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.chatx__msg {
  font-family: var(--font-hand);
  font-size: 0.85rem;
  margin: 0;
  padding: 6px 10px;
  border-radius: 10px;
  max-width: 85%;
}
.chatx__msg--user { align-self: flex-end; background: rgba(176, 73, 47, 0.12); }
.chatx__msg--ai { align-self: flex-start; border: 1.5px solid rgba(43, 50, 64, 0.2); }
.chatx__inputrow {
  display: flex; align-items: center; gap: 8px;
  border-top: 2px solid rgba(43, 50, 64, 0.18);
  padding: 9px 12px;
}
.chatx__clip { font-size: 0.95rem; }
.chatx__input {
  flex: 1;
  font-family: var(--font-hand);
  font-size: 0.85rem;
  color: var(--ink-soft);
  border: 1.5px solid rgba(43, 50, 64, 0.25);
  border-radius: 8px;
  padding: 5px 10px;
}
.chatx__caret { display: inline-block; width: 1.5px; height: 0.9em; background: var(--ink); margin-left: 2px; vertical-align: -1px; animation: caret 1.1s steps(1) infinite; }
.chatx__send { color: var(--accent); }

.chatx__spot {
  position: absolute;
  left: var(--x); top: var(--y);
  transform: translate(-50%, -50%);
  width: 26px; height: 26px;
  border-radius: 48% 52% 50% 50% / 52% 48% 52% 48%;
  border: 2px solid #fdfbf3;
  background: var(--accent);
  color: #fdfbf3;
  font-family: var(--font-hand);
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
  transition: transform 0.25s cubic-bezier(0.34, 1.6, 0.64, 1);
  z-index: 2;
}
.chatx__spot:hover { transform: translate(-50%, -50%) scale(1.18); }
.chatx__spot.is-active { background: var(--ink); }
[data-spot-zone].is-lit { outline: 3px solid rgba(176, 73, 47, 0.55); outline-offset: 3px; border-radius: 6px; }
.chatx__note {
  min-height: 3em;
  margin: 14px 0 0;
  font-size: 1.12rem;
  color: var(--accent);
  transform: rotate(-0.5deg);
}

/* ---- context window simulator (lesson 2) ---- */
.ctxsim__messages { display: flex; flex-direction: column; gap: 7px; }
.ctxsim__msg {
  font-family: var(--font-hand);
  font-size: 0.9rem;
  margin: 0;
  padding: 6px 10px;
  border: 1.5px solid rgba(43, 50, 64, 0.25);
  border-radius: 9px;
  background: #fffdf6;
  transition: opacity 0.4s, filter 0.4s, transform 0.4s;
}
.ctxsim__msg.is-forgotten {
  opacity: 0.22;
  filter: blur(0.6px);
  transform: translateX(-6px) rotate(-0.5deg);
  text-decoration: line-through;
  text-decoration-color: rgba(176, 73, 47, 0.4);
}
.ctxsim__control { display: flex; align-items: center; gap: 12px; margin-top: 16px; }
.ctxsim__control span { color: var(--ink-soft); font-size: 1rem; white-space: nowrap; }
.ctxsim__control input[type="range"] {
  flex: 1;
  accent-color: var(--accent);
  cursor: pointer;
}
.ctxsim__note { margin: 12px 0 0; font-size: 1.1rem; color: var(--accent); min-height: 2.6em; }

/* ---- persona switcher (lesson 3) ---- */
.personax__pills { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.personax__pill {
  font-family: var(--font-hand);
  font-size: 0.98rem;
  background: none;
  color: var(--ink);
  border: 2px solid var(--ink-soft);
  border-radius: 12px 15px 13px 16px / 15px 12px 16px 13px;
  padding: 7px 14px;
  cursor: pointer;
  transition: border-color 0.25s, background 0.25s, color 0.25s, transform 0.2s;
}
.personax__pill:hover { transform: translateY(-2px); }
.personax__pill.is-active { border-color: var(--accent); background: var(--accent); color: #fdfbf3; }
.personax__answer {
  font-family: var(--font-hand);
  font-size: 1.05rem;
  color: var(--ink);
  border: 1.5px solid rgba(43, 50, 64, 0.25);
  border-radius: 12px;
  background: #fffdf6;
  padding: 14px 16px;
  margin: 0;
  min-height: 6.2em;
  transition: opacity 0.25s;
}
.personax__answer.is-swapping { opacity: 0; }

/* ---- MCP switchboard (lesson 4) ---- */
.mcpx__rows { display: flex; flex-direction: column; gap: 14px; }
.mcpx__row {
  display: grid;
  grid-template-columns: 110px 1fr 52px;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}
.mcpx__label { font-family: var(--font-hand); font-size: 1.02rem; color: var(--ink); }
.mcpx__wire {
  height: 0;
  border-top: 2.5px dashed rgba(43, 50, 64, 0.3);
  transition: border-color 0.35s, border-style 0.35s;
}
.mcpx__row input { position: absolute; opacity: 0; pointer-events: none; }
.mcpx__switch {
  width: 46px; height: 24px;
  border: 2.5px solid var(--ink-soft);
  border-radius: 14px;
  position: relative;
  transition: border-color 0.3s, background 0.3s;
}
.mcpx__switch::after {
  content: "";
  position: absolute; top: 2px; left: 2px;
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--ink-soft);
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), background 0.3s;
}
.mcpx__row input:checked ~ .mcpx__switch { border-color: var(--accent); background: rgba(176, 73, 47, 0.12); }
.mcpx__row input:checked ~ .mcpx__switch::after { transform: translateX(21px); background: var(--accent); }
.mcpx__row:has(input:checked) .mcpx__wire { border-top-style: solid; border-top-color: var(--accent); }
.mcpx__result {
  margin: 18px 0 0;
  font-size: 1.08rem;
  color: var(--accent);
  min-height: 3.9em;
  transform: rotate(-0.4deg);
}

/* ---- agent runner (lesson 5) ---- */
.agentx__run {
  font-family: var(--font-hand);
  font-size: 1.05rem;
  background: var(--accent);
  color: #fdfbf3;
  border: 0;
  border-radius: 12px 15px 13px 16px / 15px 12px 16px 13px;
  padding: 9px 20px;
  cursor: pointer;
  transition: transform 0.2s, opacity 0.3s;
  margin-bottom: 14px;
}
.agentx__run:hover { transform: translateY(-2px); }
.agentx__run:disabled { opacity: 0.45; cursor: default; }
.agentx__steps { list-style: none; margin: 0; padding: 0; }
.agentx__steps li {
  font-family: var(--font-hand);
  font-size: 0.98rem;
  color: var(--ink-soft);
  padding: 7px 0 7px 30px;
  position: relative;
  opacity: 0.35;
  transition: opacity 0.35s, color 0.35s;
}
.agentx__steps li::before {
  content: "○";
  position: absolute; left: 4px;
  color: var(--ink-soft);
}
.agentx__steps li.is-doing { opacity: 1; color: var(--ink); }
.agentx__steps li.is-doing::before { content: "…"; color: var(--accent); }
.agentx__steps li.is-done { opacity: 1; color: var(--ink); }
.agentx__steps li.is-done::before { content: "✓"; color: var(--accent); font-family: var(--font-chalk); font-weight: 700; }
.agentx__done {
  margin: 14px 0 0;
  font-size: 1.15rem;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.5s;
  transform: rotate(-0.6deg);
}
.agentx__done.is-visible { opacity: 1; }
.lesson {
  border-top: 2px dashed rgba(43, 50, 64, 0.18);
}
.lesson:last-child { border-bottom: 2px dashed rgba(43, 50, 64, 0.18); }
.lesson__head {
  display: grid;
  grid-template-columns: 84px 1fr 40px;
  gap: 14px;
  align-items: center;
  width: 100%;
  padding: 20px 4px;
  background: none;
  border: 0;
  cursor: pointer;
  text-align: left;
}
.lesson__num { font-size: 0.72rem; letter-spacing: 0.08em; color: var(--accent); text-transform: uppercase; }
.lesson__title { font-size: 1.55rem; font-weight: 400; margin: 0; color: var(--ink); transition: color 0.25s; }
.lesson__head:hover .lesson__title { color: var(--accent); }
.lesson__toggle {
  font-size: 2rem;
  color: var(--accent);
  text-align: center;
  transition: transform 0.35s cubic-bezier(0.34, 1.4, 0.64, 1);
}
.lesson.is-open .lesson__toggle { transform: rotate(45deg); }

.lesson__body {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s cubic-bezier(0.65, 0, 0.35, 1);
}
.lesson.is-open .lesson__body { grid-template-rows: 1fr; }
.lesson__content {
  overflow: hidden;
  min-height: 0;
  padding: 0 4px;
}
.lesson.is-open .lesson__content { padding-bottom: 30px; }
.lesson__content > p { color: var(--ink-soft); font-size: 1.06rem; margin: 0 0 14px; max-width: 62ch; }
.lesson__content strong { color: var(--ink); }

.lesson__carry {
  font-size: 1.3rem;
  line-height: 1.45;
  color: var(--ink);
  margin: 22px 0 18px;
  max-width: 54ch;
  background: linear-gradient(transparent 60%, rgba(240, 205, 90, 0.45) 60%, rgba(240, 205, 90, 0.45) 94%, transparent 94%);
  display: inline-block;
  padding: 0 6px;
  transform: rotate(-0.5deg);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}
.lesson__try {
  border-left: 3px solid var(--accent);
  padding: 4px 0 4px 18px;
  margin-top: 6px;
}
.lesson__try-label { color: var(--accent); font-size: 1.15rem; margin: 0 0 4px; }
.lesson__try p:last-child { margin: 0; color: var(--ink-soft); font-size: 1.02rem; max-width: 58ch; }

.lesson__loop {
  font-size: 1.35rem;
  color: var(--accent);
  margin: 4px 0 16px;
  transform: rotate(-0.8deg);
}
.lesson__tools { list-style: none; margin: 0 0 8px; padding: 0; }
.lesson__tools li {
  padding: 8px 0 8px 24px;
  position: relative;
  color: var(--ink-soft);
  font-size: 1.03rem;
  max-width: 62ch;
}
.lesson__tools li::before {
  content: "✎";
  position: absolute; left: 0; top: 8px;
  color: var(--accent);
  font-size: 0.95rem;
}
.lesson__tools strong { color: var(--ink); }

/* ============ STICKY NOTES WALL ============ */
.stickies {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(22px, 3.5vw, 40px);
}
.sticky {
  position: relative;
  padding: 26px 22px 30px;
  box-shadow: 0 10px 24px rgba(60, 55, 40, 0.16);
  min-height: 150px;
}
.sticky::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0;
  height: 26px;
  background: rgba(255, 255, 255, 0.22);
}
.sticky:nth-child(odd) { transform: rotate(-1.3deg); }
.sticky:nth-child(even) { transform: rotate(1.1deg); }
.sticky:nth-child(3n) { transform: rotate(2deg); }
.sticky p { margin: 0; font-size: 1.16rem; line-height: 1.45; color: #453f2e; }
.sticky--yellow { background: #fbf0b8; }
.sticky--green { background: #d9ecc8; }
.sticky--blue { background: #cfe3ec; }
.sticky--pink { background: #f5d9d4; }

/* ============ CORK BOARD: assignments ============ */
.cork {
  padding: clamp(64px, 10vh, 110px) var(--pad-x);
  background:
    radial-gradient(ellipse at 30% 20%, rgba(255, 255, 255, 0.06), transparent 60%),
    linear-gradient(150deg, #b08a5e 0%, #9c7549 55%, #a87f52 100%);
  position: relative;
}
.cork::before {
  content: "";
  position: absolute; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.55' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)' opacity='1'/%3E%3C/svg%3E");
  opacity: 0.18;
  pointer-events: none;
}
.cork__inner {
  max-width: 1060px;
  margin: 0 auto;
  position: relative;
  border: 10px solid #6f5233;
  border-radius: 4px;
  box-shadow: inset 0 0 40px rgba(0, 0, 0, 0.18), 0 12px 34px rgba(0, 0, 0, 0.2);
  padding: clamp(30px, 5vw, 60px);
}
.hand-title--chalkless { color: #2f2416; }
.hand-title--chalkless::after { background: #f4e9c8; opacity: 0.8; }
.cork__lead {
  color: #3d2f1d;
  font-size: 1.15rem;
  max-width: 56ch;
  margin: 0 0 44px;
}
.cork__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(24px, 3.5vw, 42px);
}
.assignment {
  position: relative;
  background: #fdfaf0;
  padding: 34px 26px 26px;
  box-shadow: 0 12px 26px rgba(30, 22, 10, 0.28);
}
.assignment:nth-child(odd) { transform: rotate(-1deg); }
.assignment:nth-child(even) { transform: rotate(1.2deg); }
.assignment__pin {
  position: absolute; top: 12px; left: 50%;
  transform: translateX(-50%);
  width: 16px; height: 16px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #e07a63, var(--accent) 60%, #7c2e1c);
  box-shadow: 0 3px 5px rgba(0, 0, 0, 0.35);
}
.assignment__level {
  display: inline-block;
  font-size: 1rem;
  color: var(--accent);
  border-bottom: 2px solid rgba(176, 73, 47, 0.35);
  margin-bottom: 10px;
}
.assignment h3 { font-size: 1.65rem; margin: 0 0 10px; color: var(--ink); }
.assignment p { margin: 0; color: var(--ink-soft); font-size: 1.02rem; line-height: 1.55; }
.assignment--blank {
  background: #fbf0b8;
  display: flex; align-items: center;
  transform: rotate(1.8deg);
}
.assignment__blank-text { font-size: 1.2rem; color: #4c4632; margin: 0; }

/* ============ DRILLS CHECKLIST ============ */
.drills { max-width: 700px; }
.drills__level {
  font-size: 1.5rem;
  color: var(--accent);
  margin: 38px 0 12px;
  transform: rotate(-0.6deg);
}
.drills__level:first-child { margin-top: 0; }
.drill {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 14px;
  align-items: start;
  padding: 10px 0;
  cursor: pointer;
}
.drill input { position: absolute; opacity: 0; pointer-events: none; }
.drill__box {
  width: 26px; height: 26px;
  border: 2.5px solid var(--ink-soft);
  border-radius: 30% 40% 35% 42% / 40% 32% 44% 36%;
  margin-top: 2px;
  position: relative;
  transition: border-color 0.25s;
}
.drill:hover .drill__box { border-color: var(--accent); }
.drill input:checked + .drill__box::after {
  content: "✓";
  position: absolute;
  left: 2px; top: -8px;
  font-family: var(--font-chalk);
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--accent);
  transform: rotate(-8deg);
}
.drill input:focus-visible + .drill__box { outline: 3px solid rgba(176, 73, 47, 0.5); outline-offset: 3px; }
.drill__text { font-size: 1.08rem; color: var(--ink-soft); transition: color 0.25s, opacity 0.25s; }
.drill input:checked ~ .drill__text {
  color: var(--ink);
  text-decoration: line-through;
  text-decoration-color: rgba(176, 73, 47, 0.6);
  text-decoration-thickness: 2px;
  opacity: 0.75;
}
.drills__progress {
  margin-top: 34px;
  font-size: 1.35rem;
  color: var(--accent);
  transform: rotate(-1deg);
}

/* ============ GLOSSARY ============ */
.glossary {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: clamp(10px, 2vw, 18px) clamp(34px, 5vw, 70px);
  margin: 0;
}
.glossary__entry {
  padding: 18px 0;
  border-bottom: 2px dotted rgba(43, 50, 64, 0.2);
}
.glossary__entry dt {
  font-family: var(--font-book);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--ink);
  margin-bottom: 6px;
}
.glossary__entry dt::before {
  content: "◆ ";
  color: var(--accent);
  font-size: 0.7em;
  vertical-align: 2px;
}
.glossary__entry dd {
  margin: 0;
  font-family: var(--font-book);
  font-size: 1rem;
  line-height: 1.6;
  color: var(--ink-soft);
}

/* ============ BOOK SPREAD ============ */
.book {
  display: grid;
  grid-template-columns: 1fr 4px 1fr;
  background: #fffdf6;
  border: 1px solid rgba(43, 50, 64, 0.14);
  border-radius: 6px;
  box-shadow: 0 16px 40px rgba(60, 55, 40, 0.14);
  overflow: hidden;
}
.book__page { padding: clamp(26px, 4vw, 48px); }
.book__page h3 {
  font-family: var(--font-book);
  font-weight: 700;
  font-size: 1.6rem;
  margin: 0 0 18px;
  color: var(--ink);
  border-bottom: 2px solid rgba(43, 50, 64, 0.15);
  padding-bottom: 10px;
}
.book__spine {
  background: linear-gradient(to right, rgba(0,0,0,0.10), rgba(0,0,0,0.02), rgba(0,0,0,0.10));
}
.book__list {
  list-style: none; margin: 0; padding: 0;
  font-family: var(--font-book);
  font-size: 1.02rem;
  color: var(--ink-soft);
}
.book__list li {
  padding: 9px 0 9px 26px;
  position: relative;
  line-height: 1.55;
}
.book__list li::before {
  content: "✓";
  position: absolute; left: 0; top: 9px;
  font-family: var(--font-hand);
  color: var(--accent);
  font-size: 1.1rem;
}

.verdict { max-width: 640px; margin: 40px auto 0; text-align: center; }
.verdict__text {
  font-size: 1.5rem;
  line-height: 1.45;
  color: var(--ink);
  transform: rotate(-0.5deg);
  margin: 0;
  background: linear-gradient(transparent 62%, rgba(240, 205, 90, 0.45) 62%, rgba(240, 205, 90, 0.45) 92%, transparent 92%);
  padding: 0 8px;
  display: inline;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

/* ============ POLAROIDS ============ */
.polaroids {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(26px, 4vw, 48px);
  align-items: flex-start;
}
.polaroid {
  display: block;
  background: #fdfcf7;
  padding: 12px 12px 8px;
  width: min(300px, 100%);
  box-shadow: 0 12px 30px rgba(60, 55, 40, 0.2);
  text-decoration: none;
  transition: transform 0.3s cubic-bezier(0.34, 1.4, 0.64, 1), box-shadow 0.3s;
  position: relative;
}
.polaroid::before {
  content: "";
  position: absolute; top: -12px; left: 50%;
  transform: translateX(-50%) rotate(2deg);
  width: 84px; height: 26px;
  background: var(--tape);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}
.polaroid--tilt-l { transform: rotate(-2deg); }
.polaroid--tilt-r { transform: rotate(1.6deg); }
.polaroid--low { margin-top: 34px; }
.polaroid:hover { transform: rotate(0deg) translateY(-6px); box-shadow: 0 20px 44px rgba(60, 55, 40, 0.26); }
.polaroid img { aspect-ratio: 16 / 11; object-fit: cover; background: #e8e2d2; }
.polaroid__caption {
  display: block;
  text-align: center;
  color: #4c4632;
  font-size: 1.12rem;
  padding: 10px 4px 6px;
}
.paper__more { margin-top: 40px; font-size: 1.05rem; color: var(--ink-soft); }

/* ============ HOMEWORK BOARD ============ */
.homework-board { padding-top: clamp(64px, 10vh, 110px); padding-bottom: 0; }
.homework-board .board__frame { text-align: center; padding-bottom: clamp(48px, 8vh, 90px); }
.homework-board__label { font-size: clamp(1.5rem, 3vw, 2.1rem); margin: 0 0 16px; transform: rotate(-1.5deg); }
.homework-board__title {
  font-family: var(--font-chalk);
  font-weight: 600;
  font-size: clamp(2rem, 5vw, 3.4rem);
  line-height: 1.15;
  margin: 0 auto 18px;
  max-width: 22ch;
  text-shadow: 0 0 12px rgba(244, 241, 230, 0.25);
}
.homework-board__sub {
  color: var(--chalk-dim);
  max-width: 52ch;
  margin: 0 auto 36px;
  font-size: 1.1rem;
}
.homework-board__cta { display: flex; gap: 20px; justify-content: center; flex-wrap: wrap; }
.homework-board__sign {
  margin: 44px 0 0;
  font-size: 1.5rem;
  transform: rotate(-2deg);
}

/* ============ FOOTER ============ */
.tfooter {
  background: var(--paper);
  border-top: 2px solid rgba(43, 50, 64, 0.12);
  text-align: center;
  padding: 26px var(--pad-x);
  font-size: 1rem;
  color: var(--ink-soft);
}
.tfooter p { margin: 0; }

/* ============ REVEAL (GSAP) ============ */
.js .t-reveal { opacity: 0; transform: translateY(26px); }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .js .t-reveal { opacity: 1; transform: none; }
  *, *::before, *::after { transition-duration: 0.01ms !important; animation: none !important; }
}

/* ============ 3D PROPS (desktop only, JS adds .props-on) ============ */
.pencil-stage, .measure { display: none; }

/* --- red pencil: a real hexagonal prism, shaded per face from JS --- */
.props-on .pencil-stage {
  display: block;
  position: absolute;
  right: -10px; bottom: 0;
  width: 320px; height: 280px;
  perspective: 1100px;
  perspective-origin: 50% 30%;
  pointer-events: none;
}
.pencil-ink { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.pencil-ink__word {
  font-family: var(--font-chalk);
  font-weight: 700;
  font-size: 46px;
  fill: var(--accent);
}
.pencil-ink__arrow {
  fill: none;
  stroke: var(--accent);
  stroke-width: 3;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.pencil-shadow {
  position: absolute; left: 0; top: 0;
  width: 290px; height: 12px;
  border-radius: 50%;
  background: rgba(40, 32, 20, 0.55);
  transform-origin: 0 50%;
  will-change: transform, opacity, filter;
}
.pencil3d {
  position: absolute; left: 0; top: 0;
  width: 0; height: 0;
  transform-style: preserve-3d;
  will-change: transform;
}
.p3-face {
  position: absolute;
  backface-visibility: hidden;
  --lit: 1;
}
.p3-face::after {
  content: "";
  position: absolute; inset: 0;
  background: #1c0d06;
  opacity: calc(0.62 - var(--lit) * 0.62);
}
.p3-body {
  background:
    repeating-linear-gradient(to right, transparent 0 5px, rgba(0, 0, 0, 0.18) 5px 6px) right 20px top 0 / 26px 100% no-repeat,
    linear-gradient(to right,
      #c2553a 0, #b0492f calc(100% - 48px),
      #9c9a90 calc(100% - 48px), #e3e1d8 calc(100% - 38px), #a9a79c calc(100% - 20px),
      #e7908a calc(100% - 20px), #d97a74 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), inset 0 -1px 0 rgba(0, 0, 0, 0.2);
}
.p3-tip {
  clip-path: polygon(0 50%, 100% 0, 100% 100%);
  background: linear-gradient(to right, #7c2616 0, #93321f 27%, #ecd0a6 27%, #dfbd8c 100%);
}
.p3-cap {
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: #d97a74;
}

/* --- ruler: a wooden slab with real thickness, lands above the book --- */
.props-on .measure {
  display: block;
  position: relative;
  height: 92px;
  margin: -14px 0 6px;
  perspective: 1200px;
  perspective-origin: 50% 320%;
  pointer-events: none;
}
.measure__ruler {
  position: absolute; left: -14px; top: 4px;
  height: 48px;
  transform-style: preserve-3d;
  transform-origin: 50% 50%;
  will-change: transform;
}
.measure__top {
  position: absolute; inset: 0;
  transform: translateZ(9px);
  border-radius: 3px;
  border: 1px solid rgba(110, 76, 30, 0.45);
  background:
    repeating-linear-gradient(to right, rgba(130, 90, 40, 0.06) 0 2px, transparent 2px 11px),
    linear-gradient(to bottom, #f3e2b6, #e8d09c);
}
.measure__ticks { position: absolute; inset: 0; width: 100%; height: 100%; }
.measure__ticks line { stroke: #4a3a22; stroke-width: 1; }
.measure__ticks text { font-family: var(--font-mono); font-size: 10px; fill: #4a3a22; }
.measure__front {
  position: absolute; left: 0; top: 100%;
  width: 100%; height: 9px;
  transform-origin: top;
  transform: translateZ(9px) rotateX(-90deg);
  background: linear-gradient(to bottom, #c8a767, #a8874d);
}
.measure__end {
  position: absolute; left: 100%; top: 0;
  width: 9px; height: 100%;
  transform-origin: left;
  transform: translateZ(9px) rotateY(90deg);
  background: #b08f53;
}
.measure__shadow {
  position: absolute; left: -10px; top: 12px;
  height: 44px;
  border-radius: 6px;
  background: rgba(60, 45, 20, 0.5);
  will-change: transform, opacity, filter;
}
.measure__dim {
  position: absolute; bottom: 4px; height: 16px;
  width: 0;
  border-left: 2px solid var(--accent);
  border-right: 2px solid var(--accent);
  opacity: 0;
}
.measure__dim::before {
  content: "";
  position: absolute; left: 0; right: 0; top: 50%;
  height: 2px; margin-top: -1px;
  background: var(--accent);
}
.measure__val {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--paper);
  padding: 0 8px;
  white-space: nowrap;
}
.measure__eq {
  position: absolute; bottom: -4px;
  transform: translateX(-50%);
  font-family: var(--font-chalk);
  font-weight: 700;
  font-size: 2.8rem;
  line-height: 1;
  color: var(--accent);
  opacity: 0;
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1360px) {
  .margin-note { display: none; }
}
@media (max-width: 900px) {
  .tnav__links { display: none; }
  .lesson__grid { grid-template-columns: 1fr; gap: 24px; }
  .lesson__visual { max-width: 480px; }
  .stickies { grid-template-columns: repeat(2, 1fr); }
  .cork__grid { grid-template-columns: 1fr; }
  .glossary { grid-template-columns: 1fr; }
  .hero-board__pins {
    position: static;
    flex-direction: row;
    width: auto;
    margin-top: 40px;
    align-items: flex-start;
  }
  .pinned--photo { width: min(200px, 44vw); }
  .pinned--note { width: min(200px, 44vw); }
  .hero-board .board__frame { min-height: 0; }
  .cards { grid-template-columns: 1fr; }
  .book { grid-template-columns: 1fr; }
  .book__spine { height: 4px; background: linear-gradient(to bottom, rgba(0,0,0,0.10), rgba(0,0,0,0.02)); }
  .chalk-doodle { display: none; }

  /* phones and tablets: straight cards and titles read easier than tilted ones */
  .notecard--tilt-l, .notecard--tilt-r,
  .sticky:nth-child(n), .assignment:nth-child(n),
  .polaroid--tilt-l, .polaroid--tilt-r,
  .hand-title, .verdict__text { transform: none; }
}
@media (max-width: 520px) {
  body { font-size: 17px; }
  .stickies { grid-template-columns: 1fr; }
  .sticky { min-height: 0; }
  .lessonmap button { grid-template-columns: 1fr 30px; }
  .lessonmap__num { grid-column: 1 / -1; margin-bottom: -6px; }
  .lesson__head { grid-template-columns: 1fr 40px; }
  .lesson__num { grid-column: 1 / -1; margin-bottom: -10px; }
  .board__frame { border-width: 8px; padding-left: 18px; padding-right: 18px; }
  .homework-board__cta { flex-direction: column; align-items: stretch; }
  .polaroid--low { margin-top: 0; }
}
