/* Calculus Videos' own rules, after the family's stylesheets (mathzetta-sites/src: site.css, shioh-style.css,
   shioh-frame.css — the Shioh look; the frame around the page is mounted by mountChrome). Everything is scoped to
   the page's <main class="cv">, so nothing reaches the frame. At the end, the block Claude UI's Editor writes into. */
.cv {
  /* the cell's translucent whites and ink, under this page's own names */
  --panel: var(--ss-panel);
  --panel-2: var(--ss-panel-strong);
  --line: var(--ss-rule);
  --text: var(--ss-ink);
  --muted: var(--ss-muted);
  --accent: var(--ss-accent);
  --radius: var(--ss-radius-sm);
  /* the stage's own colours: it is dark whatever the page is */
  --ink: #e4e8f7;
  --blue: #7c9bff;
  --amber: #ffcf73;
}
.cv, .cv *, .cv *::before, .cv *::after { box-sizing: border-box; }
.cv .sub { margin: 0 0 1rem; max-width: 72ch; text-wrap: pretty; }
.cv .sr-only:where(:not(:focus-within, :active)) {
  position: absolute !important; clip-path: inset(50%) !important; overflow: hidden !important;
  width: 1px !important; height: 1px !important; margin: -1px !important; padding: 0 !important;
  border: 0 !important; white-space: nowrap !important;
}
/* a cell's title: a band flush with the cell's top and sides */
body.ss .cv > .ss-cell > h2.ss-section:first-child { margin: calc(-1 * var(--ss-pad-y)) calc(-1 * var(--ss-pad-x)) 0.9rem; padding: 0.6rem var(--ss-pad-x); }
.cv h2.ss-section small { font: 400 0.8rem var(--ss-font-body); margin-left: 0.6rem; color: var(--muted); }

