/* fonts live with the study app (copied from the extension by scripts/build-study.sh) */
@font-face { font-family: 'Figtree'; font-style: normal; font-weight: 300 900; font-display: swap; src: url(/study/fonts/figtree.woff2) format('woff2'); }
@font-face { font-family: 'Fredoka'; font-style: normal; font-weight: 300 700; font-display: swap; src: url(/study/fonts/fredoka.woff2) format('woff2'); }

/* Rempip Capture — one-handed, outdoors, on a phone. Big targets.
   Soft UI, like the study screen: one warm surface, controls raised out of it,
   fields and the camera window pressed into it, mint for the action that matters.
   It follows the phone's light or dark setting. */

:root {
  --bg: #ecebe7;
  --surface: #ecebe7;
  --surface-2: #e4e3df;
  --line: #d2d1cb;
  --text: #2b2c2e;
  --text-2: #5f6064;
  --blue: #23926e;          /* accent for lines and links: mint itself is too pale on this surface */
  --blue-soft: #d3f1e5;
  --on-soft: #1c5e47;
  --mint: #8fe3c3;
  --on-mint: #173a2e;
  --red: #cf4d4d;
  --sel: #bfead8;           /* a picked run of words */
  --hi: rgba(255, 255, 255, .92);
  --lo: rgba(160, 156, 146, .5);
  --raise: 7px 7px 16px var(--lo), -7px -7px 16px var(--hi);
  --raise-sm: 3px 3px 8px var(--lo), -3px -3px 8px var(--hi);
  --inset: inset 3px 3px 7px var(--lo), inset -3px -3px 7px var(--hi);
  --glow: 0 0 0 3px rgba(143, 227, 195, .45);
  --r: 18px;
  --r-pill: 999px;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #2a2c30;
    --surface: #2a2c30;
    --surface-2: #26282b;
    --line: #3a3d42;
    --text: #e9eaec;
    --text-2: #a4a7ad;
    --blue: #6fd3ae;
    --blue-soft: #24443a;
    --on-soft: #bdf0dc;
    --mint: #6fd3ae;
    --on-mint: #10271f;
    --red: #f08e8e;
    --sel: #2f6b55;
    --hi: rgba(255, 255, 255, .055);
    --lo: rgba(0, 0, 0, .5);
    --glow: 0 0 0 3px rgba(111, 211, 174, .35);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.45 Figtree, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  overscroll-behavior: none;
}

img { max-width: 100%; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { box-shadow: var(--glow); }

.screen { display: none; min-height: 100dvh; flex-direction: column; }
.screen.is-active { display: flex; }

.pad { padding: 16px 16px calc(24px + var(--safe-b)); display: flex; flex-direction: column; gap: 12px; }

h1, h2 { font-family: Fredoka, ui-rounded, Figtree, sans-serif; }
h1 { font-size: 24px; margin: 8px 0 0; }
h2 { font-size: 17px; font-weight: 600; margin: 0; }
.sub { color: var(--text-2); margin: 0 0 8px; }
.hint { color: var(--text-2); font-size: 13px; margin: 0; }
/* help text folded away until asked for */
.more-info summary { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--r-pill); background: var(--bg); box-shadow: var(--raise-sm); color: var(--blue); font-size: 13px; font-weight: 600; cursor: pointer; list-style: none; }
.more-info summary::-webkit-details-marker { display: none; }
.more-info summary::after { content: '▾'; transition: transform .2s; }
.more-info[open] summary::after { transform: rotate(180deg); }
.more-info .hint { margin-top: 10px; }

