:root {
  --bg: #000;
  --panel: #0b0b0b;
  --panel-2: #111;
  --line: #1c1c1c;
  --gold: #ececec;
  --gold-dim: #6a6a6a;
  --ink: #ececec;
  --mute: #8a8a8a;
  --danger: #c45c5c;
  --fill: #1e4a86;
  --ok: #7dba7a;
  --tap: 48px;
  --pad: 20px;
  --chrome: #000;
  --input: #080808;
  --btn-fg: #111;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  font-synthesis: none;
  color-scheme: dark;
}
html { background: var(--bg); }
body {
  min-height: 100vh;
  min-height: 100dvh;
  font: 15px/1.45 "Segoe UI", "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--ink);
}
html[data-theme="light"] {
  --bg: #f3f3f4;
  --panel: #fff;
  --panel-2: #ececee;
  --line: #e1e1e6;
  --gold: #111;
  --gold-dim: #8a8a90;
  --ink: #111;
  --mute: #5c5c64;
  --fill: #1e4a86;
  --danger: #b42323;
  --chrome: #f3f3f4;
  --input: #fff;
  --btn-fg: #fff;
  color-scheme: light;
}
img, video { max-width: 100%; }
a { color: inherit; }
button, input, select, textarea { font: inherit; }
:focus-visible {
  outline: 1px solid var(--ink);
  outline-offset: 2px;
}

.wrap {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding-left: max(var(--pad), env(safe-area-inset-left));
  padding-right: max(var(--pad), env(safe-area-inset-right));
}

.top {
  position: sticky; top: 0; z-index: 8;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
}
.top-inner {
  display: flex;
  align-items: center;
  gap: 28px;
  min-height: 56px;
}
.brand {
  letter-spacing: 0.04em;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  flex: 0 0 auto;
}
.nav {
  display: flex;
  gap: 2px;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
}
.nav a, .nav .ghost, .account-link, .account-menu summary {
  text-decoration: none;
  color: var(--mute);
  font-size: 13px;
  letter-spacing: 0;
  text-transform: none;
  min-height: 36px;
  padding: 8px 10px;
  display: inline-flex;
  align-items: center;
  border: 0;
  background: none;
  cursor: pointer;
}
.nav a:hover, .nav a.on, .nav .ghost:hover, .account-link:hover, .account-menu summary:hover { color: var(--ink); }
.nav a.on { color: var(--ink); }
.top-end {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex: 0 0 auto;
}
.credits {
  color: var(--mute);
  font-size: 13px;
  letter-spacing: 0;
  white-space: nowrap;
}
.account-menu { position: relative; }
.account-menu summary { list-style: none; }
.account-menu summary::-webkit-details-marker { display: none; }
.account-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 200px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 6px;
  z-index: 12;
}
.account-panel a, .account-panel .ghost {
  display: flex;
  width: 100%;
  justify-content: flex-start;
  min-height: 40px;
}
.ghost { background: none; border: 0; color: var(--mute); font: inherit; cursor: pointer; letter-spacing: 0.06em; }
.nav-logout { display: inline; margin: 0; }
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  min-width: var(--tap);
  min-height: var(--tap);
  padding: 0;
  background: transparent;
  border: 0;
  color: var(--ink);
  cursor: pointer;
}
.nav-toggle-label { display: none; }
.nav-toggle-bars {
  width: 16px;
  height: 12px;
  display: block;
  background:
    linear-gradient(var(--ink), var(--ink)) left top / 100% 2px no-repeat,
    linear-gradient(var(--ink), var(--ink)) left 5px / 100% 2px no-repeat,
    linear-gradient(var(--ink), var(--ink)) left bottom / 100% 2px no-repeat;
}
.nav-toggle-label { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; }

