/* MATH-helper — a classroom desk with a real-feeling calculator, a spiral notebook and a chalkboard. */
:root {
  --wood1: #a8733f; --wood2: #8d5a2b; --wood3: #6f431d;
  --ink: #1f2a44; --pencil: #3b3b3b; --red: #d2453c; --blue-line: #b9d3ee; --margin: #f08f8f;
  --paper: #fdfcf6; --hl: #fff27a;
  --chalk: #f4f4ec; --board: #2f4a3a; --board2: #264033;
  --hand: 'Noteworthy', 'Patrick Hand', 'Comic Sans MS', 'Chalkboard SE', cursive;
  --chalkfont: 'Chalkboard SE', 'Patrick Hand', 'Comic Sans MS', cursive;
  --chalkhead: 'Chalkduster', 'Fredericka the Great', 'Chalkboard SE', cursive;
  --ui: -apple-system, 'Avenir Next', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--ui); color: #222; overflow-x: hidden;
  background-color: var(--wood2);
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(255, 230, 190, .25), transparent 60%),
    repeating-linear-gradient(92deg, rgba(0,0,0,.0) 0 18px, rgba(0,0,0,.05) 18px 19px, rgba(255,255,255,.03) 19px 40px),
    repeating-linear-gradient(88deg, rgba(60,30,10,.08) 0 3px, transparent 3px 11px, rgba(255,220,170,.05) 11px 13px),
    linear-gradient(180deg, var(--wood1), var(--wood2) 45%, var(--wood3));
  background-attachment: fixed;
}
button { font: inherit; cursor: pointer; }

