/* 苹果设计语言:系统字体、深色画布、毛玻璃层、大圆角、克制蓝 */
:root {
  --bg: #0d0d0f;
  --panel: rgba(28, 28, 32, .72);
  --card: rgba(44, 44, 50, .6);
  --text: #f5f5f7;
  --text2: #98989f;
  --line: rgba(255, 255, 255, .08);
  --blue: #0a84ff;
  --green: #30d158;
  --amber: #ffd60a;
  --red: #ff453a;
  --radius: 18px;
  font-size: 15px;
}
* { box-sizing: border-box; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei UI", sans-serif;
  background: radial-gradient(1200px 800px at 20% -10%, rgba(10,132,255,.12), transparent 60%),
              radial-gradient(1000px 700px at 90% 0%, rgba(191,90,242,.10), transparent 55%),
              var(--bg);
  color: var(--text);
  min-height: 100vh;
}
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: rgba(13,13,15,.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: .2px; }
.steps { display: flex; align-items: center; gap: 8px; margin: 0 auto; }
.step { color: var(--text2); padding: 5px 12px; border-radius: 999px; transition: all .25s; font-size: 13px; }
.step.active { background: var(--blue); color: #fff; font-weight: 600; }
.step.done { color: var(--blue); }
.sep { color: var(--text2); opacity: .5; font-size: 12px; }

main { max-width: 1060px; margin: 34px auto 80px; padding: 0 24px; }
.panel {
  background: var(--panel);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 30px 32px;
  animation: rise .35s ease;
}
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
h2 { font-size: 21px; font-weight: 700; margin-bottom: 6px; }
h2 .sub { font-size: 13px; font-weight: 400; color: var(--text2); margin-left: 10px; }
.hint { color: var(--text2); font-size: 13px; margin: 4px 0 16px; line-height: 1.6; }
.hidden { display: none !important; }

textarea, input, select {
  width: 100%;
  background: rgba(0,0,0,.35);
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  font: inherit;
  padding: 12px 14px;
  outline: none;
  transition: border .2s, box-shadow .2s;
}
textarea:focus, input:focus, select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(10,132,255,.25); }
#scriptText { min-height: 260px; resize: vertical; line-height: 1.7; }
#assetsEdit, #storyboardEdit { min-height: 300px; font-size: 13px; line-height: 1.7; }

.row { display: flex; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.row.right { justify-content: flex-end; }
.flex1 { flex: 1; }
.inline { display: flex; align-items: center; gap: 8px; color: var(--text2); font-size: 13px; }
.inline input { width: 80px; }

.btn {
  border: none; border-radius: 12px; padding: 10px 20px;
  font: inherit; font-weight: 600; cursor: pointer;
  transition: transform .12s, filter .2s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
.btn.ghost { background: rgba(255,255,255,.08); color: var(--text); }
.btn.ghost:hover { background: rgba(255,255,255,.14); }
.btn:disabled { opacity: .4; cursor: default; }

.assets, .cards, .storyboard, .queue { display: flex; flex-direction: column; gap: 10px; }
.asset-card, .prompt-card, .sb-card, .queue-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px 18px;
}
.asset-card h4 { font-size: 14px; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 999px; font-weight: 600; }
.tag.char { background: rgba(10,132,255,.2); color: #6cb2ff; }
.tag.scene { background: rgba(48,209,88,.18); color: #6ee787; }
.tag.prop { background: rgba(255,214,10,.16); color: #ffd60a; }
.asset-card p { font-size: 13px; color: var(--text2); line-height: 1.65; }
.asset-card .voice { margin-top: 6px; font-size: 12px; color: #b8a6ff; }

.prompt-card textarea { min-height: 110px; font-size: 12.5px; line-height: 1.6; }
.prompt-card .head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.sb-card pre {
  white-space: pre-wrap; word-break: break-word;
  font: 12.5px/1.75 ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color: #d8d8de; max-height: 320px; overflow: auto;
}
.sb-card .head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.badge { font-size: 11px; color: var(--text2); border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; }
.badge.ok { color: var(--green); border-color: rgba(48,209,88,.4); }
.badge.warn { color: var(--amber); border-color: rgba(255,214,10,.4); }
.badge.err { color: var(--red); border-color: rgba(255,69,58,.4); }

.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-top: 18px; }
.g-item { background: var(--card); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.g-item img { width: 100%; display: block; aspect-ratio: 3/4; object-fit: cover; }
.g-item .cap { padding: 8px 10px; font-size: 12px; color: var(--text2); display: flex; align-items: center; gap: 6px; }
.g-item .cap input { width: 14px; height: 14px; }

.queue-item { display: grid; grid-template-columns: 1fr auto auto; gap: 14px; align-items: center; }
.queue-item .name { font-weight: 600; font-size: 14px; }
.queue-item .st { font-size: 13px; color: var(--text2); }
.status-pill { font-size: 12px; font-weight: 600; padding: 3px 12px; border-radius: 999px; }
.st.queued, .st.production { background: rgba(10,132,255,.18); color: #6cb2ff; }
.st.completed { background: rgba(48,209,88,.18); color: #6ee787; }
.st.failed, .st.cancelled { background: rgba(255,69,58,.18); color: #ff8b85; }

.mask {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.5); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center;
}
.dialog {
  width: 460px; max-width: 92vw;
  background: rgba(36,36,42,.92);
  border: 1px solid var(--line); border-radius: 22px;
  padding: 28px 30px;
  backdrop-filter: blur(30px);
}
.dialog h3 { font-size: 18px; margin-bottom: 18px; }
.dialog label { display: block; font-size: 12.5px; color: var(--text2); margin: 12px 0 6px; }
.dialog input, .dialog select { padding: 9px 12px; }
.dialog hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
.spin { width: 15px; height: 15px; border: 2px solid var(--text2); border-top-color: transparent; border-radius: 50%; display: inline-block; animation: sp .8s linear infinite; vertical-align: -2px; margin-right: 6px; }
@keyframes sp { to { transform: rotate(360deg); } }
.toast {
  position: fixed; bottom: 30px; left: 50%; transform: translateX(-50%);
  background: rgba(58,58,64,.95); border: 1px solid var(--line);
  padding: 10px 22px; border-radius: 999px; font-size: 13.5px; z-index: 99;
  animation: rise .3s ease;
}
.toast.err { border-color: rgba(255,69,58,.5); }
