:root {
  --ink: #171a18;
  --text: #343a36;
  --muted: #727a75;
  --line: #dfe4e0;
  --surface: #fff;
  --canvas: #f4f6f4;
  --green: #1f6848;
  --green-soft: #e2f0e8;
  --blue: #326b91;
  --blue-soft: #e3eef5;
  --coral: #a94c38;
  --coral-soft: #f7e5e0;
  --amber: #936411;
  --amber-soft: #f7edd9;
  font-family: Inter, "Noto Sans SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { min-width: 320px; margin: 0; background: var(--canvas); }
button, input, select, textarea { font: inherit; letter-spacing: 0; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible { outline: 2px solid #5b9ac3; outline-offset: 2px; }
svg { width: 18px; height: 18px; stroke-width: 1.8; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.studio-topbar { height: 64px; display: flex; align-items: center; justify-content: space-between; padding: 0 max(22px, calc((100vw - 1120px) / 2)); border-bottom: 1px solid var(--line); background: rgba(255,255,255,.96); }
.studio-brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.studio-brand > span:last-child { display: grid; gap: 1px; }
.studio-brand strong { font-size: 14px; }
.studio-brand small { color: var(--muted); font-size: 9px; text-transform: uppercase; }
.studio-mark { width: 28px; height: 28px; display: grid; grid-template-columns: 1fr 1fr; gap: 3px; padding: 5px; border-radius: 5px; background: #1b201d; transform: rotate(-5deg); }
.studio-mark i { border-radius: 1px; background: #dcebe1; }
.studio-mark i:nth-child(2), .studio-mark i:nth-child(3) { background: #3ba373; }
.studio-health { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 10px; }
.studio-health > i { width: 8px; height: 8px; border-radius: 50%; background: #d49a31; }
.studio-health.ready > i { background: #3ba373; box-shadow: 0 0 0 3px rgba(59,163,115,.14); }
.studio-topbar-actions { display: flex; align-items: center; gap: 16px; }
.quota-state { min-height: 28px; display: inline-flex; align-items: center; gap: 6px; padding: 0 9px; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: #f8faf8; font-size: 9px; font-weight: 600; }
.quota-state svg { width: 14px; height: 14px; color: var(--green); }
.studio-main { width: min(1120px, calc(100% - 44px)); margin: 0 auto; padding: 32px 0 56px; }
.studio-heading { min-height: 54px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.studio-heading h1 { margin: 0; font-size: 25px; line-height: 1.15; }
.studio-heading p { margin: 7px 0 0; color: var(--muted); font-size: 11px; }
.icon-button { width: 36px; height: 36px; display: inline-grid; place-items: center; flex: 0 0 auto; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: var(--surface); cursor: pointer; }
.icon-button:hover { background: #edf1ee; }
.studio-workspace { display: grid; grid-template-columns: minmax(0, 1.06fr) minmax(360px, .94fr); gap: 18px; align-items: stretch; }
.compose-panel, .result-panel { min-width: 0; padding: 22px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.section-title { display: flex; align-items: center; gap: 9px; margin-bottom: 15px; }
.section-title > span { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 50%; color: var(--green); background: var(--green-soft); font-size: 9px; font-weight: 700; }
.section-title h2 { margin: 0; font-size: 13px; }
.prompt-field { position: relative; display: block; }
.prompt-field textarea { width: 100%; min-height: 245px; resize: vertical; padding: 15px 15px 30px; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: #f8faf8; line-height: 1.65; }
.prompt-field small { position: absolute; right: 11px; bottom: 9px; color: var(--muted); font-size: 9px; }
.parameter-row { display: grid; grid-template-columns: .9fr .7fr 1fr 1.25fr; margin-top: 16px; border-block: 1px solid var(--line); }
.parameter-row > div, .parameter-row > label { min-width: 0; display: grid; gap: 5px; padding: 12px 10px; border-right: 1px solid var(--line); }
.parameter-row > :first-child { padding-left: 0; }
.parameter-row > div:last-child { border-right: 0; }
.parameter-row span { color: var(--muted); font-size: 9px; }
.parameter-row strong { font-size: 10px; }
.parameter-row select { width: 100%; min-height: 25px; padding: 0 22px 0 0; border: 0; color: var(--ink); background: transparent; font-size: 10px; font-weight: 700; cursor: pointer; }
.parameter-row select:disabled { color: var(--muted); cursor: not-allowed; }
.model-notice { min-height: 16px; margin: 10px 0 -5px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.primary-button { width: 100%; min-height: 43px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; margin-top: 17px; border: 0; border-radius: 5px; color: white; background: var(--green); font-weight: 600; cursor: pointer; }
.primary-button:hover { background: #18553a; }
.primary-button:disabled { opacity: .55; cursor: not-allowed; }
.form-error { min-height: 16px; margin: 8px 0 0; color: var(--coral); font-size: 10px; text-align: center; }
.result-panel { display: flex; flex-direction: column; }
.result-empty, .result-ready { min-height: 377px; flex: 1; border-radius: 5px; overflow: hidden; background: #202622; }
.result-empty { display: grid; place-items: center; gap: 8px; color: #929c96; font-size: 11px; }
.result-empty svg { width: 34px; height: 34px; }
.result-ready { display: flex; flex-direction: column; }
.result-ready.is-approval { min-height: 0; flex: 0 0 auto; }
.result-ready video { width: 100%; min-height: 303px; flex: 1; object-fit: contain; background: #171a18; }
.result-status-bar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 14px; color: white; }
.result-status-bar > div { min-width: 0; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 5px 9px; }
.result-status-bar strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.result-status-bar small { grid-column: 2; color: #aeb7b1; font-size: 9px; }
.icon-button.inverse { border-color: #3a443e; color: white; background: transparent; }
.status-label { width: max-content; display: inline-flex; min-height: 22px; align-items: center; padding: 0 7px; border-radius: 4px; color: var(--amber); background: var(--amber-soft); font-size: 9px; font-weight: 600; }
.status-label.succeeded { color: var(--green); background: var(--green-soft); }
.status-label.polling, .status-label.submitting, .status-label.claimed, .status-label.generating { color: var(--blue); background: var(--blue-soft); }
.status-label.brief_pending, .status-label.storyboard_pending { color: var(--amber); background: var(--amber-soft); }
.status-label.failed, .status-label.submission_unknown { color: var(--coral); background: var(--coral-soft); }
.approval-panel { margin-top: 16px; padding-top: 17px; border-top: 1px solid var(--line); }
.approval-heading { display: flex; align-items: flex-start; gap: 10px; }
.approval-heading > div { min-width: 0; }
.approval-heading h3 { margin: 0; font-size: 13px; }
.approval-heading p { margin: 5px 0 0; color: var(--muted); font-size: 9px; line-height: 1.5; }
.approval-stage { min-height: 22px; display: inline-flex; align-items: center; flex: 0 0 auto; padding: 0 7px; border-radius: 4px; color: var(--amber); background: var(--amber-soft); font-size: 9px; font-weight: 700; }
.approval-content { max-height: 360px; overflow: auto; margin-top: 14px; padding: 4px 13px; border-left: 3px solid var(--green); color: var(--text); background: #f8faf8; font-size: 10px; line-height: 1.6; }
.approval-details { margin: 0; }
.approval-details > div { display: grid; grid-template-columns: minmax(90px, .35fr) minmax(0, 1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.approval-details > div:last-child { border-bottom: 0; }
.approval-details dt { color: var(--muted); font-size: 9px; font-weight: 600; overflow-wrap: anywhere; }
.approval-details dd { min-width: 0; margin: 0; overflow-wrap: anywhere; }
.approval-details .approval-details > div { grid-template-columns: minmax(72px, .3fr) minmax(0, 1fr); padding: 5px 0; }
.approval-list { display: grid; gap: 7px; margin: 0; padding-left: 18px; }
.approval-empty-value { color: var(--muted); }
.approval-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 13px; }
.approval-option { min-height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: white; font-size: 9px; cursor: pointer; }
.approval-option:hover { background: #edf1ee; }
.approval-option.is-active { border-color: var(--green); color: var(--green); background: var(--green-soft); font-weight: 600; }
.approval-message { display: grid; gap: 6px; margin-top: 13px; color: var(--muted); font-size: 9px; font-weight: 600; }
.approval-message textarea { width: 100%; min-height: 70px; resize: vertical; padding: 9px 10px; border: 1px solid var(--line); border-radius: 5px; color: var(--text); background: white; font-size: 10px; line-height: 1.55; }
.approval-submit { margin-top: 12px; }
.history-section { margin-top: 28px; padding-top: 4px; }
.history-list { border-top: 1px solid var(--line); }
.history-item { min-height: 62px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 18px; padding: 10px 2px; border-bottom: 1px solid var(--line); }
.history-item > div { min-width: 0; display: grid; gap: 4px; }
.history-item strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; }
.history-item small { color: var(--muted); font-size: 9px; }
.history-time { color: var(--muted); font-size: 9px; }
.history-empty { min-height: 90px; display: grid; place-items: center; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.auth-gate { position: fixed; inset: 0; z-index: 40; display: grid; place-items: center; padding: 20px; background: rgba(23,26,24,.58); }
.auth-dialog { width: min(390px, 100%); display: grid; gap: 17px; padding: 24px; border: 1px solid var(--line); border-radius: 7px; background: white; box-shadow: 0 20px 55px rgba(23,26,24,.22); }
.auth-dialog > svg { width: 28px; height: 28px; color: var(--green); }
.auth-dialog h2 { margin: 0; font-size: 18px; }
.auth-dialog p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.auth-dialog label { display: grid; gap: 6px; color: var(--text); font-size: 10px; font-weight: 600; }
.auth-dialog input { width: 100%; height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 5px; }
.studio-toast { position: fixed; right: 20px; bottom: 20px; z-index: 30; min-width: 250px; display: grid; gap: 3px; padding: 12px 14px; border: 1px solid #b8d8c5; border-radius: 6px; background: white; box-shadow: 0 12px 35px rgba(23,26,24,.15); opacity: 0; transform: translateY(80px); transition: 180ms ease; pointer-events: none; }
.studio-toast.is-visible { opacity: 1; transform: translateY(0); }
.studio-toast strong { font-size: 10px; }
.studio-toast small { color: var(--muted); font-size: 9px; }
@media (max-width: 820px) {
  .studio-workspace { grid-template-columns: 1fr; }
  .result-empty, .result-ready { min-height: 340px; }
  .result-ready.is-approval { min-height: 0; }
}
@media (max-width: 560px) {
  .studio-topbar { height: 58px; padding: 0 14px; }
  .studio-health span { display: none; }
  .studio-topbar-actions { gap: 9px; }
  .quota-state { padding-inline: 7px; }
  .studio-main { width: calc(100% - 26px); padding: 22px 0 38px; }
  .studio-heading h1 { font-size: 22px; }
  .compose-panel, .result-panel { padding: 14px; }
  .prompt-field textarea { min-height: 190px; }
  .parameter-row { grid-template-columns: 1fr; }
  .parameter-row > div, .parameter-row > label, .parameter-row > :first-child { grid-template-columns: 1fr auto; padding: 10px 0; border-right: 0; border-bottom: 1px solid var(--line); }
  .parameter-row > div:last-child { border-bottom: 0; }
  .approval-details > div, .approval-details .approval-details > div { grid-template-columns: 1fr; gap: 3px; }
  .approval-content { max-height: 300px; }
  .history-item { grid-template-columns: minmax(0, 1fr) auto; gap: 9px; }
  .history-time { display: none; }
  .studio-toast { right: 12px; bottom: 12px; left: 12px; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }
