/* Demotape. Black canvas, Apple-style glass, one typeface (Aspekta Regular), Untitled UI icons. */

@font-face {
  font-family: "Aspekta";
  src: url("/assets/fonts/Aspekta-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: dark;
  --bg: #000;

  /* Glass: a translucent tint over a strong blur that lifts the colours behind it (vibrancy),
     a thin rim that catches light on the top-left and bottom-right edges, a soft top sheen,
     and a shadow that separates it from the page. */
  --glass-tint: rgba(28, 28, 31, 0.5);
  --glass-tint-dense: rgba(22, 22, 25, 0.66);
  --glass-blur: blur(40px) saturate(190%);
  --glass-sheen: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.015) 38%, rgba(255, 255, 255, 0) 60%);
  --glass-rim: linear-gradient(150deg, rgba(255, 255, 255, 0.36) 0%, rgba(255, 255, 255, 0.1) 18%, rgba(255, 255, 255, 0.03) 45%, rgba(255, 255, 255, 0.05) 70%, rgba(255, 255, 255, 0.2) 100%);
  --glass-shadow: 0 1px 1px rgba(0, 0, 0, 0.25), 0 18px 50px rgba(0, 0, 0, 0.42);
  --glass-inner: inset 0 1px 0 rgba(255, 255, 255, 0.07), inset 0 0 0 0.5px rgba(255, 255, 255, 0.05);

  --fill: rgba(255, 255, 255, 0.06);
  --fill-2: rgba(255, 255, 255, 0.1);
  --fill-3: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.13);
  --hair: inset 0 0 0 0.5px rgba(255, 255, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.06);

  --text: #fff;
  --text-2: #cacacf;
  --text-3: #9a9aa1;
  --text-4: #7c7c83;
  --rec: #ff453a;
  --ok: #30d158;
  --warn: #ffd60a;

  --r-sm: 10px;
  --r-md: 14px;
  --r-lg: 20px;
  --r-xl: 26px;
  --font: "Aspekta", ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --gap: 20px;
  --vh: 100vh;
}
@supports (height: 100dvh) {
  :root { --vh: 100dvh; }
}