/* ---- controls ---- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border: 0; border-radius: var(--r-pill);
  background: var(--bg); color: var(--text);
  box-shadow: var(--raise-sm);
  font: inherit; font-size: 15px; font-weight: 500;
  cursor: pointer; transition: box-shadow .15s, transform .06s;
}
.btn:active:not(:disabled) { box-shadow: var(--inset); transform: scale(.99); }
.btn.filled { background: var(--mint); color: var(--on-mint); font-weight: 600; }
.btn.tonal { background: var(--bg); color: var(--blue); }
.btn.text { background: none; color: var(--blue); min-height: 40px; padding: 0 12px; box-shadow: none; }
.btn.text:active:not(:disabled) { box-shadow: var(--inset); }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; box-shadow: none; }

.icon-btn {
  position: relative;
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; flex: none;
  border: 0; border-radius: 50%;
  background: none; color: var(--text-2); cursor: pointer;
  transition: box-shadow .15s, color .15s;
}
.icon-btn:active { box-shadow: var(--inset); color: var(--blue); }
.icon-btn svg { fill: currentColor; }
.icon-btn.big { width: 56px; height: 56px; background: var(--bg); color: var(--text); box-shadow: var(--raise-sm); }
.icon-btn.big:active { box-shadow: var(--inset); }

.badge {
  position: absolute; top: 2px; right: 0;
  min-width: 20px; height: 20px; padding: 0 5px;
  border-radius: var(--r-pill); background: var(--mint);
  color: var(--on-mint); font-size: 11px; font-weight: 700; line-height: 20px; text-align: center;
  box-shadow: var(--raise-sm);
}

.input {
  width: 100%; min-height: 48px; padding: 12px 16px;
  border: 0; border-radius: var(--r);
  background: var(--bg); color: var(--text);
  box-shadow: var(--inset);
  font: inherit; font-size: 16px; /* 16px or iOS zooms on focus */
}
.input:focus { outline: 0; box-shadow: var(--inset), var(--glow); }
.input.area { min-height: 180px; resize: vertical; line-height: 1.5; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; color: var(--text-2); }
.field i { font-style: normal; opacity: .6; }

.toggle { display: flex; align-items: center; gap: 10px; padding: 6px 0; font-size: 14px; color: var(--text-2); }
.toggle input { width: 20px; height: 20px; accent-color: var(--blue); }

.row { display: flex; gap: 8px; }
.row.end { justify-content: flex-end; margin: 12px 0 0; padding: 0; }

/* ---- bars ---- */

.topbar, .bookbar {
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + var(--safe-t)) 8px 10px;
  background: var(--bg); border-bottom: 0;
  position: sticky; top: 0; z-index: 5;
}
.topbar h2 { flex: 1; text-align: center; }
.topbar .icon-btn, .topbar .btn.text { flex: none; min-width: 56px; }

.book-pick {
  flex: 1; display: flex; align-items: center; gap: 10px;
  min-height: 50px; padding: 6px 14px;
  border: 0; border-radius: var(--r-pill); background: var(--bg);
  box-shadow: var(--raise-sm);
  color: var(--text); font: inherit; text-align: left; cursor: pointer;
}
.book-pick:active { box-shadow: var(--inset); }
.book-pick svg { fill: var(--blue); flex: none; }
.book-text { display: grid; min-width: 0; }
.book-text b { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.book-text i { font-style: normal; font-size: 12px; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- camera ---- */

/* the preview is a window pressed into the surface */
.viewport {
  position: relative; flex: 1; background: #000; overflow: hidden;
  margin: 4px 12px 0; border-radius: 26px;
  box-shadow: var(--inset), 0 0 0 6px var(--bg);
}
.viewport video, .scanner video { width: 100%; height: 100%; object-fit: cover; display: block; }

.guides { position: absolute; inset: 24px; pointer-events: none; }
.guides span { position: absolute; width: 28px; height: 28px; border: 3px solid rgba(255,255,255,.6); }
.guides span:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; border-top-left-radius: 12px; }
.guides span:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; border-top-right-radius: 12px; }
.guides span:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; border-bottom-left-radius: 12px; }
.guides span:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; border-bottom-right-radius: 12px; }

.viewport-hint {
  position: absolute; left: 0; right: 0; bottom: 16px; margin: 0;
  text-align: center; font-size: 13px; color: #fff;
  text-shadow: 0 1px 4px rgba(0,0,0,.8);
}

.shutterbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 24px calc(18px + var(--safe-b));
  background: var(--bg);
}
/* a raised disc with a mint button pressed into it */
.shutter {
  width: 78px; height: 78px; flex: none;
  border: 0; border-radius: 50%;
  background: var(--bg); padding: 9px; cursor: pointer;
  box-shadow: var(--raise);
}
.shutter span { display: block; width: 100%; height: 100%; border-radius: 50%; background: var(--mint); box-shadow: var(--raise-sm); transition: box-shadow .1s, transform .1s; }
.shutter:active span { box-shadow: var(--inset); transform: scale(.96); }

