:root {
  color-scheme: dark;
  --ink: #0b0d13;
  --ink-1: #12151e;
  --ink-2: #1a1e2a;
  --ink-3: #272d3c;
  --text: #f5f0e8;
  --soft: rgba(245, 240, 232, .84);
  --muted: #a7acb9;
  --dim: #7a8091;
  --coral: #ff6b4f;
  --coral-2: #ff9a85;
  --on-coral: #1d0904;
  --dash: rgba(245, 240, 232, .4);
  --accent: #82a6b5;
  --r: 22px;
  --tab-h: 62px;
  --top-h: 56px;
  --st: env(safe-area-inset-top, 0px);
  --sb: env(safe-area-inset-bottom, 0px);
  --sl: env(safe-area-inset-left, 0px);
  --sr: env(safe-area-inset-right, 0px);
  --gut: 14px;
  --ease: cubic-bezier(.2, .7, .1, 1);
}

* { box-sizing: border-box; }
html { background: var(--ink); color: var(--text); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; min-height: 100dvh; font-size: 16px; line-height: 1.5; -webkit-font-smoothing: antialiased; overflow-x: hidden; }
html[lang="ar"] body, [lang="ar"] { font-family: system-ui, -apple-system, "SF Arabic", "Noto Sans Arabic", "Geeza Pro", "Segoe UI", Tahoma, sans-serif; }
html[lang="ar"] body { line-height: 1.62; }
html[lang="en"] body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif; }
html[lang="zh"] body, [lang="zh"] { font-family: system-ui, -apple-system, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif; }
[lang="en"] { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:disabled { cursor: default; }
a { color: inherit; text-decoration: none; -webkit-tap-highlight-color: transparent; }
img { display: block; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2.5px solid var(--coral); outline-offset: 2px; }
::selection { background: rgba(255, 107, 79, .38); }
::placeholder { color: var(--dim); opacity: 1; }

.sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.ic { display: inline-flex; width: 24px; height: 24px; flex: none; }
.ic svg { width: 100%; height: 100%; }
[dir="rtl"] .ic-dir { transform: scaleX(-1); }
img.broken { visibility: hidden; }

/* ---------- boot ---------- */
.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 18px; padding: 24px; text-align: center; }
.boot-mark { font-size: 56px; font-weight: 800; line-height: 1; color: var(--text); }
.boot:not(.boot-err) .boot-mark { animation: breathe 1.6s ease-in-out infinite; }
.boot-t { font-size: 18px; font-weight: 700; }
.boot-gate { max-width: 420px; margin-inline: auto; }
.gate-s { color: var(--muted); font-size: 14.5px; line-height: 1.5; }
.gate-err { color: #ff9b86; font-size: 14.5px; font-weight: 600; }
/* Apple's localized button artwork is transparent with black lettering: Apple's white style on a white base. */
.apple-btn {
  display: inline-flex; padding: 0; border: 0; border-radius: 8px; background: #fff; overflow: hidden;
  width: min(240px, calc(100vw - 48px)); cursor: pointer;
}
.apple-img { display: block; width: 100%; height: auto; }
.apple-btn:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
.apple-btn:disabled { opacity: .45; cursor: not-allowed; }
/* Google's light button: white fill, #747775 stroke, #1f1f1f label, the four-colour G. */
.google-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: min(240px, calc(100vw - 48px)); min-height: 44px; padding: 0 14px;
  border: 1px solid #747775; border-radius: 8px; background: #fff; color: #1f1f1f;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.google-g { display: inline-flex; flex: none; }
.google-btn:focus-visible { outline: 3px solid var(--coral); outline-offset: 3px; }
@keyframes breathe { 50% { opacity: .45; } }

/* ---------- shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  height: calc(var(--top-h) + var(--st));
  padding: var(--st) max(var(--gut), var(--sr)) 0 max(var(--gut), var(--sl));
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(var(--ink) 72%, rgba(11, 13, 19, 0));
}
.brand { display: inline-flex; align-items: baseline; gap: 8px; min-height: 44px; align-items: center; }
.brand-ar { font-size: 26px; font-weight: 800; line-height: 1; }
.brand-lat { font-size: 10.5px; font-weight: 800; letter-spacing: .26em; color: var(--muted); font-family: system-ui, -apple-system, sans-serif; }

.lang-control { display: inline-flex; flex: none; }
.lang-trigger { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; color: var(--text); background: var(--ink-2); }
.lang-trigger[aria-expanded="true"] { color: var(--coral-2); }
.lang-menu { position: fixed; inset: auto; margin: 0; width: 184px; max-width: calc(100vw - 24px); max-height: calc(100dvh - 24px); padding: 6px; overflow-y: auto; border: 1px solid rgba(245, 240, 232, .13); border-radius: 16px; background: var(--ink-2); color: var(--text); box-shadow: 0 12px 36px rgba(0, 0, 0, .38); }
.lang-menu::backdrop { background: transparent; }
.lang-option { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; font-size: 15px; font-weight: 600; text-align: start; }
.lang-option[aria-checked="true"] { color: var(--coral-2); background: rgba(255, 107, 79, .12); }
.lang-option .ic { width: 18px; height: 18px; visibility: hidden; }
.lang-option[aria-checked="true"] .ic { visibility: visible; }
.me-lang { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.me-lang .sec-h { margin-bottom: 0; }

.views { padding-bottom: calc(var(--tab-h) + var(--sb) + 28px); }
.tabbar {
  position: fixed; z-index: 30; left: 0; right: 0; bottom: 0;
  padding: 0 var(--sr) var(--sb) var(--sl);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: rgba(11, 13, 19, .94);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
  border-top: 1px solid rgba(255, 255, 255, .06);
}
.tab { height: var(--tab-h); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11.5px; font-weight: 600; color: var(--dim); min-width: 0; }
.tab-l { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding-inline: 2px; }
.tab[aria-current="page"] { color: var(--text); }
.tab[aria-current="page"] .ic { color: var(--coral); }
.tab-create .ic { width: 44px; height: 30px; padding: 3px 10px; border-radius: 11px; background: var(--coral); color: var(--on-coral) !important; }

.toast {
  position: fixed; z-index: 200; left: 50%; bottom: calc(var(--tab-h) + var(--sb) + 14px);
  transform: translate(-50%, 12px); opacity: 0; pointer-events: none;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 14px;
  background: var(--text); color: var(--ink); font-weight: 600; font-size: 14px;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- shared bits ---------- */
.sec-h { font-size: 18px; font-weight: 800; margin-bottom: 12px; line-height: 1.3; }
.page-h { font-size: 28px; font-weight: 800; line-height: 1.2; }
.kicker { font-size: 13px; font-weight: 600; color: rgba(245, 240, 232, .78); }

.primary {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding-inline: 20px 24px; border-radius: 999px;
  background: var(--coral); color: var(--on-coral); font-weight: 800; font-size: 16px;
  transition: transform .15s, opacity .2s;
}
.primary:active:not(:disabled) { transform: scale(.97); }
.primary:disabled { opacity: .42; }
.primary[aria-busy] { opacity: .7; }
.primary-sm { min-height: 44px; padding-inline: 18px; font-size: 15px; }
.ghost-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding-inline: 16px 18px; border-radius: 999px;
  border: 1.5px solid rgba(245, 240, 232, .36); font-weight: 700; font-size: 15px;
}
.ghost-btn .ic { width: 20px; height: 20px; }
.err { color: #ff9b86; font-size: 14px; font-weight: 600; }
.err:empty { display: none; }
.none { color: var(--muted); font-size: 15px; }
.none-row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  position: relative; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding-inline: 16px; border-radius: 999px;
  background: var(--ink-2); font-size: 14.5px; font-weight: 600; white-space: nowrap;
  border: 1.5px solid transparent; transition: background .2s, color .2s;
}
.chip .ic { width: 18px; height: 18px; }
.chip[aria-pressed="true"], .chip-radio:has(input:checked) { background: var(--text); color: var(--ink); }
.chip-radio { cursor: pointer; }
.chip-radio:has(input:focus-visible) { outline: 2.5px solid var(--coral); outline-offset: 2px; }
.chips-scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: calc(var(--gut) * -1); padding-inline: var(--gut); }
.chips-scroll::-webkit-scrollbar { display: none; }