/* ============ the "video" ============ */
.player {
  position: relative; width: 100%; aspect-ratio: 16 / 9;
  background: #07080b; border-radius: var(--radius); overflow: hidden;
  user-select: none; box-shadow: 0 12px 40px rgba(0,0,0,.35);
}
.player:fullscreen { border-radius: 0; aspect-ratio: auto; }
.player:focus { outline: none; }
.player.idle { cursor: none; }
.stage {
  position: absolute; inset: 0; container-type: size;
  /* the caption strip clears the controls on a small player too, and the board ends above it */
  --cap-bottom: max(14.5cqh, 66px);
  --cap-h: max(13cqh, 40px);
  background:
    radial-gradient(120% 90% at 50% 0%, #1c2346 0%, transparent 60%),
    radial-gradient(90% 70% at 50% 120%, #14253d 0%, transparent 55%),
    #07080b;
}
.stage::after {  /* vignette, so it reads as rendered footage */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(130% 100% at 50% 50%, transparent 55%, rgba(0,0,0,.5) 100%);
}

.badge {
  position: absolute; top: 4.5cqh; left: 4cqw; right: 4cqw;
  display: flex; align-items: baseline; gap: 1.4cqw; z-index: 3;
  font-size: max(1.5cqw, 9.5px); letter-spacing: .15em; text-transform: uppercase;
  color: rgba(255,255,255,.68); font-weight: 620;
}
.badge .dot { width: max(1.3cqw, 7px); height: max(1.3cqw, 7px); border-radius: 50%; background: var(--blue); box-shadow: 0 0 8px rgba(124,155,255,.65); align-self: center; flex: none; }
.player.waiting .badge .dot { animation: pulse .9s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .25; transform: scale(.7); } }
.badge b { color: #fff; font-weight: 650; }
.badge i { font-style: normal; white-space: nowrap; }
.badge .rule {
  margin-left: auto; text-transform: none; letter-spacing: .015em; text-align: right;
  color: rgba(255,255,255,.86); font-weight: 560; font-size: max(1.75cqw, 10.5px);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* the math board: lines accumulate, older ones slide up */
.board {
  position: absolute; top: 12cqh; bottom: calc(var(--cap-bottom) + var(--cap-h) + .5cqh); left: 5cqw; right: 4cqw;
  overflow: hidden; z-index: 1;
  /* lines leaving at the top fade out rather than being cut */
  -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 7%);
          mask-image: linear-gradient(to bottom, transparent 0, #000 7%);
}
.player.nocaps .board { bottom: var(--cap-bottom); }
.lines {
  --line-size: 3;     /* in cqw; app.js reads it to shrink a line that is too long */
  transition: transform .55s cubic-bezier(.3,.7,.2,1); will-change: transform;
  padding: 2.4cqh 1cqw 3.6cqh 2.4cqw;   /* room for the outlines and the answer's glow inside the board's clip */
}
/* a phone-sized player: bigger maths, since there is less of it across */
@container (max-width: 520px) { .lines { --line-size: 3.7; } }
.lines.measure .mline { display: block !important; visibility: hidden; }
.mline {
  display: none; color: var(--ink); font-size: calc(var(--line-size) * 1cqw); padding: .55cqh 0;
  opacity: .5; transition: opacity .35s;
}
.mline.eq { padding-left: 3.2cqw; }
.mline .mv-display { display: inline-block; margin: 0; }
.eqsign { font: 1.2em "Inline Math Roman", "Latin Modern Roman", "Times New Roman", serif; margin-right: .3em; }
.mline.shown { display: block; animation: lineIn .5s ease both; }
@keyframes lineIn {
  from { opacity: 0; transform: translateY(1.4cqh); }
}
.mline .mx { display: inline-block; transform-origin: left top; border-radius: 1cqw; cursor: pointer; }
.mline:has(.mx:hover) { opacity: .85; }
.mline.from { opacity: .88; }
.mline.live { opacity: 1; }
.mline.final .mx {
  padding: .7cqh 1.5cqw; margin-left: -1.5cqw;
  box-shadow: 0 0 0 .22cqw var(--blue), 0 0 2.2cqw rgba(111,143,255,.35);
  animation: answer 1.1s ease-out both;
}
@keyframes answer {
  from { box-shadow: 0 0 0 .22cqw rgba(124,155,255,0), 0 0 0 rgba(111,143,255,0); }
  45% { box-shadow: 0 0 0 .3cqw var(--blue), 0 0 2.6cqw rgba(111,143,255,.8); }
}
/* A step's line appears by growing out of the line above (View.morph):
   parts it shares glide down, the rest fades in after them. */
.mline.shown.morph { animation: none; }
.mline.morph .eqsign, .mline.morph .mv-bin, .mline.morph .mv-rel,
.mline.morph .mv-delim, .mline.morph .mv-hook, .mline.morph .mv-d,
.mline.morph .mv-word, .mline.morph svg { animation: fadeIn .45s .35s both; }
.mline.morph .mv-hl { animation: hlIn .75s ease both; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes hlIn { from { background-color: transparent; box-shadow: none; } }

/* the part a rule rewrote, on its new line */
.mline .mv-hl {
  color: #fff; background: rgba(111,143,255,.2);
  border-radius: .2em; box-shadow: 0 0 0 .1em rgba(111,143,255,.2), 0 0 0 .14em rgba(111,143,255,.38);
}
.mline:not(.live) .mv-hl, .mline.final .mv-hl { background: none; box-shadow: none; color: inherit; }
/* ...and what it was, on the line before, while the step plays */
.mline .src {
  border-radius: .2em; box-shadow: 0 0 0 .13em rgba(255,196,92,.5);
}
/* narration sync: the phrase being read, and the exact part of it the
   current word names */
.mline .mv-n, .mline .mv-bin { transition: color .12s linear, background-color .12s linear, text-shadow .12s; }
.mline .phrase { background-color: rgba(255,196,92,.1); border-radius: .2em; }
.mline .say, .mline .say .mv-n {
  color: var(--amber); text-shadow: 0 0 .5em rgba(255,196,92,.55);
}
.mline .say .mv-denom, .mline .say .mv-radicand { border-color: var(--amber); }
.mline .say .mv-delim { color: var(--amber); }

/* narration caption with karaoke highlighting; a long sentence turns its pages */
.caps {
  position: absolute; left: 6cqw; right: 6cqw; bottom: var(--cap-bottom); height: var(--cap-h);
  display: grid; place-items: end center; z-index: 2; pointer-events: none;
}
.player.nocaps .caps { display: none; }
.capline {
  grid-area: 1 / 1; text-align: center; max-width: 100%;
  font-size: max(2.5cqw, 13px); line-height: 1.44; font-weight: 540; color: #9aa2bc;
  opacity: 0; transform: translateY(.8cqh);
  transition: opacity .3s ease, transform .3s ease;
  text-wrap: balance;
}
.capline.live { opacity: 1; transform: none; }
.cappage { display: none; }
.cappage.live { display: block; animation: fadeIn .22s ease both; }
.w {
  border-radius: .45cqw; padding: .04em .28cqw; margin: 0 -.06cqw; color: #a5adc6;
  transition: color .12s linear, background-color .12s linear;
}
.w.m { color: #dfc99b; }
.w.done { color: #dce1f2; }
.w.on { color: #fff; background: #3b57cf; }
.w.m.done { color: #f0d9a8; }
.w.m.on { color: #17130a; background: var(--amber); font-weight: 600; }

.bigplay {
  position: absolute; inset: 0 0 22% 0; margin: auto; z-index: 4;
  width: 72px; height: 72px; border-radius: 50%; border: 0;
  background: rgba(16,20,34,.74); backdrop-filter: blur(8px);
  color: #fff; display: grid; place-items: center; cursor: pointer;
  transition: opacity .2s, transform .2s, background-color .2s;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,.26), 0 8px 30px rgba(0,0,0,.55);
}
.bigplay svg { width: 28px; height: 28px; }
.bigplay:hover { transform: scale(1.06); background: rgba(45,66,148,.82); }
/* once the video has played the button stays off the maths; it comes back to offer a replay */
.player.begun:not(.ended) .bigplay { opacity: 0; pointer-events: none; transform: scale(.9); }
.player.ended .bigplay { inset: auto 5% 32% auto; margin: 0; width: 54px; height: 54px; }
.player.empty .stage { background: #0b0c10; }
.placeholder {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 0 8cqw;
  color: #9ba3bf; font-size: clamp(0.9rem, 2.1cqw, 1.15rem); letter-spacing: .015em;
}

/* ============ controls ============ */
.controls {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 5;
  padding: 34px 16px 10px;
  background: linear-gradient(transparent, rgba(0,0,0,.58) 42%, rgba(0,0,0,.88));
  opacity: 1; transition: opacity .25s ease;
}
.player.idle .controls { opacity: 0; pointer-events: none; }
.player.idle .controls:focus-within { opacity: 1; pointer-events: auto; }

.scrub { display: flex; gap: 3px; height: 18px; align-items: center; cursor: pointer; touch-action: pan-y; border-radius: 4px; }
.seg {
  position: relative; height: 5px; border-radius: 3px; min-width: 2px; flex-basis: 0;
  background: rgba(255,255,255,.28); overflow: hidden;
  transition: height .12s ease, flex-grow .3s ease, background-color .3s;
}
/* a step whose narration is still being made */
.seg.pending { background: repeating-linear-gradient(90deg, rgba(255,255,255,.2) 0 4px, rgba(255,255,255,.08) 4px 8px); }
.scrub:hover .seg { height: 8px; }
.seg i {
  position: absolute; inset: 0; background: var(--blue);
  transform-origin: left; transform: scaleX(0);
}
.seg.past i { transform: scaleX(1) !important; }
.scrubwrap { position: relative; }
.tip {
  position: absolute; bottom: 24px; transform: translateX(-50%);
  background: rgba(10,12,18,.95); color: #fff; font-size: 11.5px;
  padding: 5px 9px; border-radius: 6px; white-space: nowrap;
  pointer-events: none; opacity: 0; transition: opacity .12s;
  font-variant-numeric: tabular-nums; text-align: center;
}
.tip em { font-style: normal; color: #a6adc4; display: block; font-size: 10.5px; }
.scrubwrap:hover .tip { opacity: 1; }

.bar { display: flex; align-items: center; gap: 4px; margin-top: 5px; }
.bar button {
  background: none; border: 0; color: #fff; cursor: pointer;
  min-width: 34px; height: 34px; border-radius: 8px; display: grid; place-items: center;
  transition: background .15s; font: inherit; flex: none;
}
.bar button:hover { background: rgba(255,255,255,.14); }
.bar svg { width: 17px; height: 17px; fill: currentColor; }
.bar .txt { font-size: 12px; font-weight: 620; padding: 0 7px; font-variant-numeric: tabular-nums; letter-spacing: .01em; }
.bar #cc[aria-pressed=false], .bar #mute.off { color: rgba(255,255,255,.45); }
.bar #cc { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.bar #cc[aria-pressed=false] { text-decoration: none; }
.tc {
  font-size: 12.5px; color: rgba(255,255,255,.86); font-variant-numeric: tabular-nums;
  margin-left: 4px; letter-spacing: .01em; white-space: nowrap;
}
.tc b { color: #fff; font-weight: 560; }
.now {
  margin-left: 12px; font-size: 12.5px; color: rgba(255,255,255,.6);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1;
}
.player:not(.nocaps) .now { visibility: hidden; }   /* the caption already says it */
.vol { width: 62px; accent-color: var(--blue); cursor: pointer; }

/* ============ steps + composer ============ */
.lbl { font-size: 0.86rem; color: var(--muted); margin: 0 0 10px; display: block; line-height: 1.5; text-wrap: pretty; }
.lbl code { background: var(--panel); padding: 0.05em 0.32em; border-radius: 3px; font-size: 0.92em; overflow-wrap: anywhere; }
.chaplist {
  display: grid; gap: 4px; overflow-y: auto; max-height: 340px; position: relative;
  scrollbar-width: thin; container-type: scroll-state;
}
.chaplist::before, .chaplist::after {
  content: ''; display: block; position: sticky; block-size: 0.7rem; z-index: 1;
  pointer-events: none; opacity: 0; transition: opacity .2s;
}
.chaplist::before { inset-block-start: 0; margin-block-end: -0.7rem; background: radial-gradient(farthest-side at 50% 0, rgb(0 0 0 / .16), transparent); }
.chaplist::after { inset-block-end: 0; margin-block-start: -0.7rem; background: radial-gradient(farthest-side at 50% 100%, rgb(0 0 0 / .16), transparent); }
@container scroll-state(scrollable: block-start) { .chaplist::before { opacity: 1; } }
@container scroll-state(scrollable: block-end) { .chaplist::after { opacity: 1; } }
@supports not (container-type: scroll-state) {
  .chaplist::before, .chaplist::after { animation: cv-shadow linear both; animation-timeline: scroll(); }
  .chaplist::before { animation-range: 0 1.5rem; }
  .chaplist::after { animation-direction: reverse; animation-range: calc(100% - 1.5rem) 100%; }
}
@keyframes cv-shadow { to { opacity: 1; } }
.chaprow {
  background: var(--panel); padding: 9px 13px; cursor: pointer; border: 0; width: 100%; border-radius: var(--radius);
  display: flex; align-items: center; gap: 12px; transition: background .13s;
  font: inherit; color: inherit; text-align: left;
}
.chaprow:hover { background: var(--panel-2); }
.chaprow:focus-visible { outline-offset: -2px; }
.chaprow.live { background: var(--panel-2); box-shadow: inset 3px 0 0 var(--accent); }
.chaprow .k {
  font-size: 0.72rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums;
  flex: none; width: 34px;
}
.chaprow.pending .k { font-style: italic; }
.chaprow .r { flex: none; width: 196px; min-width: 0; font-size: 0.82rem; font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chaprow .t { flex: 1; min-width: 0; font-size: 0.82rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chaprow .d { font-size: 0.74rem; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; min-width: 32px; text-align: right; }

.stats { display: flex; gap: 22px; flex-wrap: wrap; align-items: center; margin-top: 13px; padding-top: 13px; border-top: 1px solid var(--line); }
.stats .ss-btn { margin-left: auto; }
.stat .k { font-size: 0.68rem; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; }
.stat .v { font-size: 1.12rem; font-weight: 650; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; margin-top: 2px; }
.stat .v small { font-size: 0.72rem; color: var(--muted); font-weight: 500; }
.keys { margin: 12px 0 0; font-size: 0.76rem; color: var(--muted); line-height: 1.6; }
.keys kbd {
  font: 0.7rem var(--ss-font-mono); background: var(--panel-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; margin: 0 1px;
}

.exprrow { display: flex; gap: 10px; align-items: center; }
body.ss .cv input[type=text] { padding: 11px 13px; font-family: var(--ss-font-mono); font-size: 0.96rem; }
#expr { flex: 1; min-width: 0; }
#variable { width: 58px; text-align: center; }
#varwrap { font-weight: 600; color: var(--text); }
#varwrap.off { opacity: .45; }
.preview {
  min-height: 54px; display: flex; align-items: center; gap: 14px; flex-wrap: wrap;
  margin: 10px 0 12px; padding: 9px 14px; font-size: 1rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.preview.is-empty { display: none; }
.preview .pkind {
  font-size: 0.68rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700;
  color: var(--ss-ink); background: var(--panel-2); border: var(--ss-chip-border);
  border-radius: var(--ss-chip-radius); padding: 2px 9px;
}
.preview .pkind:empty { display: none; }
.preview .perr { color: var(--mz-err); font-size: 0.85rem; font-weight: 600; }
.preview .mv-display { margin: 0; }

.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-top: 2px; }
.cv select { background: #fff; color: var(--ss-ink); border: 1px solid rgb(34 34 34 / 0.38); border-radius: var(--radius); padding: 7px 9px; font: inherit; font-size: 0.86rem; cursor: pointer; }
label.f { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; color: var(--text); font-weight: 600; }
.status { font-size: 0.85rem; color: var(--muted); flex-basis: 100%; min-height: 1.4em; margin-top: -2px; }
.status:empty { display: none; }
.status.note { color: var(--text); font-weight: 600; }
.status.err { color: var(--mz-err); font-weight: 650; }

.exblock { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.exhead { font-size: 0.72rem; text-transform: uppercase; letter-spacing: .08em; font-weight: 700; color: var(--muted); margin-bottom: 8px; }
.examples { display: grid; gap: 7px; margin: 0; }
.exrow { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }
.exname { font-size: 0.78rem; font-weight: 600; color: var(--text); width: 82px; flex: none; }
body.ss .cv .ex {
  background: var(--panel); border: var(--ss-chip-border); color: var(--ss-ink);
  font: 0.78rem var(--ss-font-mono); padding: 4px 10px; border-radius: var(--ss-chip-radius); cursor: pointer; min-height: 0;
  transition: background .12s, box-shadow .12s;
}
body.ss .cv .ex:hover { background: var(--panel-2); }
body.ss .cv .ex.active { background: #fff; font-weight: 600; box-shadow: inset 0 0 0 1.5px var(--accent); }
audio { display: none; }

@media (pointer: coarse) {
  .bar button { min-width: 40px; min-height: 40px; }
  body.ss .cv .ex { padding: 6px 11px; }
}
@media (max-width: 640px) {
  .chaprow .t { display: none; }
  .chaprow .r { flex: 1; width: auto; }
  .vol, .now { display: none; }
  .bigplay { inset: 0 0 34% 0; width: 48px; height: 48px; }
  .bigplay svg { width: 20px; height: 20px; }
  .bar { gap: 2px; }
  .bar button { min-width: 34px; min-height: 34px; height: 34px; }
  .bar .txt { padding: 0 5px; font-size: 11.5px; }
  .tc { margin: 0 auto; font-size: 11.5px; }
  .controls { padding: 20px 6px 6px; }
  .exprrow { flex-wrap: wrap; }
  .exname { width: 100%; margin-top: 2px; }
}
@media (max-width: 400px) {
  .bar { gap: 1px; }
  .bar button { min-width: 30px; padding: 0 3px; }
}
@media (prefers-reduced-motion: reduce) {
  .mline.shown, .cappage.live, .mline.final .mx, .player.waiting .badge .dot { animation: none; }
  .lines, .capline, .seg { transition: none; }
}

/* the composer sits above the player, in the same cell: type, press Generate, watch */
.cv .composer { margin: 0 0 1rem; }
.cv .composer .row { margin-top: 0.5rem; }
.cv .composer .status { margin: 0; }

/* the player's own buttons keep their look over the family's button rules */
body.ss .cv .player button { background: none; border: 0; color: #fff; min-height: 0; }
body.ss .cv .player .bigplay { background: rgba(16,20,34,.74); }
body.ss .cv .player .bigplay:hover { background: rgba(45,66,148,.82); }
body.ss .cv .player :focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
@media print { .cv .player, .cv .exblock, .cv .row, .cv .keys { display: none; } }

/* claude-ui:editor begin — layout set in the Claude UI Editor tab. Keep this shape if you edit it by hand. */
/* claude-ui:editor end */