.scanner { position: relative; height: 40dvh; background: #000; margin: 0 12px; border-radius: 22px; overflow: hidden; box-shadow: var(--inset); }

/* ---- reading a page ---- */

.ocr-progress { height: 10px; padding: 2px; background: var(--bg); border-radius: var(--r-pill); box-shadow: var(--inset); overflow: hidden; margin-bottom: 12px; }
.ocr-bar { height: 100%; width: 6%; background: var(--mint); border-radius: var(--r-pill); transition: width .4s; }

/* the photograph, kept in view while picking lines so a line that reads oddly
   can be checked against what is printed */
.proof {
  position: relative; flex: none;
  height: 26vh; overflow: hidden;
  margin: 0 12px; border-radius: 20px; background: #000;
  box-shadow: var(--inset);
  transition: height .2s;
}
.proof.is-open { height: 68vh; }
.proof img { width: 100%; height: 100%; object-fit: contain; display: block; }
.proof-toggle {
  position: absolute; right: 10px; bottom: 10px;
  display: grid; place-items: center;
  width: 38px; height: 38px;
  border: 0; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff; cursor: pointer;
}
.proof-toggle svg { fill: currentColor; }

.reading { padding: 16px; }
.status-line { margin: 0 0 6px; font-size: 15px; }

/* The select screen is pinned to the viewport: the photo stays put at the top
   so a word can be checked against what is printed, the button stays put at the
   bottom, and only the transcript between them scrolls. Left to grow, the
   screen simply got taller than the phone and the photo scrolled out of reach. */
#screen-select.is-active { height: 100dvh; overflow: hidden; }

.transcript {
  position: relative;          /* the grips are positioned against this */
  flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch;
  padding: 12px 16px 28px;
  font-size: 16px; line-height: 1.75;
  /* The selection here is drawn by the app, so the browser's own must stay out
     of the way — otherwise a long-press raises a second, competing highlight
     with its own handles on top of this one. */
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: pan-y;         /* scrolling still works; dragging a run does not scroll */
}
.tpara { margin: 0 0 16px; }

.w { padding: 3px 0; }
.w.is-sel { background: var(--sel); }

/* The grips. Small on screen, but the touch target around each one is 40px so
   a fingertip can find it. */
.grip {
  position: absolute; z-index: 3;
  width: 14px; height: 14px; margin: -1px 0 0 -7px;
  border-radius: 50%;
  background: var(--blue); box-shadow: 0 0 0 2px var(--bg), 0 1px 4px rgba(0,0,0,.35);
  touch-action: none;
}
.grip::after {
  content: ''; position: absolute; left: 50%; top: 50%;
  width: 44px; height: 44px; transform: translate(-50%, -50%);
}
.pad { padding: 16px; }

.sticky-actions {
  position: sticky; bottom: 0;
  padding: 12px 16px calc(12px + var(--safe-b));
  background: linear-gradient(to top, var(--bg) 75%, transparent);
}
.batch-bar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 8px; color: var(--text-2); font-size: 13px;
}

/* ---- results ---- */

.results { display: grid; gap: 12px; }
.result {
  display: flex; align-items: center; gap: 12px;
  width: 100%; padding: 12px; text-align: left;
  border: 0; border-radius: var(--r);
  background: var(--bg); box-shadow: var(--raise-sm);
  color: var(--text); font: inherit; cursor: pointer;
}
.result:active { box-shadow: var(--inset); }
.result.stacked { justify-content: space-between; }
.result img, .result-blank { width: 36px; height: 52px; flex: none; border-radius: 6px; object-fit: cover; background: var(--surface-2); }
.result span { display: grid; min-width: 0; gap: 2px; }
.result b { font-size: 14px; font-weight: 600; }
.result i { font-style: normal; font-size: 12px; color: var(--text-2); }

/* ---- overlays ---- */