/* vote: the action on a next chapter */
.vote {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding-inline: 12px 14px; border-radius: 999px;
  border: 1.5px solid rgba(245, 240, 232, .55); font-weight: 700; font-size: 14px; white-space: nowrap;
  transition: background .2s, color .2s, border-color .2s, transform .15s;
}
.vote-ic { display: inline-flex; }
.vote .ic { width: 19px; height: 19px; }
.vote-n { font-variant-numeric: tabular-nums; padding-inline-start: 8px; border-inline-start: 1px solid currentColor; line-height: 1; }
.vote[aria-pressed="true"] { background: var(--coral); border-color: var(--coral); color: var(--on-coral); }
.vote[aria-busy] { opacity: .6; pointer-events: none; }
.vote:active { transform: scale(.96); }
.vote-lg { min-height: 50px; font-size: 15.5px; padding-inline: 16px 18px; }
.idea-save {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 44px; padding-inline: 12px 14px; border-radius: 999px;
  border: 1.5px solid rgba(245, 240, 232, .3); font-weight: 700; font-size: 14px; white-space: nowrap;
}
.idea-save .ic { width: 19px; height: 19px; }
.idea-save[aria-pressed="true"] .ic { color: var(--coral); }
.idea-save[aria-busy] { opacity: .6; pointer-events: none; }
.vcount { display: inline-flex; align-items: center; gap: 3px; font-variant-numeric: tabular-nums; font-weight: 700; }
.vcount .ic { width: 15px; height: 15px; }
.vcount.on { color: var(--coral-2); }

.save-icon {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(11, 13, 19, .5); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
.save-icon .ic { width: 22px; height: 22px; }
.save[aria-pressed="true"] .ic { color: var(--coral); }
.save[aria-busy] { opacity: .6; }
.save-ic { display: inline-flex; }

/* progress line: time axis, always LTR */
.pline { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(245, 240, 232, .22); direction: ltr; }
.pline i { display: block; height: 100%; width: 0; background: var(--coral); transition: width .3s; }

/* ---------- home: channel bar + the feed between the top bar and the tab bar ---------- */
:root { --ch-h: 46px; }
.home-bar {
  position: fixed; z-index: 15; top: calc(var(--top-h) + var(--st)); left: 0; right: 0; height: var(--ch-h);
  padding: 0 max(calc(var(--gut) - 10px), var(--sr)) 0 max(calc(var(--gut) - 10px), var(--sl));
  display: flex; align-items: center; gap: 6px; background: var(--ink);
}
.ch-tabs { flex: 1; min-width: 0; display: flex; gap: 2px; overflow-x: auto; scrollbar-width: none; }
.ch-tabs::-webkit-scrollbar { display: none; }
.ch-b { position: relative; flex: none; min-height: 44px; padding: 0 10px; font-size: 16px; font-weight: 700; color: var(--dim); white-space: nowrap; transition: color .2s; }
.ch-b[aria-pressed="true"] { color: var(--text); }
.ch-b[aria-pressed="true"]::after { content: ""; position: absolute; inset-inline: 10px; bottom: 5px; height: 3px; border-radius: 2px; background: var(--coral); }
.ch-search { background: var(--ink-2); backdrop-filter: none; -webkit-backdrop-filter: none; color: var(--text); }
.home-stage { position: fixed; z-index: 5; top: calc(var(--top-h) + var(--st) + var(--ch-h)); bottom: calc(var(--tab-h) + var(--sb)); left: 0; right: 0; background: #000; }

.cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
.card { position: relative; }
.card-link { display: block; }
.card-frame { position: relative; aspect-ratio: 2 / 3; border-radius: 16px 16px 0 0; overflow: hidden; background: var(--ink-2); }
.card-frame img { width: 100%; height: 100%; object-fit: cover; transition: transform .4s var(--ease); }
.card-link:hover .card-frame img { transform: scale(1.03); }
.card-dur { position: absolute; bottom: 10px; inset-inline-start: 10px; font-size: 12px; font-weight: 700; background: rgba(11, 13, 19, .62); padding: 2px 8px; border-radius: 999px; font-variant-numeric: tabular-nums; }
.card-stub { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 7px 10px; border: 1.5px dashed var(--dash); border-top: 0; border-radius: 0 0 16px 16px; font-size: 12px; font-weight: 600; color: var(--muted); }
.card-t { font-size: 15.5px; font-weight: 700; margin-top: 8px; line-height: 1.35; padding-inline: 2px; }
.card-m { font-size: 12.5px; color: var(--muted); padding-inline: 2px; }
.card > .save { position: absolute; top: 8px; inset-inline-end: 8px; }

.rows { display: flex; flex-direction: column; gap: 10px; }
.row-item { display: flex; align-items: center; gap: 12px; padding: 8px; padding-inline-end: 14px; border-radius: 18px; background: var(--ink-1); min-height: 64px; }
.row-thumb { position: relative; flex: none; width: 46px; aspect-ratio: 9 / 16; border-radius: 9px; overflow: hidden; background: var(--ink-2); }
.row-thumb img { width: 100%; height: 100%; object-fit: cover; }
.row-thumb .pline { height: 3px; }
.row-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-m { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.row-go { color: var(--coral); display: inline-flex; }
.row-go .ic { width: 20px; height: 20px; }

/* ---------- discover ---------- */
.discover { padding: 0 var(--gut); }
.search { position: sticky; top: calc(var(--top-h) + var(--st)); z-index: 10; margin-inline: calc(var(--gut) * -1); padding: 2px var(--gut) 12px; background: var(--ink); display: grid; gap: 10px; }
.search-box { display: flex; align-items: center; gap: 8px; height: 52px; padding-inline: 16px 4px; border-radius: 999px; background: var(--ink-2); border: 1.5px solid transparent; }
.search-box:focus-within { border-color: var(--coral); }
.search-box > .ic { color: var(--muted); width: 22px; height: 22px; }
.search-in { flex: 1; min-width: 0; height: 100%; background: none; border: 0; outline: 0; font-size: 16px; }
.search-in::-webkit-search-cancel-button { display: none; }
.search-x { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: var(--muted); }
.disc-results { display: grid; gap: 28px; padding-top: 8px; }
.idea-grid { display: grid; gap: 14px; }
.empty { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 56px 16px; text-align: center; }
.empty-ic { width: 40px; height: 40px; color: var(--dim); }
.empty-t { font-size: 18px; font-weight: 700; overflow-wrap: anywhere; }

/* ---------- ideas (next chapters) ---------- */
.ideas { padding: 0 var(--gut); }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 4px 0 18px; max-width: 760px; margin-inline: auto; }
.idea-list { display: flex; flex-direction: column; gap: 20px; max-width: 760px; margin-inline: auto; }
.idea { scroll-margin-block: calc(var(--top-h) + var(--st) + 16px) calc(var(--tab-h) + 16px); border-radius: 18px; }
.idea:focus-visible { outline-offset: 4px; }
.idea-parent {
  display: flex; align-items: center; gap: 10px; min-height: 60px;
  padding: 6px; padding-inline-end: 14px;
  background: var(--ink-2); border-radius: 18px 18px 0 0;
}
.idea-thumb { position: relative; flex: none; width: 27px; height: 48px; border-radius: 6px; overflow: hidden; background: var(--ink-3); box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent); }
.idea-thumb img { width: 100%; height: 100%; object-fit: cover; }
.idea-after { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 600; color: var(--soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.idea-play { width: 18px; height: 18px; color: var(--coral); }
.idea-body { border: 1.5px dashed var(--dash); border-radius: 18px; padding: 16px; display: flex; flex-direction: column; gap: 8px; transition: border-color .3s, background .3s; }
.idea-parent + .idea-body { border-top: 0; border-radius: 0 0 18px 18px; }
.idea-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); font-weight: 600; }
.badge { display: inline-flex; align-items: center; padding: 1px 9px; border-radius: 999px; background: rgba(255, 107, 79, .16); color: var(--coral-2); font-size: 11.5px; font-weight: 800; }
.badge-new { background: var(--coral); color: var(--on-coral); }
.idea-t { font-size: 20px; font-weight: 800; line-height: 1.3; overflow-wrap: anywhere; }
.idea-log { color: var(--soft); overflow-wrap: anywhere; }
.idea-scenes summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; font-weight: 700; font-size: 14px; color: var(--muted); }
.idea-scenes summary::-webkit-details-marker { display: none; }
.idea-scenes summary .n { font-variant-numeric: tabular-nums; }
.idea-scenes .chev { width: 18px; height: 18px; transition: transform .2s; }
.idea-scenes[open] .chev { transform: rotate(180deg); }
.idea-scenes ol { list-style: none; margin: 0; padding: 0 0 4px; display: grid; gap: 10px; }
.idea-scenes li { display: flex; gap: 10px; align-items: flex-start; overflow-wrap: anywhere; }
.sc-n { flex: none; width: 24px; height: 34px; border: 1.5px dashed var(--dash); border-radius: 6px; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--muted); }
.idea-foot { display: flex; justify-content: flex-end; gap: 8px; padding-top: 4px; }
.idea.is-new .idea-body { border-color: var(--coral); background: rgba(255, 107, 79, .06); }
.idea-compact .idea-t { font-size: 17px; }
.idea-compact .idea-body { gap: 6px; padding: 14px; }