*, *::before, *::after { box-sizing: border-box; }
html {
  font-synthesis: none; /* one weight only: never fake a bold or italic */
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 400 14px/1.55 var(--font);
  letter-spacing: 0.004em;
  word-spacing: 0.07em; /* Aspekta's word space is narrow at small sizes */
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, h4, h5, h6, b, strong, th, button, input, select, textarea, label { font-weight: 400; }
img, video { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
::selection { background: rgba(255, 255, 255, 0.24); }
:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.75); outline-offset: 2px; }
.muted { color: var(--text-3); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.i { flex: none; display: block; }
/* Digits of live numbers (timers) sit in equal boxes, since the typeface has no tabular figures. */
.dg { display: inline-block; width: 0.6em; text-align: center; }

/* ---------- Ambient backdrop: the video's own frame, blurred far behind the glass ---------- */
.ambient {
  position: fixed; inset: -12%; z-index: 0; pointer-events: none;
  background: #000 center / cover no-repeat;
  filter: blur(90px) saturate(1.6) brightness(0.24);
  transform: translateZ(0);
}
.ambient::after { content: ""; position: absolute; inset: 0; background: radial-gradient(72% 62% at 50% 36%, transparent 0%, rgba(0, 0, 0, 0.55) 64%, #000 100%); }
.ambient video { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Glass ---------- */
.glass {
  position: relative;
  background: var(--glass-sheen), var(--glass-tint);
  -webkit-backdrop-filter: var(--glass-blur);
  backdrop-filter: var(--glass-blur);
  border-radius: var(--r-lg);
  box-shadow: var(--glass-inner), var(--glass-shadow);
}
.glass::before {
  content: ""; position: absolute; inset: 0; z-index: 2; border-radius: inherit; padding: 1px; pointer-events: none;
  background: var(--glass-rim);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.divider { height: 1px; background: var(--line); flex: none; }

/* ---------- Controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 36px; padding: 0 15px; border: 0; border-radius: 999px;
  background: var(--fill-2); color: var(--text); box-shadow: var(--hair);
  font-size: 14px; line-height: 1; white-space: nowrap;
  transition: background 0.18s var(--ease), color 0.18s var(--ease), transform 0.18s var(--ease), opacity 0.18s, box-shadow 0.18s;
}
@media (hover: hover) { .btn:hover { background: var(--fill-3); } }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; pointer-events: none; }
.btn .i { width: 18px; height: 18px; }
.btn.primary { background: #fff; color: #000; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 18px rgba(255, 255, 255, 0.08); }
@media (hover: hover) { .btn.primary:hover { background: #ececef; } }
.btn.ghost { background: transparent; color: var(--text-2); box-shadow: none; }
@media (hover: hover) { .btn.ghost:hover { background: var(--fill-2); color: var(--text); } }
@media (hover: hover) { .btn.danger:hover { color: var(--rec); } }
.btn.sm { height: 32px; padding: 0 13px; font-size: 13px; }
.btn.lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn.block { width: 100%; }
.btn.icon { width: 36px; padding: 0; border-radius: 999px; background: transparent; color: var(--text-2); box-shadow: none; }
@media (hover: hover) { .btn.icon:hover { background: var(--fill-2); color: var(--text); } }
.btn.icon.sm { width: 32px; height: 32px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--rec); flex: none; box-shadow: 0 0 10px rgba(255, 69, 58, 0.55); }
.dot.live { animation: pulse 1.4s ease-in-out infinite; }
.dot.held { background: var(--warn); box-shadow: 0 0 10px rgba(255, 214, 10, 0.4); animation: none; }
@keyframes pulse { 50% { opacity: 0.35; } }

.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px;
  border-radius: 999px; background: var(--fill); color: var(--text-2); box-shadow: var(--hair);
  font-size: 12.5px; white-space: nowrap;
}
.pill .i { width: 14px; height: 14px; }
.pill.ok { color: var(--ok); }
.pill.warn { color: var(--warn); }
.pill.rec { color: #fff; background: rgba(255, 69, 58, 0.2); }

.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 14px; border: 0; border-radius: var(--r-sm);
  background: var(--fill); color: var(--text); font-size: 14px; box-shadow: var(--hair);
  transition: box-shadow 0.15s, background 0.15s;
}
.textarea { height: auto; padding: 11px 14px; resize: none; line-height: 1.5; }
.input::placeholder, .textarea::placeholder { color: var(--text-4); }
@media (hover: hover) { .input:hover, .select:hover, .textarea:hover { background: var(--fill-2); } }
.input:focus, .select:focus, .textarea:focus { outline: none; background: var(--fill-2); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.38); }
.select {
  appearance: none; -webkit-appearance: none; padding-right: 38px; cursor: pointer;
  background-repeat: no-repeat; background-position: right 13px center; background-size: 16px;
  /* Untitled UI chevron-down */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23cacacf' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}
.select option { background: #1c1c1e; color: #fff; }
.label { font-size: 12.5px; color: var(--text-3); }
.field { display: grid; gap: 7px; }

/* Segmented control, like iOS: a glassy thumb on a recessed track. */
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 999px; background: rgba(0, 0, 0, 0.28); box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.1), inset 0 1px 2px rgba(0, 0, 0, 0.35); }
.seg button { height: 30px; padding: 0 12px; border: 0; border-radius: 999px; background: transparent; color: var(--text-3); font-size: 13px; transition: background 0.2s var(--ease), color 0.2s var(--ease); }
@media (hover: hover) { .seg button:hover { color: var(--text); } }
.seg button.on { background: rgba(255, 255, 255, 0.2); color: #fff; box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 1px 3px rgba(0, 0, 0, 0.35); }

.progress { height: 3px; border-radius: 3px; background: var(--fill-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: #fff; border-radius: inherit; transition: width 0.3s var(--ease); }

.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); z-index: 100;
  --tx: -50%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 10px; padding: 11px 18px; border-radius: 999px;
  background: var(--glass-sheen), var(--glass-tint-dense); -webkit-backdrop-filter: var(--glass-blur); backdrop-filter: var(--glass-blur);
  box-shadow: var(--glass-inner), inset 0 0 0 0.5px rgba(255, 255, 255, 0.16), 0 18px 40px rgba(0, 0, 0, 0.45);
  font-size: 13.5px; max-width: calc(100vw - 32px);
  animation: rise 0.25s var(--ease);
}
.toast .i { width: 16px; height: 16px; color: var(--ok); }
.toast { pointer-events: none; } /* never in the way of a click */
body.rec .toast { bottom: calc(100px + env(safe-area-inset-bottom, 0px)); } /* above the recording dock */

.modal {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px;
  background: rgba(0, 0, 0, 0.5); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
  animation: fade 0.2s var(--ease);
}
.modal .sheet { width: min(640px, 100%); max-height: calc(var(--vh) - 32px); overflow: auto; padding: 22px; display: grid; gap: 16px; border-radius: var(--r-xl); background: var(--glass-sheen), var(--glass-tint-dense); animation: rise 0.25s var(--ease); }
.modal .sheet::before { display: none; } /* it scrolls: the rim is drawn with shadows instead */
.modal .sheet.glass { box-shadow: var(--glass-inner), inset 0 0 0 0.5px rgba(255, 255, 255, 0.16), var(--glass-shadow); }
.sheet:focus { outline: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; font-size: 18px; letter-spacing: -0.015em; }
.sheet .row-end { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; align-items: center; }
.sheet .row-end .grow { flex: 1; }
.sheet-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }

@keyframes rise { from { opacity: 0; transform: translate(var(--tx, 0), 8px); } to { opacity: 1; transform: translate(var(--tx, 0), 0); } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 20px; letter-spacing: -0.02em; line-height: 1; color: var(--text); }
.brand .dot { width: 9px; height: 9px; }

.note { font-size: 13px; line-height: 1.5; color: var(--text-2); display: flex; gap: 10px; align-items: flex-start; margin: 0; }
.note .i { width: 16px; height: 16px; margin-top: 1px; color: var(--text-3); }
.err { color: #ff8a80; font-size: 13px; line-height: 1.5; margin: 0; display: flex; gap: 10px; align-items: flex-start; }
.err:empty { display: none; }
.err .i { width: 16px; height: 16px; margin-top: 1px; }

/* Meta lines (length, date, size): separated by a thin middle dot. */
.meta { font-size: 13px; color: var(--text-3); display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.meta > span + span::before { content: "·"; margin-right: 8px; color: var(--text-4); }

.av { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: 11.5px; color: #fff; flex: none; box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.2); }
.ts {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border: 0; border-radius: 999px;
  background: var(--fill-2); color: #fff; font-size: 12px; box-shadow: var(--hair);
}
@media (hover: hover) { button.ts:hover { background: var(--fill-3); } }
.ts.cut { color: var(--text-3); background: transparent; }

/* ---------- Library ---------- */
body.lib { height: var(--vh); overflow: hidden; }
.lib-shell {
  position: relative; z-index: 1; height: var(--vh);
  display: grid; grid-template-columns: 300px minmax(0, 1fr) 360px; gap: var(--gap);
  padding: var(--gap) max(var(--gap), env(safe-area-inset-right)) var(--gap) max(var(--gap), env(safe-area-inset-left));
}
.lib-shell.nopanel { grid-template-columns: 300px minmax(0, 1fr); }
.side { display: flex; flex-direction: column; min-height: 0; overflow: hidden; animation: rise 0.35s var(--ease); }
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; height: 70px; padding: 0 16px 0 24px; flex: none; }
.side-nav { padding: 12px 14px; display: grid; gap: 2px; flex: none; }
.nav-row {
  display: flex; align-items: center; gap: 12px; height: 40px; padding: 0 10px; border: 0; border-radius: 12px;
  background: transparent; color: var(--text); font-size: 14px; text-align: left; width: 100%;
  transition: background 0.15s var(--ease);
}
.nav-row .i { width: 20px; height: 20px; color: var(--text-3); }
.nav-row .count { margin-left: auto; font-size: 12.5px; color: var(--text-3); }
@media (hover: hover) { .nav-row:hover { background: var(--fill); } }
.nav-row.on { background: var(--fill-2); box-shadow: var(--hair); }
.nav-row.on .i { color: var(--text); }
.side-list { flex: 1; min-height: 0; overflow: auto; padding: 8px 14px 12px; display: grid; align-content: start; gap: 2px; }
.side-list .section { padding: 10px 10px 6px; font-size: 12.5px; color: var(--text-3); display: flex; justify-content: space-between; }
.side-list > .note { padding: 8px 10px; }
.vrow {
  display: grid; grid-template-columns: 66px minmax(0, 1fr) auto; align-items: center; gap: 12px;
  padding: 8px; border-radius: var(--r-md); border: 0; background: transparent; text-align: left; width: 100%;
  transition: background 0.15s var(--ease);
}
@media (hover: hover) { .vrow:hover { background: var(--fill); } }
.vrow.on { background: var(--fill-2); box-shadow: var(--hair); }
.vrow .thumb { width: 66px; aspect-ratio: 16 / 10; border-radius: 8px; overflow: hidden; background: var(--fill-2); position: relative; box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.14); }
.vrow .thumb img { width: 100%; height: 100%; object-fit: cover; }
.vrow .thumb .i { position: absolute; inset: 0; margin: auto; width: 16px; height: 16px; color: var(--text-3); }
.vrow .t { min-width: 0; display: grid; gap: 2px; }
.vrow .t b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.vrow .t .m { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.vrow .t .m > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.vrow .t .cc { display: inline-flex; align-items: center; gap: 4px; flex: none; color: var(--text-2); }
.vrow .t .cc .i { width: 12px; height: 12px; }
.vrow .flag { width: 7px; height: 7px; border-radius: 50%; background: #fff; box-shadow: 0 0 8px rgba(255, 255, 255, 0.6); }
.vrow .flag.rec { background: var(--rec); box-shadow: 0 0 8px rgba(255, 69, 58, 0.6); }
.side-foot { flex: none; padding: 14px 14px 16px; display: grid; gap: 12px; }
.storage { display: grid; gap: 8px; padding: 0 10px; }
.storage .top { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-3); }
.storage .top b { color: var(--text-2); }
.side-foot .acct { display: flex; gap: 4px; align-items: center; }
.side-foot .acct .grow { flex: 1; }
.back { display: none; align-self: flex-start; margin: 0 0 -8px -6px; }

/* Stage: the recording, its link and settings. Comments live in the panel on the right. */
.stage {
  position: relative; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain;
  display: flex; flex-direction: column; gap: 22px; animation: fade 0.5s var(--ease);
  scrollbar-width: none;
}
.stage::-webkit-scrollbar { display: none; }
.stage > * { flex: none; }
.stage-center { flex: 1 0 auto; display: grid; place-items: center; padding: 24px 0; }
.frame { position: relative; width: 100%; border-radius: var(--r-lg); overflow: hidden; background: #000; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.55), 0 0 0 0.5px rgba(255, 255, 255, 0.14); }
.empty-stage { text-align: center; display: grid; justify-items: center; gap: 16px; max-width: 440px; }
.empty-stage h1 { margin: 0; font-size: 36px; letter-spacing: -0.035em; line-height: 1.05; }
.empty-stage p { margin: 0; color: var(--text-2); font-size: 15px; }
.empty-stage > .i { width: 28px; height: 28px; color: var(--text-3); }

.v-info { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 20px; min-width: 0; } /* above the player's shadow */
.v-head { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; padding: 0 2px; min-width: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; }
.title-input {
  display: block; width: calc(100% + 16px); min-width: 0; border: 0; background: transparent; padding: 4px 8px; margin: -4px -8px; border-radius: 12px;
  font-size: clamp(24px, 2.2vw, 32px); letter-spacing: -0.03em; line-height: 1.2; color: var(--text);
  text-overflow: ellipsis; transition: background 0.15s var(--ease);
}
@media (hover: hover) { .title-input:hover { background: var(--fill); } }
.title-input:focus { outline: none; background: var(--fill-2); box-shadow: var(--hair); }
.sharebar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.linkcard { flex: 1 1 340px; min-width: 0; display: flex; align-items: center; gap: 6px; padding: 5px 5px 5px 18px; border-radius: 999px; background: var(--fill); box-shadow: var(--hair); }
.linkcard .u { flex: 1; min-width: 0; font-size: 13.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px; }
.card { padding: 18px 20px 20px; display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; align-content: start; min-width: 0; }
.card h3 { margin: 0; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); }
.card .seg { display: flex; width: 100%; }
.card .seg button { flex: 1; padding: 0 6px; }
.viewers { display: grid; gap: 14px; }
.viewer { display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 11px; align-items: start; }
.viewer .vt { display: grid; gap: 7px; min-width: 0; }
.viewer .vt .top { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; min-width: 0; }
.viewer .vt b { font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.viewer .vt span { font-size: 12.5px; color: var(--text-3); white-space: nowrap; }
.viewer .progress { height: 2px; }
.solo { width: min(520px, 100%); padding: 28px; display: grid; gap: 16px; border-radius: var(--r-xl); animation: rise 0.35s var(--ease); }
.solo h1 { margin: 0; font-size: 26px; letter-spacing: -0.025em; line-height: 1.2; overflow-wrap: anywhere; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Gate (login / setup) ---------- */
.gate-wrap { position: relative; z-index: 1; min-height: var(--vh); display: grid; place-items: center; padding: 20px; }
.gate { width: min(410px, 100%); padding: 30px; display: grid; gap: 18px; border-radius: var(--r-xl); animation: rise 0.35s var(--ease); }
.gate h1 { margin: 0 0 4px; font-size: 26px; letter-spacing: -0.025em; }
.gate p { margin: 0; color: var(--text-2); }
.gate .badge { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--fill-2); box-shadow: var(--hair); }
.gate .badge .i { width: 22px; height: 22px; }

/* ---------- Player (share page and library) ---------- */
.player { position: relative; background: #000; user-select: none; -webkit-user-select: none; }
.player video { width: 100%; max-height: 72vh; margin: 0 auto; background: #000; }
.stage .player video { max-height: 64vh; }
/* A dark glass lens: the white glyph stays readable over white pages as well as dark ones. */
.player .big {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: 76px; height: 76px; border: 0; border-radius: 50%; display: grid; place-items: center; color: #fff;
  background: radial-gradient(120% 120% at 30% 15%, rgba(255, 255, 255, 0.22), rgba(255, 255, 255, 0.03) 55%, rgba(255, 255, 255, 0.07)), rgba(12, 12, 14, 0.46);
  -webkit-backdrop-filter: blur(22px) saturate(180%); backdrop-filter: blur(22px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.4), inset 0 -1px 0 rgba(255, 255, 255, 0.08), inset 0 0 0 0.5px rgba(255, 255, 255, 0.3), 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: transform 0.2s var(--ease), background 0.2s;
}
@media (hover: hover) { .player .big:hover { transform: translate(-50%, -50%) scale(1.05); } }
.player .big .i { width: 28px; height: 28px; margin-left: 3px; fill: currentColor; filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.35)); }
.player .bar {
  position: absolute; left: 12px; right: 12px; bottom: 12px; padding: 6px 10px 6px 6px;
  display: grid; gap: 2px; border-radius: 18px; color: #fff;
  background: var(--glass-sheen), rgba(16, 16, 18, 0.74);
  -webkit-backdrop-filter: blur(30px) saturate(180%); backdrop-filter: blur(30px) saturate(180%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), inset 0 0 0 0.5px rgba(255, 255, 255, 0.16), 0 10px 30px rgba(0, 0, 0, 0.3);
  transition: opacity 0.25s var(--ease), transform 0.25s var(--ease);
}
.player.idle.playing .bar { opacity: 0; transform: translateY(6px); pointer-events: none; }
.player.idle.playing { cursor: none; }
.player .row { display: flex; align-items: center; gap: 4px; }
.player .row .grow { flex: 1; }
.player .pbtn { width: 36px; height: 36px; border: 0; border-radius: 999px; background: transparent; color: #fff; display: grid; place-items: center; padding: 0; }
@media (hover: hover) { .player .pbtn:hover { background: rgba(255, 255, 255, 0.14); } }
.player .pbtn .i { width: 20px; height: 20px; }
.player .time { font-size: 12.5px; color: rgba(255, 255, 255, 0.9); padding: 0 6px; white-space: nowrap; }
.player .speed { height: 28px; min-width: 44px; padding: 0 10px; border: 0; border-radius: 999px; background: rgba(255, 255, 255, 0.11); color: #fff; font-size: 12.5px; }
@media (hover: hover) { .player .speed:hover { background: rgba(255, 255, 255, 0.22); } }
.scrub { position: relative; height: 20px; margin: 0 6px; cursor: pointer; touch-action: none; }
.scrub .rail, .scrub .buf, .scrub .fill { position: absolute; left: 0; top: 8px; height: 4px; border-radius: 4px; }
.scrub .rail { right: 0; background: rgba(255, 255, 255, 0.2); }
.scrub .buf { background: rgba(255, 255, 255, 0.3); width: 0; }
.scrub .fill { background: #fff; width: 0; }
.scrub .knob { position: absolute; top: 4px; left: 0; width: 12px; height: 12px; margin-left: -6px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5); transform: scale(0); transition: transform 0.15s var(--ease); }
.scrub.drag .knob, .scrub:focus-visible .knob { transform: scale(1); }
@media (hover: hover) { .scrub:hover .knob { transform: scale(1); } }
.scrub .mk { position: absolute; top: 5px; width: 10px; height: 10px; margin-left: -5px; padding: 0; border: 2px solid rgba(0, 0, 0, 0.8); border-radius: 50%; background: #fff; z-index: 2; }
.scrub .mk::after { content: ""; position: absolute; inset: -8px; } /* easier to hit */
@media (hover: hover) { .scrub .mk:hover { transform: scale(1.3); } }
.scrub .mk.resolved { background: #8e8e93; }
.scrub .tip { position: absolute; bottom: 26px; transform: translateX(-50%); max-width: 260px; padding: 6px 10px; border-radius: 10px; background: rgba(18, 18, 20, 0.88); color: #fff; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; pointer-events: none; box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.16); }
.player .processing { aspect-ratio: 16 / 9; display: grid; place-items: center; text-align: center; padding: 24px; color: var(--text-2); }
.player .processing .i { width: 26px; height: 26px; margin: 0 auto 12px; color: #fff; }
/* Full screen: the video fills the screen, controls float over it. */
.player:fullscreen { display: grid; place-items: center; width: 100%; height: 100%; }
.player:fullscreen video { width: 100%; height: 100%; max-height: none; object-fit: contain; aspect-ratio: auto !important; }
.player:fullscreen .bar { left: 50%; right: auto; width: min(900px, calc(100% - 48px)); transform: translateX(-50%); bottom: 24px; }
.player:fullscreen.idle.playing .bar { transform: translate(-50%, 6px); }

/* ---------- Share page ---------- */
body.share { min-height: var(--vh); }
.s-top {
  position: relative; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: max(var(--gap), env(safe-area-inset-top)) max(var(--gap), env(safe-area-inset-right)) 0 max(var(--gap), env(safe-area-inset-left));
  max-width: 1600px; margin: 0 auto;
}
.s-top .brand { font-size: 19px; }
.s-top .brand-logo { height: 22px; width: auto; }
.s-main {
  position: relative; z-index: 1; max-width: 1600px; margin: 0 auto;
  padding: var(--gap) max(var(--gap), env(safe-area-inset-right)) max(var(--gap), env(safe-area-inset-bottom)) max(var(--gap), env(safe-area-inset-left));
  display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: var(--gap); align-items: start;
}
.s-main.single { grid-template-columns: minmax(0, 1fr); max-width: 1100px; }
.s-stage { display: grid; gap: 18px; min-width: 0; animation: fade 0.5s var(--ease); }
.s-stage .frame { border-radius: var(--r-xl); }
.s-head { position: relative; display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; padding: 0 4px; }
.s-title { margin: 0; font-size: clamp(24px, 2.4vw, 34px); letter-spacing: -0.03em; line-height: 1.12; text-wrap: balance; overflow-wrap: anywhere; }
.s-sub { margin-top: 10px; }
.s-message { position: relative; z-index: 1; max-width: 560px; margin: 16vh auto 0; padding: 0 var(--gap); display: grid; gap: 14px; }
.s-message h1 { margin: 0; font-size: 36px; letter-spacing: -0.035em; line-height: 1.1; }
.s-message p { margin: 0; color: var(--text-2); font-size: 16px; }
.s-foot { position: relative; color: var(--text-3); font-size: 12.5px; padding: 0 4px; margin: 0; }
.msg-icon { width: 54px; height: 54px; border-radius: 16px; display: grid; place-items: center; background: var(--fill-2); box-shadow: var(--hair); color: var(--text-2); }

/* Comments panel (share page and library). */
.cpanel { position: sticky; top: var(--gap); display: flex; flex-direction: column; height: calc(var(--vh) - 2 * var(--gap) - 56px); min-height: 440px; border-radius: var(--r-xl); animation: rise 0.35s 0.05s var(--ease) both; }
.chead { display: flex; align-items: center; justify-content: space-between; gap: 10px; height: 62px; padding: 0 14px 0 22px; flex: none; }
.chead h2 { margin: 0; font-size: 16px; letter-spacing: -0.01em; display: flex; align-items: center; gap: 9px; }
.chead h2 .count { font-size: 13px; color: var(--text-3); }
.clist { flex: 1; overflow: auto; padding: 8px; display: grid; align-content: start; gap: 2px; }
.cempty { padding: 44px 24px; text-align: center; color: var(--text-3); display: grid; justify-items: center; gap: 10px; font-size: 13.5px; }
.cempty .i { width: 22px; height: 22px; color: var(--text-4); }
.c { padding: 12px 14px; border-radius: var(--r-md); display: grid; grid-template-columns: 26px minmax(0, 1fr); gap: 5px 12px; transition: background 0.2s var(--ease); }
@media (hover: hover) { .c:hover { background: var(--fill); } }
.c.flash { background: var(--fill-3); }
.c.resolved { opacity: 0.7; }
.c.resolved .text { color: var(--text-3); }
.c .top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; min-height: 26px; }
.c .name { font-size: 14px; min-width: 0; overflow-wrap: anywhere; } /* a long name or an email typed as a name wraps */
.c .owner { font-size: 12px; color: var(--text-3); }
.c .when { font-size: 12px; color: var(--text-4); margin-left: auto; }
.c .text { grid-column: 2; white-space: pre-wrap; word-break: break-word; font-size: 14px; color: var(--text-2); line-height: 1.55; }
.c .acts { grid-column: 2; display: flex; gap: 2px; margin: 2px 0 0 -8px; opacity: 0; transition: opacity 0.15s; }
.c:focus-within .acts, .c.replying > .acts { opacity: 1; }
@media (hover: hover) { .c:hover .acts { opacity: 1; } }
@media (hover: none) { .c .acts { opacity: 1; } }
.c .acts button { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 9px; border: 0; border-radius: 999px; background: transparent; color: var(--text-3); font-size: 13px; }
@media (hover: hover) { .c .acts button:hover { background: var(--fill-2); color: var(--text); } }
.c .acts .i { width: 15px; height: 15px; }
.c .replies { grid-column: 2; display: grid; gap: 2px; margin-top: 6px; }
.c .replies .c { padding: 8px 0 4px; }
@media (hover: hover) { .c .replies .c:hover { background: none; } }
.replyform { grid-column: 2; display: grid; gap: 8px; margin-top: 6px; }
.replyform .foot { display: flex; gap: 6px; justify-content: flex-end; }
.composer { flex: none; padding: 12px; display: grid; gap: 8px; }
.composer .box { border-radius: 18px; background: rgba(0, 0, 0, 0.22); box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.14), inset 0 1px 2px rgba(0, 0, 0, 0.3); transition: box-shadow 0.15s, background 0.15s; }
.composer .box:focus-within { background: rgba(0, 0, 0, 0.3); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.34); }
.composer .box .name { width: 100%; height: 40px; border: 0; background: transparent; padding: 0 16px; border-bottom: 1px solid var(--line); font-size: 14px; color: var(--text); }
.composer .box textarea { width: 100%; min-height: 66px; max-height: 200px; border: 0; background: transparent; padding: 13px 16px 4px; resize: none; font-size: 14px; line-height: 1.5; color: var(--text); }
.composer .box textarea:focus, .composer .box .name:focus { outline: none; }
.composer .box ::placeholder { color: var(--text-4); }
.composer .foot { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 10px; }
.composer .foot .grow { flex: 1; }
.tchip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px 0 10px; border: 0; border-radius: 999px; background: var(--fill-2); color: #fff; font-size: 12.5px; box-shadow: var(--hair); }
.tchip .i { width: 14px; height: 14px; }
.tchip .ic { display: inline-flex; }
.tchip.off { color: var(--text-3); background: transparent; box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.2); }
.send { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #fff; color: #000; display: grid; place-items: center; transition: transform 0.15s var(--ease), opacity 0.15s; }
.send:disabled { opacity: 0.3; }
.send:not(:disabled):active { transform: scale(0.94); }
.send .i { width: 16px; height: 16px; }
.composer .who { font-size: 12.5px; color: var(--text-3); display: flex; gap: 8px; align-items: center; padding: 0 6px; }
.composer .who span { min-width: 0; overflow-wrap: anywhere; }
.composer .who button { border: 0; background: none; color: var(--text-2); font-size: 12.5px; padding: 0; text-decoration: underline; text-underline-offset: 3px; }
.toggle { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-3); cursor: pointer; user-select: none; }
.toggle input { appearance: none; -webkit-appearance: none; width: 34px; height: 20px; border-radius: 999px; background: var(--fill-3); position: relative; margin: 0; cursor: pointer; transition: background 0.2s; box-shadow: inset 0 0 0 0.5px rgba(255, 255, 255, 0.12); }
.toggle input::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.35); transition: transform 0.2s var(--ease); }
.toggle input:checked { background: var(--ok); }
.toggle input:checked::after { transform: translateX(14px); }

/* ---------- Recorder ---------- */
body.rec { height: var(--vh); overflow: hidden; }
.rec-shell { position: relative; z-index: 1; height: var(--vh); display: grid; grid-template-columns: 370px minmax(0, 1fr); gap: var(--gap); padding: var(--gap); }
.rec-panel { display: flex; flex-direction: column; min-height: 0; overflow: auto; border-radius: var(--r-xl); animation: rise 0.35s var(--ease); }
.rec-panel .body { padding: 22px 26px 26px; display: grid; gap: 20px; }
.rec-panel h1 { margin: 0; font-size: 28px; letter-spacing: -0.03em; line-height: 1.1; }
.rec-panel .lede { margin: 6px 0 0; color: var(--text-2); }
.src-row { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 14px; border-radius: var(--r-md); background: var(--fill); box-shadow: var(--hair); }
.src-row .i { width: 20px; height: 20px; color: var(--text-2); }
.src-row .grow { flex: 1; min-width: 0; }
.src-row .grow b { display: block; }
.src-row .grow span { display: block; font-size: 12.5px; color: var(--text-3); }
.mic-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.level { height: 3px; border-radius: 3px; background: var(--fill-2); overflow: hidden; }
.level i { display: block; height: 100%; width: 0; background: var(--ok); transition: width 0.06s linear; }
.rec-stage { position: relative; min-width: 0; min-height: 0; display: grid; place-items: center; }
.rec-stage .frame { max-width: 100%; }
.rec-stage video { width: 100%; max-height: calc(var(--vh) - 2 * var(--gap)); background: #000; }
.rec-empty { text-align: center; display: grid; justify-items: center; gap: 12px; color: var(--text-3); }
.rec-empty .i { width: 30px; height: 30px; }
.rec-empty b { color: var(--text); font-size: 17px; }
.rec-live { position: relative; z-index: 1; height: var(--vh); display: grid; place-items: center; text-align: center; }
.rec-live .clock { font-size: clamp(88px, 14vw, 180px); line-height: 1; letter-spacing: -0.02em; }
.rec-live .state { display: inline-flex; align-items: center; gap: 10px; font-size: 14px; color: var(--text-2); margin-bottom: 18px; }
.rec-live .up { margin-top: 20px; font-size: 13px; color: var(--text-3); }
.dock {
  position: fixed; left: 50%; bottom: calc(28px + env(safe-area-inset-bottom, 0px)); z-index: 5;
  --tx: -50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 6px; padding: 7px; border-radius: 999px;
  animation: rise 0.3s var(--ease);
}
.dock .timer { display: inline-flex; align-items: center; gap: 10px; padding: 0 12px 0 14px; font-size: 15px; }
.dock .sep { width: 1px; height: 22px; background: var(--line-2); }
.dock .btn.icon.confirm { width: auto; padding: 0 14px 0 11px; color: #fff; background: rgba(255, 69, 58, 0.85); }
@media (hover: hover) { .dock .btn.icon.confirm:hover { background: var(--rec); color: #fff; } }
.done { position: relative; z-index: 1; min-height: var(--vh); display: grid; place-items: center; padding: var(--gap); }
.done .card { width: min(540px, 100%); padding: 30px; display: grid; gap: 18px; border-radius: var(--r-xl); animation: rise 0.35s var(--ease); }
.done h1 { margin: 0; font-size: 30px; letter-spacing: -0.03em; line-height: 1.1; }
.done .sub { margin: 8px 0 0; color: var(--text-2); }
.done .linkbig { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 18px; border-radius: 999px; background: var(--fill); box-shadow: var(--hair); }
.done .linkbig span { flex: 1; min-width: 0; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.done .row { display: flex; gap: 8px; flex-wrap: wrap; }
.countdown { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0, 0, 0, 0.45); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); font-size: clamp(140px, 22vw, 260px); line-height: 1; letter-spacing: -0.04em; }

/* Floating controller (Document Picture-in-Picture window). */
body.pip { margin: 0; min-height: 100vh; background: #121214; display: flex; align-items: center; gap: 8px; padding: 0 10px 0 14px; }
body.pip .timer { display: inline-flex; align-items: center; gap: 10px; font-size: 16px; flex: 1; min-width: 0; }
body.pip .up { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.pip .up.warn { color: var(--warn); }

/* ---------- Trim ---------- */
.trim video { width: 100%; max-height: 46vh; background: #000; border-radius: var(--r-md); }
.trim .track { position: relative; height: 36px; }
.trim .rail { position: absolute; left: 0; right: 0; top: 16px; height: 4px; border-radius: 4px; background: var(--fill-3); }
.trim .sel { position: absolute; top: 16px; height: 4px; border-radius: 4px; background: #fff; }
.trim input[type=range] { position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; }
.trim input[type=range]::-webkit-slider-thumb { pointer-events: auto; -webkit-appearance: none; width: 14px; height: 30px; border-radius: 6px; background: #fff; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); cursor: ew-resize; }
.trim input[type=range]::-moz-range-thumb { pointer-events: auto; width: 14px; height: 30px; border: 0; border-radius: 6px; background: #fff; cursor: ew-resize; }
.trim .times { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--text-2); }

/* Single-column grids never grow past their container (inputs have a wide intrinsic size). */
.field, .modal .sheet, .card, .solo, .gate, .s-stage, .s-message, .composer, .replyform, .rec-panel .body,
.clist, .side-list, .side-nav, .viewers, .c .replies { grid-template-columns: minmax(0, 1fr); }

/* ---------- Responsive ---------- */
/* Wide library: the stage and the comments are columns of the shell. This is the default rather
   than a min-width query, so no window width (125% zoom gives fractions) falls between layouts. */
.lib-shell .main-col { display: contents; }
.lib-shell .cpanel { position: relative; top: auto; height: auto; min-height: 0; }
@media (max-width: 1240px) {
  .lib-shell, .lib-shell.nopanel { grid-template-columns: 280px minmax(0, 1fr); grid-template-rows: minmax(0, 1fr); }
  .lib-shell .main-col { display: flex; flex-direction: column; gap: var(--gap); min-height: 0; overflow: auto; overscroll-behavior: contain; }
  .lib-shell .main-col .stage { flex: none; overflow: visible; min-height: auto; }
  .lib-shell .main-col .stage-center { min-height: calc(var(--vh) - 2 * var(--gap)); }
  .lib-shell .cpanel { position: relative; top: auto; height: auto; min-height: 0; flex: none; }
  .lib-shell .cpanel .clist { overflow: visible; }
  .stage .player video { max-height: 58vh; }
}
@media (max-width: 860px) {
  :root { --gap: 12px; }
  body.lib, body.rec { height: auto; overflow: auto; }
  .lib-shell, .lib-shell.nopanel { height: auto; min-height: var(--vh); grid-template-columns: minmax(0, 1fr); padding-top: max(var(--gap), env(safe-area-inset-top)); padding-bottom: max(var(--gap), env(safe-area-inset-bottom)); }
  .lib-shell .main-col { overflow: visible; }
  .lib-shell .main-col .stage-center { min-height: 60vh; }
  .side { max-height: none; }
  .side-list { overflow: visible; }
  .lib-shell.viewing .side { display: none; }
  .back { display: inline-flex; }
  .lib-shell:not(.viewing) .main-col { display: none; }
  .rec-shell { height: auto; grid-template-columns: minmax(0, 1fr); }
  .rec-stage { order: -1; }
  .s-main { grid-template-columns: minmax(0, 1fr); }
  .cpanel { position: relative; top: auto; height: auto; min-height: 0; }
  .clist { max-height: none; overflow: visible; }
  /* On a phone the comment box sits right under the video, above the thread. */
  .cpanel .divider { display: none; }
  .cpanel .chead { order: -2; border-bottom: 1px solid var(--line); }
  .cpanel .composer { order: -1; border-bottom: 1px solid var(--line); }
  .player .big { width: 60px; height: 60px; }
  .player .big .i { width: 22px; height: 22px; }
  .s-title { font-size: 26px; }
}
/* A narrow player (a phone, a small window, a landscape phone beside the comments) gets one
   compact row of controls, so they cover as little of the video as possible. The media query
   repeats it for browsers without container queries. */
.player { container: player / inline-size; }
@container player (max-width: 560px) {
  .player .bar { left: 8px; right: 8px; bottom: 8px; padding: 3px 4px; border-radius: 999px; display: flex; align-items: center; gap: 2px; }
  .player .row { display: contents; }
  .player .row .grow, .player .pbtn.mute { display: none; }
  .player .pbtn.play { order: 1; }
  .player .time { order: 2; font-size: 12px; padding: 0 4px 0 2px; }
  .player .scrub { order: 3; flex: 1; margin: 0 6px; }
  .player .speed { order: 4; min-width: 38px; padding: 0 8px; height: 30px; }
  .player .pbtn.full { order: 5; }
  .player .scrub .tip { bottom: 30px; }
  .player .big { width: 60px; height: 60px; }
  .player .big .i { width: 22px; height: 22px; }
}
@media (max-width: 560px) {
  .player .bar { left: 8px; right: 8px; bottom: 8px; padding: 3px 4px; border-radius: 999px; display: flex; align-items: center; gap: 2px; }
  .player .row { display: contents; }
  .player .row .grow, .player .pbtn.mute { display: none; }
  .player .pbtn.play { order: 1; }
  .player .time { order: 2; font-size: 12px; padding: 0 4px 0 2px; }
  .player .scrub { order: 3; flex: 1; margin: 0 6px; }
  .player .speed { order: 4; min-width: 38px; padding: 0 8px; height: 30px; }
  .player .pbtn.full { order: 5; }
  .player .scrub .tip { bottom: 30px; }
}
/* Touch screens: bigger targets, the seek handle always visible, and 16 px text fields (smaller
   text makes iPhone zoom in on focus). */
@media (pointer: coarse) {
  .scrub { height: 28px; }
  .scrub .rail, .scrub .buf, .scrub .fill { top: 12px; }
  .scrub .knob { top: 8px; transform: scale(1); }
  .scrub .mk { top: 9px; }
  .scrub .mk::after { inset: -12px; }
  .player .pbtn { width: 42px; height: 42px; }
  .player .speed { height: 32px; }
  .ts { height: 28px; padding: 0 10px; }
  .c .acts button { height: 36px; }
  .input, .textarea, .select, .composer .box .name, .composer .box textarea { font-size: 16px; }
  .btn.sm { height: 36px; }
  .btn.icon.sm { width: 36px; height: 36px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .glass, .toast, .player .bar { background: rgba(28, 28, 31, 0.96); }
}
