:root {
  color-scheme: dark;
  --app-width: 470px;
  --page: #0c0848;
  --page-deep: #070426;
  --paper: rgba(33, 27, 88, .66);
  --paper-solid: #181242;
  --glass: rgba(255, 255, 255, .06);
  --glass-strong: rgba(255, 255, 255, .11);
  --ink: #f5f2ff;
  --ink-soft: #ece8ff;
  --muted: #d2cdf6;
  --border: rgba(160, 138, 255, .24);
  --border-strong: rgba(185, 160, 255, .48);
  --violet: #8c5cff;
  --violet-bright: #b794ff;
  --violet-dark: #cdb8ff;
  --violet-soft: rgba(140, 92, 255, .2);
  --blue: #4f7dff;
  --success: #62e08f;
  --danger: #ff8fa8;
  --gradient: linear-gradient(100deg, #9150ff, #6b2df5 52%, #5a2ee6);
  --glow: 0 0 22px rgba(124, 70, 255, .5), 0 6px 18px rgba(60, 20, 170, .45);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "PingFang SC", "Microsoft YaHei UI", "Microsoft YaHei", "Noto Sans CJK SC", system-ui, sans-serif;
  background: var(--page-deep);
  color: var(--ink);
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; min-width: 300px; min-height: 100dvh; background: var(--page-deep); }
h1, h2, p, dl, dd { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button, a, select, summary { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
img { display: block; max-width: 100%; }
button:disabled { opacity: .7; cursor: default; }
:focus-visible { outline: 2px solid var(--violet-bright); outline-offset: 2px; }
::selection { background: rgba(140, 92, 255, .55); }

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  clip-path: inset(50%);
  overflow: hidden;
  white-space: nowrap;
}

.icon { display: block; width: 20px; height: 20px; flex: 0 0 auto; }
.shell { position: relative; min-height: 100dvh; width: min(100%, var(--app-width)); margin: 0 auto; background: var(--page); isolation: isolate; }
.shell::before {
  content: '';
  position: fixed;
  z-index: -1;
  top: 0;
  left: 50%;
  width: min(100%, var(--app-width));
  height: 100dvh;
  transform: translateX(-50%);
  background: var(--page) url(/art/backdrop.webp) center top / 100% auto no-repeat;
  opacity: .5;
  pointer-events: none;
}
.shell.is-create::before { opacity: 1; }
.shell.has-nav { --nav-height: 68px; }
.shell.has-action { --action-height: 78px; }
main {
  padding: 8px 16px calc(24px + var(--nav-height, 0px) + var(--action-height, 0px) + var(--safe-bottom));
  outline: none;
}

.app-header {
  position: sticky;
  z-index: 4;
  top: 0;
  min-height: calc(70px + env(safe-area-inset-top, 0px));
  padding: calc(10px + env(safe-area-inset-top, 0px)) 16px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.app-header:not(.inner-header):has(> h1) { justify-content: center; }
.app-header:not(.inner-header) {
  background: linear-gradient(rgba(12, 8, 72, .92), rgba(12, 8, 72, .55) 70%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.app-header.inner-header {
  display: grid;
  min-height: calc(58px + env(safe-area-inset-top, 0px));
  grid-template-columns: 42px minmax(0, 1fr) 42px;
  gap: 3px;
  padding-right: 10px;
  padding-left: 10px;
  background: linear-gradient(rgba(12, 8, 72, .94), rgba(12, 8, 72, .78));
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}
.app-header h1 {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  font-size: 19px;
  font-weight: 780;
  white-space: nowrap;
}
.identity { display: block; min-width: 0; line-height: 0; }
.brand-mark { position: relative; display: block; }
.brand-img { height: 54px; width: auto; max-width: none; }
.brand-sub { position: absolute; left: 26.5%; top: 69%; color: #fff; font-size: 10.5px; font-weight: 500; letter-spacing: .1em; white-space: nowrap; text-shadow: 0 1px 6px rgba(7, 4, 38, .9); }
.store-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 44%;
  min-height: 42px;
  padding: 5px 11px;
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 680;
}
.store-switch span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.store-switch .icon { width: 17px; height: 17px; }
.store-switch .icon:last-child { width: 13px; height: 13px; }
.header-action, .icon-button {
  display: inline-grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 0;
  border-radius: 12px;
  background: transparent;
}
.header-action:hover, .icon-button:hover { background: var(--violet-soft); }
.header-action .icon { width: 23px; height: 23px; }
.success-mark { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #07210f; background: var(--success); }
.success-mark .icon { width: 15px; height: 15px; stroke-width: 2.6; }

.create-stack, .create-form, .screen-stack { display: grid; gap: 15px; min-width: 0; }
.card {
  min-width: 0;
  background: linear-gradient(160deg, rgba(48, 38, 118, .62), rgba(24, 19, 66, .7));
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 14px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 10px 28px rgba(3, 2, 30, .35);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.card-heading { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
h2 { font-size: 17px; line-height: 1.36; font-weight: 780; }
.card-heading h2 { min-width: 0; overflow-wrap: anywhere; }
.hint { color: var(--muted); font-size: 13px; line-height: 1.55; text-shadow: 0 1px 6px rgba(7, 4, 38, .9); }

/* 创作页首屏：大标题与三个卖点，右侧留给背景里的 AI 场记板 */
.hero { display: grid; gap: 14px; padding: 6px 0 2px; min-height: 168px; align-content: start; }
.hero-title {
  display: grid;
  gap: 2px;
  max-width: 62%;
  font-size: clamp(25px, 7.2vw, 32px);
  font-style: italic;
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: .01em;
  background: linear-gradient(180deg, #fff 18%, #cfc0ff 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 4px 14px rgba(110, 60, 255, .55));
}
.hero-title span:last-child { position: relative; padding-bottom: 9px; }
.hero-title span:last-child::after {
  content: '';
  position: absolute;
  left: 4px;
  bottom: 0;
  width: 88%;
  height: 3px;
  border-radius: 3px;
  background: linear-gradient(90deg, #b077ff, rgba(176, 119, 255, 0));
}
.hero-points { display: flex; flex-wrap: nowrap; gap: 6px 10px; text-shadow: 0 1px 6px rgba(7, 4, 38, .9); margin: 0; padding: 0; list-style: none; }
.hero-points li { display: flex; align-items: center; gap: 5px; color: var(--ink-soft); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.hero-points .icon { width: 17px; height: 17px; color: var(--violet-bright); }

.create-summary {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 66px;
  padding: 10px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  background: linear-gradient(105deg, rgba(60, 46, 150, .6), rgba(30, 24, 84, .68));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .1);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
.create-summary-icon { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; color: white; background: linear-gradient(136deg, #a780ff, #6c2eef); box-shadow: 0 0 16px rgba(130, 80, 255, .6); }
.create-summary-icon .icon { width: 19px; height: 19px; }
.create-summary dl { display: grid; grid-template-columns: 1.2fr 1fr .8fr; min-width: 0; }
.create-summary dl > div { min-width: 0; padding-left: 12px; }
.create-summary dl > div:first-child { padding-left: 0; }
.create-summary dl > div + div { border-left: 1px solid var(--border); }
.create-summary dt { color: var(--muted); font-size: 13px; line-height: 1.3; }
.create-summary dd { margin-top: 3px; color: var(--ink); font-size: 16px; line-height: 1.3; font-weight: 800; overflow-wrap: anywhere; }

.mode-switch {
  display: grid;
  grid-template-columns: 1.23fr 1fr 1fr;
  padding: 4px;
  gap: 2px;
  background: rgba(18, 14, 62, .72);
  border: 1px solid var(--border);
  border-radius: 16px;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
}
.mode-switch button {
  display: flex;
  min-width: 0;
  min-height: 44px;
  gap: 6px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 12px;
  padding: 4px 2px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 740;
  white-space: nowrap;
}
.mode-switch .icon { width: 18px; height: 18px; }
.mode-switch button[aria-pressed="true"] { background: var(--gradient); color: #fff; box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .28); }

.text-button {
  display: inline-flex;
  gap: 4px;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  min-height: 36px;
  border: 0;
  background: transparent;
  padding: 5px 1px;
  color: var(--violet-dark);
  font-size: 12.5px;
  font-weight: 710;
  white-space: nowrap;
}
.text-button .icon { width: 15px; height: 15px; }
.text-button.subdued { color: var(--ink-soft); font-weight: 600; }

/* 分区标题：左侧斜向紫色标记 */
.media-card h2, .direction-section h2, .create-specs h2 { display: flex; align-items: center; gap: 8px; }
.media-card h2::before, .direction-section h2::before {
  content: '';
  width: 5px;
  height: 19px;
  border-radius: 3px;
  background: linear-gradient(180deg, #c7a4ff, #7b3cf2);
  transform: skewX(-14deg);
  box-shadow: 0 0 10px rgba(150, 100, 255, .7);
}
.create-specs h2 .icon { width: 18px; height: 18px; color: var(--violet-bright); }

.card.media-card { padding: 0; border: 0; background: none; box-shadow: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
.media-card .card-heading { min-height: 33px; margin-bottom: 9px; }
.media-card .hint { margin-top: 10px; }
.capture-options { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.capture-tile {
  position: relative;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  flex-direction: column;
  min-height: 132px;
  padding: 14px;
  gap: 3px;
  overflow: hidden;
  border: 1px solid rgba(175, 150, 255, .5);
  border-radius: 18px;
  background: linear-gradient(135deg, #5a2fd6, #3a1fa0 62%, #2c1a86);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 10px 24px rgba(40, 14, 130, .45);
  text-align: left;
}
.capture-tile:last-child { border-color: rgba(120, 160, 255, .5); background: linear-gradient(135deg, #2e57d8, #223f9e 62%, #1d2f78); }
.capture-tile::after {
  content: '';
  position: absolute;
  right: 0;
  bottom: 0;
  width: 58%;
  height: 100%;
  background: var(--art) right center / contain no-repeat;
  -webkit-mask-image: radial-gradient(ellipse 62% 58% at 58% 50%, #000 52%, transparent 100%);
  mask-image: radial-gradient(ellipse 62% 58% at 58% 50%, #000 52%, transparent 100%);
  pointer-events: none;
}
.capture-tile:first-child { --art: url(/art/camera.webp); }
.capture-tile:last-child { --art: url(/art/gallery.webp); }
.capture-tile > span { position: absolute; top: 14px; left: 14px; display: grid; place-items: center; width: 34px; height: 34px; color: #fff; }
.capture-tile .icon { width: 30px; height: 30px; stroke-width: 1.7; }
.capture-tile strong { position: relative; z-index: 1; font-size: 18px; font-weight: 800; }
.capture-tile small { position: relative; z-index: 1; color: rgba(225, 218, 255, .95); font-size: 13px; }
.asset-strip { display: flex; overflow-x: auto; gap: 8px; padding: 1px 0 5px; scrollbar-width: thin; }
.asset-tile, .add-tile { position: relative; flex: 0 0 calc((100% - 24px) / 4); min-width: 70px; aspect-ratio: .75; border-radius: 12px; overflow: hidden; }
.asset-tile { background: var(--paper-solid); border: 1px solid var(--border); }
.asset-tile img { width: 100%; height: 100%; object-fit: cover; }
.remove-asset {
  display: grid;
  place-items: center;
  position: absolute;
  top: 0;
  right: 0;
  width: 37px;
  height: 37px;
  padding: 0;
  border: 0;
  background: radial-gradient(circle, #05031ecc 0 10px, transparent 11px);
  color: white;
}
.remove-asset .icon { width: 12px; height: 12px; stroke-width: 2.5; }
.asset-duration {
  position: absolute;
  left: 4px;
  bottom: 4px;
  display: flex;
  align-items: center;
  gap: 2px;
  color: white;
  background: #05031ecc;
  padding: 2px 5px;
  border-radius: 5px;
  font-size: 10px;
}
.asset-duration .icon { width: 12px; height: 12px; }
.add-tile { display: grid; place-content: center; justify-items: center; gap: 4px; border: 1px dashed var(--border-strong); background: var(--glass); font-size: 11px; color: var(--ink-soft); }
.add-tile .icon { width: 22px; height: 22px; }
.asset-symbol { margin: auto; height: 100%; }

textarea, select, input:not([type="checkbox"]) {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(12, 8, 52, .72);
  padding: 11px 12px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.45;
}
textarea:focus, input:focus, select:focus { outline: 0; border-color: var(--violet-bright); box-shadow: 0 0 0 3px rgba(140, 92, 255, .28); }
textarea { display: block; resize: vertical; min-height: 48px; }
textarea::placeholder, input::placeholder { color: #8f88c0; opacity: 1; }
select option { background: #181242; color: var(--ink); }
.brief-field { position: relative; display: block; }
.brief-field textarea {
  min-height: 108px;
  padding: 14px 14px 30px 46px;
  border-color: var(--border-strong);
  border-radius: 18px;
  background: linear-gradient(160deg, rgba(40, 32, 104, .62), rgba(20, 16, 58, .72));
}
.brief-pen { position: absolute; top: 15px; left: 14px; width: 22px; height: 22px; color: var(--violet-bright); pointer-events: none; }
.brief-count { position: absolute; right: 16px; bottom: 9px; color: var(--muted); font-size: 13px; pointer-events: none; font-variant-numeric: tabular-nums; }
.track-pill { display: flex; align-items: center; gap: 9px; padding: 2px 9px 2px 12px; border-radius: 12px; background: var(--violet-soft); border: 1px solid var(--border); font-size: 13px; color: var(--ink-soft); }
.track-pill span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.track-pill .icon-button { margin-left: auto; }
.direction-section { padding: 0 1px; }
.direction-section .card-heading { margin-bottom: 8px; }
.direction-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.direction-grid button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  min-width: 0;
  min-height: 70px;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(48, 38, 118, .5), rgba(22, 18, 62, .6));
  padding: 6px 2px;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 720;
  white-space: nowrap;
}
.direction-grid button[aria-pressed="true"] {
  border-color: rgba(220, 200, 255, .85);
  color: #fff;
  background: linear-gradient(160deg, #9456ff, #5e2ae0);
  box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.direction-grid .icon { width: 23px; height: 23px; }

.dock {
  position: fixed;
  inset: auto auto 0 50%;
  transform: translateX(-50%);
  width: min(100%, var(--app-width));
  z-index: 5;
  padding-bottom: var(--safe-bottom);
  background: linear-gradient(180deg, rgba(7, 4, 38, 0), rgba(7, 4, 38, .88) 26%);
}
.dock-action { display: grid; padding: 12px 16px 10px; }
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--glass-strong);
  color: var(--ink);
  gap: 7px;
  font-size: 14px;
  font-weight: 720;
  line-height: 1.35;
  text-align: center;
}
.button:hover:not(:disabled) { background: rgba(255, 255, 255, .16); }
.button.primary {
  position: relative;
  min-height: 52px;
  background: var(--gradient);
  box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .32);
  border-color: rgba(205, 180, 255, .7);
  color: white;
  font-size: 17px;
  font-weight: 800;
}
.dock-action .button.primary { min-height: 58px; border-radius: 30px; font-size: 20px; letter-spacing: .04em; }
.dock-action .button.primary .icon { width: 22px; height: 22px; }
.cta-play { position: absolute; right: 10px; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, .22); border: 1px solid rgba(255, 255, 255, .5); }
.cta-play .icon { width: 18px !important; height: 18px !important; margin-left: 2px; }
.button.primary:hover:not(:disabled) { background: linear-gradient(100deg, #9a5cff, #7437ff 52%, #6233f0); }
.button.outline { border-color: var(--border-strong); background: rgba(255, 255, 255, .05); }
.button.outline:hover, .button.soft:hover { background: var(--violet-soft); }
.button.soft { border-color: var(--border); background: var(--glass); }
.button .icon { width: 18px; height: 18px; }
.tab-bar {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  min-height: 64px;
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: rgba(14, 10, 56, .9);
  box-shadow: 0 -10px 30px rgba(60, 30, 180, .2);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}
.tab-bar a { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; color: var(--muted); font-size: 12.5px; }
.tab-bar .icon { width: 24px; height: 24px; }
.tab-bar a[aria-current="page"] { color: #fff; font-weight: 800; }
.tab-bar a[aria-current="page"] .icon { stroke-width: 2.2; color: var(--violet-bright); filter: drop-shadow(0 0 8px rgba(160, 110, 255, .9)); }
.tab-bar a[aria-current="page"]::after { content: ''; position: absolute; bottom: 5px; width: 34px; height: 3px; border-radius: 3px; background: linear-gradient(90deg, transparent, #b58cff, transparent); box-shadow: 0 0 10px #9c6bff; }

.story-card .card-heading { margin-bottom: 2px; }
.story-question { font-size: 13px; color: var(--ink-soft); margin: 0 0 11px; line-height: 1.5; }
.story-board { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; align-items: center; }
.story-cover, .progress-cover {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  aspect-ratio: 9 / 14;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(146deg, #4d2fb8, #35208c 64%, #241667);
}
.story-cover img, .progress-cover img { width: 100%; height: 100%; object-fit: cover; }
.cover-art { display: grid; gap: 9px; place-content: center; justify-items: center; padding: 12px; height: 100%; color: #e6dcff; text-align: center; }
.cover-art .icon { width: 42px; height: 42px; stroke-width: 1.3; }
.cover-art strong { font-size: 17px; line-height: 1.27; overflow-wrap: anywhere; }
.frame-tag, .ratio-tag {
  position: absolute;
  left: 7px;
  display: flex;
  align-items: center;
  gap: 4px;
  width: max-content;
  max-width: calc(100% - 14px);
  padding: 4px 7px;
  border-radius: 6px;
  background: rgba(12, 8, 52, .78);
  border: 1px solid var(--border);
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 750;
}
.frame-tag { top: 7px; }
.ratio-tag { bottom: 7px; }
.has-image .frame-tag, .has-image .ratio-tag { background: rgba(5, 3, 30, .75); color: white; }
.frame-tag .icon { width: 13px; height: 13px; }
.shot-list { display: grid; gap: 8px; }
.shot-list button { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 58px; border: 1px solid var(--border); border-radius: 13px; background: var(--glass); text-align: left; padding: 5px; }
.shot-list button[aria-pressed="true"] { background: var(--violet-soft); border-color: var(--border-strong); box-shadow: 0 0 14px rgba(130, 80, 255, .3); }
.shot-list small, .shot-list strong { display: block; font-size: 12px; line-height: 1.4; }
.shot-list small { color: var(--muted); font-variant-numeric: tabular-nums; }
.shot-list strong { overflow-wrap: anywhere; }
.shot-thumb { display: grid; flex: none; width: 40px; height: 44px; place-items: center; overflow: hidden; border-radius: 8px; background: rgba(140, 92, 255, .25); color: var(--violet-dark); }
.shot-thumb img { width: 100%; height: 100%; object-fit: cover; }
.shot-thumb .icon { width: 18px; height: 18px; }
.shot-note { margin-top: 10px; font-size: 13px; color: var(--ink-soft); line-height: 1.55; }
.script-card { display: grid; gap: 10px; }
.script-card .card-heading { margin-bottom: 0; }
.script-contrast { color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.script-beats { display: grid; gap: 8px; }
.script-beats button { display: grid; grid-template-columns: 42px minmax(0, 1fr); gap: 9px; width: 100%; min-width: 0; padding: 10px; border: 1px solid var(--border); border-radius: 13px; background: var(--glass); text-align: left; }
.script-beats button[aria-pressed="true"] { background: var(--violet-soft); border-color: var(--border-strong); box-shadow: 0 0 14px rgba(130, 80, 255, .3); }
.script-beat-thumb { display: grid; place-items: center; width: 42px; height: 48px; border-radius: 9px; overflow: hidden; background: rgba(140, 92, 255, .25); color: var(--violet-dark); }
.script-beat-thumb img { width: 100%; height: 100%; object-fit: cover; }
.script-beat-body { display: grid; gap: 3px; min-width: 0; }
.script-beat-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px 8px; font-size: 12px; line-height: 1.4; }
.script-beat-meta > span, .script-beat-scene { color: var(--muted); }
.script-beat-scene { font-size: 12px; overflow-wrap: anywhere; }
.script-beat-action { font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
.script-beat-audio { display: flex; gap: 4px; align-items: flex-start; color: var(--muted); font-size: 13px; line-height: 1.4; }
.script-beat-audio .icon { width: 14px; height: 14px; }
.script-beat-detail { margin-top: 0; }
.script-acceptance { display: grid; gap: 7px; }
.script-acceptance p, .script-change p { color: var(--ink-soft); font-size: 13px; line-height: 1.5; }
.script-change { display: grid; gap: 5px; }
.story-beats { display: grid; gap: 8px; list-style: none; padding: 0; margin: 12px 0; }
.story-beats li { display: grid; grid-template-columns: 62px 1fr; gap: 8px; font-size: 13px; line-height: 1.55; color: var(--ink-soft); }
.story-beats small { color: var(--violet-bright); font-weight: 700; }
.plan-error { color: var(--danger); }

.quote-card h2 { margin-bottom: 4px; }
.quote-meta { color: var(--ink-soft); font-size: 13px; margin-bottom: 10px; }
.res-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 8px; margin-bottom: 6px; }
.res-options button { display: flex; gap: 7px; align-items: center; min-height: 44px; padding: 4px 10px; border: 1px solid var(--border); border-radius: 12px; background: var(--glass); color: var(--ink-soft); font-size: 14px; font-weight: 750; }
.res-options button[aria-pressed="true"] { border-color: var(--border-strong); background: var(--gradient); color: #fff; box-shadow: var(--glow); }
.res-options button:disabled { opacity: .65; color: var(--muted); background: var(--glass); cursor: default; box-shadow: none; }
.create-specs { display: grid; grid-template-columns: 1.15fr 1fr; gap: 0; padding-inline: 1px; }
.create-specs > div:first-child { padding-right: 14px; border-right: 1px solid var(--border); }
.create-specs > div:last-child { padding-left: 14px; }
.create-specs h2 { margin-bottom: 8px; font-size: 14.5px; }
.create-specs .res-options {
  grid-template-columns: none;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 2px;
  margin: 0;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(18, 14, 62, .72);
}
.create-specs .res-options button { justify-content: center; min-height: 42px; padding-inline: 3px; border: 0; border-radius: 12px; background: transparent; white-space: nowrap; }
.create-specs .res-options button[aria-pressed="true"] { background: var(--gradient); box-shadow: var(--glow), inset 0 1px 0 rgba(255, 255, 255, .25); }
.resolution-help { display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; }
.resolution-help .text-button { min-height: 24px; padding-block: 1px; }
.radio-mark { display: grid; width: 16px; height: 16px; border: 1px solid var(--muted); border-radius: 50%; place-items: center; }
[aria-pressed="true"] .radio-mark { background: #fff; border-color: #fff; color: var(--violet); }
.radio-mark .icon { width: 12px; height: 12px; stroke-width: 2.5; }
.quote-details div, .quote-total { display: flex; justify-content: space-between; align-items: center; gap: 10px; min-height: 34px; font-size: 13px; }
.quote-details dd { font-weight: 720; white-space: nowrap; }
.quote-total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; font-size: 14px; font-weight: 800; }
.quote-total strong { color: var(--violet-dark); font-size: 24px; white-space: nowrap; text-shadow: 0 0 16px rgba(150, 100, 255, .6); }
.quote-total small { font-size: 12px; }

.progress-screen { gap: 12px; }
.progress-cover { width: min(68%, 235px); justify-self: center; max-height: 302px; aspect-ratio: 9 / 13; box-shadow: 0 0 36px rgba(110, 60, 255, .45); }
.progress-title h2 { font-size: 20px; }
.progress-title p { margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.5; }
.stage-list { display: grid; margin: 0; padding: 2px 11px; list-style: none; }
.stage-list li { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 8px; align-items: center; min-height: 42px; border-bottom: 1px solid var(--border); font-size: 13px; }
.stage-list li:last-child { border-bottom: 0; }
.stage-mark { display: grid; width: 17px; height: 17px; border: 1px solid var(--muted); border-radius: 50%; place-items: center; }
.stage-mark .icon { width: 12px; height: 12px; stroke-width: 2.5; }
.stage-list .complete .stage-mark { color: #07210f; background: var(--success); border-color: var(--success); }
.stage-list .complete small { color: var(--success); }
.stage-list .current .stage-mark { border: 0; }
.stage-list small { color: var(--muted); font-size: 13px; }
.spinner { display: inline-block; vertical-align: middle; width: 17px; height: 17px; border: 2px solid rgba(180, 150, 255, .3); border-bottom-color: var(--violet-bright); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.progress-tip { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.progress-tip .icon { width: 16px; height: 16px; }
.progress-cost { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; border-radius: 12px; background: var(--violet-soft); border: 1px solid var(--border); font-size: 13px; }
.progress-cost strong { color: var(--violet-dark); font-size: 15px; }

.done-screen { gap: 10px; }
.result-video { position: relative; background: #05031c; border-radius: 16px; border: 1px solid var(--border); overflow: hidden; isolation: isolate; box-shadow: 0 0 36px rgba(110, 60, 255, .35); }
.result-video video { display: block; width: 100%; height: clamp(245px, 49svh, 415px); object-fit: contain; background: #05031c; }
.result-store, .result-mode { position: absolute; top: 9px; pointer-events: none; color: white; background: rgba(5, 3, 30, .72); padding: 4px 8px; border-radius: 8px; }
.result-store { left: 9px; max-width: 65%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; font-weight: 800; }
.result-mode { right: 9px; font-size: 10px; }
.result-meta { color: var(--muted); font-size: 13px; }
.edit-area { display: grid; gap: 8px; }
.edit-area textarea { background: rgba(12, 8, 52, .72); }
.edit-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.edit-actions .button { font-size: 13px; }
.finish-actions { display: grid; gap: 8px; margin-top: 3px; }
.finish-actions .redo { display: flex; flex-direction: column; gap: 1px; padding: 8px; }
.redo strong { font-size: 16px; }
.redo small { color: var(--muted); font-weight: 500; font-size: 12px; }
.download-shots, .feedback-row { display: flex; flex-wrap: wrap; gap: 6px; }
.feedback-row .button[aria-pressed="true"] { border-color: var(--border-strong); background: var(--violet-soft); color: #fff; }

.work-list { padding-block: 2px; }
.work-entry { display: grid; grid-template-columns: 48px minmax(0, 1fr) auto 13px; gap: 11px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.work-entry:last-child { border-bottom: 0; }
.work-thumb { display: grid; place-items: center; width: 48px; height: 58px; overflow: hidden; border-radius: 10px; background: var(--violet-soft); border: 1px solid var(--border); color: var(--violet-dark); }
.work-thumb img { width: 100%; height: 100%; object-fit: cover; }
.work-info strong, .work-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.work-info strong { font-size: 14.5px; }
.work-info small, .work-status { color: var(--muted); font-size: 12px; }
.work-status { border-radius: 20px; padding: 4px 9px; background: var(--violet-soft); border: 1px solid var(--border); color: var(--violet-dark); }
.work-entry > .icon { width: 13px; color: var(--muted); }
.empty-state { display: grid; justify-items: start; gap: 10px; padding: 24px 18px; }
.empty-state > .icon { color: var(--violet-bright); width: 28px; height: 28px; filter: drop-shadow(0 0 8px rgba(150, 100, 255, .7)); }
.empty-state p, .empty-copy, .loading { font-size: 14px; color: var(--muted); }
.empty-copy, .loading { padding: 10px 2px 16px; }
.profile-card { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 11px; }
.profile-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 14px; background: var(--gradient); color: #fff; box-shadow: var(--glow); }
.profile-card h2 { overflow-wrap: anywhere; }
.profile-card p, .local-card p { color: var(--muted); font-size: 13px; line-height: 1.55; }
.menu-card { display: grid; gap: 4px; padding-block: 6px; }
.account-entry small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.account-card { display: grid; gap: 12px; }
.account-modes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.local-card p { margin: 7px 0 10px; }
.wallet-card { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; background: linear-gradient(135deg, rgba(110, 60, 235, .55), rgba(40, 28, 120, .7)); border-color: var(--border-strong); }
.wallet-card span { display: block; color: var(--ink-soft); font-size: 12px; }
.wallet-card strong { font-size: 26px; color: #fff; text-shadow: 0 0 18px rgba(170, 130, 255, .7); }
.recharge-card { display: grid; gap: 10px; }
.recharge-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.recharge-options button { background: var(--glass); border: 1px solid var(--border); border-radius: 14px; padding: 11px 4px; color: var(--ink); }
.recharge-options button[aria-pressed="true"] { border-color: var(--border-strong); background: var(--gradient); color: #fff; box-shadow: var(--glow); }
.recharge-options button strong, .recharge-options button small { display: block; }
.recharge-options button small { margin-top: 4px; color: var(--muted); }
.recharge-options button[aria-pressed="true"] small { color: rgba(255, 255, 255, .85); }
.recharge-custom-option { grid-column: 1 / -1; min-height: 42px; }
.recharge-custom-field { display: grid; gap: 6px; }
.recharge-custom-field label { font-size: 13px; font-weight: 650; }
.recharge-custom-field input { width: 100%; min-height: 44px; padding: 8px 10px; }
.ledger > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.ledger > div:last-child { border-bottom: 0; }
.ledger small { display: block; color: var(--muted); margin-top: 3px; }

.sheet {
  position: fixed;
  inset: auto 0 0;
  z-index: 9;
  width: min(100%, var(--app-width));
  max-width: 100%;
  max-height: min(84dvh, 700px);
  margin: 0 auto;
  padding: 10px 16px calc(18px + var(--safe-bottom));
  border: 1px solid var(--border-strong);
  border-bottom: 0;
  border-radius: 26px 26px 0 0;
  background: linear-gradient(180deg, #1c1558, #100b44);
  box-shadow: 0 -16px 50px rgba(60, 30, 190, .35);
  color: var(--ink);
}
.sheet::backdrop { background: rgba(3, 2, 22, .72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.sheet-grip { width: 38px; height: 4px; margin: 1px auto 4px; border-radius: 9px; background: rgba(190, 170, 255, .4); }
.sheet-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.sheet-header h2 { font-size: 18px; }
.sheet-message { margin: 0 0 9px; padding: 9px 10px; border-radius: 10px; background: var(--violet-soft); border: 1px solid var(--border); color: var(--violet-dark); font-size: 13px; }
.sheet-message.error { background: rgba(255, 90, 130, .16); border-color: rgba(255, 130, 160, .4); color: var(--danger); }
.sheet-form, .sheet-list { display: grid; gap: 10px; }
.sheet > .button.primary { width: 100%; margin-top: 10px; }
.sheet-form label, .sub-settings { font-size: 13px; font-weight: 650; }
.sheet-form label small { color: var(--muted); font-size: 12px; font-weight: 500; }
.sheet-form label > input:not([type="checkbox"]), .sheet-form label > select, .sheet-form label > textarea, .sub-settings > select { display: block; margin-top: 5px; }
.row-button { justify-content: flex-start; min-height: 48px; text-align: left; width: 100%; }
.row-button small { margin-left: auto; color: var(--muted); font-size: 12px; }
.row-button .icon:last-child:not(:first-child) { margin-left: auto; width: 15px; }
.sub-settings { padding: 10px 9px; border-radius: 12px; background: var(--glass); border: 1px solid var(--border); }
.sub-settings summary { cursor: pointer; }
.version-links { display: grid; gap: 7px; margin: 9px 0 0 11px; }
.version-links a { color: var(--violet-dark); }
.music-settings { display: grid; gap: 7px; }
.form-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-line { display: flex; align-items: center; gap: 7px; min-height: 42px; }
input[type="checkbox"] { accent-color: var(--violet); width: 18px; height: 18px; flex: 0 0 auto; }
.library-list { display: grid; gap: 6px; }
.library-item { display: grid; grid-template-columns: 44px minmax(0, 1fr) 27px; align-items: center; gap: 9px; padding: 5px; border-radius: 12px; }
.library-item:hover { background: var(--glass); }
.library-item img { width: 44px; height: 40px; border-radius: 8px; object-fit: cover; }
.library-item span, .library-item small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#toast {
  display: none;
  position: fixed;
  z-index: 10;
  bottom: calc(86px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: min(89vw, 430px);
  padding: 11px 15px;
  color: white;
  background: rgba(36, 22, 100, .96);
  border: 1px solid var(--border-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  border-radius: 14px;
  font-size: 13px;
  line-height: 1.45;
}
#toast.visible { display: block; }
#toast.error { background: rgba(110, 24, 56, .96); border-color: rgba(255, 130, 160, .5); }
.has-nav.has-action ~ #toast { bottom: calc(150px + var(--safe-bottom)); }

@media (min-width: 510px) {
  body { background: radial-gradient(ellipse at 50% -10%, #241a7a, var(--page-deep) 70%); }
  .shell { box-shadow: 0 0 70px rgba(90, 50, 230, .35); }
}
@media (max-width: 350px) {
  main { padding-right: 10px; padding-left: 10px; }
  .app-header { padding-right: 10px; padding-left: 10px; }
  .brand-img { height: 46px; }
  .brand-sub { font-size: 10px; }
  .mode-switch button { font-size: 12px; gap: 3px; }
  .mode-switch .icon { width: 15px; height: 15px; }
  .shot-thumb { width: 32px; height: 38px; }
  .create-specs { grid-template-columns: 1fr; gap: 12px; }
  .create-specs > div:first-child { padding-right: 0; border-right: 0; }
  .create-specs > div:last-child { padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}

.code-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; margin-top: 5px; }
.code-row input { margin-top: 0 !important; min-width: 0; }
.code-row .button { white-space: nowrap; padding-inline: 14px; }

/* 开场字幕 */
.hook-field { display: grid; gap: 6px; margin: 4px 0 12px; }
.hook-field > span { font-weight: 700; font-size: 13px; color: var(--ink-soft); }
.hook-field input { width: 100%; min-height: 44px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--border); background: rgba(8, 5, 52, .55); color: var(--ink); }
.hook-field input:focus-visible { border-color: var(--border-strong); }

/* 候选首帧 */
.frame-offer { margin-top: 10px; }
.frame-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 8px 0 14px; }
.frame-choice { display: grid; gap: 6px; padding: 6px; border: 1px solid var(--line, #4b3f8f); border-radius: 12px; background: transparent; color: var(--ink-soft); cursor: pointer; }
.frame-choice img { width: 100%; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 8px; }
.frame-choice:hover, .frame-choice:focus-visible { border-color: #b18cff; }

/* 真人脸素材标记 */
.asset-flag { position: absolute; left: 6px; bottom: 6px; padding: 2px 7px; border-radius: 999px; background: rgba(120, 30, 60, .88); color: #fff; font-size: 11px; font-weight: 700; }

.refine-field { display: flex; gap: 10px; align-items: flex-start; margin-top: 12px; font-size: 14px; line-height: 1.5; }
.refine-field input { margin-top: 4px; accent-color: #7c4dff; }

.subtitle-editor { margin-top: 12px; font-size: 14px; }
.subtitle-editor summary { cursor: pointer; color: #cdbbff; }
.subtitle-editor label { display: grid; gap: 4px; margin-top: 10px; }
.subtitle-editor input { width: 100%; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.06); color: inherit; font: inherit; }