/* ---------- create ---------- */
.create { padding: 4px var(--gut) 0; max-width: 760px; margin-inline: auto; display: flex; flex-direction: column; gap: 22px; }
.compose, .draft { display: flex; flex-direction: column; gap: 22px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.field { display: flex; flex-direction: column; }
.field-l { display: block; font-size: 13px; font-weight: 700; color: var(--muted); margin-bottom: 8px; padding: 0; }
.prompt {
  width: 100%; min-height: 150px; resize: vertical; padding: 16px 18px; border-radius: 20px;
  background: var(--ink-1); border: 1.5px solid var(--ink-3); font-size: 17px; line-height: 1.75;
}
.prompt:focus { border-color: var(--coral); }
.count { align-self: flex-end; font-size: 12px; color: var(--dim); padding-top: 6px; font-variant-numeric: tabular-nums; }
.actions { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.draft { padding-top: 22px; border-top: 1.5px dashed var(--dash); scroll-margin-top: calc(var(--top-h) + var(--st) + 8px); }
.draft-title { width: 100%; background: none; border: 0; border-bottom: 1.5px solid var(--ink-3); padding: 6px 0 10px; font-size: 25px; font-weight: 800; line-height: 1.3; }
.draft-title:focus { border-bottom-color: var(--coral); }
.draft-log { width: 100%; resize: vertical; padding: 12px 14px; border-radius: 16px; background: var(--ink-1); border: 1.5px solid var(--ink-3); font-size: 16px; line-height: 1.7; }
.draft-log:focus { border-color: var(--coral); }
.draft-meta { font-size: 13.5px; font-weight: 700; color: var(--muted); }
.scene-strip { display: flex; gap: 12px; overflow-x: auto; scroll-snap-type: x mandatory; margin-inline: calc(var(--gut) * -1); padding: 2px var(--gut) 8px; scroll-padding-inline: var(--gut); scrollbar-width: none; }
.scene-strip::-webkit-scrollbar { display: none; }
.scene-card { flex: none; width: min(70vw, 250px); aspect-ratio: 9 / 13; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; padding: 14px; border: 1.5px dashed var(--dash); border-radius: 18px; transition: border-color .2s; }
.scene-card:focus-within { border-color: var(--coral); border-style: solid; }
.scene-k { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--muted); }
.scene-num { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-2); color: var(--text); font-size: 13px; }
.scene-in { flex: 1; width: 100%; resize: none; background: none; border: 0; font-size: 15px; line-height: 1.7; }

/* ---------- me ---------- */
.me { padding: 4px var(--gut) 0; max-width: 960px; margin-inline: auto; display: flex; flex-direction: column; gap: 30px; }
.me-lists { display: flex; flex-direction: column; gap: 30px; }
.profile { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border-radius: 22px; background: var(--ink-1); }
.avatar { flex: none; width: 54px; height: 54px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-3); font-weight: 800; font-size: 22px; }
.profile-txt { flex: 1; min-width: 0; }
.profile-n { font-size: 19px; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.id-slot { display: contents; }
.id-links { padding: 14px 16px; border-radius: 22px; background: var(--ink-1); }
.id-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.id-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; }
.id-name { font-weight: 700; }
.id-state { font-size: 13.5px; font-weight: 600; color: var(--muted); }

/* ---------- creator centre: the same story line, seen from the writer's side ----------
   dashed frame = only words so far · filling frame = being made · solid frame = real footage */
