/* ===== Steve's Video Studio — same family as Steve's Signed & Sealed and Oreo Boards =====
   Instrument Sans for the interface, Newsreader for names and page titles, brand blue #0070E5, a white header band
   with the compass-and-dragon medallion hanging below it. Fonts are self-hosted (SIL OFL) so the app works offline. */
@font-face { font-family: "Instrument Sans"; src: url(/fonts/InstrumentSans.woff2) format("woff2"); font-weight: 400 700; font-style: normal; font-display: swap; }
@font-face { font-family: "Newsreader"; src: url(/fonts/Newsreader.woff2) format("woff2"); font-weight: 500 700; font-style: normal; font-display: swap; }

:root {
  --brand: #0070E5; --brand-deep: #005BC0; --brand-wash: #EAF3FE; --brand-line: #B9D6FF;
  --bg: #F3F5F8; --paper: #ffffff; --raise: #F8FAFC; --card: var(--paper);
  --ink: #0F1729; --ink-2: #2A3445; --muted: #586273; --line: #E2E6EC; --line-strong: #CDD4DD;
  --ok: #0A7A5F; --ok-wash: #E4F8F1; --warn: #8A5A00; --warn-wash: #FFF5E0; --bad: #B3261E; --bad-wash: #FDECEA; --rec: #D92D20;
  --font-body: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-display: "Newsreader", "Iowan Old Style", Georgia, "Times New Roman", serif;
  --font-mono: ui-monospace, "SF Mono", Menlo, monospace;
  --radius: 16px; --radius-sm: 10px;
  --shadow-1: 0 1px 2px rgba(15, 23, 41, .05), 0 1px 1px rgba(15, 23, 41, .03);
  --shadow-2: 0 1px 2px rgba(15, 23, 41, .04), 0 6px 20px rgba(15, 23, 41, .07);
  --shadow-3: 0 2px 6px rgba(15, 23, 41, .06), 0 24px 60px rgba(15, 23, 41, .18);
  --ease: cubic-bezier(.16, 1, .3, 1); --fast: 160ms;
  --gut: max(20px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 16px/1.5 var(--font-body); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
::selection { background: #CFE3FF; color: var(--ink); }
:where(a) { color: var(--brand); text-underline-offset: 3px; }
h1, h2, h3 { text-wrap: balance; }
p { text-wrap: pretty; }
.muted { color: var(--muted); }
.err { color: var(--bad); min-height: 1.4em; margin: 8px 0 0; font-size: 14px; }
.warn { color: var(--warn); background: var(--warn-wash); border-radius: var(--radius-sm); padding: 10px 14px; }
.ic { width: 20px; height: 20px; flex: none; }
:where(#shell, #login) :focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
:where(#shell) ::-webkit-scrollbar { width: 10px; height: 10px; }
:where(#shell) ::-webkit-scrollbar-thumb { background: #CDD4DD; border-radius: 99px; border: 3px solid transparent; background-clip: padding-box; }

/* ---------- controls (owner screens + login; zero specificity so each page can refine) ---------- */
:where(#shell, #login) :where(button, .btn) {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; margin: 0; padding: 0 18px;
  font: 600 15px/1.2 var(--font-body); color: #fff; text-decoration: none; white-space: nowrap; cursor: pointer;
  background: var(--brand); border: 1px solid var(--brand); border-radius: var(--radius-sm);
  box-shadow: 0 1px 2px rgba(0, 60, 130, .18), inset 0 1px 0 rgba(255, 255, 255, .14);
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease), transform 90ms ease;
}
:where(#shell, #login) :where(button, .btn):hover { background: var(--brand-deep); border-color: var(--brand-deep); }
:where(#shell, #login) :where(button, .btn):active { transform: translateY(1px); }
:where(#shell, #login) :where(button:disabled) { opacity: .55; cursor: default; transform: none; }
:where(#shell) :where(button.ghost, a.ghost, .btn.ghost) { background: var(--paper); color: var(--ink); border-color: var(--line-strong); box-shadow: var(--shadow-1); }
:where(#shell) :where(button.ghost, a.ghost, .btn.ghost):hover { background: var(--raise); border-color: #AEB8C6; }
:where(#shell) :where(button.armed) { background: var(--bad); border-color: var(--bad); color: #fff; }
:where(#shell, #login) :where(input:not([type=checkbox]):not([type=radio]):not([type=range]):not([type=file]), select, textarea) {
  font: inherit; font-size: 16px; color: var(--ink); background: var(--paper); border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  min-height: 44px; padding: 10px 12px; transition: border-color var(--fast) var(--ease), box-shadow var(--fast) var(--ease);
}
:where(#shell, #login) :where(input, select, textarea):focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(0, 112, 229, .18); }
:where(#shell) ::placeholder { color: #7A8496; }
:where(#shell) progress { width: 100%; height: 8px; border: 0; border-radius: 99px; background: #E3E8EF; overflow: hidden; accent-color: var(--brand); }
:where(#shell) progress::-webkit-progress-bar { background: #E3E8EF; border-radius: 99px; }
:where(#shell) progress::-webkit-progress-value { background: var(--brand); border-radius: 99px; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--brand-line); border-top-color: var(--brand); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- the header: medallion, name, tabs ---------- */
.topbar { position: relative; z-index: 20; display: flex; align-items: center; gap: 28px; height: 84px; padding: 0 var(--gut) 0 148px;
  background: var(--paper); border-bottom: 1px solid var(--line); box-shadow: 0 1px 0 rgba(15, 23, 41, .02), 0 8px 24px rgba(15, 23, 41, .04);
  padding-top: env(safe-area-inset-top, 0px); height: calc(84px + env(safe-area-inset-top, 0px)); }
.tb-brand { display: flex; align-items: center; text-decoration: none; color: var(--ink); flex: none; }
.tb-badge { position: absolute; left: max(24px, env(safe-area-inset-left, 0px)); top: calc(12px + env(safe-area-inset-top, 0px)); width: 104px; height: 104px; border-radius: 50%;
  background: #fff; display: grid; place-items: center; border: 1px solid var(--line);
  box-shadow: 0 2px 4px rgba(15, 23, 41, .05), 0 12px 28px rgba(15, 23, 41, .1); transition: transform 300ms var(--ease); }
.tb-brand:hover .tb-badge { transform: rotate(-8deg); }
.tb-mark { width: 82px; height: 82px; display: block; }
.tb-name { font: 600 1.7rem/1 var(--font-display); letter-spacing: -0.015em; font-optical-sizing: auto; white-space: nowrap; }
.tb-tabs { display: flex; gap: 4px; padding: 4px; background: #EEF1F5; border-radius: 12px; }
.tb-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 9px; color: var(--muted);
  font-weight: 600; font-size: 15px; text-decoration: none; white-space: nowrap; transition: color var(--fast) var(--ease), background var(--fast) var(--ease); }
.tb-tab .ic { width: 18px; height: 18px; }
.tb-tab:hover { color: var(--ink); }
.tb-tab.on { color: var(--ink); background: var(--paper); box-shadow: var(--shadow-1), 0 0 0 1px rgba(15, 23, 41, .04); }
.tb-tab.on .ic { color: var(--brand); }
.tb-tab[data-tab="record"] .ic { color: var(--rec); }
.tb-tab:focus-visible, .tb-brand:focus-visible, .tb-out:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.tb-out { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 12px; border: 0; border-radius: 9px;
  background: transparent; color: var(--muted); font: 600 14px/1 var(--font-body); cursor: pointer; }
.tb-out:hover { color: var(--ink); background: #EEF1F5; }
.tb-out .ic { width: 18px; height: 18px; }

/* ---------- page frame ---------- */
/* top room: the medallion hangs 32px below the header band */
#shell { padding: 56px var(--gut) calc(56px + env(safe-area-inset-bottom, 0px)); }
.page { max-width: 1160px; margin: 0 auto; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin: 0 0 28px; }
.page-title { margin: 0; font: 600 clamp(2rem, 3.4vw, 2.6rem)/1.05 var(--font-display); letter-spacing: -0.02em; font-optical-sizing: auto; }
.page-sub { margin: 8px 0 0; color: var(--muted); font-size: 15.5px; max-width: 60ch; }
.page-sub:empty { display: none; }
.empty { text-align: center; padding: 56px 20px; background: var(--paper); border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.empty-icon { display: inline-grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; background: var(--brand-wash); color: var(--brand); margin-bottom: 14px; }
.empty-icon .ic { width: 26px; height: 26px; }
.empty-title { margin: 0 0 6px; font: 600 1.35rem/1.2 var(--font-display); }
.empty p.muted { max-width: 46ch; margin: 0 auto 20px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); max-width: calc(100% - 32px); z-index: 50;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; box-shadow: var(--shadow-3); font-weight: 500; animation: toast-in .3s var(--ease) both; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- sign in ---------- */
body.is-login { background: radial-gradient(1200px 600px at 50% -10%, #E3EEFC 0%, var(--bg) 60%); }
.login { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 72px 20px 40px; }
.login-card { position: relative; width: min(400px, 100%); padding: 72px 32px 28px; text-align: center; background: var(--paper); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow-3); }
.login-badge { position: absolute; left: 50%; top: 0; transform: translate(-50%, -50%); width: 112px; height: 112px; border-radius: 50%; background: #fff; display: grid; place-items: center;
  border: 1px solid var(--line); box-shadow: 0 2px 4px rgba(15, 23, 41, .05), 0 12px 28px rgba(15, 23, 41, .12); }
.login-badge img { width: 88px; height: 88px; }
.login-card h1 { margin: 0; font: 600 1.85rem/1.1 var(--font-display); letter-spacing: -0.015em; }
.login-sub { margin: 8px 0 26px; color: var(--muted); }
.login-card form { display: grid; gap: 10px; text-align: left; }
.login-label { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.login-card input, .login-card button { width: 100%; }
.login-card button { min-height: 48px; margin-top: 6px; font-size: 16px; }
.login-card .err { text-align: center; margin: 2px 0 0; }

/* ---------- record ---------- */
.rec-page { max-width: 1000px; }
.rec { display: grid; gap: 18px; }
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
:where(#shell) .tile { display: flex; flex-direction: column; align-items: flex-start; gap: 4px; min-height: 168px; padding: 22px 20px; text-align: left; white-space: normal;
  background: var(--paper); color: var(--ink); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2);
  transition: transform 220ms var(--ease), box-shadow 220ms var(--ease), border-color var(--fast) var(--ease); }
:where(#shell) .tile:hover { background: var(--paper); border-color: var(--brand-line); transform: translateY(-2px); box-shadow: var(--shadow-3); }
.tile-ic { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: var(--brand-wash); color: var(--brand); }
.tile-ic .ic { width: 26px; height: 26px; }
.tile[data-mode="both"] .tile-ic { background: var(--brand); color: #fff; }
.tile strong { margin-top: 18px; font: 600 1.25rem/1.15 var(--font-display); letter-spacing: -.01em; }
.tile > span:last-of-type { color: var(--muted); font: 400 14px/1.4 var(--font-body); }
.row { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; }
.row label { flex: 1 1 220px; display: flex; flex-direction: column; gap: 6px; }
.row label > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.rec-devices { padding: 18px 20px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }
.rec-hint, .rec-note { display: flex; align-items: center; gap: 8px; margin: 0; color: var(--muted); font-size: 14px; flex: 1 1 100%; }
.rec-hint .ic, .rec-note .ic { width: 18px; height: 18px; color: var(--brand); }
.rec-note { padding: 12px 16px; background: var(--brand-wash); color: var(--ink-2); border-radius: var(--radius-sm); }
.stage { position: relative; background: #05070C; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-3); outline: 3px solid transparent; outline-offset: 3px; transition: outline-color .3s var(--ease); }
.stage.is-live { outline-color: rgba(217, 45, 32, .55); }
.preview { display: block; width: 100%; max-height: 60vh; object-fit: contain; background: #05070C; }
/* The Screen + Camera preview is a canvas: size it by its own aspect so the page never stretches it. */
canvas.preview { width: auto; height: auto; max-width: 100%; margin: 0 auto; touch-action: none; }
canvas.preview.over-bubble { cursor: grab; }
canvas.preview.dragging { cursor: grabbing; }
.count { position: absolute; inset: 0; display: grid; place-items: center; font: 600 132px/1 var(--font-display); color: #fff; background: rgba(5, 7, 12, .45); animation: count .9s var(--ease) both; }
@keyframes count { from { opacity: 0; transform: scale(1.15); } }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
:where(#shell) button.big { min-height: 52px; padding: 0 30px; font-size: 17px; border-radius: 12px; }
:where(#shell) button.stop { background: var(--rec); border-color: var(--rec); }
:where(#shell) button.stop:hover { background: #B42318; border-color: #B42318; }
.stop-sq { width: 12px; height: 12px; border-radius: 3px; background: #fff; }
/* while recording, the controls stay pinned in view: Stop is never below the fold */
.rec-live { position: sticky; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 5; padding: 10px 10px 10px 18px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); }
.rec-live button.stop { margin-left: auto; }
.live { display: inline-flex; align-items: center; gap: 8px; color: var(--rec); font: 700 13px/1 var(--font-body); letter-spacing: .08em; }
.live i { width: 10px; height: 10px; border-radius: 50%; background: var(--rec); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; transform: scale(.8); } }
.timer { font: 600 22px/1 var(--font-mono); font-variant-numeric: tabular-nums; color: var(--ink); }
.timer.paused { color: var(--muted); }
.rec-title { display: grid; gap: 6px; }
.rec-title > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.rec-title input { width: 100%; font-size: 17px; }
.rec-progress { display: grid; gap: 12px; padding: 24px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); }
.rec-progress p { margin: 0; font-weight: 600; color: var(--ink); }
.rec-wait { display: flex; align-items: center; gap: 12px; margin: 0; padding: 24px; font-weight: 600; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); }

/* drafts that never finished uploading (library strip) */
.drafts:empty { display: none; }
.drafts h2 { font-size: 15px; font-weight: 600; margin: 0 0 10px; color: var(--ink-2); }
.drafts { margin-bottom: 24px; }
.draft { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 14px 16px; background: var(--warn-wash); border: 1px solid #F0DCAE; border-radius: var(--radius-sm); margin-bottom: 8px; }
.draft strong { flex: 1 1 100%; }
.draft .muted { font-size: 14px; }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; height: auto; gap: 0; padding: env(safe-area-inset-top, 0px) var(--gut) 0 96px; min-height: calc(64px + env(safe-area-inset-top, 0px)); }
  .tb-brand { height: 64px; }
  .topbar { padding-left: 88px; }
  .tb-badge { left: max(14px, env(safe-area-inset-left, 0px)); top: calc(7px + env(safe-area-inset-top, 0px)); width: 60px; height: 60px; }
  .tb-mark { width: 48px; height: 48px; }
  .tb-name { font-size: 1.3rem; }
  .tb-out { order: 2; margin-left: auto; padding: 0 10px; }
  .tb-out span { display: none; }
  .tb-tabs { order: 3; flex: 1 1 100%; margin: 8px calc(12px - var(--gut)) 10px -76px; }
  .tb-tab { flex: 1; justify-content: center; padding: 0 8px; font-size: 14px; gap: 6px; }
  #shell { padding-top: 26px; }
  .page-head { margin-bottom: 20px; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  :where(#shell) .tile { min-height: 132px; padding: 16px; }
  .tile strong { margin-top: 12px; font-size: 1.08rem; }
  .rec-live { padding-left: 14px; gap: 10px; }
  .rec-live button.stop { flex: 1 1 100%; }
}
@media (max-width: 380px) { .tb-tab .ic { display: none; } }
@media (prefers-reduced-motion: reduce) { *, *::before { animation: none !important; transition: none !important; } }


/* ===== share page (viewer, dark by default) ===== */
.share-body {
  --sh-bg: #0a0e16; --sh-panel: #121826; --sh-raise: #1a2234; --sh-line: #243049; --sh-ink: #eef2f9; --sh-muted: #97a3ba;
  --sh-brand: #0070E5; --sh-brand-hi: #4a9dff; --sh-radius: 16px; --sh-gut: max(16px, env(safe-area-inset-left, 0px));
  background: var(--sh-bg); color: var(--sh-ink); color-scheme: dark;
}
.share-body .sh-title { font-family: var(--font-display); font-weight: 600; letter-spacing: -.02em; }
.share-body .sh-end-kicker, .share-body .sh-card h1, .share-body .sh-gate-title { font-family: var(--font-display); font-weight: 600; }
.share { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 var(--sh-gut); padding-bottom: env(safe-area-inset-bottom, 0px); overflow-x: hidden; }
:where(.share) button, :where(.share) input, :where(.share) select { width: auto; margin: 0; font: inherit; color: inherit; }
:where(.share) a { color: inherit; }
.sh-muted { color: var(--sh-muted); }
.sh-head { display: flex; align-items: center; gap: 12px; max-width: 1360px; width: 100%; margin: 0 auto; padding: calc(18px + env(safe-area-inset-top, 0px)) 0 18px; }
.sh-mark { width: 34px; height: 34px; flex: none; }
.sh-headline { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: .01em; color: var(--sh-muted); }
.sh-main { flex: 1; width: 100%; max-width: 1360px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); gap: 28px; align-items: start; }
.sh-left { min-width: 0; }
.sh-title { font-size: clamp(22px, 2.6vw, 32px); line-height: 1.2; font-weight: 700; letter-spacing: -.015em; margin: 0 0 16px; overflow-wrap: anywhere; }
.sh-desc { color: var(--sh-muted); margin: 18px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.sh-foot { text-align: center; color: var(--sh-muted); font-size: 13px; padding: 40px 0 28px; }

/* player */
.sh-player { background: #000; border-radius: var(--sh-radius); overflow: hidden; box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .8), 0 0 0 1px var(--sh-line); }
.sh-player:fullscreen { border-radius: 0; display: flex; flex-direction: column; }
.sh-player:fullscreen .sh-stage { flex: 1; aspect-ratio: auto; max-height: none; }
.sh-stage { position: relative; aspect-ratio: 16 / 9; max-height: 72vh; width: 100%; background: #000; overflow: hidden; }
.sh-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.sh-video::cue { font-size: 1.05em; background: rgba(0, 0, 0, .72); }
.sh-bigplay { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: 84px; height: 84px; border-radius: 50%; border: 0; padding: 0; background: var(--sh-brand); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 10px 40px rgba(0, 112, 229, .5); transition: transform .15s ease, opacity .2s ease; }
.sh-bigplay .ic { width: 38px; height: 38px; margin-left: 4px; }
.sh-bigplay:hover { transform: translate(-50%, -50%) scale(1.06); }
.sh-player.started .sh-bigplay { opacity: 0; pointer-events: none; }
.sh-player.started:not(.is-playing) .sh-bigplay { opacity: .92; pointer-events: auto; }
.sh-controls { display: flex; align-items: center; gap: 4px; padding: 6px 8px; background: #0d1220; border-top: 1px solid var(--sh-line); }
.sh-ctl { flex: none; width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; display: grid; place-items: center; cursor: pointer; padding: 0; }
.sh-ctl:hover { background: var(--sh-raise); }
.sh-ctl:disabled, .sh-scrub:disabled { opacity: .35; cursor: default; background: transparent; }
.sh-ctl[aria-pressed="true"] { color: var(--sh-brand-hi); }
.ic { width: 22px; height: 22px; flex: none; }
.sh-time { flex: none; font: 600 13px/1 var(--font-body); color: var(--sh-muted); padding: 0 6px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sh-scrub { flex: 1; min-width: 40px; height: 44px; accent-color: var(--sh-brand); background: transparent; cursor: pointer; padding: 0; border: 0; }
.sh-speed { flex: none; height: 44px; min-width: 56px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--sh-line); background: var(--sh-panel); font-size: 13px; cursor: pointer; }
.sh-stage-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center; padding: 24px; background: rgba(5, 8, 14, .86); }
.sh-stage-msg p { margin: 0; font-weight: 600; }
.sh-stage-msg .sh-muted { font-weight: 400; }
.sh-stage-msg .sh-btn { margin-top: 10px; }

/* buttons */
.sh-btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; min-height: 48px; padding: 12px 20px; border-radius: 12px; border: 1px solid var(--sh-line); background: var(--sh-raise); color: var(--sh-ink); font-weight: 600; text-decoration: none; cursor: pointer; line-height: 1.2; transition: background .15s ease, transform .1s ease, border-color .15s ease; }
.sh-btn:active { transform: translateY(1px); }
.sh-btn-primary { background: var(--sh-brand); border-color: var(--sh-brand); color: #fff; }
.sh-btn-primary:hover { background: #0a7dfa; }
.sh-btn-quiet:hover, .sh-btn-ghost:hover { border-color: var(--sh-brand-hi); }
.sh-btn-ghost { background: transparent; }
.sh-btn-block { width: 100% !important; }
.sh-btn-lg { min-height: 56px; padding: 14px 26px; font-size: 17px; }
.sh-btn-sm { min-height: 44px; padding: 8px 14px; font-size: 14px; }
.sh-btn:focus-visible, .sh-ctl:focus-visible, .sh-tab:focus-visible, .sh-chapter:focus-visible, .sh-stamp:focus-visible, .sh-bigplay:focus-visible { outline: 2px solid var(--sh-brand-hi); outline-offset: 2px; }
.sh-cta span { overflow-wrap: anywhere; }
.seal { width: 26px; height: 26px; flex: none; border-radius: 50%; }
.sh-btn-primary .seal { background: #fff; padding: 1px; }
.sh-player:has(.sh-cta-card) .sh-bigplay { opacity: 0 !important; pointer-events: none !important; }
.sh-pinned { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; }
.sh-dl-row { display: flex; margin-top: 14px; }
.sh-download { text-decoration: none; }
.sh-pinned .sh-btn { flex: 1 1 220px; }

/* timed CTA card (lower third) */
.sh-overlay { position: absolute; left: 0; right: 0; bottom: 0; display: flex; justify-content: center; padding: 0 16px 16px; pointer-events: none; }
.sh-cta-card { pointer-events: auto; position: relative; display: flex; align-items: center; gap: 16px; max-width: 560px; width: 100%; padding: 14px 52px 14px 18px; border-radius: 14px; background: rgba(14, 20, 34, .92); border: 1px solid rgba(255, 255, 255, .12); box-shadow: 0 12px 40px rgba(0, 0, 0, .5); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); animation: sh-rise .35s ease both; }
.sh-cta-card-label { flex: 1; margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sh-cta-card .sh-btn { flex: none; }
.sh-x { position: absolute; top: 50%; right: 4px; transform: translateY(-50%); width: 44px; height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--sh-muted); display: grid; place-items: center; cursor: pointer; padding: 0; }
.sh-x .ic { width: 18px; height: 18px; }
@keyframes sh-rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* end screen */
.sh-end { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; background: radial-gradient(120% 90% at 50% 0%, rgba(0, 112, 229, .28), rgba(6, 9, 16, .96) 60%); animation: sh-fade .35s ease both; }
.sh-end-inner { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; max-width: 520px; width: 100%; }
.sh-end-kicker { margin: 0; font-size: clamp(20px, 3vw, 28px); font-weight: 700; letter-spacing: -.01em; }
.sh-end-ctas { display: flex; flex-direction: column; gap: 12px; width: 100%; }
@keyframes sh-fade { from { opacity: 0; } to { opacity: 1; } }

/* gate */
.sh-gate { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 10px; padding: 24px max(24px, calc(50% - 190px)); background: rgba(6, 9, 16, .9); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sh-gate-title { margin: 0; font-size: 20px; font-weight: 700; }
.sh-gate-sub { margin: 0 0 6px; font-size: 14px; }
.sh-input { width: 100% !important; min-height: 48px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--sh-line); background: var(--sh-panel); font-size: 16px; }
.sh-input:focus { outline: 2px solid var(--sh-brand); outline-offset: 0; border-color: transparent; }
.sh-err { color: #ff8a80; min-height: 1.3em; margin: 0; font-size: 14px; }

/* side: tabs + panels */
.sh-side { position: sticky; top: calc(16px + env(safe-area-inset-top, 0px)); display: flex; flex-direction: column; background: var(--sh-panel); border: 1px solid var(--sh-line); border-radius: var(--sh-radius); max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); min-height: 360px; overflow: hidden; margin-top: 54px; }
.sh-tabs { display: flex; gap: 4px; padding: 6px; border-bottom: 1px solid var(--sh-line); flex: none; }
.sh-tab { flex: 1; min-height: 44px; border: 0; border-radius: 10px; background: transparent; color: var(--sh-muted); font-weight: 600; cursor: pointer; }
.sh-tab[aria-selected="true"] { background: var(--sh-raise); color: var(--sh-ink); }
.sh-panel { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 16px 18px 24px; -webkit-overflow-scrolling: touch; }
.sh-search { position: sticky; top: -16px; z-index: 1; display: flex; align-items: center; gap: 8px; margin: -16px -18px 12px; padding: 12px 18px; background: var(--sh-panel); border-bottom: 1px solid var(--sh-line); color: var(--sh-muted); }
.sh-search-input { flex: 1; min-width: 0; min-height: 44px; border: 0; background: transparent; font-size: 16px; color: var(--sh-ink) !important; outline: none; padding: 0; }
.sh-search-count { font-size: 12px; white-space: nowrap; }
.sh-para { margin: 0 0 16px; line-height: 1.75; font-size: 15.5px; color: #cdd5e3; }
.sh-stamp { display: flex; align-items: center; min-height: 44px; min-width: 44px; margin: -10px 0 -8px; padding: 0; border: 0; background: none; font: 600 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--sh-brand-hi); cursor: pointer; }
.w { cursor: pointer; border-radius: 4px; padding: 1px 0; transition: background .12s ease, color .12s ease; }
.w:hover { background: rgba(255, 255, 255, .08); }
.w.on { background: rgba(0, 112, 229, .32); color: #fff; box-shadow: 0 0 0 2px rgba(0, 112, 229, .32); }
.w.hit { background: rgba(255, 196, 0, .28); color: #fff; }
.sh-nohits { text-align: center; padding: 20px 0; }
.sh-pending { text-align: center; padding: 40px 12px; }
.sh-pending-title { font-weight: 700; margin: 14px 0 4px; }
.sh-pending .sh-muted { margin: 0; font-size: 14px; }
.sh-dots { display: inline-flex; gap: 6px; }
.sh-dots i { width: 8px; height: 8px; border-radius: 50%; background: var(--sh-brand); animation: sh-dot 1.2s ease-in-out infinite; }
.sh-dots i:nth-child(2) { animation-delay: .15s; } .sh-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes sh-dot { 0%, 80%, 100% { opacity: .25; transform: scale(.8); } 40% { opacity: 1; transform: scale(1); } }
.sh-notes-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.sh-notes-tag { font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--sh-brand-hi); }
.sh-panel h3 { font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--sh-muted); margin: 22px 0 8px; }
.sh-summary { margin: 0; line-height: 1.65; overflow-wrap: anywhere; }
.sh-list { margin: 0; padding-left: 20px; line-height: 1.6; }
.sh-list li { margin-bottom: 6px; overflow-wrap: anywhere; }
.sh-actions { list-style: none; padding-left: 0; }
.sh-actions li { position: relative; padding-left: 28px; }
.sh-actions li::before { content: ""; position: absolute; left: 0; top: .3em; width: 16px; height: 16px; border-radius: 5px; border: 2px solid var(--sh-brand-hi); }
.sh-chapters { list-style: none; margin: 0; padding: 0; }
.sh-chapter { display: flex; align-items: baseline; gap: 12px; width: 100% !important; min-height: 44px; padding: 10px 10px; border: 0; border-radius: 10px; background: transparent; text-align: left; cursor: pointer; }
.sh-chapter:hover { background: var(--sh-raise); }
.sh-chapter-t { flex: none; font: 600 12px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--sh-brand-hi); min-width: 3.5em; }

/* message pages (password, 404, offline) */
.sh-center { display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 6vh 0; }
.sh-card { width: 100%; max-width: 420px; padding: 32px 28px; text-align: center; background: var(--sh-panel); border: 1px solid var(--sh-line); border-radius: 20px; box-shadow: 0 24px 60px -30px rgba(0, 0, 0, .9); }
.sh-card h1 { font-size: 22px; margin: 16px 0 8px; }
.sh-card > p { margin: 0 0 20px; line-height: 1.55; }
.sh-card-mark { width: 56px; height: 56px; }
.sh-card-icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 112, 229, .16); color: var(--sh-brand-hi); }
.sh-card-icon .ic { width: 26px; height: 26px; }
.sh-form { display: flex; flex-direction: column; gap: 10px; }

/* loading skeleton */
.sk { background: linear-gradient(90deg, var(--sh-panel) 0%, var(--sh-raise) 50%, var(--sh-panel) 100%); background-size: 200% 100%; animation: sh-shimmer 1.4s linear infinite; border-radius: 10px; }
.sk-line { display: inline-block; height: 14px; margin: 0 0 14px; }
.sh-headline .sk-line { margin: 0; max-width: 60vw; }
.sk-title { height: 30px; width: 55%; margin-bottom: 16px; }
.sh-stage.sk { border-radius: var(--sh-radius); }
.sk-bar { height: 52px; margin-top: 16px; width: 40%; }
@keyframes sh-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sh-offscreen { position: fixed; left: -9999px; top: 0; }

@media (prefers-reduced-motion: reduce) { .share *, .share *::before { animation: none !important; transition: none !important; } }

/* phone + tablet: transcript below the player */
@media (max-width: 899px) {
  .sh-main { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .sh-side { position: static; margin-top: 0; max-height: 70vh; max-height: 70dvh; min-height: 300px; }
  .sh-stage { max-height: none; }
}
@media (max-width: 560px) {
  .sh-head { padding-bottom: 12px; }
  .sh-title { margin-bottom: 12px; }
  .sh-player { border-radius: 12px; }
  .sh-bigplay { width: 68px; height: 68px; }
  .sh-bigplay .ic { width: 30px; height: 30px; }
  .sh-controls { gap: 0; padding: 4px; flex-wrap: wrap; }
  .sh-time { font-size: 12px; padding: 0 4px; }
  .sh-scrub { order: -1; flex-basis: 100%; height: 32px; padding: 0 8px; }
  .sh-ctl-hide-xs { display: none; }
  .sh-speed { margin-left: auto; }
  .sh-overlay { padding: 0 8px 8px; }
  .sh-overlay { justify-content: flex-end; }
  .sh-cta-card { width: auto; padding: 6px 44px 6px 6px; gap: 0; }
  .sh-cta-card-label { display: none; }
  .sh-cta-card .sh-btn { min-height: 44px; padding: 8px 14px; font-size: 14px; }
  .sh-cta-card .sh-btn .ic { display: none; }
  .sh-cta-card .seal { width: 22px; height: 22px; }
  .sh-end-kicker { font-size: 18px; }
  .sh-end .sh-btn-lg { min-height: 48px; padding: 10px 18px; font-size: 15px; }
  .sh-end-inner { gap: 10px; }
  .sh-gate { gap: 8px; padding: 14px 18px; }
  .sh-gate-title { font-size: 17px; }
  .sh-stage.has-gate { aspect-ratio: auto; min-height: 330px; }
  .sh-stage.has-end { aspect-ratio: auto; min-height: 300px; }
  .sh-gate-sub { display: none; }
  .sh-gate .sh-input, .sh-gate .sh-btn { min-height: 44px; padding-top: 8px; padding-bottom: 8px; }
}


/* ===== owner edit page /edit/<id> (light) ===== */
.ed-body #shell { padding-top: 52px; }
.ed { max-width: 1440px; margin: 0 auto; }
.ed button, .ed input, .ed select, .ed textarea { width: auto; margin: 0; font: inherit; }
.ed input[type=text], .ed input[type=url], .ed input[type=email], .ed input[type=number], .ed textarea, .ed select { min-height: 40px; padding: 8px 11px; font-size: 15px; border: 1px solid var(--line-strong); border-radius: 9px; background: #fff; color: var(--ink); }
.ed textarea { width: 100%; resize: vertical; line-height: 1.45; }
.ed input:focus, .ed textarea:focus, .ed select:focus { outline: none; box-shadow: 0 0 0 3px rgba(0, 112, 229, .18); border-color: var(--brand); }
.ed button { min-height: 40px; padding: 0 14px; font-size: 14.5px; border-radius: 9px; }
.ed button.ghost, .ed .ghost { background: #fff; color: var(--ink); border: 1px solid var(--line-strong); box-shadow: var(--shadow-1); }
.ed button.ghost:hover, .ed .ghost:hover { background: var(--raise); border-color: #AEB8C6; }
.ed button.armed { background: var(--bad); border-color: var(--bad); color: #fff; }
.ed-small { font-size: 14px; min-height: 40px; }
.ed-small .ic { width: 17px; height: 17px; }
.ed-loading, .ed-missing { max-width: 520px; margin: 12vh auto; text-align: center; }
.ed-head { display: grid; grid-template-columns: 1fr auto; gap: 8px 20px; align-items: center; margin-bottom: 22px; }
.ed-back { grid-column: 1 / -1; justify-self: start; display: inline-flex; align-items: center; gap: 4px; margin-left: -4px; padding: 4px 8px 4px 4px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--muted); text-decoration: none; }
.ed-back:hover { color: var(--ink); background: #E9EDF2; }
.ed-back .ic { width: 18px; height: 18px; }
.ed-titlerow { display: flex; align-items: center; gap: 12px; min-width: 0; flex-wrap: wrap; }
.ed-title { font: 600 clamp(1.6rem, 2.6vw, 2.2rem)/1.1 var(--font-display); margin: 0; overflow-wrap: anywhere; letter-spacing: -.015em; }
.ed-headactions { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-headactions a { display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; border-radius: 9px; text-decoration: none; font-size: 14px; font-weight: 600; }
.ed-statusrow { grid-column: 1 / -1; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ed-status { margin: 0; font-size: 14px; color: var(--muted); }
.ed-share-flags { grid-column: 1 / -1; margin: 0; font-size: 14px; }
.ed-status.bad { color: var(--bad); }
.ed-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; padding: 4px 11px; border-radius: 999px; background: #EEF1F5; color: var(--muted); white-space: nowrap; }
.ed-chip::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ed-chip[data-status=ready] { background: var(--ok-wash); color: var(--ok); }
.ed-chip[data-status=transcribing], .ed-chip[data-status=noting], .ed-chip[data-status=uploading] { background: var(--brand-wash); color: var(--brand-deep); }
.ed-chip[data-status=transcribing]::before, .ed-chip[data-status=noting]::before, .ed-chip[data-status=uploading]::before { animation: pulse 1.4s ease-in-out infinite; }
.ed-chip[data-status=failed] { background: var(--bad-wash); color: var(--bad); }
.ed-chip[data-status=ai-capped] { background: var(--warn-wash); color: var(--warn); }
.ed-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(360px, 1fr); gap: 28px; align-items: start; }
.ed-left { min-width: 0; position: sticky; top: calc(12px + env(safe-area-inset-top, 0px)); }
.ed-right { min-width: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); overflow: hidden; }
.ed-stage { background: #05070C; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; box-shadow: var(--shadow-3); }
.ed-video { display: block; width: 100%; height: 100%; object-fit: contain; background: #000; }
.ed-controls { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.ed-play { min-width: 76px; min-height: 40px; }
.ed-time { font: 600 14px/1 var(--font-body); font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.ed-scrubwrap { flex: 1; position: relative; padding-bottom: 8px; min-width: 0; }
.ed .ed-scrub { width: 100%; padding: 0; border: 0; margin: 0; accent-color: var(--brand); height: 28px; }
.ed-marks { position: absolute; left: 0; right: 0; bottom: 0; height: 6px; }
.ed-marks i { position: absolute; top: 0; height: 6px; border-radius: 3px; background: var(--brand); opacity: .75; }
.ed-marks i.sign { background: var(--ok); }
.ed-trim { margin-top: 16px; padding: 14px 16px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-1); }
.ed-trim-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; font-size: 14px; margin-bottom: 6px; }
.ed-trim-track { position: relative; height: 34px; }
.ed-trim-track::before { content: ''; position: absolute; left: 0; right: 0; top: 13px; height: 8px; border-radius: 4px; background: #E3E8EF; }
.ed-trim-cuts i { position: absolute; top: 13px; height: 8px; background: repeating-linear-gradient(-45deg, #B3261E 0 3px, #E06A63 3px 6px); border-radius: 2px; }
.ed-trim-in { position: absolute; inset: 0; width: 100%; height: 34px; margin: 0; padding: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; border: 0; }
.ed-trim-in::-webkit-slider-runnable-track { background: transparent; height: 34px; }
.ed-trim-in::-moz-range-track { background: transparent; }
.ed-trim-in::-webkit-slider-thumb { -webkit-appearance: none; pointer-events: auto; width: 14px; height: 30px; margin-top: 2px; border-radius: 4px; background: var(--brand); border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: ew-resize; }
.ed-trim-in::-moz-range-thumb { pointer-events: auto; width: 14px; height: 30px; border-radius: 4px; background: var(--brand); border: 2px solid #fff; cursor: ew-resize; }
.ed-inline-err { margin: 6px 0 0; min-height: 0; }
.ed-tabs { display: flex; gap: 4px; margin: 10px; padding: 4px; background: #EEF1F5; border-radius: 12px; overflow-x: auto; scrollbar-width: none; }
.ed .ed-tab { flex: 1; background: transparent; color: var(--muted); border: 0; border-radius: 9px; box-shadow: none; padding: 0 12px; min-height: 38px; font-weight: 600; font-size: 14.5px; white-space: nowrap; }
.ed .ed-tab:hover { background: transparent; color: var(--ink); }
.ed .ed-tab[aria-selected="true"] { color: var(--ink); background: var(--paper); box-shadow: var(--shadow-1), 0 0 0 1px rgba(15, 23, 41, .04); }
.ed-panel { padding: 8px 20px 22px; max-height: calc(100vh - 210px); overflow-y: auto; container-type: inline-size; }
/* Narrow panel (phone, or a squeezed desktop): each viewer row becomes a stacked card with inline labels. */
@container (max-width: 520px) {
  .ed-table thead { display: none; }
  .ed-table, .ed-table tbody, .ed-table tr, .ed-table td { display: block; width: auto; }
  .ed-table tr { padding: 10px 0; border-bottom: 1px solid var(--line); }
  .ed-table td { border: 0; padding: 3px 0; }
  .ed-table td[data-label]:not(.ed-who-td) { display: grid; grid-template-columns: 7.5em 1fr; gap: 8px; }
  .ed-table td[data-label]:not(.ed-who-td)::before { content: attr(data-label); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
}
.ed-panel h3 { font: 600 1.15rem/1.2 var(--font-display); margin: 6px 0 10px; }
.ed-hint { font-size: 13px; margin: 8px 0 10px; }
.ed-tools, .ed-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.ed-row-fill > input { flex: 1 1 160px; min-width: 0; }
.ed-selbar { position: sticky; top: -8px; z-index: 2; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 10px; margin: 0 0 10px; background: #fff; border: 1px solid var(--brand); border-radius: 10px; box-shadow: var(--shadow-2); }
.ed-sel-label { font-size: 14px; font-weight: 600; margin-right: auto; }
.ed-words { font-size: 16.5px; line-height: 1.8; color: var(--ink-2); }
.ed-para { margin: 0 0 14px; }
.ed-stamp { font: 600 12px/1 var(--font-body); font-variant-numeric: tabular-nums; color: var(--brand); background: var(--brand-wash); padding: 2px 6px; border-radius: 5px; margin-right: 6px; user-select: none; }
.ed-words .w { border-radius: 4px; cursor: text; padding: 1px 0; }
.ed-words .w:hover { background: #EEF3FC; }
.ed-words .w.on { background: #cfe2ff; }
.ed-words .w.cut { text-decoration: line-through; text-decoration-color: var(--bad); color: #8E98A9; background: var(--bad-wash); }
.ed-words .w.fixed { border-bottom: 2px dotted var(--brand); }
.ed-words ::selection { background: #ffd9a8; }
.ed-fix { width: 9em; padding: 2px 6px !important; font-size: 15px; }
.ed-review { padding: 14px; margin-bottom: 14px; background: var(--raise); border: 1px solid var(--line); border-radius: var(--radius-sm); }
.ed-review-head { margin: 0 0 8px; font-weight: 600; font-size: 14px; }
.ed-fillers { display: grid; gap: 4px; max-height: 260px; overflow-y: auto; margin-bottom: 10px; }
.ed-filler { display: flex; gap: 10px; align-items: center; font-size: 14px; padding: 6px 4px; border-radius: 6px; cursor: pointer; }
.ed-filler:hover { background: #fff; }
.ed-filler input { width: 18px; height: 18px; flex: none; }
.ed-filler-t { font: 600 12px/1 var(--font-body); font-variant-numeric: tabular-nums; color: var(--muted); flex: none; }
.ed-empty { text-align: center; padding: 28px 8px; }
.ed-empty-title { font: 600 1.15rem/1.2 var(--font-display); margin: 0 0 4px; }
.ed-empty-line { margin: 4px 0 12px; }
.ed-form { display: grid; gap: 12px; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
.ed-form:last-of-type { border-bottom: 0; }
.ed-field { display: grid; gap: 5px; font-size: 14px; }
.ed-field > span:first-child { color: var(--ink-2); font-weight: 600; font-size: 13px; }
.ed-help { margin: -6px 0 0; font-size: 13px; }
.ed-notes-head, .ed-viewers-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ed-viewers-head h3 { margin: 0; }
.ed-tag { font-size: 12px; font-weight: 600; color: var(--brand-deep); background: var(--brand-wash); padding: 3px 10px; border-radius: 999px; }
.ed-tag-warn { color: var(--warn); background: var(--warn-wash); }
.ed-note-msg { margin: 8px 0 0; color: var(--ok); font-size: 14px; }
.ed-chapters { display: grid; gap: 6px; }
.ed-ch { display: grid; grid-template-columns: 5.5em 1fr auto; gap: 6px; }
.ed-short { width: 6.5em; }
.ed-cta-list { display: grid; gap: 8px; margin-bottom: 12px; }
.ed-cta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--paper); box-shadow: var(--shadow-1); }
.ed-cta-main { display: grid; gap: 2px; min-width: 0; font-size: 14px; }
.ed-cta-url { overflow-wrap: anywhere; font-size: 13px; }
.ed-cta-warn { flex-basis: 100%; order: 3; margin: 0; padding: 6px 10px; font-size: 13px; }
.ed-cta-type { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--brand); }
.ed-cta-type.t-sign { color: var(--ok); }
.ed-cta-form { margin-top: 14px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--raise); }
.ed-recipient-result { display: grid; gap: 8px; padding: 14px; margin: -6px 0 18px; border: 1px solid var(--brand-line); background: var(--brand-wash); border-radius: var(--radius-sm); }
.ed-recipient-result .ed-link, .ed-recipient-result .ed-msg { width: 100%; font-size: 14px; }
.ed-table-wrap { overflow-x: auto; }
.ed-table { border-collapse: collapse; width: 100%; font-size: 14px; }
.ed-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 6px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.ed-table td { padding: 12px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ed-table tr.unopened td { color: var(--muted); }
.ed-who-td { width: 38%; }
.ed-who, .ed-cell { display: grid; gap: 2px; justify-items: start; overflow-wrap: anywhere; }
.ed-who-actions { margin-top: 6px; }
.ed-cell { grid-auto-flow: row; }
.ed-trunc { margin: 0 0 10px; font-size: 14px; }
.ed-sub { font-size: 12px; }
.ed-badge { justify-self: start; font-size: 11.5px; font-weight: 600; color: var(--warn); background: var(--warn-wash); padding: 1px 8px; border-radius: 999px; }
.ed-pct { white-space: nowrap; }
.ed-clicks { overflow-wrap: anywhere; }
.ed-bar { display: inline-block; width: 60px; height: 6px; border-radius: 99px; background: #E6EAF0; margin-right: 8px; vertical-align: middle; overflow: hidden; }
.ed-bar i { display: block; height: 100%; background: var(--brand); }
.ed-anon { margin: 10px 0 0; }
.ed-thumb { width: 100%; max-width: 320px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 10px; background: #000; }
.ed-filebtn { position: relative; display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 9px; cursor: pointer; overflow: hidden; }
.ed-filebtn input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.ed-check { display: flex; gap: 10px; align-items: center; font-size: 15px; min-height: 40px; }
.ed-check input { width: 20px; height: 20px; accent-color: var(--brand); flex: none; }
.ed-check-off { color: var(--muted); }
.ed .ed-delete { color: var(--bad); }
.ed-retry { min-height: 36px; }
@media (max-width: 900px) {
  .ed-grid { grid-template-columns: minmax(0, 1fr); }
  .ed-left { position: static; }
  .ed-panel { max-height: none; padding: 6px 16px 18px; }
  .ed-body #shell { padding-top: 22px; }
  .ed-head { grid-template-columns: minmax(0, 1fr); }
}
/* Watched cell: bar + % on one line, the "watched an earlier cut" note on its own line below (as a grid column it was
   squeezed to one letter per line). */
.ed-cell:has(.ed-bar) { display: flex; flex-wrap: wrap; align-items: center; justify-content: start; gap: 2px 0; }
.ed-cell .ed-stale { flex: 1 0 100%; overflow-wrap: normal; word-break: normal; }
.ed-table td[data-label="Watched"] { min-width: 9.5em; }


/* ===== library "/" ===== */
.lib-record .ic { width: 18px; height: 18px; }
:where(#shell) .lib-record { min-height: 50px; padding: 0 24px; font-size: 16px; border-radius: 12px; }
.lib-record .ic circle:last-child { fill: #fff; }

/* Recent views (top of home) + Who watched (/views): one row per view */
.lib-activity { margin: 0 0 28px; }
.lib-activity:empty { display: none; }
.lib-activity-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0 0 10px; }
.lib-h2 { margin: 0; font: 600 1.3rem/1.2 var(--font-display); letter-spacing: -.01em; }
.lib-seeall { font-weight: 600; font-size: 14px; text-decoration: none; }
.lib-seeall::after { content: " →"; }
.lib-seeall:hover { text-decoration: underline; }
.lib-views { list-style: none; margin: 0; padding: 0; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-2); overflow: hidden; }
.lib-views li + li { border-top: 1px solid var(--line); }
.lib-view { display: grid; grid-template-columns: 40px minmax(0, 1.6fr) minmax(140px, 1fr) minmax(0, 1.2fr) 72px; align-items: center; gap: 16px;
  min-height: 64px; padding: 12px 18px; color: var(--ink); text-decoration: none; transition: background var(--fast) var(--ease); }
.lib-view:hover { background: var(--raise); }
.lib-view:focus-visible { outline: 2px solid var(--brand); outline-offset: -2px; }
.vw-avatar { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: var(--brand-wash); color: var(--brand-deep); font: 600 17px/1 var(--font-display); }
.vw-avatar.anon { background: #EEF1F5; color: var(--muted); }
.vw-avatar .ic { width: 18px; height: 18px; }
.is-done .vw-avatar { background: var(--brand); color: #fff; }
.vw-who { display: grid; gap: 2px; min-width: 0; }
.vw-name { display: flex; align-items: baseline; gap: 8px; min-width: 0; font-weight: 600; }
.vw-name > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-flag { flex: none; font-size: 12px; font-weight: 500; color: var(--warn); }
.vw-video { font-size: 14px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-progress { display: flex; align-items: center; gap: 10px; }
.vw-bar { flex: 1; height: 6px; border-radius: 99px; background: #E6EAF0; overflow: hidden; }
.vw-bar i { display: block; height: 100%; border-radius: 99px; background: var(--brand); }
.vw-pct { flex: none; min-width: 3.4em; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.is-done .vw-pct { color: var(--brand-deep); }
.vw-clicks { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.vw-click { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; padding: 3px 10px 3px 8px; border-radius: 99px; background: var(--ok-wash); color: var(--ok); font-size: 13px; font-weight: 600; }
.vw-click .ic { width: 14px; height: 14px; }
.vw-click span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vw-ago { justify-self: end; font-size: 13px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* search + archived toggle */
.lib-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 0 0 20px; }
.lib-searchrow { flex: 1 1 320px; position: relative; display: flex; align-items: center; }
.lib-searchrow > .ic { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--muted); pointer-events: none; }
:where(#shell) .lib-search { width: 100%; min-height: 48px; padding-left: 42px; border-radius: 12px; border-color: var(--line); box-shadow: var(--shadow-1); }
.lib-toggle:empty { display: none; }
:where(#shell) .lib-small { min-height: 44px; padding: 0 14px; font-size: 14px; border-radius: 9px; }
.lib-small .ic { width: 17px; height: 17px; }
.lib-hits { margin-bottom: 8px; }
.lib-hits:empty { display: none; }
.lib-hits > .lib-h2 { margin: 0 0 12px; font-size: 1.15rem; }
.lib-hit { display: grid; gap: 4px; padding: 14px 16px; margin-bottom: 8px; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius-sm); color: var(--ink); text-decoration: none; overflow-wrap: anywhere; box-shadow: var(--shadow-1); }
.lib-hit:hover { border-color: var(--brand-line); }
.lib-hit .muted { font-size: 14px; }

/* the grid of videos */
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 22px; }
.lib-card { position: relative; display: flex; flex-direction: column; background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-2);
  transition: transform 260ms var(--ease), box-shadow 260ms var(--ease); }
.lib-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-3); }
.lib-card.is-archived { opacity: .72; }
.lib-thumb { position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
  background: radial-gradient(120% 120% at 0% 100%, #0B2A5A 0%, #0A3F86 45%, #0070E5 100%); }
.lib-thumb::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(5, 10, 20, .35), transparent 45%); pointer-events: none; }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 500ms var(--ease); }
.lib-card:hover .lib-thumb img { transform: scale(1.03); }
.lib-play { position: absolute; left: 50%; top: 50%; z-index: 1; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; color: var(--brand);
  background: rgba(255, 255, 255, .94); box-shadow: 0 6px 20px rgba(0, 20, 60, .3); transform: translate(-50%, -50%) scale(.85); opacity: 0; transition: opacity 220ms var(--ease), transform 220ms var(--ease); }
.lib-play .ic { width: 24px; height: 24px; margin-left: 3px; }
.lib-thumb:hover .lib-play, .lib-thumb:focus-visible .lib-play { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.lib-dur { position: absolute; right: 10px; bottom: 10px; z-index: 1; padding: 4px 7px; border-radius: 6px; background: rgba(5, 10, 20, .72); color: #fff; font: 600 12px/1 var(--font-body); font-variant-numeric: tabular-nums; }
.lib-body { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px 16px; flex: 1; }
.lib-name { color: var(--ink); font: 600 1.18rem/1.25 var(--font-display); letter-spacing: -.005em; text-decoration: none; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.lib-name:hover { color: var(--brand-deep); }
.lib-meta { font-size: 14px; }
.lib-status { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; }
.lib-status:empty { display: none; }
.lib-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 12px; }
:where(#shell) .lib-more { min-width: 44px; padding: 0; }
.lib-copy.is-copied { color: var(--ok); border-color: #9FD9C4; }
.lib-menu { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 10px; border-top: 1px solid var(--line); margin-top: 6px; animation: menu-in .2s var(--ease) both; }
.lib-menu[hidden] { display: none; }
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
:where(#shell) .lib-danger { color: var(--bad); }
.lib-chip { display: inline-flex; align-items: center; min-height: 26px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; text-decoration: none; background: var(--brand-wash); color: var(--brand-deep); border: 0; }
.lib-chip-warn { background: var(--warn-wash); color: var(--warn); }
.lib-chip-bad { background: var(--bad-wash); color: var(--bad); }
:where(#shell) .lib-chipbtn { min-height: 44px; padding: 0 16px; font-size: 14px; background: var(--warn-wash); color: var(--warn); border: 1px solid #F0D9A8; box-shadow: none; }
:where(#shell) .lib-chipbtn:hover { background: #FFEBC2; border-color: #E8C77F; }
.lib-msg { font-size: 13px; }
.lib-err { margin: 0; font-size: 13px; color: var(--bad); }
.lib-empty { grid-column: 1 / -1; }
.lib-none { grid-column: 1 / -1; text-align: center; padding: 32px 0; }

/* ===== Who watched /views ===== */
.vw .page-head { margin-bottom: 20px; }
.vw-filters { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 24px; }
:where(#shell) .vw-chip { min-height: 44px; padding: 0 14px; gap: 8px; border-radius: 99px; font-size: 14px; background: var(--paper); color: var(--ink-2); border-color: var(--line-strong); box-shadow: none; }
:where(#shell) .vw-chip:hover { background: var(--raise); border-color: #AEB8C6; }
:where(#shell) .vw-chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.vw-count { min-width: 1.6em; padding: 1px 6px; border-radius: 99px; background: rgba(15, 23, 41, .07); font-size: 12px; font-variant-numeric: tabular-nums; }
.vw-chip.on .vw-count { background: rgba(255, 255, 255, .18); }
.vw-day + .vw-day { margin-top: 28px; }
.vw-dayhead { margin: 0 0 10px; font-size: 13px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.vw-none { text-align: center; padding: 32px 0; }
.vw-skel { height: 64px; margin-bottom: 1px; background: linear-gradient(90deg, #EEF1F5 0%, #F7F9FB 50%, #EEF1F5 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }
.vw-skel:first-child { border-radius: var(--radius) var(--radius) 0 0; } .vw-skel:last-child { border-radius: 0 0 var(--radius) var(--radius); }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }

@media (max-width: 760px) {
  .lib-view { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "av who ago" "av prog prog" "av clk clk"; gap: 6px 12px; padding: 12px 14px; }
  .vw-avatar { grid-area: av; align-self: start; }
  .vw-who { grid-area: who; }
  .vw-ago { grid-area: ago; align-self: start; padding-top: 2px; }
  .vw-progress { grid-area: prog; }
  .vw-clicks { grid-area: clk; }
  .vw-clicks:empty { display: none; }
  .lib-grid { grid-template-columns: 1fr; gap: 16px; }
  :where(#shell) .lib-record { width: 100%; }
  .lib-top > div { flex: 1 1 100%; }
  .lib-play { opacity: 1; transform: translate(-50%, -50%) scale(.85); }
}

/* Wave A: editor — upload that never finished, personal-link copy, disabled share page link */
.ed-upload-stuck { grid-column: 1 / -1; margin: 0; padding: 12px 14px; border-radius: 10px; font-size: 14.5px; }
.ed-upload-stuck .ed-row { margin-top: 10px; align-items: center; }
.ed-upload-stuck .btn { display: inline-flex; align-items: center; text-decoration: none; padding: 0 14px; border-radius: 9px; font-weight: 600; }
.ed-headactions a.ed-disabled { opacity: .45; pointer-events: none; }
.ed-headactions { align-items: center; }
.ed-public-hint { flex-basis: 100%; margin: 0; font-size: 13px; }
.ed-person-form { grid-column: 1 / -1; }
.ed-person-form .ed-row { display: flex; gap: 8px; flex-wrap: wrap; }
.ed-person-form input { flex: 1 1 200px; min-width: 0; }
.ed button:disabled { opacity: .5; cursor: not-allowed; }

/* Phone held sideways: fit the video to the screen height so the play button and the controls stay on screen.
   The title drops below the player (scroll for it); the transcript is below that, as on portrait. */
@media (orientation: landscape) and (max-height: 500px) {
  .sh-head { padding-top: calc(6px + env(safe-area-inset-top, 0px)); padding-bottom: 6px; }
  .sh-mark { width: 22px; height: 22px; }
  .sh-headline { font-size: 13px; }
  .sh-main { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .sh-left { display: flex; flex-direction: column; }
  .sh-left .sh-player { order: -1; }
  .sh-title { margin-top: 12px; }
  .sh-side { position: static; max-height: none; }
  .sh-player:not(:fullscreen) .sh-stage { aspect-ratio: auto; max-height: none; height: calc(100vh - 40px - 60px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); height: calc(100svh - 40px - 60px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px)); min-height: 120px; }
  .sh-stage.has-gate, .sh-stage.has-end { min-height: 0; }
}


/* ===== fix wave E: tap targets, tab bar, toast, focus rings ===== */
.ed-toast { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60; max-width: min(92vw, 520px); padding: 12px 18px; border-radius: 12px; background: var(--ink); color: #fff; font-size: 14.5px; font-weight: 600; line-height: 1.35; box-shadow: var(--shadow-3); }
.ed-toast.bad { background: var(--bad); }
.ed-toast[hidden] { display: none; }
.ed .ed-tab { min-height: 44px; }
.ed a:focus-visible, .ed button:focus-visible, .ed summary:focus-visible, .ed select:focus-visible, .ed input[type=checkbox]:focus-visible, .ed input[type=file]:focus-visible, .ed input[type=range]:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.ed-check:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; border-radius: 8px; }
.ed-check { min-height: 44px; align-items: center; }
.share a:focus-visible, .share button:focus-visible, .share select:focus-visible, .share input[type=range]:focus-visible, .share-body a:focus-visible, .share-body button:focus-visible, .share-body select:focus-visible, .share-body input[type=range]:focus-visible { outline: 2px solid var(--sh-brand-hi); outline-offset: 2px; }
.sh-search:focus-within { outline: 2px solid var(--sh-brand-hi); outline-offset: 2px; border-radius: 10px; }
@media (max-width: 560px) {
  /* Owner pages on a phone: every control at least 44 x 44. */
  .ed button, .ed-small, .ed-play, .ed input[type=text], .ed input[type=url], .ed input[type=email], .ed input[type=number], .ed input[type=password], .ed input[type=search], .ed textarea, .ed select { min-height: 44px; }
  .ed-headactions a { min-height: 44px; }
  .ed-back { min-height: 44px; padding: 4px 12px 4px 4px; }
  .ed .ed-scrub { height: 44px; }
  .ed-trim-track, .ed-trim-in { height: 44px; }
  .ed-trim-track::before, .ed-trim-cuts i { top: 18px; }
  .ed-trim-in::-webkit-slider-runnable-track { height: 44px; }
  .ed-trim-in::-webkit-slider-thumb { width: 22px; height: 44px; margin-top: 0; }
  .ed-trim-in::-moz-range-thumb { width: 22px; height: 44px; }
  .ed-marks { bottom: 6px; }
  .tb-out { min-width: 44px; justify-content: center; }
  .lib-seeall { display: inline-flex; align-items: center; min-height: 44px; padding: 0 4px; color: var(--brand-deep); }
  /* Five tabs, one row, no scrolling: Settings (where the Alerts switch lives) is always on screen. */
  .ed-tabs { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; margin: 10px 8px; padding: 3px; overflow: visible; }
  .ed .ed-tab { min-height: 44px; padding: 0 2px; font-size: 12.5px; letter-spacing: -.01em; text-overflow: clip; }
  /* Share page */
  .sh-scrub { height: 44px; }
  .sh-controls { padding: 2px 4px; }
}
@media (max-width: 560px) {
  a.lib-name { display: flex; align-items: center; min-height: 44px; }
  a.lib-chip { display: inline-flex; align-items: center; min-height: 44px; }
}
