:root {
  color-scheme: dark;
  --bg: #090b0f;
  --panel: #10131a;
  --panel-2: #151922;
  --line: #282d37;
  --line-soft: #1c2028;
  --text: #f0ede5;
  --muted: #989ba4;
  --quiet: #6f737c;
  --accent: #c8b98e;
  --accent-text: #13110d;
  --danger: #d79b8f;
  --radius: 20px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "Noto Sans JP", sans-serif;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}
.app {
  width: min(100%, 700px);
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 18px max(34px, env(safe-area-inset-bottom));
}
.topbar {
  min-height: 46px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line-soft);
}
.home {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
}
.night-label { color: var(--quiet); font-size: 12px; letter-spacing: .16em; white-space: nowrap; }
.screen { display: none; padding: 42px 0 0; }
.screen.active { display: block; }
.eyebrow { margin: 0 0 12px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .17em; }
h1 { margin: 0; font-size: clamp(36px, 9vw, 64px); line-height: 1.08; letter-spacing: -.055em; }
h1 span { color: var(--accent); }
h2 { margin: 0; font-size: clamp(27px, 7vw, 43px); line-height: 1.22; letter-spacing: -.035em; }
h3 { margin: 0; font-size: 19px; }
.lead { margin: 22px 0 0; color: #b8bbc2; font-size: 17px; line-height: 1.75; }
.lead strong { color: var(--text); font-weight: 700; }
.lead.small { margin-top: 14px; font-size: 15px; }
.tiny { color: var(--quiet); font-size: 12px; line-height: 1.65; }
.tiny.center { text-align: center; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.section-head > span {
  width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 50%; display: grid; place-items: center;
  color: var(--accent); font-size: 12px; font-weight: 800;
}
.section-head h2 { font-size: 22px; letter-spacing: -.025em; }
.theme-panel { margin-top: 36px; }
.theme-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.theme-choice {
  min-height: 74px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 15px;
  background: var(--panel); text-align: left; cursor: pointer;
}
.theme-choice span { display: block; font-size: 16px; font-weight: 800; }
.theme-choice small { display: block; margin-top: 5px; color: var(--muted); font-size: 12px; }
.theme-choice.selected { border-color: var(--accent); background: #171811; }
.custom-wrap { display: block; margin-top: 14px; }
.custom-wrap > span, .scene-input-wrap > span, .quote-wrap > span, .detail-editor label span {
  display: block; margin-bottom: 8px; color: var(--muted); font-size: 12px; font-weight: 700;
}
input, textarea {
  width: 100%; border: 1px solid var(--line); border-radius: 13px; background: #0d1016; color: var(--text);
  padding: 14px 15px; font-size: 16px; line-height: 1.5;
}
textarea { resize: none; min-height: 104px; }
input::placeholder, textarea::placeholder { color: #60646d; }
.primary, .secondary, .back {
  min-height: 52px; border-radius: 14px; padding: 13px 16px; font-weight: 800; cursor: pointer;
}
.primary {
  width: 100%; margin-top: 14px; border: 0; background: var(--accent); color: var(--accent-text);
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.primary b { font-size: 18px; }
.primary.compact, .secondary.compact { min-height: 46px; margin-top: 0; }
.secondary { width: 100%; border: 1px solid var(--line); background: var(--panel); color: var(--text); }
.back { border: 0; background: transparent; color: var(--muted); }
.validation { min-height: 20px; margin: 8px 0 0; color: var(--danger); font-size: 12px; }
.promise-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.promise-row span { border: 1px solid var(--line-soft); border-radius: 999px; padding: 7px 10px; color: var(--muted); font-size: 12px; }
.saved-card {
  margin-top: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); padding: 17px;
}
.saved-card small { color: var(--accent); letter-spacing: .14em; font-size: 12px; }
.saved-card strong { display: block; margin-top: 7px; font-size: 17px; }
.saved-card p { margin: 7px 0 16px; color: var(--muted); font-size: 12px; line-height: 1.5; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.saved-actions { display: grid; grid-template-columns: 1.4fr 1fr; gap: 8px; }
.progress-row { display: grid; grid-template-columns: auto minmax(60px, 1fr) auto; gap: 10px; align-items: center; color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; }
.progress { height: 2px; background: var(--line); overflow: hidden; }
.progress b { display: block; width: 33.33%; height: 100%; background: var(--accent); transition: width .25s ease; }
.filmstrip {
  margin: 28px -4px 0; padding: 14px 4px; display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 7px;
  border-top: 1px dashed #31353f; border-bottom: 1px dashed #31353f;
}
.film-frame {
  min-width: 0; min-height: 104px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #0d1016; text-align: left;
}
.film-frame small { display: block; color: var(--quiet); font-size: 12px; font-weight: 800; }
.film-frame span {
  display: -webkit-box; margin-top: 9px; overflow: hidden; color: var(--muted); font-size: 12px; line-height: 1.45;
  -webkit-box-orient: vertical; -webkit-line-clamp: 4;
}
.film-frame.current { border-color: var(--accent); }
.film-frame.filled span { color: var(--text); }
.cut-editor { margin-top: 34px; }
.cut-kicker { margin: 0 0 9px; color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .12em; }
.cut-editor h2 { font-size: clamp(24px, 6vw, 35px); }
.cut-help { margin: 12px 0 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.suggestion {
  min-height: 42px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel); padding: 9px 12px;
  color: #c5c6ca; font-size: 12px; text-align: left;
}
.scene-input-wrap { display: block; margin-top: 18px; }
.quote-wrap { display: block; margin-top: 12px; }
.storyboard { display: grid; gap: 11px; margin-top: 30px; }
.story-card { position: relative; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); padding: 18px 18px 18px 58px; }
.story-card .num { position: absolute; left: 16px; top: 18px; width: 28px; height: 28px; border-radius: 50%; border: 1px solid var(--line); display: grid; place-items: center; color: var(--accent); font-size: 12px; font-weight: 800; }
.story-card small { display: block; color: var(--quiet); font-size: 12px; font-weight: 800; letter-spacing: .1em; }
.story-card strong { display: block; margin-top: 7px; font-size: 16px; line-height: 1.6; }
.story-card em { display: block; margin-top: 8px; color: #b9b3a4; font-size: 12px; font-style: normal; }
.sharpen-panel { margin-top: 26px; border-top: 1px solid var(--line-soft); padding-top: 24px; }
.sharpen-panel .section-head { margin-bottom: 7px; }
.sharpen-panel > p { margin: 0; color: var(--muted); font-size: 12px; }
.detail-choices { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 14px; }
.detail-choice { min-height: 48px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); font-size: 12px; }
.detail-choice.selected { border-color: var(--accent); color: var(--accent); }
.detail-editor { margin-top: 12px; }
.detail-editor .secondary { margin-top: 8px; }
.story-actions { display: grid; gap: 9px; margin-top: 24px; }
.story-actions .primary { margin-top: 0; }
.playback-screen { padding-top: 20px; }
.playback-top { min-height: 45px; display: flex; align-items: center; justify-content: space-between; color: var(--quiet); font-size: 12px; }
.icon-back { padding-left: 0; }
.playback-stage { min-height: 380px; padding: 52px 0 30px; display: flex; flex-direction: column; justify-content: center; }
.playback-kicker { color: var(--accent); font-size: 12px; font-weight: 800; letter-spacing: .14em; }
.playback-stage > strong { display: block; max-width: 620px; margin-top: 14px; font-size: clamp(30px, 8vw, 50px); line-height: 1.42; letter-spacing: -.035em; }
.playback-stage > p:not(.playback-kicker) { margin: 20px 0 0; color: #c9c1ab; font-size: 19px; line-height: 1.6; }
.detail-line { margin-top: 24px; border-left: 2px solid var(--accent); padding-left: 13px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.dots { display: flex; justify-content: center; gap: 8px; margin: 6px 0 14px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: #30343c; }
.dots i.on { background: var(--accent); }
.primary.calm { margin-top: 0; }
.lightsout-screen { padding-top: 72px; text-align: center; }
.lightsout-mark { display: flex; justify-content: center; gap: 10px; margin: 0 0 28px; }
.lightsout-mark span { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); opacity: .5; }
.lightsout-copy { margin: 20px 0 0; color: var(--muted); font-size: 17px; line-height: 1.8; }
.lightsout-copy strong { color: var(--text); }
.memory-cuts { list-style: none; padding: 0; margin: 30px auto 0; max-width: 500px; text-align: left; }
.memory-cuts li { padding: 12px 0; border-bottom: 1px solid var(--line-soft); color: #b7bac0; font-size: 12px; }
.memory-cuts li b { display: inline-block; width: 70px; color: var(--quiet); font-size: 12px; letter-spacing: .08em; }
.lightsout-btn { margin-top: 30px; justify-content: center; }
#lightsoutBackBtn { margin-top: 8px; }
.blackout-screen { padding: 0; }
.blackout-screen.active { min-height: 620px; display: grid; place-items: center; }
.blackout-return { width: 100%; min-height: 560px; border: 0; background: #020304; color: #26282d; display: grid; place-items: center; align-content: center; gap: 12px; }
.blackout-return span { font-size: 14px; }
.blackout-return small { font-size: 12px; opacity: .55; }
@media (max-width: 420px) {
  .app { padding-left: 15px; padding-right: 15px; }
  .screen { padding-top: 32px; }
  .night-label { font-size: 12px; }
  .theme-grid { gap: 8px; }
  .theme-choice { min-height: 70px; padding: 12px; }
  .saved-actions { grid-template-columns: 1fr; }
  .film-frame { min-height: 96px; padding: 9px; }
  .film-frame small { font-size: 12px; }
  .film-frame span { font-size: 12px; }
  .detail-choices { grid-template-columns: 1fr; }
  .playback-stage { min-height: 340px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