.sheet {
  width: min(520px, 100%); margin: auto auto 0; padding: 22px 16px calc(22px + var(--safe-b));
  border: 0; border-radius: 26px 26px 0 0;
  background: var(--bg); color: var(--text);
  box-shadow: 0 -8px 24px var(--lo);
}
.sheet::backdrop { background: rgba(43, 44, 46, .35); backdrop-filter: blur(2px); }
.sheet .field, .sheet .hint { margin-top: 12px; }
.sheet .btn.wide { margin-top: 14px; }

.add-part { margin: 12px 0 20px; gap: 6px; }
.part-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 6px; color: var(--text-2); font-size: 13px;
}
.part-head .btn.text { min-height: 32px; }
.part-gap { margin: 10px 0; text-align: center; color: var(--text-2); font-size: 20px; letter-spacing: 2px; }
.append-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin: 8px 12px 0; padding: 8px 8px 8px 16px; border-radius: var(--r-pill);
  background: var(--blue-soft); color: var(--on-soft); font-size: 13px;
}

/* a dark pill floating over the surface (a light one in dark mode) */
.toast {
  position: fixed; left: 16px; right: 16px; bottom: calc(20px + var(--safe-b)); z-index: 20;
  padding: 14px 20px; border-radius: var(--r-pill);
  background: var(--text); color: var(--bg);
  font-size: 14px; box-shadow: var(--raise);
}

.select-hint { padding: 10px 16px 0; margin: 0; }

/* while the rest of the page is still being generated */
.transcript.is-streaming::after {
  content: ''; display: block; height: 3px; margin: 6px 16px 0;
  border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--blue), transparent);
  background-size: 50% 100%; background-repeat: no-repeat;
  animation: sweep 1.1s linear infinite;
}
@keyframes sweep { from { background-position: -50% 0; } to { background-position: 150% 0; } }

/* ---- video ---- */

.video-source { display: grid; gap: 2px; padding: 14px 16px; border: 0; border-radius: var(--r); background: var(--bg); box-shadow: var(--raise-sm); }
.video-source b { font-size: 15px; font-weight: 600; }
.video-source i { font-style: normal; font-size: 13px; color: var(--text-2); }
.video-platform { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--blue); }
.video-platform:empty, .video-source i:empty { display: none; }
.video-wait { display: grid; gap: 10px; }