main { padding: 32px 0 88px; }
.hero { padding: 8px 0 28px; border-bottom: 1px solid var(--line); margin-bottom: 28px; }
.hero h1, .studio-head h1, .auth-copy h1, .legal h1 {
  letter-spacing: 0;
  font-weight: 600;
  overflow-wrap: anywhere;
}
.hero h1 { font-size: clamp(28px, 4vw, 40px); line-height: 1.15; margin: 0 0 12px; }
.hero p { max-width: 640px; color: var(--mute); margin: 0; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  text-decoration: none;
  display: block;
  overflow: hidden;
  transition: border-color 0.2s ease, transform 0.2s ease;
}
.card:hover { border-color: var(--gold-dim); }
.thumb { aspect-ratio: 3/4; background: var(--panel-2); overflow: hidden; position: relative; border-bottom: 1px solid var(--line); }
.thumb video, .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.meta { padding: 14px 16px 16px; }
.meta h2 { margin: 0 0 6px; font-size: 16px; font-weight: 600; }
.meta span { color: var(--mute); font-size: 12px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 28px;
  max-width: 520px;
}
.wide { max-width: none; }
label { display: block; font-size: 11px; letter-spacing: 0.1em; color: var(--mute); margin: 16px 0 8px; text-transform: uppercase; }
input, select, textarea {
  width: 100%;
  background: var(--input);
  color: var(--ink);
  border: 1px solid var(--line);
  padding: 12px 14px;
  min-height: 46px;
}
input[type="file"] { padding: 10px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--gold-dim); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line);
  background: var(--input);
  color: var(--ink);
  padding: 10px 14px;
  min-height: 44px;
  cursor: pointer;
}
.chip.on, .chip:hover { border-color: var(--gold); color: var(--gold); }
button.gold, a.gold {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--gold);
  color: var(--btn-fg);
  border: 0;
  padding: 13px 18px;
  min-height: 46px;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
  margin-top: 8px;
}
button.gold:hover, a.gold:hover { filter: brightness(1.08); }
.flash { border: 1px solid var(--gold-dim); color: var(--gold); padding: 12px 14px; margin: 0 0 20px; background: rgba(212,180,106,0.05); }
.empty { color: var(--mute); padding: 40px 0; }
.muted { color: var(--mute); }
.fine { font-size: 13px; color: var(--mute); }
.legal { max-width: 720px; }
.legal h1 { font-size: clamp(36px, 7vw, 64px); margin: 0 0 16px; }
.plans { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.plan { border: 1px solid var(--line); padding: 24px; background: var(--panel); min-height: 100%; position: relative; }
.plan.vip { border-color: var(--gold-dim); background: linear-gradient(180deg, rgba(30,74,134,0.16), var(--panel) 42%); }
.plan.on { border-color: var(--ink); box-shadow: 0 0 0 1px var(--ink); }
.price { font-size: 28px; letter-spacing: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-top: 16px; }
.check input { width: auto; min-height: 0; min-width: 20px; height: 20px; margin-top: 3px; }
.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
  padding: 12px 14px;
  min-height: 44px;
  cursor: pointer;
}
footer {
  border-top: 1px solid var(--line);
  padding: 22px 0 calc(28px + env(safe-area-inset-bottom));
  color: var(--mute);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
footer .wrap { overflow-wrap: anywhere; }
.phone-only { display: none; }

.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.choice { border: 1px solid var(--line); background: var(--panel); padding: 28px; text-decoration: none; min-height: 180px; }
.choice:hover { border-color: var(--gold-dim); }
.choice h2 { margin: 0 0 8px; letter-spacing: 0; }

.studio-head { display: flex; justify-content: space-between; gap: 20px; align-items: end; margin-bottom: 16px; }
.studio-head h1 { margin: 0; font-size: clamp(28px, 4vw, 44px); line-height: 1.12; }
.split { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.gen-form {
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}
.gen-board {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "kind preview"
    "rail preview";
  min-height: 0;
  flex: 1;
}
.kind-bar {
  grid-area: kind;
  display: flex;
  gap: 6px;
  padding: 14px 16px 8px;
  align-items: center;
}
.kind-btn {
  min-height: 36px;
  padding: 8px 12px;
  border: 0;
  background: transparent;
  color: #777;
  border-radius: 0;
  cursor: pointer;
}
.kind-btn.on {
  background: transparent;
  color: #fff;
  box-shadow: inset 0 -1px 0 #fff;
}
.gen-rail {
  grid-area: rail;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  padding: 4px 16px 12px;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #1a1a1a;
}
.rail-scroll {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-bottom: 8px;
}
.rail-block { min-width: 0; }
.rail-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: none;
  color: #cfcfcf;
  margin: 0 0 8px;
  font-weight: 600;
}
.rail-hint {
  margin: 8px 0 0;
  font-size: 12px;
  color: #6d6d6d;
  line-height: 1.4;
}
.seg {
  display: flex;
  gap: 0;
  background: transparent;
  padding: 0;
  border-bottom: 1px solid #1c1c1c;
}
.seg button {
  flex: 1;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: #8a8a8a;
  border-radius: 0;
  cursor: pointer;
}
.seg button.on {
  background: transparent;
  color: #fff;
  box-shadow: inset 0 -1px 0 #fff;
}
.start-own {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  color: #bbb;
  font-size: 13px;
}
.start-drop {
  margin-top: 8px;
  min-height: 48px;
  border: 1px dashed #2a2a2a;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8a8a8a;
  cursor: pointer;
  font-size: 13px;
  padding: 10px;
}
.start-drop[hidden] { display: none; }
.start-drop.on, .start-drop:hover { border-color: #1e4a86; color: #ddd; }
.start-drop.has-file {
  border-style: solid;
  padding: 0;
  overflow: hidden;
}
.start-drop.has-file video, .start-drop.has-file img {
  width: 100%;
  height: 72px;
  object-fit: cover;
  display: block;
}
.char-row {
  display: flex;
  flex-wrap: nowrap;
  gap: 8px;
  align-items: center;
  overflow-x: auto;
}
.char-slot { position: relative; flex: 0 0 auto; }
.char-dot, .char-add {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  border: 1px solid #2a2a2a;
  background: #111 center/cover no-repeat;
  cursor: pointer;
  color: #ddd;
  padding: 0;
}
.char-dot.on { border-color: #fff; }
.char-add { font-size: 22px; line-height: 1; background: #0c0c0c; }
.char-del {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 20px;
  height: 20px;
  border: 0;
  border-radius: 50%;
  background: #1a1a1a;
  color: #ddd;
  font-size: 14px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}
.char-drop { min-height: 48px; }
.gen-rail textarea, .gen-rail select, .gen-rail .duration-custom {
  width: 100%;
  background: #0a0a0a;
  color: #f2f2f2;
  border: 1px solid #222;
  border-radius: 10px;
  padding: 12px 14px;
  min-height: 46px;
}
.gen-rail textarea { min-height: 72px; resize: vertical; }
.duration-row { align-items: center; }
.gen-rail .duration-custom { max-width: 88px; min-height: 44px; padding: 8px 10px; }
.gen-rail .chip {
  min-height: 44px;
  padding: 8px 12px;
  border-radius: 8px;
  background: #0a0a0a;
}
.gen-rail .chip.on { border-color: #fff; color: #fff; }
.rail-foot {
  flex: 0 0 auto;
  margin-top: 0;
  padding-top: 10px;
  background: #000;
}
.rail-foot .char-row { margin-bottom: 10px; }
.rail-foot .duration-row { margin-bottom: 8px; }
.rail-foot .chip { min-height: 36px; padding: 6px 9px; }
.cost-save {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.cost-pill {
  margin: 0;
  min-height: 40px;
  padding: 8px 0;
  border: 0;
  color: #ddd;
  letter-spacing: 0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  text-transform: none;
}
.cost-pill .cost-k { color: #8a8a8a; }
.cost-pill [data-cost] { color: #f2f2f2; }
button.save {
  min-height: 44px;
  padding: 10px 14px;
  background: transparent;
  color: #ddd;
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  letter-spacing: 0.02em;
  text-transform: none;
  font-weight: 600;
  cursor: pointer;
}
button.save:hover { border-color: #fff; color: #fff; }
.btn-generate {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  background: #1e4a86;
  color: #fff;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
}
.btn-generate:hover { filter: brightness(1.08); }
.gen-preview {
  grid-area: preview;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 28px 12px;
  background: #000;
}
.preview-stage {
  width: min(100%, 720px);
  height: min(72vh, 640px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.preview-media {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 16px;
  background: #050505;
  display: block;
}
.preview-empty {
  text-align: center;
  color: #8a8a8a;
  border: 1px dashed #222;
  border-radius: 16px;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.preview-empty p { margin: 0 0 8px; }
.preview-stage { position: relative; }
.preview-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.62);
  border-radius: 16px;
  z-index: 3;
}
.preview-overlay[hidden] { display: none; }
.overlay-card {
  text-align: center;
  min-width: 160px;
  padding: 20px 24px;
}
.overlay-status {
  margin: 0 0 8px;
  color: #ddd;
  font-size: 15px;
}
.overlay-pct {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: 0;
  margin-bottom: 8px;
}
.overlay-eta { margin: 4px 0 0; color: #bbb; font-size: 13px; }
.process {
  flex: 0 0 auto;
  border: 0;
  border-top: 1px solid #1a1a1a;
  background: #000;
  padding: 10px 20px 12px;
  position: relative;
  z-index: 1;
}
.process .bar-track {
  height: 36px;
  background: #0a0a0a;
  border: 1px solid #222;
  border-radius: 8px;
}
.process .bar-eta { margin: 8px 0 0; font-size: 13px; color: #8a8a8a; }
.process .bar-note:empty { display: none; }
body.page-studio {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}
body.page-studio::before { content: none; }
html:has(body.page-studio) { background: var(--bg); }
body.page-studio .top {
  min-height: 0;
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
  backdrop-filter: none;
}
body.page-studio .top-inner { min-height: 52px; width: min(100%, 1600px); }
body.page-studio .brand { letter-spacing: 0.16em; }
body.page-studio main.studio-main,
body.page-studio main.wrap {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 0;
  width: 100%;
  max-width: none;
}
body.page-studio footer { display: none; }
body.page-studio .gen-form {
  flex: 1 1 auto;
  min-height: 0;
}
body.page-studio .flash { margin: 10px 16px 0; }

body.page-feed {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
  background: var(--bg);
}
body.page-feed footer { display: none; }
body.page-feed .top {
  background: var(--chrome);
  border-bottom: 1px solid var(--line);
}
body.page-feed main.feed-main {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  max-width: none;
  padding: 0;
  position: relative;
  display: flex;
  flex-direction: column;
}
body.page-feed .flash {
  position: absolute;
  left: 16px;
  right: 16px;
  top: 12px;
  z-index: 6;
  margin: 0;
}
.feed {
  flex: 1 1 auto;
  min-height: 0;
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  scroll-snap-type: y mandatory;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  outline: none;
}
.feed-slide {
  position: relative;
  height: 100%;
  min-height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: block;
  padding: 0;
}
.feed-frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  margin: 0;
  background: #050505;
  overflow: hidden;
}
.feed-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  background: #000;
  max-width: none;
}
.feed-shade {
  position: absolute;
  inset: auto 0 0;
  height: 42%;
  background: linear-gradient(transparent, rgba(0,0,0,0.72));
  pointer-events: none;
}
.feed-meta {
  position: absolute;
  left: 16px;
  right: 88px;
  bottom: 76px;
  z-index: 2;
}
.feed-meta h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0;
}
.feed-meta p {
  margin: 0;
  color: #c8c8c8;
  font-size: 13px;
}
.feed-actions {
  position: absolute;
  right: 12px;
  bottom: 88px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}
.feed-like, .feed-sound {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border: 1px solid #2a2a2a;
  border-radius: 50%;
  background: rgba(8,8,8,0.72);
  color: #fff;
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  padding: 0;
  cursor: pointer;
}
.feed-like svg, .feed-sound svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: #fff;
  stroke-width: 1.6;
  stroke-linejoin: round;
}
.feed-like.on {
  border-color: #fff;
  background: #fff;
  color: #111;
}
.feed-like.on svg { fill: #111; stroke: #111; }
.feed-like [data-count] {
  font-size: 11px;
  line-height: 1;
  margin-top: 1px;
}
.feed-like.on [data-count] { color: #111; }
.feed-sound .ico-on { display: none; }
.feed-sound.on .ico-mute { display: none; }
.feed-sound.on .ico-on { display: block; }
.feed-create {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 16px;
  z-index: 3;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #111;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0;
  border-radius: 8px;
}
.feed-create:hover { background: #f2f2f2; }
.feed-empty {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: var(--mute);
  text-align: center;
  padding: 40px 20px;
}
.feed-empty p { margin: 0; font-size: 16px; }

.col-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--mute);
  margin: 0 0 10px;
}
.stage {
  position: relative;
  min-height: 280px;
  height: min(42vh, 380px);
  background:
    linear-gradient(180deg, rgba(212,180,106,0.04), transparent 30%),
    #080808;
  border: 1px solid var(--line);
  overflow: hidden;
}
.stage video, .stage img { width: 100%; height: 100%; object-fit: cover; display: block; min-height: 280px; }
.stage.drop {
  border-style: dashed;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--mute);
  padding: 24px;
  cursor: pointer;
}
.stage.drop.on, .stage.drop:hover { border-color: var(--gold); color: var(--gold); }
.stage.drop.has-file { padding: 0; border-style: solid; }
.placeholder { pointer-events: none; }
.placeholder .plus {
  width: 56px; height: 56px; margin: 0 auto 14px;
  border: 1px solid var(--gold-dim); color: var(--gold);
  display: flex; align-items: center; justify-content: center;
  font-size: 28px; line-height: 1;
}
.stage .tag {
  position: absolute; top: 12px; left: 12px;
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  background: rgba(0,0,0,0.55); padding: 6px 8px;
}
.controls {
  position: sticky;
  bottom: 0;
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding: 14px 0 calc(10px + env(safe-area-inset-bottom));
  background: rgba(5,5,5,0.94);
  backdrop-filter: blur(12px);
  z-index: 4;
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
}
.controls-fields { flex: 1; min-width: 0; }
.controls-go { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding-bottom: 2px; }
.controls-go .gold { margin-top: 0; min-width: 168px; }
.cost { color: var(--gold); letter-spacing: 0.06em; margin: 10px 0 0; }
.controls-go .cost { margin: 0 0 6px; text-align: right; }
.duration-custom { max-width: 220px; }
.controls textarea { min-height: 84px; resize: vertical; }

.bar-track {
  position: relative;
  height: 42px;
  background: #0a0a0a;
  border: 1px solid #2a2a2a;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, #6d5424, var(--fill));
  transition: width 0.45s ease;
}
.bar-pct {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: 0.08em;
  pointer-events: none;
}
.bar-eta { margin: 10px 0 0; color: var(--mute); }
.job-grid { display: grid; gap: 14px; }
.job-card {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  border: 1px solid #2a2a2a;
  background: var(--panel-2);
  padding: 12px;
  text-decoration: none;
}
.job-card video, .job-card .ph {
  width: 132px;
  height: 176px;
  object-fit: cover;
  background: #151515;
  display: block;
  border: 1px solid var(--line);
}
.job-body { min-width: 0; }
.job-result { width: 100%; max-height: 70vh; margin-top: 18px; display: block; }
.status {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border: 1px solid var(--line);
  padding: 6px 8px;
  color: var(--mute);
}
.status.running, .status.pending { color: var(--gold); border-color: var(--gold-dim); }
.status.done { color: var(--ok); border-color: #355335; }
.status.failed { color: var(--danger); border-color: var(--danger); }

.auth { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 28px; align-items: start; }
.auth-copy h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.15; margin: 0 0 14px; }
.auth-copy p { color: var(--mute); max-width: 420px; }

@media (max-width: 900px) {
  .plans { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
  :root { --pad: 14px; }
  .desk-only { display: none; }
  .phone-only { display: inline; }
  .top-inner {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px 12px;
    min-height: 56px;
    padding: 6px 0;
  }
  .brand { flex: 1 1 auto; order: 1; }
  .top-end { margin-left: 0; order: 2; }
  .nav-toggle { display: inline-flex; }
  .nav {
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    padding: 4px 0 10px;
    border-top: 1px solid var(--line);
    flex-basis: 100%;
    order: 3;
  }
  body.nav-open .nav { display: flex; }
  .nav a, .nav .ghost {
    min-height: var(--tap);
    width: 100%;
    justify-content: flex-start;
    padding: 12px 4px;
    font-size: 14px;
    letter-spacing: 0.06em;
    border-bottom: 1px solid var(--line);
    box-shadow: none;
  }
  .nav-logout { display: block; width: 100%; }
  .credits-nav { display: none; }
  main { padding: 22px 0 72px; }
  .hero { padding-bottom: 20px; margin-bottom: 20px; }
  .hero h1 { font-size: clamp(26px, 8vw, 32px); }
  .grid, .choices, .split, .auth, .job-card { grid-template-columns: 1fr; }
  .card:hover { transform: none; }
  .panel { padding: 22px 18px; max-width: none; }
  .studio-head { align-items: start; flex-direction: column; gap: 10px; }
  .studio-head .credits { display: none; }
  .split { gap: 18px; }
  .thumb { aspect-ratio: 4/5; }
  .stage, .stage video, .stage img {
    min-height: 220px;
    height: 38vh;
  }
  body.page-studio {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
    overflow-x: clip;
  }
  body.page-studio main.studio-main,
  body.page-studio main.wrap {
    display: flex;
    padding: 0 0 16px;
  }
  body.page-studio footer { display: none; }
  .gen-board {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "kind"
      "preview"
      "rail";
  }
  .kind-bar { padding: 12px 14px 4px; }
  .kind-btn { min-height: 48px; flex: 1; }
  .kind-bar { display: flex; }
  .gen-rail {
    border-right: 0;
    border-top: 1px solid #1a1a1a;
    padding: 16px 14px 18px;
    overflow: visible;
  }
  .rail-scroll { overflow: visible; flex: none; }
  .gen-preview { padding: 8px 14px 12px; }
  .preview-stage {
    width: 100%;
    height: 42vh;
    min-height: 220px;
  }
  .start-drop, .char-add, .char-dot, .seg button, .btn-generate, button.save, .chip,
  .rail-foot .chip, .kind-btn {
    min-height: 48px;
  }
  .char-del { width: 24px; height: 24px; }
  .char-dot, .char-add { width: 48px; }
  .gen-form { min-height: 0; display: flex; flex-direction: column; }
  .process { position: static; padding: 12px 14px 16px; }
  .cost-save { flex-wrap: wrap; }
  .cost-pill, button.save { justify-content: center; }
  button.save { flex: 1; }
  .gen-rail .duration-custom { max-width: none; }
  .controls {
    position: static;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .controls-go { align-items: stretch; }
  .controls-go .cost { text-align: left; }
  .controls-go .gold, button.gold, a.gold { width: 100%; min-width: 0; }
  .duration-custom { max-width: none; }
  .chip { flex: 1 1 calc(33.33% - 8px); justify-content: center; display: inline-flex; align-items: center; }
  .bar-track { height: 48px; }
  .bar-pct { font-size: 16px; }
  .job-card { padding: 0 0 14px; gap: 0; }
  .job-card video, .job-card .ph {
    width: 100%;
    height: 200px;
    border: 0;
    border-bottom: 1px solid var(--line);
  }
  .job-body { padding: 14px 14px 0; }
  .choice { min-height: 0; padding: 22px 18px; }
  body.page-feed {
    height: 100dvh;
    overflow: hidden;
  }
  body.page-feed main.feed-main { padding: 0; }
  .feed-slide {
    padding: 0;
    display: block;
    position: relative;
    height: 100%;
    min-height: 100%;
  }
  .feed-frame {
    position: absolute;
    inset: 0;
    max-width: none;
    width: 100%;
    height: 100%;
    aspect-ratio: unset;
    border-radius: 0;
  }
  .feed-video {
    position: absolute;
    inset: 0;
    max-width: none;
  }
  .feed-create, .feed-like, .feed-sound { min-height: 48px; }
}

.theme-toggle {
  min-height: 36px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--mute);
  cursor: pointer;
  font-size: 13px;
}
.theme-toggle:hover { color: var(--ink); }
.feed-tabs {
  position: absolute;
  top: 10px;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  justify-content: center;
  gap: 8px;
  pointer-events: none;
}
.feed-tabs a {
  pointer-events: auto;
  min-height: 36px;
  padding: 6px 14px;
  color: var(--mute);
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.feed-tabs a.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--ink); }
.feed-creator-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  flex-wrap: wrap;
}
.feed-creator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-size: 14px;
  font-weight: 600;
}
.feed-avatar, .profile-avatar, .avatar-preview {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #222 center/cover no-repeat;
  flex: 0 0 auto;
  display: inline-block;
}
.feed-avatar.ph, .profile-avatar.ph, .avatar-preview.ph {
  background: #1a1a1a;
  box-shadow: inset 0 0 0 1px var(--line);
}
.feed-follow, .follow-btn {
  min-height: 32px;
  padding: 4px 12px;
  margin: 0;
  border: 1px solid #fff;
  background: #fff;
  color: #111;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
}
.follow-btn { margin: 0 0 10px; }
.feed-follow.on, .follow-btn.on {
  background: transparent;
  color: #fff;
  border-color: rgba(255,255,255,0.45);
}
.profile { padding-bottom: 40px; }
.profile-head {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 24px;
  align-items: start;
  padding: 8px 0 28px;
  border-bottom: 1px solid var(--line);
}
.profile-avatar { width: 120px; height: 120px; }
.profile-copy h1 { margin: 0 0 4px; font-size: 28px; }
.profile-copy .handle { margin: 0 0 10px; color: var(--mute); }
.profile-copy .bio { margin: 0 0 12px; max-width: 520px; }
.profile-stats { display: flex; gap: 18px; margin: 0 0 10px; }
.profile-stats a { text-decoration: none; }
.profile-section { margin: 28px 0 14px; font-size: 16px; }
.profile-edit .panel { margin: 0 0 16px; }
.profile-grid .thumb { aspect-ratio: 9/16; }
.avatar-preview { width: 96px; height: 96px; margin: 12px 0; }
.people-list { display: grid; gap: 8px; }
.people-row {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 8px 0;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.library {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}
.library-card {
  text-decoration: none;
  background: var(--panel);
  border: 1px solid var(--line);
  overflow: hidden;
  transition: border-color 0.2s ease;
}
.library-card:hover { border-color: var(--gold-dim); }
.library-thumb { aspect-ratio: 9/16; background: var(--panel-2); }
.library-thumb video, .library-thumb .ph {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.library-meta { padding: 12px 14px 16px; }
.library-date { margin: 0 0 6px; font-weight: 600; }
.library-empty {
  text-align: center;
  padding: 64px 16px;
  color: var(--mute);
}
.library-empty .gold { margin-top: 16px; }
.plan-now { margin: 0 0 8px; font-size: 12px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--mute); }
.plan-features { margin: 16px 0 0; padding: 0; list-style: none; }
.plan-features li {
  padding: 8px 0;
  border-top: 1px solid var(--line);
  color: var(--ink);
  font-size: 14px;
}

html[data-theme="light"] body.page-feed,
html[data-theme="light"] body.page-studio {
  background: var(--bg);
}
html[data-theme="light"] body.page-feed .top,
html[data-theme="light"] body.page-studio .top {
  background: var(--bg);
  border-bottom-color: var(--line);
}
html[data-theme="light"] .feed-frame { background: #ddd; }
html[data-theme="light"] .feed-create { background: #111; color: #fff; }
html[data-theme="light"] .feed-like,
html[data-theme="light"] .feed-sound {
  background: rgba(255,255,255,0.86);
  color: #111;
  border-color: #ddd;
}
html[data-theme="light"] .feed-like svg,
html[data-theme="light"] .feed-sound svg { stroke: #111; }
html[data-theme="light"] .feed-like.on { background: #111; color: #fff; }
html[data-theme="light"] .feed-like.on svg { fill: #fff; stroke: #fff; }
html[data-theme="light"] .feed-follow,
html[data-theme="light"] .follow-btn { background: #111; color: #fff; border-color: #111; }
html[data-theme="light"] .feed-follow.on,
html[data-theme="light"] .follow-btn.on { background: transparent; color: #111; }
html[data-theme="light"] .gen-rail,
html[data-theme="light"] .preview-stage,
html[data-theme="light"] .kind-bar {
  background: var(--panel);
  border-color: var(--line);
}
html[data-theme="light"] .btn-generate { background: var(--fill); color: #fff; }
html[data-theme="light"] .feed-avatar.ph,
html[data-theme="light"] .profile-avatar.ph,
html[data-theme="light"] .avatar-preview.ph {
  background: #e6e6ea;
}
html[data-theme="light"] .bar-track { background: #ececee; border-color: var(--line); }

.home-options {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 20px;
}
.home-options.admin-i2i {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  max-width: 720px;
}
.home-option {
  background: var(--panel);
  border: 1px solid var(--line);
  text-decoration: none;
  display: block;
  overflow: hidden;
  min-width: 0;
}
.home-option.is-soon {
  opacity: 0.7;
  pointer-events: none;
}
.home-option:hover { border-color: var(--gold-dim); }
.home-option.is-soon:hover { border-color: var(--line); }
.home-frame {
  aspect-ratio: 3 / 4;
  background: var(--panel-2);
  overflow: hidden;
  position: relative;
  border-bottom: 1px solid var(--line);
}
.home-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.home-ph {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--mute);
  font-size: 13px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background:
    linear-gradient(var(--panel-2), var(--panel-2)) padding-box,
    repeating-linear-gradient(-45deg, transparent, transparent 10px, rgba(255,255,255,0.03) 10px, rgba(255,255,255,0.03) 11px);
}
.home-meta { padding: 16px 16px 18px; }
.home-kicker {
  margin: 0 0 6px;
  color: var(--mute);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.home-meta h2 { margin: 0; font-size: 18px; font-weight: 600; }

.i2i-board {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.i2i-col {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 18px;
  min-width: 0;
}
.i2i-still {
  aspect-ratio: 3 / 4;
  max-height: 220px;
  background: var(--panel-2);
  overflow: hidden;
  margin-bottom: 12px;
  border: 1px solid var(--line);
}
.i2i-still img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.i2i-drop,
.i2i-col .drop {
  position: relative;
  margin-top: 8px;
  min-height: 280px;
  height: auto;
  aspect-ratio: 3 / 4;
  border: 1px dashed var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  overflow: hidden;
}
.i2i-drop.on,
.i2i-col .drop.on,
.i2i-drop:hover,
.i2i-col .drop:hover {
  border-color: var(--gold-dim, #1e4a86);
}
.i2i-drop.has-file,
.i2i-col .drop.has-file {
  border-style: solid;
  padding: 0;
}
.i2i-drop img,
.i2i-drop video,
.i2i-col .start-drop.has-file img,
.i2i-col .start-drop.has-file video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.i2i-drop .tag {
  position: absolute;
  left: 10px;
  bottom: 10px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.62);
  color: #fff;
  font-size: 12px;
}
#head-photo,
#i2i-head [name="photo"],
#i2i-original [name="original"] {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.gallery-still {
  display: block;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.gallery-still img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.gallery-still.is-wait {
  display: flex;
  align-items: center;
  justify-content: center;
}
.gallery-bar-track {
  width: 42%;
  max-width: 88px;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
.gallery-bar-fill {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: #1e4a86;
  transition: width 0.4s ease;
}
.gallery-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 56px 20px 20px;
  background: #000;
}
.gallery-modal[hidden] { display: none; }
.gallery-modal img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}
.gallery-modal-x {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 40px;
  height: 40px;
  border: 0;
  background: transparent;
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}
body.gallery-modal-on { overflow: hidden; }
body.gallery-modal-on .nh-side,
body.gallery-modal-on .nh-shell { visibility: hidden; }
.i2i-actions {
  margin-top: 22px;
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 18px;
}
.i2i-actions .cost-pill { margin: 16px 0; }
.i2i-actions .btn-generate { width: 100%; min-height: 48px; }

@media (max-width: 800px) {
  .home-options,
  .home-options.admin-i2i,
  .i2i-board {
    grid-template-columns: 1fr;
  }
  .profile-head { grid-template-columns: 72px minmax(0, 1fr); gap: 14px; }
  .profile-avatar { width: 72px; height: 72px; }
  .library,
  .gallery-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .i2i-drop,
  .i2i-col .drop { min-height: 220px; }
  .theme-toggle { min-height: 40px; }
}