.studio { padding: 0 var(--gut); max-width: 760px; margin-inline: auto; }
.st-page { display: flex; flex-direction: column; gap: 22px; padding-top: 2px; }
.st-head { display: flex; align-items: center; gap: 4px; margin-inline-start: -10px; }
.st-h { font-size: 24px; font-weight: 800; line-height: 1.25; min-width: 0; overflow-wrap: anywhere; }
.st-status { display: flex; gap: 8px; min-height: 0; }
.st-status:empty { display: none; }
.st-actions, .row-btns { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.st-actions .err { flex-basis: 100%; }
.link-btn { display: inline-flex; align-items: center; min-height: 44px; padding-inline: 4px; color: var(--coral-2); font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.cap-off { color: var(--muted); font-size: 14px; font-weight: 600; padding-inline-start: 12px; border-inline-start: 2px solid var(--ink-3); }
.text-in { width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 14px; background: var(--ink-1); border: 1.5px solid var(--ink-3); font-size: 16px; }
.text-in:focus, .text-in:focus-visible { border-color: var(--coral); outline: none; }
.text-in[readonly], .draft-log[readonly], .draft-title[readonly], .prompt[readonly], .scene-in[readonly] { color: var(--soft); border-color: transparent; background: transparent; padding-inline: 0; }
.chip:disabled, .chip-radio:has(input:disabled) { opacity: .5; cursor: default; }
fieldset:disabled { opacity: .5; }
.two-step.armed { border-color: #ff9b86; color: #ff9b86; }

/* status stamp: shape + word */
.stamp { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding-inline: 8px; border-radius: 6px; font-size: 11.5px; font-weight: 800; white-space: nowrap; border: 1.5px solid currentColor; color: var(--muted); }
.stamp-draft, .stamp-queued, .stamp-uploading, .stamp-scheduled { border-style: dashed; }
.stamp-generating, .stamp-narrating, .stamp-composing, .stamp-transcoding, .stamp-importing, .stamp-vod_submitting, .stamp-training, .stamp-active { color: var(--text); }
.stamp-generating::before, .stamp-narrating::before, .stamp-composing::before, .stamp-transcoding::before, .stamp-importing::before, .stamp-vod_submitting::before, .stamp-training::before, .stamp-uploading::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--coral); animation: breathe 1.4s ease-in-out infinite;
}
.stamp-ready, .stamp-approved { color: var(--text); }
.stamp-pending, .stamp-needs_review { color: #ffd34d; }
.stamp-rejected, .stamp-failed, .stamp-error, .stamp-cancelled { background: var(--coral); border-color: var(--coral); color: var(--on-coral); }
.stamp-published { background: var(--text); border-color: var(--text); color: var(--ink); }

/* human review note: original text, quoted under the work it belongs to */
.review-note { margin: 0; padding: 8px 12px; border-inline-start: 3px solid var(--coral); background: rgba(255, 107, 79, .08); border-radius: 0 10px 10px 0; font-size: 14px; color: var(--soft); white-space: pre-line; overflow-wrap: anywhere; }
[dir="rtl"] .review-note { border-radius: 10px 0 0 10px; }
.review-note-lg { font-size: 15.5px; padding: 12px 14px; }

/* points: available solid, held dashed — the same bar wherever points are about to move */
.meter { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border-radius: 18px; background: var(--ink-1); }
.m-top { display: flex; align-items: center; gap: 8px; }
.m-ic { width: 22px; height: 22px; color: var(--coral); }
.m-l { font-size: 13.5px; font-weight: 700; color: var(--muted); }
.m-n { margin-inline-start: auto; font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.m-go { width: 18px; height: 18px; color: var(--dim); }
.m-bar { display: flex; height: 8px; border-radius: 4px; background: var(--ink-2); overflow: hidden; direction: ltr; }
.m-av { display: block; height: 100%; background: var(--coral); transition: width .4s var(--ease); }
.m-held { display: block; height: 100%; background: repeating-linear-gradient(90deg, var(--coral-2) 0 5px, transparent 5px 9px); opacity: .7; transition: width .4s var(--ease); }
.m-sub { display: flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.m-dash { width: 16px; height: 0; border-top: 2px dashed var(--coral-2); }
.m-h-n { font-variant-numeric: tabular-nums; }

/* three dashed frames: the empty first frame of something new */
.starters { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.starter { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; }
.starter-frame { width: 100%; aspect-ratio: 9 / 12; display: grid; place-items: center; border: 1.5px dashed var(--dash); border-radius: 16px; color: var(--soft); transition: border-color .2s, color .2s; }
.starter-frame .ic { width: 28px; height: 28px; }
.starter:hover .starter-frame, .starter:focus-visible .starter-frame { border-color: var(--coral); color: var(--coral); }
.starter-l { font-size: 14px; font-weight: 700; line-height: 1.3; }

/* the work strip */
.works { display: flex; flex-direction: column; gap: 10px; }
.work-wrap { display: flex; flex-direction: column; gap: 6px; }
.saved-row { display: flex; align-items: center; gap: 8px; }
.saved-row > .work { flex: 1; min-width: 0; }
.work { display: flex; align-items: center; gap: 12px; min-height: 76px; padding: 8px; padding-inline-end: 12px; border-radius: 16px; background: var(--ink-1); }
.work-frame { flex: none; width: 36px; aspect-ratio: 9 / 16; display: grid; place-items: center; border-radius: 7px; color: var(--muted); position: relative; overflow: hidden; }
.work-frame .ic { width: 18px; height: 18px; }
.work-dash .work-frame { border: 1.5px dashed var(--dash); }
.work-solid .work-frame { background: var(--ink-3); color: var(--text); box-shadow: inset 0 0 0 1.5px var(--soft); }
.work-fill .work-frame { border: 1.5px dashed var(--dash); }
.work-fill .work-frame::after, .ep-frame.fill::after, .cr-frame.fill::after {
  content: ""; position: absolute; inset: auto 0 0; height: 100%;
  background: linear-gradient(to top, rgba(255, 107, 79, .32), rgba(255, 107, 79, 0));
  animation: rise 2.4s ease-in-out infinite;
}
@keyframes rise { 0% { transform: translateY(70%); } 60% { transform: translateY(10%); } 100% { transform: translateY(70%); } }
.work-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.work-k { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; color: var(--muted); }
.work-t { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-m { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.work-go { width: 18px; height: 18px; color: var(--dim); }
.work-wrap .review-note { margin-inline-start: 56px; }

.todo .sec-h::before { content: ""; display: inline-block; width: 8px; height: 8px; margin-inline-end: 8px; border-radius: 50%; background: var(--coral); vertical-align: middle; }
.shelf { display: flex; flex-direction: column; }
.shelf-tabs { margin-bottom: 14px; }
.shelf-tabs .chip { gap: 6px; }
.tab-n { font-size: 12px; font-variant-numeric: tabular-nums; opacity: .75; }
.tab-n:empty { display: none; }
.paged { display: flex; flex-direction: column; gap: 12px; }
.more-btn { align-self: center; }

.tools { display: flex; flex-direction: column; border-radius: 18px; background: var(--ink-1); overflow: hidden; }
.tool { display: flex; align-items: center; gap: 12px; min-height: 56px; padding-inline: 16px 12px; }
.tool + .tool { border-top: 1px solid rgba(245, 240, 232, .06); }
.tool-ic { width: 22px; height: 22px; color: var(--muted); }
.tool-l { flex: 1; font-weight: 700; }
.tool-go { width: 18px; height: 18px; color: var(--dim); }

.gate-box { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 40px 12px; text-align: center; }
.gate-frame { width: 64px; aspect-ratio: 9 / 14; display: grid; place-items: center; border: 1.5px dashed var(--dash); border-radius: 12px; color: var(--muted); }
.gate-t { font-size: 17px; font-weight: 700; }
.auth-control { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.gate-box .auth-control { align-items: center; }
.auth-state { font-size: 12.5px; font-weight: 600; color: var(--muted); }

/* Me page entry */
.studio-entry { display: flex; flex-direction: column; gap: 10px; }
.entry-link { display: flex; align-items: center; gap: 14px; min-height: 72px; padding: 10px 14px; border-radius: 18px; border: 1.5px dashed var(--dash); }
.entry-frame { flex: none; width: 30px; aspect-ratio: 9 / 14; display: grid; place-items: center; border-radius: 6px; background: var(--coral); color: var(--on-coral); }
.entry-frame .ic { width: 18px; height: 18px; }
.entry-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.entry-t { font-size: 17px; font-weight: 800; }
.entry-m { font-size: 13px; color: var(--muted); font-weight: 600; }
.entry-m:empty { display: none; }
.entry-go { width: 18px; height: 18px; color: var(--dim); }

/* Create page links */
.create-head { padding-bottom: 0; }
.create-links { display: flex; gap: 8px; flex-wrap: wrap; }
.create .actions .row-btns { display: flex; }

/* editors */
.idea-form, .video-page { display: flex; flex-direction: column; gap: 22px; }
.scene-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.scene-row { width: auto; aspect-ratio: auto; min-height: 120px; }
.scene-row .scene-k { min-height: 32px; }
.scene-x { margin-inline-start: auto; width: 36px; height: 36px; }
.scene-x .ic { width: 18px; height: 18px; }
.scene-add { display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 52px; margin-top: 10px; border: 1.5px dashed var(--dash); border-radius: 16px; color: var(--soft); font-weight: 700; }
.scene-add .ic { width: 20px; height: 20px; }
.save-state { display: flex; align-items: center; gap: 8px; min-height: 24px; font-size: 13px; font-weight: 600; color: var(--muted); }
.save-state:empty { display: none; }
.save-state[data-state="conflict"], .save-state[data-state="error"] { color: #ff9b86; }

.range-head { display: flex; align-items: baseline; justify-content: space-between; }
.range-v { font-weight: 800; font-variant-numeric: tabular-nums; }
.range { width: 100%; height: 44px; accent-color: var(--coral); direction: ltr; }
.ratio-glyph { display: inline-block; border: 1.5px solid currentColor; border-radius: 3px; }

.spend { display: flex; flex-direction: column; gap: 12px; padding-top: 18px; border-top: 1.5px dashed var(--dash); }
.quote { display: flex; flex-direction: column; gap: 8px; }
.quote-n { display: flex; align-items: baseline; gap: 6px; }
.quote-n > span:first-child { font-size: 34px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.quote-u { font-weight: 700; color: var(--muted); }
.quote-m { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.quote-unknown { font-weight: 700; color: #ffd34d; }

/* one creation */
.cr-frame { position: relative; width: min(100%, 300px); max-height: 60dvh; margin-inline: auto; border-radius: 18px; overflow: hidden; display: grid; place-items: center; }
.cr-frame.dash, .cr-frame.fill { border: 1.5px dashed var(--dash); color: var(--muted); }
.cr-frame.solid { background: #000; box-shadow: 0 0 0 1.5px var(--soft); }
.cr-ic { width: 40px; height: 40px; }
.cr-video { width: 100%; height: 100%; object-fit: contain; background: #000; }
.steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13.5px; font-weight: 700; color: var(--dim); }
.steps li { display: inline-flex; align-items: center; gap: 6px; }
.step-dot { width: 10px; height: 10px; border-radius: 50%; border: 1.5px dashed currentColor; }
.steps li.done { color: var(--muted); }
.steps li.done .step-dot { border-style: solid; background: currentColor; }
.steps li.now { color: var(--text); }
.steps li.now .step-dot { border: 0; background: var(--coral); animation: breathe 1.4s ease-in-out infinite; }
.facts { margin: 0; display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 10px 16px; font-size: 14.5px; }
.facts dt { color: var(--muted); font-weight: 700; font-size: 13px; padding-top: 1px; }
.facts dd { margin: 0; overflow-wrap: anywhere; }
.facts .pre { white-space: pre-line; }

/* series: every episode is a numbered frame; bytes fill it from below */
.lang-pairs { display: flex; flex-direction: column; gap: 16px; }
.lang-pair { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: 16px; background: var(--ink-1); }
.lang-pair .field-l { margin: 4px 0 0; }
.lang-k { font-size: 14px; font-weight: 800; }
.texts-sec { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.texts-sec .lang-pairs { align-self: stretch; }
.ep-sec .sec-h { font-variant-numeric: tabular-nums; }
.ep-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 14px 10px; }
.ep-cell { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ep-frame { position: relative; aspect-ratio: 9 / 16; display: grid; place-items: center; border-radius: 12px; overflow: hidden; }
.ep-frame.dash, .ep-frame.fill { border: 1.5px dashed var(--dash); }
.ep-frame.solid { background: var(--ink-2); box-shadow: inset 0 0 0 1.5px var(--soft); }
.ep-cell[data-state="error"] .ep-frame { border-color: var(--coral); }
.ep-no { position: relative; z-index: 1; font-size: 28px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--soft); }
.ep-fill { position: absolute; left: 0; right: 0; bottom: 0; height: 0; background: rgba(255, 107, 79, .38); border-top: 2px solid var(--coral); transition: height .2s linear; }
.ep-fill[style*="height: 0"] { border-top: 0; }
.ep-video { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; object-fit: contain; background: #000; }
.ep-name { font-size: 12.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ep-size { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ep-size:empty { display: none; }
.ep-err { font-size: 12px; }
.ep-btns { display: flex; flex-direction: column; gap: 4px; }
.mini-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding-inline: 8px; border-radius: 10px; background: var(--ink-2); font-size: 13px; font-weight: 700; cursor: pointer; }
.mini-btn .ic { width: 16px; height: 16px; }
.mini-btn.armed { background: rgba(255, 107, 79, .18); color: #ff9b86; }
.ep-add .ep-frame { border: 1.5px dashed var(--dash); color: var(--soft); cursor: pointer; display: flex; flex-direction: column; justify-content: center; gap: 6px; text-align: center; padding: 8px; }
.ep-add .ep-frame:hover, .ep-add:focus-within .ep-frame { border-color: var(--coral); color: var(--coral); }
.ep-add-l { font-size: 13px; font-weight: 700; }
.events summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; cursor: pointer; font-weight: 700; color: var(--muted); }
.events summary::-webkit-details-marker { display: none; }
.events .chev { width: 18px; height: 18px; transition: transform .2s; }
.events[open] .chev { transform: rotate(180deg); }
.ev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ev-k { display: flex; align-items: center; gap: 10px; }
.ev-t { font-size: 12.5px; color: var(--muted); }
.ev-note { margin-top: 4px; font-size: 14px; color: var(--soft); white-space: pre-line; overflow-wrap: anywhere; }

/* points page, voices, settings, promotion */
.topup { display: flex; flex-direction: column; gap: 12px; }
.amount-in { max-width: 200px; font-variant-numeric: tabular-nums; }
.led { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(245, 240, 232, .06); }
.led-a { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.led-op { font-weight: 700; overflow-wrap: anywhere; }
.led-note { font-size: 13px; color: var(--soft); }
.led-t { font-size: 12px; color: var(--muted); }
.led-d { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; font-variant-numeric: tabular-nums; font-weight: 800; white-space: nowrap; }
.led-d .pos { color: var(--text); }
.led-d .neg { color: var(--coral-2); }
.held-d { font-size: 12px; font-weight: 600; color: var(--muted); }
.voices { display: flex; flex-direction: column; gap: 10px; }
.voice { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 16px; background: var(--ink-1); }
.voice-ic { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--ink-2); color: var(--muted); flex: none; }
.voice-txt { flex: 1; min-width: 0; }
.voice-n { font-weight: 700; }
.voice-m { font-size: 12.5px; color: var(--muted); }
.enroll { display: flex; flex-direction: column; gap: 12px; }
.enroll-f { display: flex; flex-direction: column; gap: 16px; }
.sample { display: flex; flex-direction: column; gap: 6px; }
.sample:empty { display: none; }
.sample audio { width: 100%; }
.sample-m { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.consent { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; font-size: 14.5px; font-weight: 600; cursor: pointer; }
.consent input { flex: none; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--coral); }
.models { display: flex; flex-direction: column; gap: 8px; }
.model { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 14px 16px; border-radius: 16px; background: var(--ink-1); border: 1.5px solid transparent; cursor: pointer; }
.model:has(input:checked) { border-color: var(--coral); }
.model:has(input:focus-visible) { outline: 2.5px solid var(--coral); outline-offset: 2px; }
.model-n { font-weight: 800; }
.model-m { font-size: 13px; color: var(--muted); font-weight: 600; }
.prefs { display: flex; flex-direction: column; gap: 26px; }
.prefs-defaults { display: flex; flex-direction: column; gap: 18px; }
.targets { display: flex; flex-direction: column; gap: 8px; }
.target { display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 14px; border-radius: 14px; background: var(--ink-1); cursor: pointer; }
.target input { accent-color: var(--coral); width: 20px; height: 20px; flex: none; }
.target-k { font-size: 12px; font-weight: 700; color: var(--muted); flex: none; }
.target-t { font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- player ---------- */
.player { position: absolute; inset: 0; background: #000; color: #fff; --tp: 80px; --info-h: 72px; --rail-w: 60px; overscroll-behavior: contain; }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .42); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); color: #fff; flex: none; }
.icon-btn-flat { background: transparent; backdrop-filter: none; color: var(--text); }
.pl-center { height: 100%; }
.pl-stage { position: relative; height: 100%; overflow: hidden; }
.pl-feed { height: 100%; overflow-y: auto; overflow-x: hidden; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; }
.pl-feed::-webkit-scrollbar { display: none; }
.pl-feed.swipe-episodes { overflow-y: hidden; touch-action: pan-x pinch-zoom; }
.slide { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; background: #000; }
.slide-poster, .pl-video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: filter .4s, top .4s var(--ease), left .4s var(--ease), width .4s var(--ease), height .4s var(--ease), border-radius .4s; }
.pl-video.contain { object-fit: contain; }
.slide-video { position: absolute; inset: var(--info-h) 0 var(--tp); inset-inline-end: var(--rail-w); }
.slide > .slide-poster { top: var(--info-h); bottom: var(--tp); inset-inline-start: 0; inset-inline-end: var(--rail-w); width: calc(100% - var(--rail-w)); height: calc(100% - var(--info-h) - var(--tp)); }
.slide .pl-video, .slide > .slide-poster { object-fit: contain; }
.slide-scrim { display: none; }
.slide-tap { position: absolute; inset: var(--info-h) 0 var(--tp); inset-inline-end: var(--rail-w); cursor: pointer; }
.slide-state { position: absolute; inset: var(--info-h) 0 var(--tp); inset-inline-end: var(--rail-w); display: grid; place-items: center; pointer-events: none; }
.big-play { grid-area: 1 / 1; width: 78px; height: 78px; border-radius: 50%; display: grid; place-items: center; background: rgba(0, 0, 0, .45); opacity: 0; transform: scale(.85); transition: opacity .2s, transform .2s; }
.big-play .ic { width: 34px; height: 34px; margin-inline-start: 4px; }
[dir="rtl"] .big-play .ic { margin-inline-start: 0; margin-inline-end: 4px; }
.slide[data-state="paused"] .big-play { opacity: 1; transform: none; }
.spinner { grid-area: 1 / 1; width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; opacity: 0; animation: spin .9s linear infinite; }
.slide[data-state="waiting"] .spinner { opacity: 1; transition: opacity .2s .35s; }
@keyframes spin { to { transform: rotate(360deg); } }
.slide-error { position: absolute; z-index: 3; inset: 0; display: none; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: rgba(0, 0, 0, .55); font-weight: 700; font-size: 17px; }
.slide[data-state="error"] .slide-error { display: flex; }
.slide-ui { position: absolute; inset: 0 0 auto; height: var(--info-h); padding: 4px max(12px, var(--sr)) 4px max(12px, var(--sl)); pointer-events: none; }
.cue { position: absolute; z-index: 2; inset-inline-start: 12px; inset-inline-end: calc(var(--rail-w) + 12px); bottom: calc(var(--tp) + 10px); width: fit-content; max-width: calc(100% - var(--rail-w) - 24px); margin-inline: auto; text-align: center; font-size: 17px; font-weight: 700; line-height: 1.4; padding: 4px 10px; border-radius: 6px; background: rgba(0, 0, 0, .6); text-shadow: 0 1px 2px rgba(0, 0, 0, .8); white-space: pre-line; pointer-events: none; }
.cue:empty { display: none; }
.engagement { position: absolute; z-index: 3; top: var(--info-h); bottom: var(--tp); inset-inline-end: 6px; width: 48px; display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 12px; }
.engagement .action-icon { flex: none; width: 48px; height: 48px; display: grid; place-items: center; border-radius: 50%; background: transparent; color: #fff; }
.engagement .ic { width: 29px; height: 29px; }
.engagement .action-icon[aria-pressed="true"] { color: var(--coral); }
.engagement .like[aria-pressed="true"] svg { fill: currentColor; }
.engagement .action-icon:active { transform: scale(.92); }
.slide[data-state="ended"] .engagement, .slide.is-ad .engagement { visibility: hidden; }
.eps-collection { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.eps-collection .ep { height: 100%; border-radius: 12px; padding: 8px; }
.eps-collection .ep-now { box-shadow: inset 0 0 0 1px var(--coral); }
.eps-collection .ep-thumb { width: 34px; height: 60px; }
.ep-entry { pointer-events: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; max-width: calc(100% - 142px); padding-inline: 0 8px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.ep-entry .ic { width: 16px; height: 16px; }
.ep-entry > span:first-child { font-variant-numeric: tabular-nums; }
.ep-nav { display: flex; align-items: center; gap: 4px; max-width: calc(100% - 142px); }
.ep-nav .ep-entry { max-width: none; }
.feed-back { flex: none; pointer-events: auto; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 8px; color: var(--muted); }
.feed-back .ic { width: 20px; height: 20px; }
.ep-entry:focus-visible, .feed-back:focus-visible { outline-offset: -2px; }
.slide-row { display: flex; }
.slide-info { flex: 1; min-width: 0; }
.slide-t { font-size: 16px; font-weight: 700; line-height: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.slide[data-state="ended"] .slide-ui, .slide[data-state="ended"] .cue, .slide[data-state="ended"] .big-play { display: none; }
.slide[data-state="ended"] .slide-poster, .slide[data-state="ended"] .pl-video { filter: brightness(.38) saturate(.8); }
.slide[data-state="error"] .cue { display: none; }
.slide[data-state="ended"] .pl-video { visibility: hidden; }
.slide.end-fit[data-state="ended"] .slide-poster {
  inset: auto; top: var(--end-y); left: var(--end-x); width: var(--end-w); height: var(--end-h);
  border-radius: 14px; object-fit: cover; filter: none;
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent) 50%, transparent), 0 24px 60px -24px rgba(0, 0, 0, .9);
}

.pl-transport { position: absolute; z-index: 5; left: 0; right: 0; bottom: 0; padding-inline: max(12px, var(--sl)) max(12px, var(--sr)); background: #000; }
.scrub { display: flex; align-items: center; gap: 10px; height: 32px; direction: ltr; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.scrub .t { min-width: 34px; opacity: .9; }
.scrub .t:last-child { text-align: right; }
.bar { position: relative; flex: 1; height: 32px; display: flex; align-items: center; cursor: pointer; touch-action: none; border-radius: 8px; }
.bar-track { position: relative; width: 100%; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .28); overflow: hidden; transition: height .15s; }
.bar-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--coral); }
.bar-thumb { position: absolute; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%; background: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .4); transition: transform .15s; }
.bar.drag .bar-track, .bar:hover .bar-track { height: 6px; }
.bar.drag .bar-thumb { transform: scale(1.3); }
.ctrls { display: flex; align-items: center; justify-content: center; gap: 12px; height: 48px; padding-bottom: 4px; }
.ctrl { flex: none; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; color: #fff; }
.ctrl .ic { width: 26px; height: 26px; }
.ctrl-sound.is-muted { color: var(--muted); }
.ctrl-cc[aria-pressed="false"] { opacity: .5; }
.ctrl-cc[aria-pressed="true"] .ic { color: #fff; }
.ctrl-next { position: absolute; z-index: 6; top: 24px; inset-inline-end: max(12px, var(--sr)); display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding-inline: 12px 10px; border-radius: 10px; background: var(--ink-2); font-weight: 600; font-size: 13px; color: #fff; white-space: nowrap; }
.ctrl-next .ic { width: 18px; height: 18px; }
.player.is-ended .ctrl-next { visibility: hidden; }
.end-feed { min-height: 44px; margin: 8px auto 0; }

/* post-roll ad: a 15 s segment in the same screen; the gate is a mark on its own timeline */
.ad-layer {
  position: absolute; z-index: 4; left: 0; right: 0; top: 0; bottom: var(--tp);
  display: flex; flex-direction: column; justify-content: space-between; padding: 12px;
  touch-action: none; cursor: pointer;
  background: linear-gradient(to bottom, rgba(0, 0, 0, .55), rgba(0, 0, 0, 0) 96px), linear-gradient(to top, rgba(0, 0, 0, .6), rgba(0, 0, 0, 0) 150px);
}
.ad-top { display: flex; align-items: center; gap: 8px; }
.ad-badge { flex: none; padding: 3px 9px; border-radius: 6px; background: #ffd34d; color: #141414; font-size: 12.5px; font-weight: 800; }
.ad-brand { font-size: 16px; font-weight: 800; text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.ad-more { margin-inline-start: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding-inline: 14px 12px; border-radius: 999px; border: 1.5px solid rgba(255, 255, 255, .55); background: rgba(0, 0, 0, .28); color: #fff; font-size: 13.5px; font-weight: 700; }
.ad-more .ic { width: 16px; height: 16px; }
.ad-bottom { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ad-skip {
  display: inline-flex; align-items: center; gap: 6px; min-height: 48px; max-width: 100%; padding-inline: 18px 14px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); border: 1.5px solid rgba(255, 255, 255, .35); color: rgba(255, 255, 255, .86);
  font-size: 15px; font-weight: 800; font-variant-numeric: tabular-nums; cursor: pointer;
}
.ad-skip:disabled { cursor: default; padding-inline: 18px; }
.ad-skip.is-open { background: #fff; border-color: #fff; color: #111; }
.ad-skip .ic { width: 20px; height: 20px; }
.ad-track { display: none; align-items: center; gap: 10px; height: 32px; direction: ltr; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.ad-track .t { min-width: 34px; opacity: .9; }
.ad-track .t:last-child { text-align: right; }
.ad-line { position: relative; flex: 1; display: flex; align-items: center; height: 32px; }
.ad-line .bar-track { width: 100%; }
.ad-line .bar-fill { background: #ffd34d; }
.ad-gate { position: absolute; top: 50%; width: 3px; height: 14px; margin: -7px 0 0 -1.5px; border-radius: 2px; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .45); }
.ad-gate.passed { background: #ffd34d; }
.player.is-ad .scrub, .player.is-ad .ctrl-cc, .player.is-ad .ctrl-next { display: none; }
.player.is-ad .ad-track { display: flex; }
.player.is-ad .pl-feed { overflow: hidden; touch-action: none; }
.slide.is-ad .slide-poster, .slide.is-ad .slide-ui, .slide.is-ad .slide-scrim, .slide.is-ad .slide-tap { visibility: hidden; }
.slide.is-ad .slide-video { top: 0; bottom: var(--tp); inset-inline-end: 0; height: auto; }
.slide.is-ad .slide-state { top: 0; inset-inline-end: 0; }
.slide.is-ad .pl-video { object-fit: contain; visibility: visible; filter: none; }
.ch-b:disabled { opacity: .45; cursor: default; }

/* end of episode: the dashed next chapter rises from the frame */
.endcard {
  position: absolute; z-index: 4; left: 0; right: 0; bottom: var(--tp);
  margin: 0 max(10px, var(--sr)) 6px max(10px, var(--sl));
  padding: 18px 16px 14px; display: flex; flex-direction: column; gap: 14px;
  border: 1.5px dashed rgba(255, 255, 255, .5); border-radius: 22px;
  background: rgba(10, 12, 18, .82); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  max-height: calc(100% - var(--tp) - 24px); overflow-y: auto; overscroll-behavior: contain;
}
.end-next { display: flex; flex-direction: column; gap: 6px; }
.end-k { font-size: 12.5px; font-weight: 700; color: rgba(255, 255, 255, .7); }
.end-t { font-size: 22px; font-weight: 800; line-height: 1.25; }
.end-log { font-size: 15px; color: rgba(255, 255, 255, .86); }
.end-vote { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.end-loc { font-size: 13px; color: rgba(255, 255, 255, .7); font-weight: 600; }
.end-write { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid rgba(255, 255, 255, .12); }
.end-wk { font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, .7); }
.chip-dark { background: rgba(255, 255, 255, .1); color: #fff; }
.chip-dash { background: transparent; border: 1.5px dashed rgba(255, 255, 255, .45); }
.end-actions { display: flex; align-items: center; gap: 10px; }
.end-actions .ghost-btn { border-color: rgba(255, 255, 255, .4); color: #fff; }
.end-go { flex: 1; min-height: 48px; }
.cd { font-variant-numeric: tabular-nums; min-width: 1ch; opacity: .75; }
.cd:empty { display: none; }

/* panels: comments / episodes, opened as a bottom sheet over the whole phone screen */
.panel { display: flex; flex-direction: column; gap: 14px; }
.panel-h { display: flex; align-items: baseline; gap: 8px; font-size: 17px; font-weight: 800; }
.panel-n { font-size: 14px; color: var(--muted); font-variant-numeric: tabular-nums; }
.about-t { font-size: 24px; font-weight: 800; line-height: 1.25; }
.about-by { font-size: 13.5px; color: var(--muted); font-weight: 600; }
.about-syn { color: var(--soft); }
.about .panel-h { margin-top: 8px; }
.eps { list-style: none; margin: 0; padding: 0; display: grid; gap: 0; }
.ep { display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px; text-align: start; border-radius: 16px; }
.ep-now { background: var(--ink-2); border-radius: 16px 16px 0 0; }
.ep-next { align-items: flex-start; border: 1.5px dashed var(--dash); border-top: 0; border-radius: 0 0 16px 16px; flex-wrap: wrap; }
.ep-thumb { position: relative; flex: none; width: 40px; height: 71px; border-radius: 8px; overflow: hidden; background: var(--ink-3); }
.ep-thumb img { width: 100%; height: 100%; object-fit: cover; }
.ep-prog { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--coral); }
.ep-thumb-dash { background: none; border: 1.5px dashed var(--dash); display: grid; place-items: center; color: var(--muted); }
.ep-thumb-dash .ic { width: 20px; height: 20px; }
.ep-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; align-items: flex-start; }
.ep-t { font-weight: 800; font-size: 15.5px; }
a.ep-t { min-height: 28px; text-decoration: underline; text-decoration-color: rgba(245, 240, 232, .3); text-underline-offset: 4px; }
.ep-m { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.ep-now .ep-m { color: var(--coral-2); }
.ep-log { font-size: 13.5px; color: var(--soft); margin-bottom: 6px; }

.cm-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.cm { display: flex; gap: 10px; }
.cm-av { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--ink-3); font-weight: 800; font-size: 14px; }
.cm-b { flex: 1; min-width: 0; }
.cm-h { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.cm-a { font-weight: 700; font-size: 14px; }
.cm-time { font-size: 12px; color: var(--dim); }
.cm-x { margin-top: 2px; overflow-wrap: anywhere; white-space: pre-line; }
.cm-empty { color: var(--muted); padding: 10px 0; }
.cm-form { position: sticky; bottom: 0; display: flex; align-items: flex-end; gap: 8px; padding: 10px 0 4px; background: var(--ink-1); }
.cm-in { flex: 1; min-width: 0; min-height: 46px; max-height: 120px; resize: none; overflow-y: hidden; padding: 11px 16px; border-radius: 23px; background: var(--ink-2); border: 1.5px solid var(--ink-3); font-size: 16px; line-height: 1.4; }
.cm-in:focus { border-color: var(--coral); }
.send { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--coral); color: var(--on-coral); }
.send:disabled { opacity: .35; }

.sheet-wrap { position: fixed; z-index: 150; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; background: rgba(0, 0, 0, .5); }
.sheet { position: relative; display: flex; flex-direction: column; max-height: 80dvh; min-height: 40dvh; background: var(--ink-1); color: var(--text); border-radius: 24px 24px 0 0; padding-bottom: var(--sb); box-shadow: 0 -20px 60px rgba(0, 0, 0, .4); }
.sheet-head { position: relative; display: flex; justify-content: flex-end; align-items: center; min-height: 48px; padding: 4px 6px 0; touch-action: none; cursor: grab; }
.sheet-grip { position: absolute; top: 8px; left: 50%; width: 40px; height: 5px; margin-left: -20px; border-radius: 3px; background: rgba(245, 240, 232, .25); }
.sheet-body { overflow-y: auto; overscroll-behavior: contain; padding: 0 max(18px, var(--sr)) 14px max(18px, var(--sl)); }
.sheet-options { flex: none; padding: 0 max(18px, var(--sr)) 12px max(18px, var(--sl)); }
.swipe-switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; width: 100%; min-height: 48px; text-align: start; font-size: 15px; font-weight: 600; }
.switch-track { flex: none; position: relative; width: 46px; height: 28px; border-radius: 16px; background: var(--ink-3); border: 1px solid var(--muted); }
.switch-track i { position: absolute; top: 3px; inset-inline-start: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: inset-inline-start .16s; }
.swipe-switch[aria-checked="true"] .switch-track { background: var(--coral); border-color: var(--coral); }
.swipe-switch[aria-checked="true"] .switch-track i { inset-inline-start: 21px; }

/* full screen: the player's mount fills the screen (or covers the app); sheets and the toast live inside it */
.ctrl-view { margin-inline-start: 8px; }
body.pl-immersive { overflow: hidden; }
body.on-home.pl-immersive .home-stage { inset: 0; z-index: 100; }
.player.is-immersive { --info-h: calc(72px + var(--st)); --tp: calc(80px + var(--sb)); }
.player.is-immersive .slide-ui { padding-top: calc(4px + var(--st)); }
.player.is-immersive .ctrl-next { top: calc(24px + var(--st)); }
.player.is-immersive .pl-transport { padding-bottom: var(--sb); }
.player > .sheet-wrap { position: absolute; }
.player .sheet { width: min(100%, 560px); margin-inline: auto; max-height: 80%; min-height: 40%; }
.player > .toast { position: absolute; bottom: calc(var(--tp) + 14px); }

/* landscape view: the frame keeps its ratio in the middle; title, rail and controls take the sides and one bottom row */
.player.is-land { --info-h: 0px; --tp: 56px; --side: clamp(120px, 22%, 260px); }
.player.is-immersive.is-land { --tp: calc(56px + var(--sb)); }
.player.is-land .slide-video, .player.is-land .slide-tap, .player.is-land .slide-state { inset: 0 var(--side) var(--tp); }
.player.is-land .slide.is-ad .slide-video, .player.is-land .slide.is-ad .slide-state { inset: 0 0 var(--tp); }
.player.is-land .slide:not(.end-fit) > .slide-poster { inset: 0 var(--side) var(--tp); width: calc(100% - 2 * var(--side)); height: calc(100% - var(--tp)); }
.player.is-land .slide-ui { inset-inline: 0 auto; width: var(--side); height: auto; padding: calc(10px + var(--st)) 10px 8px; }
.player.is-land .slide-t { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.player.is-land .ep-nav, .player.is-land .ep-entry { max-width: none; }
.player.is-land .engagement { top: 0; bottom: calc(var(--tp) + 52px); inset-inline-end: 0; width: var(--side); display: grid; grid-template-columns: repeat(2, 44px); place-content: center; gap: 8px; }
.player.is-land .ctrl-next { top: auto; bottom: calc(var(--tp) + 6px); }
.player.is-land .engagement .action-icon { width: 44px; height: 44px; }
.player.is-land .cue { inset-inline: calc(var(--side) + 8px); max-width: calc(100% - 2 * var(--side) - 16px); }
.player.is-land .pl-transport { display: flex; align-items: center; gap: 8px; }
.player.is-land .ctrls { order: -1; height: 56px; padding: 0; gap: 4px; }
.player.is-land .scrub, .player.is-land .ad-track { flex: 1; min-width: 0; }

/* the chosen view differs from the screen and can't be locked: the player turns; on a computer, portrait is a column */
.player.is-rot { inset: auto; top: 50%; left: 50%; width: var(--rot-w); height: var(--rot-h); transform: translate(-50%, -50%) rotate(var(--rot)); }
.player.is-rot .pl-feed { overflow-y: hidden; touch-action: none; }
.player.is-col .pl-stage { width: var(--col-w); margin-inline: auto; }

/* ---------- wider phones / tablets ---------- */
@media (min-width: 600px) {
  :root { --gut: 24px; }
  .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .scene-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); overflow: visible; margin-inline: 0; padding-inline: 0; }
  .scene-card { width: auto; }
  .idea-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- phone held sideways ---------- */
@media (orientation: landscape) and (max-height: 520px) {
  .player { --rail-w: 108px; }
  .engagement { width: 96px; display: grid; grid-template-columns: repeat(2, 44px); align-content: center; gap: 8px; }
  .engagement .action-icon { width: 44px; height: 44px; }
  .slide-poster, .pl-video { object-fit: contain; }
  body.on-home .topbar { display: none; }
  body.on-home .home-bar { top: var(--st); }
  body.on-home .home-stage { top: calc(var(--st) + var(--ch-h)); }
}
@media (max-width: 360px) {
  .ch-b { padding: 0 7px; font-size: 15px; }
}

/* ---------- computer: the same app inside a phone ---------- */
body.device-mode { overflow-x: hidden; background: radial-gradient(ellipse 60% 70% at 50% 45%, #161b27 0%, var(--ink) 70%); }
.stage { min-height: 100dvh; display: flex; align-items: center; justify-content: center; gap: 56px; padding: 24px; }
.stage.stacked { flex-direction: column; gap: 28px; }
.device-wrap { position: relative; flex: none; width: calc(414px * var(--s, 1)); height: calc(868px * var(--s, 1)); }
.device {
  position: absolute; top: 0; left: 0; width: 414px; height: 868px; padding: 12px;
  border-radius: 60px; background: #030407; transform: scale(var(--s, 1)); transform-origin: 0 0;
  box-shadow: inset 0 0 0 1.5px #2c313d, 0 0 0 1px #171a22, 0 50px 120px -40px rgba(0, 0, 0, .9), 0 0 140px -30px rgba(255, 107, 79, .14);
}
.device-screen { display: block; width: 390px; height: 844px; border: 0; border-radius: 48px; background: var(--ink); }
.device-screen:fullscreen { border-radius: 0; }
.mobile-open { flex: none; width: 260px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.stage.stacked .mobile-open { align-items: center; text-align: center; width: min(320px, 100%); }
.m-h { font-size: 18px; font-weight: 800; }
.qr-box { width: 200px; height: 200px; padding: 12px; border-radius: 20px; background: #fff; }
.qr-img { display: block; width: 100%; height: 100%; }
.mobile-open[data-state="loading"] .qr-box, .mobile-open[data-state="qr"] .qr-box { background: var(--ink-2); }
.mobile-open[data-state="loading"] .qr-img, .mobile-open[data-state="qr"] .qr-img { visibility: hidden; }
.url-row { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; width: 100%; }
.stage.stacked .url-row { align-items: center; }
.m-url { display: block; width: 100%; padding: 10px 12px; border-radius: 12px; background: var(--ink-2); border: 1px solid var(--ink-3); color: var(--soft); font: 13px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; direction: ltr; text-align: left; overflow-wrap: anywhere; word-break: break-all; user-select: all; }
.m-fail { display: none; flex-direction: column; align-items: inherit; gap: 10px; color: var(--soft); }
.mobile-open[data-state="fail"] .m-fail { display: flex; }
.mobile-open[data-state="fail"] .qr-box, .mobile-open[data-state="fail"] .url-row,
.mobile-open[data-state="loading"] .url-row { display: none; }
.m-wifi { font-size: 13.5px; color: var(--muted); }

/* ---------- motion ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
  .spinner { animation: none; border-top-color: rgba(255, 255, 255, .8); }
  .card-link:hover .card-frame img { transform: none; }
}