/* Pip watching the video on an old TV, taking notes */
.pip-tv { width: 100%; max-width: 380px; height: auto; margin: 4px auto 0; display: block; overflow: visible; }
.pt-host, .pt-knob-2, .pt-pip, .pt-head, .pt-eye, .pt-pencil, .pt-idea { transform-box: fill-box; }
.pt-floor { fill: var(--lo); opacity: .35; }
.pt-wood { fill: #b98a5e; stroke: #8a6240; stroke-width: 3; }
.pt-wood-dark, .pt-knob { fill: #8a6240; }
.pt-bezel { fill: #3b3530; }
.pt-leg, .pt-ant { stroke: #6b4c33; stroke-width: 4; stroke-linecap: round; }
.pt-ant-tip { fill: #6b4c33; }
.pt-screen { fill: #2f6b55; }
.pt-sun { fill: #ffe08a; }
.pt-hill { fill: #8fe3c3; }
.pt-host-head, .pt-host-body { fill: #173a2e; }
.pt-flicker { fill: #fff; opacity: 0; mix-blend-mode: overlay; }
.pt-body { fill: #bfc2c6; }
.pt-skull { fill: #c9ccd0; }
.pt-ink, .pt-brow { fill: #26282b; }
.pt-brow { fill: none; stroke: #26282b; stroke-width: 2.5; stroke-linecap: round; }
.pt-white { fill: #fbfbf9; }
.pt-foot { stroke: #26282b; stroke-width: 3.5; stroke-linecap: round; }
.pt-scarf, .pt-mint { fill: #8fe3c3; }
.pt-paper { fill: #fffdf6; stroke: #d8d2c2; stroke-width: 1.5; }
.pt-note { stroke: #5f6064; stroke-width: 2.2; stroke-linecap: round; stroke-dasharray: 30; stroke-dashoffset: 30; }
.pt-pencil-body { fill: #f2c14e; }
.pt-pencil-tip { fill: #e8c9a0; }
.pt-pencil-end { fill: #e88a8a; }
.pt-spark { fill: #ffd25e; }

.pt-show { animation: pt-channel 9s steps(1) infinite; }
.pt-host { transform-origin: 50% 100%; animation: pt-talk .7s ease-in-out infinite alternate; }
.pt-scan { animation: pt-roll 2.4s linear infinite; }
.pt-flicker { animation: pt-flicker 3.1s steps(1) infinite; }
.pt-beam { animation: pt-beam 3.1s steps(1) infinite; }
.pt-knob-2 { transform-origin: center; animation: pt-turn 9s steps(1) infinite; }
.pt-ant { transform-origin: 50% 100%; }
.pt-pip { transform-origin: 50% 100%; animation: pt-breathe 2.6s ease-in-out infinite; }
.pt-head { transform-origin: 70% 90%; animation: pt-glance 7s ease-in-out infinite; }
.pt-eye { transform-origin: center; animation: pt-blink 4.3s infinite; }
.pt-pencil { animation: pt-scribble .45s ease-in-out infinite alternate; }
.pt-n1 { animation: pt-write 8s linear infinite; }
.pt-n2 { animation: pt-write 8s linear infinite; animation-delay: 1.6s; }
.pt-n3 { animation: pt-write 8s linear infinite; animation-delay: 3.2s; }
.pt-n4 { animation: pt-write 8s linear infinite; animation-delay: 4.8s; }
.pt-idea { transform-origin: center; animation: pt-idea 7s ease-out infinite; animation-delay: 2.5s; opacity: 0; }

@keyframes pt-channel { 0% { filter: none; } 33% { filter: hue-rotate(140deg); } 66% { filter: hue-rotate(250deg) saturate(1.3); } }
@keyframes pt-talk { from { transform: translateY(0) rotate(-2deg); } to { transform: translateY(-2px) rotate(2deg); } }
@keyframes pt-roll { from { transform: translateY(0); } to { transform: translateY(6px); } }
@keyframes pt-flicker { 0%, 100% { opacity: 0; } 12% { opacity: .18; } 14% { opacity: 0; } 61% { opacity: .12; } 63% { opacity: 0; } }
@keyframes pt-beam { 0%, 100% { opacity: .9; } 12% { opacity: 1; } 14% { opacity: .75; } 61% { opacity: 1; } 63% { opacity: .85; } }
@keyframes pt-turn { 0% { transform: rotate(0); } 33% { transform: rotate(60deg); } 66% { transform: rotate(130deg); } }
@keyframes pt-breathe { 0%, 100% { transform: scale(1, 1); } 50% { transform: scale(1.012, .985); } }
/* mostly glued to the TV; now and then a look down at the notes */
@keyframes pt-glance { 0%, 62%, 100% { transform: rotate(0); } 68%, 84% { transform: rotate(-16deg) translate(4px, 3px); } 90% { transform: rotate(0); } }
@keyframes pt-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(.1); } }
@keyframes pt-scribble { from { transform: translate(-3px, 0) rotate(-3deg); } to { transform: translate(5px, 2px) rotate(4deg); } }
@keyframes pt-write { 0% { stroke-dashoffset: 30; } 15%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
@keyframes pt-idea { 0% { opacity: 0; transform: translateY(8px) scale(.4) rotate(0); } 8% { opacity: 1; transform: translateY(0) scale(1.1) rotate(20deg); } 20% { opacity: 0; transform: translateY(-14px) scale(.8) rotate(45deg); } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .pip-tv * { animation: none !important; }
  .pt-note { stroke-dashoffset: 0; }
}
.video-failed { display: grid; gap: 12px; }
.video-open { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; color: var(--blue); font-size: 14px; text-decoration: none; }
.video-open svg { fill: currentColor; }
.video-edit { display: grid; gap: 12px; }
.video-edit .input.area { min-height: 320px; font-size: 15px; }
/* one per paragraph: a card per idea, tap to keep or drop */
.video-pick { display: grid; gap: 10px; }
.pick-bar { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); }
.pick-bar span { flex: 1; font-weight: 600; color: var(--text); }
.pick-all, .pick-edit { padding: 6px 12px; border: 0; border-radius: var(--r-pill); background: var(--bg); box-shadow: var(--raise-sm); color: var(--blue); font: inherit; font-size: 13px; font-weight: 600; cursor: pointer; }
.pick-edit { justify-self: start; }
.pick-list { display: grid; gap: 10px; }
.pick-card { display: grid; grid-template-columns: 26px 1fr; gap: 12px; align-items: start; width: 100%; padding: 14px; border: 0; border-radius: var(--r); background: var(--bg); box-shadow: var(--raise-sm); color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: opacity .2s, box-shadow .2s; }
.pick-check { width: 26px; height: 26px; border-radius: 50%; background: var(--mint); box-shadow: var(--raise-sm); position: relative; }
.pick-check::after { content: ''; position: absolute; left: 9px; top: 5px; width: 6px; height: 12px; border: solid var(--on-mint); border-width: 0 2.5px 2.5px 0; transform: rotate(45deg); }
.pick-body { display: grid; gap: 4px; min-width: 0; }
.pick-time { font-size: 12px; font-weight: 600; color: var(--blue); }
.pick-text { font-size: 15px; line-height: 1.45; white-space: pre-wrap; }
.pick-card.is-dropped { box-shadow: var(--inset); opacity: .5; }
.pick-card.is-dropped .pick-check { background: var(--bg); box-shadow: var(--inset); }
.pick-card.is-dropped .pick-check::after { display: none; }
.pick-card.is-dropped .pick-text { text-decoration: line-through; }
/* a pressed-in track with the chosen side raised in mint */
.segmented { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: var(--r-pill); background: var(--bg); box-shadow: var(--inset); }
.seg { padding: 9px 8px; border: 0; border-radius: var(--r-pill); background: none; color: var(--text-2); font: inherit; font-size: 14px; cursor: pointer; }
.seg.is-on { background: var(--mint); color: var(--on-mint); font-weight: 600; box-shadow: var(--raise-sm); }
.topbar-spacer { width: 44px; }

/* ---- motion ----
 * The same motion as the study screen: highlights slide, screens and sheets
 * rise into place, every control sinks when pressed and springs back.
 */

:root {
  --ease: cubic-bezier(.22, .8, .3, 1);
  --spring: cubic-bezier(.3, 1.4, .5, 1);
}

/* the segmented control: one mint shape that slides to the chosen side */
.segmented { position: relative; }
.segmented::before {
  content: ''; position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px);
  border-radius: var(--r-pill); background: var(--mint); box-shadow: var(--raise-sm);
  transition: transform .42s var(--ease);
}
.segmented:has(.seg:nth-child(2).is-on)::before { transform: translateX(100%); }
.seg { position: relative; z-index: 1; transition: color .3s var(--ease); }
.seg.is-on { background: none; box-shadow: none; }

.screen.is-active { animation: screen-in .36s var(--ease); }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.btn, .icon-btn, .book-pick, .result, .seg, .shutter span {
  transition: transform .22s var(--spring), box-shadow .25s var(--ease), background-color .25s var(--ease), color .25s var(--ease), opacity .25s var(--ease);
}
.btn:active:not(:disabled), .book-pick:active, .result:active { transform: scale(.97); transition-duration: .08s; }
.icon-btn:active { transform: scale(.9); transition-duration: .08s; }
.shutter:active span { transform: scale(.9); transition-duration: .08s; }
.input { transition: box-shadow .25s var(--ease); }
.proof { transition: height .35s var(--ease); }
.ocr-bar { transition: width .45s var(--ease); }

.sheet[open] { animation: sheet-up .38s var(--ease); }
.sheet[open]::backdrop { animation: fade-in .3s var(--ease); }
@keyframes sheet-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
.toast:not([hidden]) { animation: toast-in .34s var(--spring); }
@keyframes toast-in { from { opacity: 0; transform: translateY(16px) scale(.97); } to { opacity: 1; transform: none; } }
.result, .video-source, .video-edit, .append-banner { animation: rise-in .34s var(--ease) backwards; }
@keyframes rise-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; transition-duration: .01ms !important; }
}
