:root {
  color-scheme: dark;
  font: 16px/1.5 system-ui, sans-serif;
  color: #f4f3ff;
  background: #10101a;
  --muted: #bfbed4;
  --surface: #1b1b2b;
  --line: #45425b;
  --accent: #d8c4ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
a { color: var(--accent); }
button, input, textarea { font: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 3px solid #ffcf90; outline-offset: 4px; }
.topbar {
  display: flex;
  align-items: center;
  gap: clamp(12px, 4vw, 34px);
  padding: 12px max(16px, calc((100% - 960px) / 2));
  border-bottom: 1px solid var(--line);
}
.brand { font-size: 1.3rem; font-weight: 750; text-decoration: none; white-space: nowrap; color: #f4f3ff; }
.brand span { color: #c7a4ff; margin: 0 .1em; }
.product, .studio-link { font-size: .875rem; white-space: nowrap; }
.product { color: var(--muted); }
.studio-link { margin-left: auto; }
main { max-width: 960px; margin: auto; padding: 0 18px 54px; }
.introduction { padding: clamp(24px, 4vw, 44px) 0 20px; }
h1, h2 { margin: 0; font-family: Georgia, serif; line-height: 1.05; }
h1 { font-size: clamp(2.4rem, 7vw, 4.4rem); letter-spacing: -.04em; }
h1 em { color: var(--accent); font-weight: 500; }
h2 { font-size: clamp(1.75rem, 4vw, 2.5rem); overflow-wrap: anywhere; }
p { margin: .55rem 0 0; color: var(--muted); overflow-wrap: anywhere; }
.film, .editor { border: 1px solid var(--line); border-radius: 20px; overflow: hidden; background: var(--surface); }
.screen { background: #070712; }
video { display: block; width: 100%; aspect-ratio: 16 / 9; max-height: min(58vh, 490px); object-fit: contain; }
.film-details, .editor { padding: clamp(16px, 3vw, 26px); }
.scene-label { color: var(--accent); font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: .45rem; font-weight: 700; }
.choices, #replay { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
h3 { margin: 0 0 10px; font-size: 1.1rem; overflow-wrap: anywhere; }
.choice-row, .actions { display: flex; flex-wrap: wrap; gap: 10px; }
button {
  appearance: none;
  min-height: 44px;
  max-width: 100%;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: var(--accent);
  color: #201032;
  font-weight: 700;
  cursor: pointer;
  overflow-wrap: anywhere;
}
button:hover { background: #ebdeff; }
button:disabled { opacity: .65; cursor: wait; }
.secondary { background: transparent; color: #f4f3ff; border-color: #77718e; }
.secondary:hover { background: #36314a; }
.choice { flex: 1 1 160px; text-align: left; }
.film-actions, .editor, #share-fallback, .editor-actions { margin-top: 18px; }
.editor > p { margin-bottom: 18px; }
.story-fields, .clips { display: grid; gap: 12px; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.clips { margin-top: 18px; }
fieldset { min-width: 0; margin: 0; padding: 12px; border: 1px solid #655e7d; border-radius: 10px; }
legend { padding: 0 5px; color: var(--accent); font-weight: 700; }
label { display: block; font-size: .9rem; font-weight: 650; }
fieldset label + label { margin-top: 11px; }
input, textarea {
  display: block;
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  padding: 8px;
  border: 1px solid #77718e;
  border-radius: 8px;
  background: #10101a;
  color: #f4f3ff;
}
textarea { resize: vertical; }
.prepare-ending { margin-top: 12px; }
input[type="file"] { font-size: .78rem; }
.notice, .error { padding: 8px 11px; border-left: 3px solid #d8c4ff; }
.error { color: #ffd3b1; border-color: #ffbf91; }
@media (max-width: 690px) {
  .story-fields, .clips { grid-template-columns: minmax(0, 1fr); }
  video { max-height: none; }
}
.editor { margin-top: 0; }
.upload-opening {
  display: grid;
  gap: 6px;
  border: 1px dashed #9b82c4;
  border-radius: 12px;
  padding: 18px;
  background: #232036;
  cursor: pointer;
}
.upload-opening strong { font-size: 1.2rem; color: var(--accent); }
.upload-opening span { color: var(--muted); font-weight: 400; }
.upload-opening.dragging { border-color: var(--accent); background: #33294a; }
.edit-options, .watch-panel { margin-top: 16px; }
.edit-options summary, .watch-panel summary { cursor: pointer; font-weight: 700; color: var(--accent); }
.edit-options .story-fields, .watch-panel .film { margin-top: 12px; }
.edit-options .story-fields + label, #load-url { margin-top: 10px; }
.edit-options .clips { grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr)); }
#trim-video { margin-top: 16px; background: #070712; border-radius: 10px; max-height: 300px; }
.trim-controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; margin-top: 10px; }
.trim-controls label { flex: 1 1 155px; }
