:root {
  color-scheme: light;
  --paper: #fff9ee;
  --ink: #23352e;
  --pine: #183b32;
  --muted: #52655e;
  --rust: #a73c2c;
  --line: #e2d6c1;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 16px/1.55 "Microsoft JhengHei", system-ui, sans-serif; }
.wrap { width: min(1120px, calc(100% - 36px)); margin-inline: auto; }
.masthead { background: var(--pine); color: white; padding: 13px 0; }
.masthead .wrap { display: flex; gap: 12px; align-items: baseline; }
.brand { color: #f6bc86; font-size: 18px; font-weight: 800; letter-spacing: .12em; }
.separator { opacity: .6; }
.product { font-size: 14px; }
.dashboard { padding: 24px 0 48px; }
.titlebar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.kicker { color: var(--rust); font-size: 13px; font-weight: 750; letter-spacing: .12em; }
h1 { margin: 0; font-size: clamp(28px, 4.6vw, 49px); line-height: 1.24; }
h2 { margin: 0 0 12px; font-size: 19px; }
.screen { display: grid; grid-template-columns: minmax(0, 2.55fr) minmax(220px, 1fr); gap: 15px; align-items: stretch; }
.theater { width: 100%; background: #10231e; overflow: hidden; display: flex; align-items: center; border-radius: 10px; }
video { display: block; width: 100%; aspect-ratio: 16/9; background: #10231e; }
.shelf, .panel { border: 1px solid var(--line); border-radius: 10px; padding: 17px; background: #fffdf7; }
.items { display: grid; gap: 7px; }
.clip { text-align: left; width: 100%; padding: 9px 10px; background: #f2eadb; color: var(--pine); font-weight: 650; display: grid; gap: 1px; }
.clip[aria-pressed="true"] { background: var(--pine); color: white; }
.clip small { font-weight: 400; opacity: .78; }
.work { display: grid; grid-template-columns: 1.3fr 1fr; gap: 15px; margin-top: 15px; align-items: start; }
.panel form { display: grid; gap: 12px; }
.fields { display: grid; grid-template-columns: 1.2fr .7fr .8fr; gap: 10px; }
label { display: grid; gap: 4px; font-size: 14px; color: var(--muted); }
input, select, textarea { width: 100%; padding: 8px; color: var(--ink); background: white; border: 1px solid var(--line); border-radius: 5px; font: inherit; }
textarea { resize: vertical; }
button { border: none; border-radius: 5px; padding: 9px 14px; background: var(--rust); color: white; font: inherit; cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid #3e8572; outline-offset: 2px; }
button:disabled { opacity: .55; cursor: wait; }
button.quiet { color: var(--pine); background: #e8dcc5; }
.job { border-bottom: 1px solid var(--line); padding: 9px 0; display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.feedback, .empty { color: var(--muted); font-size: 14px; margin: 0; }
.feedback:empty { display: none; }
.login { width: min(440px, calc(100% - 36px)); margin: min(13vh, 100px) auto; padding: 24px; border-radius: 12px; border: 1px solid var(--line); background: #fffdf7; }
.login form { display: grid; gap: 10px; margin-top: 20px; }
.login a { color: var(--rust); }
.title-actions, .episode-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.title-actions a { color: var(--pine); font-weight: 700; }
.studio-nav, .library-filters { display: flex; gap: 10px; align-items: end; }
.studio-nav { margin: 6px 0 14px; flex-wrap: wrap; }
.studio-nav a { display: inline-flex; align-items: center; padding: 0 15px; min-height: 44px; border-radius: 6px; background: #e8dcc5; color: var(--pine); font-weight: 700; text-decoration: none; }
.library-filters { display: grid; grid-template-columns: minmax(80px, 2fr) minmax(92px,1fr); margin-bottom: 10px; }
.studio-nav + .screen, #shot-maker { scroll-margin-top: 15px; }
#episode-template { margin-bottom: 10px; }
#episode-duration[aria-invalid="true"] { color: var(--rust); }
.episode-panel { margin-top: 15px; scroll-margin-top: 12px; }
.episode-fields { display: grid; grid-template-columns: minmax(0, 2fr) minmax(120px, 1fr); gap: 10px; }
.episode-projects { display: grid; gap: 12px; border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.episode-shots { display: grid; gap: 8px; }
.editor-toolbar { position: sticky; top: 0; z-index: 1; padding: 8px 0; background: #fffdf7; border-bottom: 1px solid var(--line); }
#episode-draft { scroll-margin-top: 12px; }
.shot-panel { scroll-margin-top: 110px; }
#episode-draft:not([hidden]) { display: grid; gap: 10px; }
.shot-panel { border: 1px solid var(--line); border-radius: 6px; background: #faf5e9; }
.shot-panel > summary, .story-source summary { cursor: pointer; font-weight: 700; padding: 10px; overflow-wrap: anywhere; }
.shot-fields { display: grid; gap: 9px; padding: 0 11px 11px; }
.shot-grid { display: grid; gap: 8px; grid-template-columns: repeat(3,minmax(0,1fr)); }
.shot-cast { display: flex; flex-wrap: wrap; gap: 10px; border: 1px solid var(--line); margin: 0; }
.shot-cast label { display: flex; align-items: center; gap: 5px; }
.shot-cast input { width: auto; }
.story-source { background: #f6eddc; border-radius: 5px; }
.story-source p { margin: 0; padding: 0 10px 10px; white-space: pre-wrap; overflow-wrap: anywhere; }
.story-source-actions { padding: 0 10px 10px; }
@media (max-width: 720px) {
  .screen, .work { grid-template-columns: 1fr; }
  .dashboard { padding-top: 19px; }
  .items { grid-template-columns: repeat(auto-fit,minmax(155px,1fr)); }
  .episode-panel input, .episode-panel select, .episode-panel textarea { font-size: 16px; }
  .shot-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .episode-actions button { min-height: 44px; }
  .library-filters input, .library-filters select { font-size: 16px; }
}