/* ---------- top shelf ---------- */
.shelf {
  display: flex; align-items: center; gap: 18px; padding: 10px 22px; flex-wrap: wrap;
  background: linear-gradient(#5b3a1e, #3d2611); border-bottom: 4px solid #2a1909;
  box-shadow: 0 6px 18px rgba(0,0,0,.45); position: sticky; top: 0; z-index: 20;
}
.logo { display: flex; flex-direction: column; line-height: 1; }
.logo-board {
  font-family: var(--chalkhead); font-size: 30px; color: var(--chalk); letter-spacing: 1px;
  background: linear-gradient(135deg, #37584a, #244034); padding: 6px 14px 4px; border-radius: 6px;
  border: 5px solid #a4702f; box-shadow: inset 0 0 20px rgba(0,0,0,.45), 0 3px 6px rgba(0,0,0,.4);
  text-shadow: 0 0 2px rgba(255,255,255,.4);
}
.logo-board .dash { color: #ffd65a; }
.logo-sub { font-family: var(--hand); color: #f2dfc0; font-size: 14px; margin-top: 4px; text-align: center; }
.tabs { display: flex; gap: 6px; margin-left: 10px; }
.tab {
  border: 0; padding: 11px 20px 9px; border-radius: 10px 10px 4px 4px; font-weight: 700; font-size: 16px;
  background: linear-gradient(#e7dcc1, #cbbd99); color: #4a3a1c; box-shadow: 0 3px 0 #7b6437, inset 0 1px 0 #fff8;
  transform: translateY(2px); transition: transform .12s;
}
.tab.on { background: linear-gradient(#fffdf3, #f2ead2); color: #1f2a44; transform: translateY(-2px); box-shadow: 0 5px 0 #8a7443, 0 8px 12px rgba(0,0,0,.35); }
.tab:hover { filter: brightness(1.05); }

/* the study radio */
.radio {
  margin-left: auto; display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 14px;
  background: linear-gradient(#c65a3d, #9d3f28); border: 2px solid #6d2616;
  box-shadow: inset 0 2px 0 rgba(255,255,255,.25), inset 0 -3px 0 rgba(0,0,0,.25), 0 4px 10px rgba(0,0,0,.4);
}
.grille { width: 42px; height: 42px; border-radius: 50%; background: radial-gradient(circle, #2a1a14 1.4px, transparent 1.6px) 0 0/5px 5px, radial-gradient(#6a2a1a, #3b1a10); box-shadow: inset 0 2px 5px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.2); }
.dial { width: 170px; height: 42px; border-radius: 6px; background: linear-gradient(#f3e3b4, #d9c38a); box-shadow: inset 0 2px 6px rgba(0,0,0,.45); padding: 4px 8px; font-family: var(--hand); color: #3b2a10; overflow: hidden; }
.dial-top { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; gap: 5px; align-items: center; }
.onair { color: #7b6a4a; font-size: 10px; }
.radio.playing .onair { color: #e3261b; text-shadow: 0 0 6px #ff4a3a; }
.eq { display: flex; gap: 3px; align-items: flex-end; height: 14px; margin-top: 2px; }
.eq i { width: 8px; height: 3px; background: #7a5a26; border-radius: 1px; transition: height .15s; }
.radio.playing .eq i { background: #c2461e; }
.rbtns { display: flex; gap: 4px; }
.rbtns button, .sfx {
  border: 0; width: 30px; height: 30px; border-radius: 8px; color: #fbe9d4; font-size: 13px;
  background: linear-gradient(#5b2a1c, #3e1b10); box-shadow: 0 2px 0 #1c0a05, inset 0 1px 0 rgba(255,255,255,.2);
}
.rbtns .big { width: 36px; font-size: 15px; }
.rbtns button:active, .sfx:active { transform: translateY(2px); box-shadow: 0 0 0 #1c0a05; }
.radio { position: relative; }
.radio.waiting::after {
  content: '🔊 Click anywhere to start the music'; position: absolute; top: calc(100% + 10px); right: 12px; white-space: nowrap;
  background: #fff59a; color: #3a3210; font-family: var(--hand); font-size: 16px; padding: 4px 12px; border-radius: 8px;
  box-shadow: 0 6px 12px rgba(0,0,0,.35); animation: nudge 1.2s ease-in-out infinite; pointer-events: none;
}
@keyframes nudge { 50% { transform: translateY(4px); } }
.sfx.off { opacity: .5; filter: grayscale(1); }
.knob { display: flex; flex-direction: column; align-items: center; font-size: 9px; color: #fbe0c8; font-weight: 800; letter-spacing: 1px; }
.knob input { width: 70px; accent-color: #f3c977; }

.saved { position: fixed; top: 14px; left: 50%; transform: translate(-50%, -60px); z-index: 50; background: #fffbe0; color: #2f6b2f; font-weight: 800; padding: 6px 16px; border-radius: 20px; box-shadow: 0 4px 14px rgba(0,0,0,.35); transition: transform .35s; font-size: 13px; letter-spacing: 1px; }
.saved.show { transform: translate(-50%, 0); }

main { padding: 22px; }
.view { display: none; }
.view.on { display: flex; gap: 26px; align-items: flex-start; justify-content: center; animation: viewin .3s ease; }
@keyframes viewin { from { opacity: 0; transform: translateY(8px); } }

/* ---------- the calculator ---------- */
.deskleft { display: flex; flex-direction: column; align-items: center; gap: 22px; flex: 0 0 auto; }
.calc {
  width: 372px; padding: 18px 18px 14px; border-radius: 26px 26px 44px 44px; position: relative;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .07 0'/%3E%3C/filter%3E%3Crect width='120' height='120' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(160deg, #474b53 0%, #33363c 35%, #25272c 100%);
  box-shadow:
    0 30px 40px rgba(0,0,0,.55), 0 8px 12px rgba(0,0,0,.4),
    inset 0 2px 1px rgba(255,255,255,.18), inset 0 -4px 6px rgba(0,0,0,.5), inset 3px 0 4px rgba(255,255,255,.05), inset -3px 0 4px rgba(0,0,0,.3);
  transform: rotate(-1.2deg); user-select: none; -webkit-user-select: none;
}
.calc::before { /* silver edge */
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
  box-shadow: inset 0 0 0 2px rgba(190, 195, 205, .35);
}
.calc-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.brand b { display: block; color: #e3e6ec; font-size: 17px; font-style: italic; letter-spacing: .5px; text-shadow: 0 1px 0 #000; }
.brand i { color: #a9b0bd; font-size: 10px; letter-spacing: 1.5px; font-style: normal; }
.solar { display: flex; gap: 2px; padding: 3px; background: #15161a; border-radius: 3px; box-shadow: inset 0 1px 2px #000, 0 1px 0 rgba(255,255,255,.15); }
.solar span { width: 24px; height: 18px; background: linear-gradient(135deg, #4c3b37 0%, #2b1f1f 40%, #3e302d 55%, #231a1a 100%); position: relative; }
.solar span::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(90deg, transparent 0 5px, rgba(255,255,255,.08) 5px 6px); }
.bezel { background: linear-gradient(#1b1c20, #2b2d33); padding: 10px; border-radius: 12px 12px 18px 18px; box-shadow: inset 0 3px 6px rgba(0,0,0,.8), 0 1px 0 rgba(255,255,255,.15); margin-bottom: 14px; }
.lcd {
  height: 116px; border-radius: 4px; position: relative; overflow: hidden; padding: 4px 8px;
  background: linear-gradient(175deg, #d4dcc3 0%, #c1cbb0 55%, #b3bfa1 100%);
  box-shadow: inset 0 3px 8px rgba(0,0,0,.45), inset 0 -1px 0 rgba(255,255,255,.4);
}
.lcd::after { /* glass glare */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(115deg, rgba(255,255,255,.38) 0%, rgba(255,255,255,.08) 28%, transparent 29%, transparent 70%, rgba(255,255,255,.06) 100%);
}
.ind { display: flex; gap: 10px; font-size: 10px; font-weight: 700; color: #26301d; height: 13px; }
.ind span { opacity: .06; }
.ind span.on { opacity: .85; }
.ind .batt { margin-left: auto; opacity: .7; letter-spacing: -2px; }
.line1 { height: 32px; overflow: hidden; white-space: nowrap; position: relative; margin-top: 2px; }
.dots {
  font-family: Menlo, 'DejaVu Sans Mono', Consolas, monospace; font-size: 24px; line-height: 32px; color: #1c2416; font-weight: 700;
  -webkit-mask-image: radial-gradient(circle at center, #000 55%, transparent 62%); -webkit-mask-size: 2.6px 2.6px;
  mask-image: radial-gradient(circle at center, #000 55%, transparent 62%); mask-size: 2.6px 2.6px;
  display: inline-block; padding-right: 20px; position: relative;
}
.dots .cur { display: inline-block; width: 3px; height: 24px; background: #1c2416; vertical-align: -4px; margin: 0 -1.5px; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.line2 { display: flex; align-items: flex-end; justify-content: flex-end; height: 58px; position: relative; }
.xlab { position: absolute; left: 0; bottom: 6px; font-family: Menlo, monospace; font-weight: 700; font-size: 20px; color: #1c2416; }
.seg { height: 52px; width: 100%; transform: skewX(-7deg); }
.seg .s { fill: #1a2214; }
.seg .s.off { fill: #1a2214; opacity: .055; }
.lcd.err .seg .s:not(.off) { animation: none; }

.fkeys { display: grid; grid-template-columns: repeat(6, 1fr); gap: 13px 8px; margin-bottom: 14px; }
.nkeys { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px 10px; }
.kw { position: relative; display: flex; flex-direction: column; align-items: center; }
.kw .gold { font-size: 9.5px; color: #e0b13f; height: 12px; line-height: 12px; font-weight: 700; white-space: nowrap; letter-spacing: -.2px; }
.k {
  width: 100%; border: 0; color: #f3f4f7; font-weight: 600; position: relative;
  border-radius: 9px 9px 12px 12px; height: 34px; font-size: 14px;
  background: linear-gradient(180deg, #6a6e77 0%, #4a4d55 45%, #3b3e45 100%);
  box-shadow: 0 3px 0 #16171a, 0 5px 6px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.3), inset 0 -2px 2px rgba(0,0,0,.3);
  transition: transform .04s, box-shadow .04s; text-shadow: 0 -1px 0 rgba(0,0,0,.5);
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.nkeys .k { height: 44px; font-size: 20px; border-radius: 10px 10px 14px 14px; background: linear-gradient(180deg, #5c6069 0%, #40434a 50%, #34363c 100%); }
.k.num { background: linear-gradient(180deg, #f3f3f1 0%, #dcdcd8 50%, #c9c9c4 100%); color: #202226; text-shadow: 0 1px 0 #fff; box-shadow: 0 3px 0 #7a7a76, 0 5px 6px rgba(0,0,0,.55), inset 0 1px 0 #fff, inset 0 -2px 2px rgba(0,0,0,.15); }
.k.orange { background: linear-gradient(180deg, #f39a4a 0%, #e0712a 50%, #c65c1c 100%); box-shadow: 0 3px 0 #7a3309, 0 5px 6px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.45); font-size: 16px; }
.k.blue { background: linear-gradient(180deg, #5d9ee8 0%, #2f73c9 50%, #245ea8 100%); box-shadow: 0 3px 0 #12325d, 0 5px 6px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.4); font-size: 24px; }
.k.shift { color: #f5c542; }
.k.shift.on { background: linear-gradient(180deg, #e8b83a, #b88a16); color: #2a1e00; text-shadow: none; }
.k.var { color: #ff9ec2; font-style: italic; font-family: Georgia, serif; font-size: 17px; }
.k.down, .k:active { transform: translateY(3px); box-shadow: 0 0 0 #16171a, 0 1px 2px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.2) !important; }
.k sup { font-size: 9px; }
.calc-foot { text-align: center; color: #6f7582; font-size: 9px; letter-spacing: 3px; margin-top: 14px; font-weight: 700; }

/* sticky note */
.sticky {
  width: 330px; padding: 18px 18px 14px; background: linear-gradient(#fff59a, #ffe96a); position: relative; transform: rotate(1.5deg);
  box-shadow: 0 12px 18px rgba(0,0,0,.35); font-family: var(--hand); color: #3a3210;
}
.sticky .tape { position: absolute; top: -12px; left: 50%; width: 90px; height: 24px; transform: translateX(-50%) rotate(-3deg); background: rgba(255,255,255,.55); box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.sticky h4 { margin: 0 0 8px; font-size: 20px; font-weight: 400; }
#examples { display: flex; flex-wrap: wrap; gap: 6px; }
#examples button { border: 0; background: rgba(255,255,255,.45); padding: 3px 9px; border-radius: 12px; font-family: var(--hand); font-size: 16px; color: #1f2a44; }
#examples button:hover { background: #fff; }

/* ---------- the notebook ---------- */
.notebook { flex: 1 1 560px; max-width: 760px; position: relative; padding-left: 26px; min-width: 0; }
.rings { position: absolute; left: 0; top: 30px; bottom: 30px; width: 40px; z-index: 3; background: repeating-linear-gradient(180deg, transparent 0 18px, #9aa0a8 18px 20px, #e8ebee 20px 23px, #7d838b 23px 26px, transparent 26px 44px); -webkit-mask: linear-gradient(90deg, #000 70%, transparent); border-radius: 6px; }
.nb-tabs { display: flex; gap: 4px; margin-left: 40px; position: relative; z-index: 1; }
.nbt { border: 0; padding: 7px 16px 6px; border-radius: 10px 10px 0 0; font-family: var(--hand); font-size: 18px; background: #d7e3f1; color: #3b4a66; box-shadow: inset 0 -3px 4px rgba(0,0,0,.08); }
.nbt.on { background: var(--paper); color: var(--ink); }
.page {
  min-height: 640px; padding: 22px 26px 30px 76px; position: relative; font-family: var(--hand); color: var(--ink); font-size: 19px; line-height: 32px;
  background-color: var(--paper);
  background-image:
    linear-gradient(90deg, transparent 58px, var(--margin) 58px, var(--margin) 60px, transparent 60px),
    repeating-linear-gradient(180deg, transparent 0 31px, var(--blue-line) 31px 32px);
  background-position: 0 6px;
  border-radius: 3px 8px 8px 3px;
  box-shadow: 0 18px 30px rgba(0,0,0,.4), 0 2px 0 #e8e3cf, 0 4px 0 #f6f2e2, 0 6px 0 #e3ddc6, inset 30px 0 30px -30px rgba(0,0,0,.25);
}
.page::before { /* punched holes */
  content: ''; position: absolute; left: 14px; top: 20px; bottom: 20px; width: 16px;
  background: radial-gradient(circle at 8px 8px, #6b4526 6px, rgba(0,0,0,.3) 7px, transparent 7.5px) 0 0 / 16px 44px;
}
.nb-empty { color: #8190a8; }
.nb-empty h3 { font-family: var(--hand); font-weight: 400; font-size: 28px; color: var(--ink); margin: 0 0 0; line-height: 64px; }
.nb-empty .arrowdoodle { font-size: 36px; display: inline-block; transform: rotate(-10deg); }
.nb-title { font-size: 26px; margin: 0; line-height: 64px; font-weight: 400; color: var(--red); }
.nb-title small { color: #7a86a0; font-size: 16px; margin-left: 8px; }
.probline { font-size: 22px; }
.m { font-family: var(--hand); white-space: nowrap; }
.m sup { font-size: .7em; line-height: 0; }
.answerbox { display: inline-block; margin: 6px 0 14px; padding: 4px 14px; font-size: 26px; line-height: 50px; position: relative; }
.answerbox::before { content: ''; position: absolute; inset: 6px -4px 4px; background: var(--hl); z-index: 0; transform: skew(-8deg) rotate(-.6deg); border-radius: 4px 12px 6px 10px; opacity: .85; }
.answerbox > * { position: relative; }
.answerbox b { color: #c0392b; font-weight: 400; }
.frac { display: inline-flex; flex-direction: column; vertical-align: middle; text-align: center; line-height: 1.05; margin: 0 3px; font-size: .92em; }
.frac > span:first-child { border-bottom: 2px solid currentColor; padding: 0 4px 1px; }
.frac > span:last-child { padding: 1px 4px 0; }
ol.steps { list-style: none; padding: 0; margin: 0; counter-reset: st; }
.step { position: relative; padding: 6px 0 10px 0; opacity: 0; transform: translateX(-8px); animation: write .45s ease forwards; animation-delay: var(--d); }
@keyframes write { to { opacity: 1; transform: none; } }
.step::before { counter-increment: st; content: counter(st); position: absolute; left: -46px; top: 8px; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--red); color: var(--red); text-align: center; line-height: 27px; font-size: 18px; transform: rotate(-6deg); }
.rule { color: #2a7a4a; font-size: 17px; line-height: 28px; }
.mathline { font-size: 22px; line-height: 38px; overflow-x: auto; overflow-y: hidden; white-space: nowrap; padding: 2px 0; }
.mathline .to { color: var(--red); margin: 0 10px; }
.hl { background: linear-gradient(transparent 20%, rgba(255, 150, 190, .55) 20%, rgba(255, 150, 190, .55) 88%, transparent 88%); border-radius: 4px; padding: 0 2px; }
.hl.new { background: linear-gradient(transparent 20%, rgba(130, 220, 160, .6) 20%, rgba(130, 220, 160, .6) 88%, transparent 88%); }
.why { margin: 0; color: #394866; font-size: 18px; line-height: 28px; }
details.method { margin-top: 4px; }
details.method summary { cursor: pointer; color: #2f62b0; font-size: 17px; line-height: 30px; list-style: none; }
details.method summary::-webkit-details-marker { display: none; }
details.method summary::before { content: '✏️ '; }
details.method[open] summary { color: #7a86a0; }
.paper { margin: 6px 0 4px; padding: 12px 14px; background: #fff; border: 1px solid #dfe6ee; border-radius: 6px; box-shadow: 0 3px 8px rgba(0,0,0,.08); display: inline-block; max-width: 100%; overflow-x: auto; }
.grid { font-family: Menlo, 'Courier New', monospace; font-size: 20px; line-height: 1; display: inline-block;
  background-image: linear-gradient(#e7eef6 1px, transparent 1px), linear-gradient(90deg, #e7eef6 1px, transparent 1px); background-size: 26px 30px; padding: 2px; }
.gr { display: flex; }
.gc { width: 26px; height: 30px; display: flex; align-items: center; justify-content: center; position: relative; color: #22314f; }
.gc.carry { color: var(--red); font-size: 13px; align-items: flex-end; }
.gc.ul { border-bottom: 2px solid #22314f; }
.gc.ans { color: #1a7a3a; font-weight: 700; }
.gc.strike::after { content: ''; position: absolute; left: 4px; right: 4px; top: 50%; border-top: 2px solid var(--red); transform: rotate(-35deg); }
.gc.zero { color: #9aa6ba; }
.gc.bracket { font-size: 30px; color: #22314f; }
.gc.over { border-top: 2px solid #22314f; }
.gc.rem { color: #c0392b; font-weight: 700; }
.mnote { margin: 8px 0 0; padding-left: 22px; font-size: 16px; line-height: 24px; color: #394866; }
.errnote { color: #c0392b; font-size: 22px; }
.errnote .big { font-size: 30px; }
.hist-item { display: flex; justify-content: space-between; gap: 12px; border: 0; background: none; width: 100%; text-align: left; font-family: var(--hand); font-size: 20px; line-height: 32px; color: var(--ink); padding: 0 6px; border-radius: 6px; }
.hist-item:hover { background: rgba(255, 242, 122, .5); }
.hist-item span:last-child { color: #2a7a4a; }

/* ---------- practice ---------- */
#view-practice.on { flex-direction: column; align-items: stretch; max-width: 1400px; margin: 0 auto; }
.pbar { overflow-x: auto; padding-bottom: 4px; }
.topics { display: flex; gap: 10px; }
.topic {
  flex: 0 0 auto; border: 0; padding: 10px 14px 8px; border-radius: 4px 10px 10px 4px; text-align: left; min-width: 118px;
  color: #fff; font-weight: 700; font-size: 14px; position: relative;
  box-shadow: inset 6px 0 0 rgba(0,0,0,.25), 0 4px 0 rgba(0,0,0,.35), 0 6px 10px rgba(0,0,0,.3); transition: transform .12s;
}
.topic small { display: block; font-weight: 500; opacity: .85; font-size: 11px; margin-top: 2px; }
.topic .gr8 { position: absolute; right: 6px; top: 5px; font-size: 12px; background: rgba(255,255,255,.9); color: #333; border-radius: 8px; padding: 0 5px; }
.topic.on { transform: translateY(-5px); outline: 3px solid #fff5b0; }
.classroom { display: flex; gap: 26px; align-items: flex-start; margin-top: 16px; }
.boardwrap { flex: 1 1 620px; min-width: 0; }
.board {
  position: relative; padding: 26px 34px 58px; border-radius: 6px; min-height: 470px;
  background:
    radial-gradient(ellipse at 30% 40%, rgba(255,255,255,.07), transparent 60%),
    radial-gradient(ellipse at 75% 70%, rgba(255,255,255,.05), transparent 50%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.6' numOctaves='3'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='200' height='200' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(160deg, var(--board), var(--board2));
  border: 16px solid #9a6431; border-image: linear-gradient(135deg, #b98046, #7c4a1e 40%, #a76d36 70%, #6a3c16) 1;
  box-shadow: 0 20px 34px rgba(0,0,0,.5), inset 0 0 60px rgba(0,0,0,.45);
  color: var(--chalk); font-family: var(--chalkfont);
}
.board-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-family: var(--chalkhead); font-size: 26px; color: #fff7c0; }
.levels { display: flex; gap: 6px; font-family: var(--chalkfont); }
.lvl { border: 2px solid rgba(255,255,255,.55); background: transparent; color: var(--chalk); border-radius: 18px; padding: 3px 14px; font-size: 15px; }
.lvl.on { background: rgba(255,255,255,.88); color: var(--board); }
.problem { font-size: 66px; text-align: center; margin: 34px 0 26px; min-height: 90px; letter-spacing: 1px; text-shadow: 0 0 3px rgba(255,255,255,.35); line-height: 1.25; word-break: break-word; }
.problem.write { animation: chalkin .6s ease; }
@keyframes chalkin { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.problem .frac > span:first-child { border-bottom-width: 3px; }
.answer { display: flex; align-items: center; justify-content: center; gap: 12px; flex-wrap: wrap; font-size: 26px; }
.answer input {
  font-family: var(--chalkfont); font-size: 34px; width: 240px; text-align: center; color: #fff; background: rgba(255,255,255,.06);
  border: 0; border-bottom: 3px dashed rgba(255,255,255,.7); padding: 4px 8px; outline: none; border-radius: 6px 6px 0 0;
}
.answer input:focus { background: rgba(255,255,255,.12); }
.answer input::placeholder { color: rgba(255,255,255,.3); }
.chalkbtn { border: 2px solid rgba(255,255,255,.7); background: rgba(255,255,255,.08); color: var(--chalk); font-family: var(--chalkfont); font-size: 19px; border-radius: 26px; padding: 7px 18px; transition: background .12s, transform .06s; }
.chalkbtn:hover { background: rgba(255,255,255,.18); }
.chalkbtn:active { transform: scale(.96); }
.chalkbtn.primary { background: #f6f3d8; color: #25402f; border-color: #f6f3d8; font-weight: 700; }
.chalkbtn.danger { color: #c0392b; border-color: #c0392b; background: #fff; margin-top: 14px; }
.feedback { text-align: center; min-height: 48px; font-size: 26px; margin: 16px 0 8px; }
.feedback.good { color: #b8f5a0; }
.feedback.bad { color: #ffb4a8; }
.feedback.hint { color: #ffe98a; font-size: 21px; }
.feedback .pop { display: inline-block; animation: pop .45s cubic-bezier(.3,1.8,.5,1); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }
.bbtns { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.tray { position: absolute; left: -16px; right: -16px; bottom: -30px; height: 22px; background: linear-gradient(#b27a42, #7c4a1e); border-radius: 0 0 6px 6px; box-shadow: 0 8px 12px rgba(0,0,0,.4); }
.chalk { position: absolute; top: -4px; height: 9px; width: 46px; border-radius: 4px; }
.chalk.w { left: 16%; background: linear-gradient(#fff, #d8d8d0); }
.chalk.y { left: 23%; width: 30px; background: linear-gradient(#fff4a0, #d9c95c); transform: rotate(4deg); }
.chalk.p { left: 29%; width: 22px; background: linear-gradient(#ffc4dc, #d98cab); }
.eraser { position: absolute; right: 12%; top: -14px; width: 78px; height: 20px; border-radius: 4px; background: linear-gradient(#caa071 0 55%, #3a3a3a 55%); box-shadow: 0 3px 4px rgba(0,0,0,.4); }
.scores { display: flex; gap: 12px; margin-top: 48px; flex-wrap: wrap; align-items: stretch; }
.score { background: var(--paper); border-radius: 8px; padding: 6px 16px; text-align: center; font-family: var(--hand); box-shadow: 0 5px 10px rgba(0,0,0,.3); transform: rotate(-1deg); min-width: 92px; }
.score:nth-child(2n) { transform: rotate(1.3deg); }
.score b { display: block; font-size: 28px; color: var(--ink); font-weight: 400; }
.score span { font-size: 15px; color: #5a6680; }
.score.bump { animation: bump .5s ease; }
@keyframes bump { 40% { transform: scale(1.25) rotate(-3deg); } }
.report-btn { margin-left: auto; border: 0; background: linear-gradient(#fdfbee, #efe6c4); font-family: var(--hand); font-size: 19px; padding: 6px 18px; border-radius: 8px; box-shadow: 0 5px 10px rgba(0,0,0,.3); color: var(--ink); }
#pNote .page { min-height: 560px; }

.modal { position: fixed; inset: 0; background: rgba(20,12,4,.6); display: flex; align-items: center; justify-content: center; z-index: 60; padding: 16px; }
.modal[hidden] { display: none; }
.card { background: #fffdf2; border-radius: 6px; width: min(520px, 100%); max-height: 90vh; overflow: auto; padding: 22px 26px; position: relative; font-family: var(--hand); box-shadow: 0 30px 60px rgba(0,0,0,.5); border-top: 10px solid #2f62b0; }
.card h2 { margin: 0; font-family: var(--chalkhead); font-weight: 400; color: #2f62b0; font-size: 30px; }
.rc-sub { margin: 0 0 12px; color: #7a86a0; }
.card .x { position: absolute; right: 12px; top: 10px; border: 0; background: none; font-size: 22px; color: #888; }
#rcTable { width: 100%; border-collapse: collapse; font-size: 18px; }
#rcTable td, #rcTable th { border-bottom: 1px solid var(--blue-line); padding: 4px 6px; text-align: left; }
#rcTable th { color: #7a86a0; font-weight: 400; }
#rcTable .g { font-size: 26px; color: #c0392b; text-align: center; width: 60px; }
.rc-foot { margin-top: 12px; font-size: 18px; }
#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 70; overflow: hidden; }
#confetti i { position: absolute; top: -20px; width: 10px; height: 14px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); } }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .view.on { flex-direction: column; align-items: center; }
  .notebook { width: 100%; max-width: 760px; flex-basis: auto; }
  .classroom { flex-direction: column; align-items: stretch; }
  #pNote { max-width: none; }
}
@media (max-width: 700px) {
  main { padding: 12px 10px 30px; }
  .shelf { padding: 8px 12px; gap: 10px; position: static; }
  .logo-board { font-size: 22px; }
  .logo-sub { display: none; }
  .tabs { margin-left: 0; }
  .tab { padding: 9px 12px 7px; font-size: 14px; }
  .radio { margin-left: 0; width: 100%; justify-content: space-between; gap: 6px; padding: 6px 8px; }
  .grille { display: none; }
  .dial { flex: 1; width: auto; min-width: 0; }
  .knob input { width: 54px; }
  .calc { width: min(372px, 100%); transform: none; padding: 14px 12px 12px; }
  .fkeys { gap: 11px 5px; }
  .nkeys { gap: 12px 7px; }
  .kw .gold { font-size: 8px; }
  .sticky { width: 100%; transform: none; }
  .notebook { padding-left: 14px; }
  .rings { width: 26px; }
  .page { padding: 18px 12px 24px 56px; font-size: 17px; min-height: 360px; }
  .page::before { left: 8px; }
  .page { background-image: linear-gradient(90deg, transparent 44px, var(--margin) 44px, var(--margin) 46px, transparent 46px), repeating-linear-gradient(180deg, transparent 0 31px, var(--blue-line) 31px 32px); }
  .step::before { left: -40px; width: 26px; height: 26px; line-height: 23px; font-size: 15px; }
  .mathline { font-size: 19px; }
  .board { padding: 18px 16px 50px; min-height: 0; border-width: 10px; }
  .board-head { font-size: 20px; }
  .problem { font-size: 42px; margin: 22px 0 18px; min-height: 60px; }
  .answer input { width: 170px; font-size: 28px; }
  .scores { margin-top: 42px; }
  .score { min-width: 70px; padding: 4px 10px; }
  .report-btn { margin-left: 0; }
}

/* ---------- text you can select and copy ---------- */
/* nothing gets highlighted when you click or drag — only the typing boxes can be selected */
*, *::before, *::after { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
input, textarea, select { -webkit-user-select: text; user-select: text; }
img, svg, canvas { -webkit-user-drag: none; }
.copy { vertical-align: middle; border: 1px solid #c9d4e4; background: #fff; border-radius: 14px; font-family: var(--hand); font-size: 15px; padding: 1px 10px; color: #2f62b0; margin-left: 6px; }
.copy:hover { background: #eef4ff; }

/* ---------- how people get it wrong ---------- */
.oops { margin: 10px 0 0 -8px; padding: 6px 14px 8px; border: 2px dashed #e0a4a0; border-radius: 10px; background: rgba(255, 235, 232, .55); opacity: 0; animation: write .45s ease forwards; animation-delay: var(--d); }
.oops h4 { margin: 0; font-weight: 400; font-size: 21px; color: #c0392b; line-height: 32px; }
.oops ul { margin: 0; padding-left: 4px; list-style: none; }
.oops li { font-size: 18px; line-height: 28px; color: #394866; margin: 2px 0 6px; }
.oops s { color: #c0392b; text-decoration-thickness: 2px; font-size: 21px; }
.oops li span { color: #c0392b; margin: 0 4px; }
.trylist { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.trylist button { border: 1px solid #c9d4e4; background: #fff; padding: 2px 12px; border-radius: 16px; font-family: var(--hand); font-size: 19px; color: var(--ink); }
.trylist button:hover { background: var(--hl); }

/* ---------- Draw mode ---------- */
.drawwrap { flex: 1 1 640px; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.drawtools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tool { border: 0; padding: 8px 14px; border-radius: 10px; font-weight: 700; font-size: 15px; color: #4a3a1c; background: linear-gradient(#f5ecd4, #d9caa4); box-shadow: 0 3px 0 #8a7443, 0 5px 8px rgba(0,0,0,.3); }
.tool.on { background: linear-gradient(#fff9dc, #ffe98a); outline: 2px solid #fff5b0; }
.tool:active { transform: translateY(2px); box-shadow: 0 1px 0 #8a7443; }
.tool.go { background: linear-gradient(#6fb0f5, #2f73c9); color: #fff; box-shadow: 0 3px 0 #173e70, 0 5px 8px rgba(0,0,0,.3); }
.tool.small { font-size: 13px; padding: 5px 10px; }
.timer { position: relative; width: 44px; height: 44px; margin-left: auto; }
.timer svg { width: 44px; height: 44px; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 4; }
.timer .bg { stroke: rgba(255,255,255,.25); }
.timer .fg { stroke: #ffe98a; stroke-linecap: round; transition: stroke-dashoffset .1s linear; }
.timer span { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff6d8; font-weight: 800; font-size: 15px; }
.timer:not(.on) { opacity: .55; }
.drawpaper {
  position: relative; flex: 1; min-height: 420px; border-radius: 4px; overflow: hidden; cursor: crosshair; touch-action: none;
  background-color: #fbfcf8;
  background-image: linear-gradient(#dfe9f3 1px, transparent 1px), linear-gradient(90deg, #dfe9f3 1px, transparent 1px), linear-gradient(#c3d5e8 1px, transparent 1px), linear-gradient(90deg, #c3d5e8 1px, transparent 1px);
  background-size: 22px 22px, 22px 22px, 110px 110px, 110px 110px;
  box-shadow: 0 18px 30px rgba(0,0,0,.4), 0 2px 0 #e8e3cf, 0 4px 0 #f6f2e2;
}
.drawpaper.erasing { cursor: cell; }
.drawpaper canvas { position: absolute; inset: 0; display: block; }
.drawhint { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; pointer-events: none; font-family: var(--hand); font-size: 34px; color: #9aabc2; transition: opacity .3s; padding: 20px; }
.drawhint small { font-size: 19px; margin-top: 6px; }
.drawstatus { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%) translateY(20px); opacity: 0; transition: .25s; pointer-events: none; background: #fff59a; color: #3a3210; font-family: var(--hand); font-size: 18px; padding: 4px 14px; border-radius: 10px; box-shadow: 0 5px 10px rgba(0,0,0,.25); white-space: nowrap; }
.drawstatus.on { opacity: 1; transform: translateX(-50%); }
.readback { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; color: #fff3da; font-family: var(--hand); font-size: 20px; }
.readback b { font-weight: 400; background: rgba(0,0,0,.2); padding: 2px 12px; border-radius: 8px; min-width: 60px; }

/* ---------- desktop: everything fits on one screen ---------- */
body.fitted { height: 100vh; overflow: hidden; display: flex; flex-direction: column; }
body.fitted .shelf { position: relative; }
body.fitted main { flex: 1; min-height: 0; padding: 14px 22px 18px; }
body.fitted .view.on { height: 100%; }
body.fitted #view-calc .deskleft { height: 100%; justify-content: flex-start; }
body.fitted #view-calc .deskleft { flex-direction: row; align-items: flex-start; gap: 20px; }
body.fitted .sidecol { width: 250px; }
body.fitted .sticky { width: 100%; }
body.fitted .notebook { height: 100%; display: flex; flex-direction: column; }
body.fitted .page { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; }
body.fitted #view-practice.on { display: flex; }
body.fitted .classroom { flex: 1; min-height: 0; }
body.fitted .classroom > .notebook { height: 100%; }
body.fitted #pNote .page { min-height: 0; }
body.fitted #view-draw .drawwrap { height: 100%; }
body.fitted .drawpaper { min-height: 0; }
.page::-webkit-scrollbar { width: 10px; }
.page::-webkit-scrollbar-thumb { background: #c9d4e4; border-radius: 6px; border: 2px solid var(--paper); }
.nb-tabs { align-items: flex-end; }
.zoomBtn { margin-left: auto; margin-bottom: 4px; border: 0; background: linear-gradient(#fff59a, #ffe25a); color: #3a3210; font-family: var(--hand); font-size: 17px; padding: 4px 14px; border-radius: 10px; box-shadow: 0 3px 8px rgba(0,0,0,.3); animation: nudge 1.6s ease-in-out 2; }
.zoomBtn[hidden] { display: none; }

/* the paper blown up to fill the whole screen */
.notebook.zoomed { position: fixed !important; inset: 0; z-index: 90; max-width: none !important; width: auto !important; height: auto !important; padding: 16px 20px 16px 46px; display: flex; flex-direction: column;
  background: rgba(40, 24, 10, .75); backdrop-filter: blur(3px); }
.notebook.zoomed .rings { left: 20px; top: 70px; bottom: 30px; }
.notebook.zoomed .page { flex: 1; min-height: 0 !important; overflow-y: auto; font-size: 23px; line-height: 38px; padding-left: 90px;
  background-image: linear-gradient(90deg, transparent 68px, var(--margin) 68px, var(--margin) 70px, transparent 70px), repeating-linear-gradient(180deg, transparent 0 37px, var(--blue-line) 37px 38px); }
.notebook.zoomed .mathline { font-size: 28px; line-height: 46px; }
.notebook.zoomed .why, .notebook.zoomed .oops li { font-size: 22px; line-height: 34px; }
.notebook.zoomed .answerbox { font-size: 32px; }
.notebook.zoomed .step::before { left: -54px; }
body.paperzoom { overflow: hidden; }
@media (max-width: 1100px) {
  .page { max-height: 78vh; overflow-y: auto; }
  .drawwrap { width: 100%; }
  .drawpaper { min-height: 60vh; }
}
@media (max-width: 700px) {
  .drawhint { font-size: 24px; }
  .notebook.zoomed { padding: 8px 8px 8px 22px; }
  .notebook.zoomed .page { padding-left: 60px; font-size: 19px; background-image: linear-gradient(90deg, transparent 44px, var(--margin) 44px, var(--margin) 46px, transparent 46px), repeating-linear-gradient(180deg, transparent 0 37px, var(--blue-line) 37px 38px); }
}

/* ---------- grade picker ---------- */
.sidecol { display: flex; flex-direction: column; gap: 22px; width: 330px; max-width: 100%; }
.sticky h4 small { font-size: 14px; color: #7a6a2a; }
.gradecard { background: var(--paper); border-radius: 6px; padding: 12px 14px 10px; font-family: var(--hand); color: var(--ink); box-shadow: 0 10px 16px rgba(0,0,0,.35); transform: rotate(-1deg); position: relative;
  background-image: repeating-linear-gradient(180deg, transparent 0 25px, var(--blue-line) 25px 26px); border-top: 8px solid #2f62b0; }
.gradecard h4 { margin: 0 0 6px; font-weight: 400; font-size: 21px; }
.grades { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.gbtn { border: 2px solid #b9cbe2; background: #fff; border-radius: 50%; aspect-ratio: 1; font-family: var(--hand); font-size: 17px; color: var(--ink); padding: 0; display: flex; align-items: center; justify-content: center; }
.gbtn:hover { border-color: #2f62b0; }
.gbtn.on { background: #2f62b0; color: #fff; border-color: #2f62b0; transform: scale(1.12); box-shadow: 0 3px 6px rgba(0,0,0,.3); }
.gradecard p { margin: 8px 0 0; font-size: 15px; line-height: 20px; color: #4a5878; }
.topic.dim { filter: grayscale(.85) brightness(.8); opacity: .55; }
.topic.mine::after { content: '★ your grade'; position: absolute; left: 8px; bottom: -9px; font-size: 10px; background: #fff59a; color: #5a4a10; border-radius: 6px; padding: 0 6px; box-shadow: 0 2px 3px rgba(0,0,0,.3); }

/* ---------- help ---------- */
.helpbtn { border: 0; font-weight: 800; font-size: 15px; padding: 9px 14px; border-radius: 20px; color: #1f2a44; background: linear-gradient(#fffbe6, #f0e2b0); box-shadow: 0 3px 0 #8a7443, 0 5px 10px rgba(0,0,0,.35); margin-left: auto; }
.helpbtn:hover { filter: brightness(1.05); }
.helpbtn + .radio { margin-left: 0; }
.helpcard { width: min(720px, 100%); }
.helpcard h3 { font-weight: 400; margin: 14px 0 2px; font-size: 22px; color: #c0392b; }
.helpcard ul { margin: 0; padding-left: 20px; }
.helpcard li { font-size: 17px; line-height: 24px; margin: 3px 0; color: #2a3656; }

/* ---------- school supplies ---------- */
.shelfdeco { display: flex; align-items: flex-end; gap: 16px; align-self: flex-end; margin-bottom: -10px; margin-left: 20px; pointer-events: none; }
.crayonbox { position: relative; width: 70px; height: 34px; background: linear-gradient(#ffd23f, #e8b400); border-radius: 3px 3px 2px 2px; box-shadow: 0 3px 5px rgba(0,0,0,.4); display: flex; justify-content: center; }
.crayonbox b { position: absolute; bottom: 5px; left: 0; right: 0; text-align: center; font-size: 9px; letter-spacing: 1px; color: #2f7a2f; font-weight: 900; }
.crayonbox::before { content: ''; position: absolute; left: 6px; right: 6px; top: 9px; height: 7px; background: #2f9a4a; border-radius: 3px; }
.cr { position: relative; top: -22px; width: 10px; height: 34px; margin: 0 1px; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 70%, black), var(--c) 45%, color-mix(in srgb, var(--c) 70%, white) 60%, var(--c)); z-index: -1; }
.cr::before { content: ''; position: absolute; top: -9px; left: 0; width: 10px; height: 10px; background: inherit; clip-path: polygon(50% 0, 100% 100%, 0 100%); }
.cr:nth-child(2n) { top: -16px; }
.apple { position: relative; width: 40px; height: 36px; border-radius: 48% 48% 44% 44%; background: radial-gradient(circle at 32% 30%, #ff8a80 0 10%, #e53935 35%, #a31515 100%); box-shadow: 0 4px 5px rgba(0,0,0,.4); }
.apple::before { content: ''; position: absolute; top: -8px; left: 18px; width: 3px; height: 11px; background: #5a3a1a; border-radius: 2px; transform: rotate(8deg); }
.apple .leaf { position: absolute; top: -9px; left: 21px; width: 14px; height: 8px; background: linear-gradient(#6fc24a, #3a8a2a); border-radius: 0 100% 0 100%; }
.books { display: flex; align-items: flex-end; gap: 1px; }
.books i { width: 18px; height: var(--h); background: linear-gradient(90deg, color-mix(in srgb, var(--c) 70%, black), var(--c) 30%, var(--c) 80%, color-mix(in srgb, var(--c) 70%, black)); border-radius: 2px; writing-mode: vertical-rl; transform: rotate(180deg); font-style: normal; font-size: 8px; font-weight: 900; color: #ffe9a8; text-align: center; letter-spacing: 1px; line-height: 18px; box-shadow: 0 2px 3px rgba(0,0,0,.4); }
.books i:last-child { transform: rotate(192deg) translateX(-4px); }

.deco { position: fixed; inset: 0; pointer-events: none; z-index: 5; overflow: hidden; }
.ruler { position: absolute; left: -30px; bottom: -14px; width: 1260px; height: 44px; transform: rotate(-1.5deg); transform-origin: left bottom;
  background:
    repeating-linear-gradient(90deg, #5a3e14 0 1px, transparent 1px 4px) 10px 0 / 100% 7px no-repeat,
    repeating-linear-gradient(90deg, #5a3e14 0 1.5px, transparent 1.5px 20px) 10px 0 / 100% 12px no-repeat,
    repeating-linear-gradient(90deg, #5a3e14 0 2px, transparent 2px 40px) 10px 0 / 100% 17px no-repeat,
    linear-gradient(#f2d78b, #e2b95a 60%, #c99a3a);
  border-radius: 3px; box-shadow: 0 -2px 8px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.6); }
.ruler span { position: absolute; top: 16px; font: 700 10px var(--ui); color: #4a3210; transform: translateX(-50%); }
.ruler i { position: absolute; left: 560px; top: 26px; font: italic 700 9px var(--ui); color: #7a5a20; letter-spacing: 2px; }
.pencil.big { position: absolute; right: 150px; bottom: 18px; width: 300px; height: 16px; transform: rotate(-12deg); background: linear-gradient(#ffe070, #f2c230 45%, #d9a410 55%, #f2c230); border-radius: 2px; box-shadow: 0 6px 8px rgba(0,0,0,.35); }
.pencil.big .rub { position: absolute; left: -26px; top: 0; width: 22px; height: 16px; background: linear-gradient(#ffb3c1, #f07c93); border-radius: 5px 2px 2px 5px; }
.pencil.big .band { position: absolute; left: -6px; top: -1px; width: 12px; height: 18px; background: repeating-linear-gradient(90deg, #cfd3d8 0 2px, #9aa0a8 2px 4px); }
.pencil.big .wood { position: absolute; right: -34px; top: 0; width: 36px; height: 16px; background: linear-gradient(90deg, #f1d3a6, #e2b77e); clip-path: polygon(0 0, 100% 45%, 100% 55%, 0 100%); }
.pencil.big .wood::after { content: ''; position: absolute; right: 0; top: 0; width: 12px; height: 16px; background: #333; clip-path: polygon(0 36%, 100% 48%, 100% 52%, 0 64%); }
.crayon { position: absolute; width: 150px; height: 18px; border-radius: 4px 2px 2px 4px; box-shadow: 0 5px 7px rgba(0,0,0,.35);
  background: linear-gradient(color-mix(in srgb, var(--c) 70%, white), var(--c) 40%, color-mix(in srgb, var(--c) 70%, black)); }
.crayon::before { content: ''; position: absolute; right: -18px; top: 2px; width: 20px; height: 14px; background: inherit; clip-path: polygon(0 0, 100% 40%, 100% 60%, 0 100%); }
.crayon b { position: absolute; left: 30px; right: 30px; top: 2px; bottom: 2px; background: repeating-linear-gradient(90deg, rgba(0,0,0,.25) 0 2px, transparent 2px 6px) left/8px 100% no-repeat, rgba(255,255,255,.18); border-left: 2px solid rgba(0,0,0,.35); border-right: 2px solid rgba(0,0,0,.35); font: 900 8px var(--ui); color: rgba(255,255,255,.9); display: flex; align-items: center; justify-content: center; letter-spacing: 1px; }
.crayon.c1 { right: -40px; bottom: 60px; transform: rotate(-24deg); }
.crayon.c2 { right: -60px; bottom: 90px; transform: rotate(-38deg); }
.crayon.c3 { left: -70px; top: 44%; transform: rotate(62deg); }
.eraser2 { position: absolute; left: 20px; bottom: 36px; width: 70px; height: 30px; border-radius: 6px; transform: rotate(14deg); background: linear-gradient(#ff9fb4, #f07a92); box-shadow: 0 5px 7px rgba(0,0,0,.35), inset 0 -4px 0 rgba(0,0,0,.08); font: 900 8px var(--ui); color: #fff; display: flex; align-items: center; justify-content: center; letter-spacing: 1px; }
.clip { position: absolute; right: 36px; top: 96px; width: 26px; height: 64px; transform: rotate(8deg); filter: drop-shadow(0 2px 2px rgba(0,0,0,.35)); }
.modal, .notebook.zoomed, #confetti, .saved { z-index: 95; }
.notebook.zoomed { z-index: 92; }
@media (max-width: 1320px) { .shelfdeco .books { display: none; } }
@media (max-width: 1180px) { .shelfdeco { display: none; } .pencil.big { display: none; } }
@media (max-width: 700px) { .deco .ruler, .deco .crayon.c3, .deco .eraser2, .clip { display: none; } .crayon.c1, .crayon.c2 { bottom: 10px; } .helpbtn { margin-left: 0; padding: 7px 10px; } }

/* ---------- one-row header, supplies kept to the edges ---------- */
.shelf { flex-wrap: nowrap; gap: 12px; padding: 8px 18px; }
.logo-board { font-size: 26px; padding: 5px 12px 3px; }
.tab { padding: 10px 14px 8px; font-size: 15px; white-space: nowrap; }
.dial { width: 150px; }
@media (max-width: 1700px) { .grille { display: none; } .shelfdeco .books { display: none; } }
@media (max-width: 1600px) { .logo-sub { display: none; } }
@media (max-width: 1500px) { .shelfdeco { display: none; } }
@media (max-width: 1250px) { .knob { display: none; } .dial { width: 120px; } }
body.fitted main { padding-bottom: 30px; }
.ruler { bottom: -24px; }
.pencil.big { right: 34px; bottom: 6px; width: 230px; transform: rotate(-3deg); }
.crayon.c1 { right: -118px; bottom: 150px; transform: rotate(-14deg); }
.crayon.c2 { right: -124px; bottom: 190px; transform: rotate(-24deg); }
.crayon.c3 { left: -118px; top: 40%; transform: rotate(18deg); }
.eraser2 { left: -30px; bottom: auto; top: 64%; transform: rotate(78deg); }
.clip { right: 8px; top: 120px; }
body.fitted .sidecol { max-height: 100%; overflow-y: auto; overflow-x: hidden; padding: 12px 8px 12px 4px; gap: 18px; scrollbar-width: none; }
body.fitted .sidecol::-webkit-scrollbar { display: none; }
body.fitted #examples button { font-size: 15px; padding: 2px 8px; }
body.fitted .sticky { padding: 16px 14px 12px; }
@media (max-width: 700px) { .shelf { flex-wrap: wrap; } }

/* ---------- Graph mode ---------- */
.gside { flex: 0 0 380px; display: flex; flex-direction: column; gap: 16px; min-width: 0; max-width: 100%; }
.exprs { background: var(--paper); border-radius: 6px; padding: 12px 14px; box-shadow: 0 12px 20px rgba(0,0,0,.35); font-family: var(--hand); color: var(--ink); border-top: 8px solid #388c46; }
.exprs-head { font-size: 22px; margin-bottom: 6px; }
.exprs-head small { font-size: 14px; color: #7a86a0; margin-left: 4px; }
.grow { display: flex; align-items: flex-start; gap: 8px; border-bottom: 1px solid var(--blue-line); padding: 6px 0; }
.gdot { width: 24px; height: 24px; flex: 0 0 24px; border-radius: 50%; border: 3px solid var(--c); background: var(--c); margin-top: 6px; padding: 0; }
.gdot.off { background: #fff; }
.gin { flex: 1; min-width: 0; }
.gin input { width: 100%; border: 0; background: transparent; font-family: var(--hand); font-size: 22px; color: var(--ink); outline: none; padding: 2px 4px; border-radius: 4px; }
.gin input:focus { background: #fffbe0; }
.gerr { font-size: 14px; color: #c0392b; line-height: 16px; }
.gerr:empty { display: none; }
.gdel { border: 0; background: none; color: #a0a8b8; font-size: 17px; margin-top: 6px; }
.gdel:hover { color: #c0392b; }
#gAdd { margin: 8px 0 6px; }
.gex { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; font-size: 15px; color: #7a86a0; }
.gex button { border: 1px solid #c9d4e4; background: #fff; border-radius: 12px; font-family: var(--hand); font-size: 15px; padding: 0 8px; color: var(--ink); }
.gex button:hover { background: var(--hl); }
.gside .notebook { flex: 1; min-height: 0; padding-left: 20px; max-width: none; }
.graphbox { flex: 1 1 600px; position: relative; min-height: 460px; border-radius: 4px; overflow: hidden; box-shadow: 0 18px 30px rgba(0,0,0,.4), 0 2px 0 #e8e3cf, 0 4px 0 #f6f2e2; touch-action: none; cursor: grab; background: #fdfdfb; min-width: 0; }
.graphbox:active { cursor: grabbing; }
.graphbox canvas { position: absolute; inset: 0; display: block; }
.gzoom { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 6px; }
.gzoom button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid #c9d4e4; background: #fff; font-size: 22px; color: #1f2a44; box-shadow: 0 3px 8px rgba(0,0,0,.18); }
.gzoom button:hover { background: #f1f5fb; }
.ghint { position: absolute; left: 12px; bottom: 10px; font-size: 13px; color: #7a86a0; background: rgba(255,255,255,.85); border-radius: 8px; padding: 2px 8px; pointer-events: none; }
body.fitted #view-graph .gside { height: 100%; }
body.fitted .graphbox { height: 100%; min-height: 0; }

/* ---------- Geometry mode ---------- */
.shapes { flex: 0 0 200px; display: grid; grid-template-columns: 1fr; gap: 6px; align-content: start; overflow-y: auto; max-height: 100%; padding: 2px 6px 8px 2px; scrollbar-width: thin; }
.shape { display: flex; align-items: center; gap: 8px; border: 0; text-align: left; padding: 6px 10px; border-radius: 8px; background: linear-gradient(#fdfbf2, #efe6c8); box-shadow: 0 3px 0 #8a7443, 0 4px 8px rgba(0,0,0,.25); font-weight: 700; font-size: 13.5px; color: #3a2e14; }
.shape .si { font-size: 20px; width: 26px; text-align: center; color: #2f62b0; }
.shape.on { background: linear-gradient(#fff9dc, #ffe98a); transform: translateX(6px); }
.geopaper { flex: 1 1 480px; min-width: 0; background: #fbfcf8; border-radius: 4px; padding: 16px 20px; box-shadow: 0 18px 30px rgba(0,0,0,.4); font-family: var(--hand); color: var(--ink); overflow-y: auto; max-height: 100%;
  background-image: linear-gradient(#e7eef6 1px, transparent 1px), linear-gradient(90deg, #e7eef6 1px, transparent 1px); background-size: 22px 22px; }
.geohead { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.geohead h3 { margin: 0; font-weight: 400; font-size: 28px; color: #c0392b; }
.units { font-size: 16px; color: #5a6680; }
.units select { font-family: var(--hand); font-size: 17px; border: 1px solid #c9d4e4; border-radius: 8px; padding: 2px 6px; background: #fff; }
.geonote { margin: 2px 0 8px; color: #6a7690; font-size: 16px; }
.geofields { display: flex; flex-wrap: wrap; gap: 12px; }
.geofields label { display: flex; flex-direction: column; font-size: 15px; color: #5a6680; }
.geofields input { width: 120px; font-family: var(--hand); font-size: 24px; color: var(--ink); border: 0; border-bottom: 2px solid #2f62b0; background: rgba(255,255,255,.8); padding: 2px 6px; outline: none; border-radius: 4px 4px 0 0; }
.geofields input:focus { background: #fffbe0; }
.geodraw { display: flex; justify-content: center; margin: 8px 0; }
.geosvg { width: 100%; max-width: 460px; height: auto; }
.geoans { display: flex; flex-wrap: wrap; gap: 10px; }
.gcard { background: #fff; border: 2px solid #c9d4e4; border-radius: 10px; padding: 4px 14px; display: flex; flex-direction: column; box-shadow: 0 3px 6px rgba(0,0,0,.08); }
.gcard span { font-size: 14px; color: #6a7690; }
.gcard b { font-weight: 400; font-size: 24px; color: #c0392b; }
.geoerr { color: #c0392b; font-size: 20px; }
#geoNoteBook { flex: 1 1 420px; }
body.fitted #view-geo .shapes, body.fitted #view-geo .geopaper { height: 100%; }
@media (max-width: 1100px) {
  .gside { flex-basis: auto; width: 100%; }
  .graphbox { width: 100%; flex-basis: auto; min-height: 70vh; }
  .shapes { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); width: 100%; flex-basis: auto; max-height: none; }
  .geopaper { width: 100%; flex-basis: auto; max-height: none; }
}
body.fitted .exprs { max-height: 52%; overflow-y: auto; flex: 0 0 auto; scrollbar-width: thin; }
body.fitted .gside .notebook { flex: 1 1 0; }
.gex { max-height: 58px; overflow: hidden; }
.exprs:hover .gex, .exprs:focus-within .gex { max-height: none; }
.ghint { top: 10px; bottom: auto; }

.pbar { padding: 4px 4px 14px; }
.logo-board, .helpbtn { white-space: nowrap; }
@media (max-width: 1400px) { .logo-board { font-size: 22px; } .tab { padding: 9px 11px 7px; font-size: 14px; } }

/* ---------- nothing cut off ---------- */
/* long steps wrap onto the next line instead of running off the paper */
.mathline { white-space: normal; overflow: visible; overflow-wrap: anywhere; }
.mathline .frac { white-space: nowrap; }
.probline, .answerbox, .oops li, .why { overflow-wrap: anywhere; }
/* sticky note and grade card sit straight so their edges aren't clipped */
body.fitted .sidecol .sticky, body.fitted .sidecol .gradecard { transform: none; }
body.fitted .sidecol { overflow-x: visible; padding-right: 6px; }
.grades { gap: 4px; }
.gbtn { min-width: 0; font-size: 15px; }
/* header: when the window is narrow, the radio moves to its own row instead of sliding off the edge */
@media (max-width: 1300px) { .dial { width: 110px; } .tab { padding: 9px 9px 7px; } }
@media (max-width: 1180px) {
  .shelf { flex-wrap: wrap; row-gap: 8px; }
  .radio { order: 5; margin-left: auto; }
}
body.fitted .shelf { flex-shrink: 0; }
/* phones: tabs wrap onto two rows */
@media (max-width: 700px) {
  .tabs { flex-wrap: wrap; gap: 5px; width: 100%; }
  .tab { flex: 1 1 auto; padding: 8px 8px 6px; font-size: 13px; text-align: center; }
  .helpbtn { order: 3; }
  .radio { order: 6; }
}
.drawstatus { bottom: 18px; }
.drawstatus:not(.on) { visibility: hidden; }

/* ---------- show your work ---------- */
.sywBtn { margin: 2px 0 10px; border: 0; font-family: var(--hand); font-size: 19px; padding: 4px 16px; border-radius: 18px; color: #fff; background: linear-gradient(#5d9ee8, #2f73c9); box-shadow: 0 3px 0 #173e70, 0 5px 8px rgba(0,0,0,.2); }
.sywBtn:hover { filter: brightness(1.08); }
.sywBtn:active { transform: translateY(2px); box-shadow: 0 1px 0 #173e70; }
.work { position: fixed; inset: 0; z-index: 96; background: rgba(40, 24, 10, .78); backdrop-filter: blur(3px); display: flex; justify-content: center; padding: 18px; }
.work[hidden] { display: none; }
.worksheet { width: min(1100px, 100%); height: 100%; overflow-y: auto; position: relative; border-radius: 4px; padding: 20px 34px 40px 96px; font-family: var(--hand); color: var(--ink);
  background-color: var(--paper);
  background-image: linear-gradient(90deg, transparent 70px, var(--margin) 70px, var(--margin) 72px, transparent 72px), repeating-linear-gradient(180deg, transparent 0 43px, var(--blue-line) 43px 44px);
  box-shadow: 0 30px 60px rgba(0,0,0,.5); }
.wtop { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; position: sticky; top: -20px; background: var(--paper); padding: 8px 0; z-index: 2; margin-top: -8px; }
.wtop h2 { margin: 0; font-family: var(--chalkhead); font-weight: 400; font-size: 34px; color: #2f62b0; }
.wbtns { display: flex; gap: 8px; flex-wrap: wrap; }
.wname { display: flex; justify-content: space-between; font-size: 20px; color: #6a7690; margin: 4px 0 6px; }
.wname u { display: inline-block; width: 220px; border-bottom: 2px solid #9aa6ba; text-decoration: none; }
.wproblem { font-size: 26px; color: #c0392b; line-height: 44px; }
.wlines { list-style: none; margin: 0; padding: 0; }
.wl { display: grid; grid-template-columns: 44px minmax(0, auto) minmax(180px, 1fr); column-gap: 18px; align-items: baseline; padding: 6px 0; opacity: 0; transform: translateY(6px); transition: opacity .35s, transform .35s; }
.wl.show { opacity: 1; transform: none; }
.wl.show .wmath { animation: writeline .7s ease-out; }
@keyframes writeline { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
.wn { margin-left: -64px; width: 36px; height: 36px; border-radius: 50%; border: 2px solid var(--red); color: var(--red); font-size: 20px; display: flex; align-items: center; justify-content: center; transform: rotate(-6deg); align-self: center; }
.wmath { font-size: 36px; line-height: 50px; color: #1a2440; overflow-wrap: anywhere; }
.wmath sup { font-size: .6em; }
.weq { color: #2f62b0; margin-right: 12px; }
.wnote { font-size: 19px; line-height: 26px; color: #2a7a4a; align-self: center; }
.wl.info .wmath { font-size: 28px; line-height: 40px; color: #394866; }
.wmethod { grid-column: 2 / 4; margin: 4px 0 6px; }
.wmethod .paper { transform-origin: left top; }
.wans .wmath { font-size: 40px; margin-top: 8px; }
.wbox { display: inline-block; border: 3px solid var(--red); border-radius: 12px 18px 10px 16px; padding: 2px 18px; color: #c0392b; transform: rotate(-.6deg); box-shadow: 4px 4px 0 rgba(210, 69, 60, .15); }
.wbox .frac { font-size: .8em; }
.wnext { position: sticky; bottom: -40px; display: flex; gap: 14px; align-items: center; justify-content: center; padding: 14px 0 4px; background: linear-gradient(transparent, var(--paper) 30%); }
.wnext[hidden] { display: none; }
.wnext .tool { font-size: 20px; padding: 10px 26px; }
.wnext span { font-size: 18px; color: #6a7690; }
@media (max-width: 700px) {
  .work { padding: 6px; }
  .worksheet { padding: 12px 12px 30px 62px; background-image: linear-gradient(90deg, transparent 46px, var(--margin) 46px, var(--margin) 48px, transparent 48px), repeating-linear-gradient(180deg, transparent 0 43px, var(--blue-line) 43px 44px); }
  .wl { grid-template-columns: 0 1fr; }
  .wn { margin-left: -50px; width: 30px; height: 30px; font-size: 16px; }
  .wmath { font-size: 27px; line-height: 40px; }
  .wnote { grid-column: 2; font-size: 16px; }
  .wtop h2 { font-size: 26px; }
}
@media print {
  body > *:not(#work) { display: none !important; }
  body { background: #fff !important; height: auto !important; overflow: visible !important; display: block !important; }
  .work { position: static; background: none; padding: 0; backdrop-filter: none; display: block; }
  .worksheet { height: auto; overflow: visible; box-shadow: none; width: 100%; }
  .wbtns, .wnext { display: none !important; }
  .wl { opacity: 1 !important; transform: none !important; break-inside: avoid; }
  .wl .wmath { animation: none !important; }
}

/* ---------- more signs + big calculator ---------- */
.calcZoom { border: 0; margin-left: auto; margin-right: 10px; font: 800 10px var(--ui); letter-spacing: 1px; color: #dfe3ea; padding: 5px 8px; border-radius: 6px; background: linear-gradient(#5a5f69, #3a3d44); box-shadow: 0 2px 0 #15161a, inset 0 1px 0 rgba(255,255,255,.25); }
.calcZoom:active { transform: translateY(2px); box-shadow: none; }
.k.symk { color: #9fe0ff; font-size: 12px; letter-spacing: 1px; }
.calc { position: relative; }
.symbox { position: absolute; left: 12px; right: 12px; top: 176px; z-index: 5; background: linear-gradient(#2c2f35, #1d1f23); border-radius: 12px; padding: 8px; box-shadow: 0 14px 30px rgba(0,0,0,.6), inset 0 1px 0 rgba(255,255,255,.12); border: 1px solid #4a4e57; }
.symbox[hidden] { display: none; }
.symhead { color: #9fe0ff; font: 800 11px var(--ui); letter-spacing: 3px; display: flex; justify-content: space-between; align-items: center; padding: 0 4px 6px; }
.symx { border: 0; background: none; color: #aab; font-size: 14px; }
.symgrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 5px; }
.symgrid button { border: 0; border-radius: 8px; padding: 4px 2px; background: linear-gradient(#5c6069, #3b3e45); color: #fff; box-shadow: 0 2px 0 #111; display: flex; flex-direction: column; align-items: center; line-height: 1.1; }
.symgrid button:active { transform: translateY(2px); box-shadow: none; }
.symgrid b { font-size: 17px; font-family: Georgia, 'Times New Roman', serif; font-weight: 600; }
.symgrid small { font-size: 8.5px; color: #c9cfda; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
body.calcbig { overflow: hidden; }
body.calcbig .shelf, body.calcbig .sidecol, body.calcbig .deco, body.calcbig #view-calc .notebook .zoomBtn { display: none !important; }
body.calcbig main { padding: 10px 16px; height: 100vh; }
body.calcbig #view-calc.on { height: 100%; align-items: center; justify-content: center; gap: 20px; display: flex; }
body.calcbig .deskleft { height: auto !important; }
body.calcbig .calc { transform: none; }
body.calcbig #view-calc .notebook { height: calc(100vh - 20px); max-width: 48vw; display: flex; flex-direction: column; }
body.calcbig #view-calc .page { flex: 1; min-height: 0; overflow-y: auto; }
@media (max-width: 1000px) { body.calcbig #view-calc .notebook { display: none; } }
.bigsteps { display: none; }
body.calcbig #view-calc .notebook { display: none !important; }
body.calcbig .bigsteps:not([hidden]) { display: block; position: fixed; right: 18px; bottom: 18px; z-index: 40; border: 0; font-family: var(--hand); font-size: 22px; padding: 10px 22px; border-radius: 26px; color: #fff; background: linear-gradient(#5d9ee8, #2f73c9); box-shadow: 0 4px 0 #173e70, 0 8px 18px rgba(0,0,0,.4); }
/* wide calculator: display on top, function keys and number keys side by side */
body.calcbig .calc { width: 960px; padding: 22px 26px 16px; border-radius: 30px; }
body.calcbig .keys { display: grid; grid-template-columns: 1.15fr 1fr; gap: 30px; align-items: end; }
body.calcbig .fkeys { margin-bottom: 0; }
body.calcbig .lcd { height: 128px; }
body.calcbig .seg { height: 60px; }
body.calcbig .line2 { height: 66px; }
body.calcbig .symbox { left: 26px; right: auto; width: 520px; top: 190px; }
body.calcbig .dots { font-size: 30px; }
