:root {
    --paper: #efe9de;
    --ink: #2a2620;
    --ink-soft: #6f675a;
    --strip: #23201b;
    --strip-2: #2c281f;
    --accent: #e8590c;
    --accent-soft: #f08c00;

    --frame-off: #f8f5ee;      --frame-off-bd: #cfc7b6;
    --frame-wip: #fff2cf;      --frame-wip-bd: #e0a92b;
    --frame-done: #d6f0cf;     --frame-done-bd: #3f9d4c;
    --danger: #d63b30;

    --display: "Playfair Display", Georgia, "Times New Roman", serif;
    --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  }
  * { box-sizing: border-box; }
  body {
    margin: 0; padding: 32px 30px 72px;
    font-family: var(--sans); color: var(--ink);
    background:
      radial-gradient(1200px 600px at 15% -5%, #f5f0e6 0%, transparent 60%),
      radial-gradient(1000px 700px at 110% 10%, #efe6d6 0%, transparent 55%),
      var(--paper);
    -webkit-font-smoothing: antialiased;
  }
  .wrap { max-width: 1280px; margin: 0 auto; }

  /* ---------- Header ---------- */
  header { margin-bottom: 20px; }
  .kicker {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 0.72rem; letter-spacing: 0.18em; text-transform: uppercase;
    font-weight: 600; color: var(--accent); margin-bottom: 10px;
  }
  .kicker::before { content: "🎬"; font-size: 0.95rem; }
  h1 {
    font-family: var(--display); font-weight: 800;
    font-size: clamp(1.8rem, 3.4vw, 2.7rem); line-height: 1.05;
    margin: 0 0 8px; letter-spacing: -0.01em;
  }
  h1 .thin { font-weight: 600; font-style: italic; color: var(--ink-soft); }
  .subtitle { color: var(--ink-soft); font-size: 0.95rem; max-width: 820px; margin: 0; line-height: 1.5; }

  /* ---------- Progress ---------- */
  .progress-card {
    margin: 20px 0; padding: 16px 20px;
    background: rgba(255,255,255,0.55); border: 1px solid rgba(0,0,0,0.07);
    border-radius: 16px; backdrop-filter: blur(4px);
    display: flex; align-items: center; gap: 22px; flex-wrap: wrap;
  }
  .progress-figure { font-family: var(--display); font-weight: 800; font-size: 1.9rem; line-height: 1; }
  .progress-figure small { font-size: 0.9rem; color: var(--ink-soft); font-weight: 600; font-family: var(--sans); }
  .progress-meta { font-size: 0.8rem; color: var(--ink-soft); margin-top: 3px; }
  .progress-bar-wrap { flex: 1 1 260px; min-width: 200px; }
  .progress-track { height: 12px; border-radius: 99px; background: rgba(0,0,0,0.09); overflow: hidden; }
  .progress-fill {
    height: 100%; width: 0%; border-radius: 99px;
    background: linear-gradient(90deg, var(--accent-soft), var(--accent));
    transition: width .45s cubic-bezier(.2,.8,.2,1);
  }
  .milestones { display: flex; gap: 5px; margin-top: 8px; }
  .milestones i { flex: 1; height: 6px; border-radius: 99px; background: rgba(0,0,0,0.1); transition: background .3s; }
  .milestones i.wip { background: var(--frame-wip-bd); }
  .milestones i.done { background: var(--frame-done-bd); }

  /* ---------- Toolbar / legend ---------- */
  .controls { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin-bottom: 4px; }
  .toolbar { display: flex; gap: 8px; flex-wrap: wrap; }
  .toolbar button {
    font: inherit; font-size: 0.82rem; font-weight: 600; padding: 8px 15px; border-radius: 99px;
    border: 1px solid rgba(0,0,0,0.14); background: rgba(255,255,255,0.7); color: var(--ink);
    cursor: pointer; transition: all .15s;
  }
  .toolbar button:hover { background: #fff; border-color: rgba(0,0,0,0.28); transform: translateY(-1px); }
  .toolbar button.primary { background: var(--accent); color: #fff; border-color: transparent; }
  .toolbar button.primary:hover { background: #d24e08; }
  .legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 0.8rem; color: var(--ink-soft); }
  .legend span { display: inline-flex; align-items: center; gap: 6px; }
  .swatch { width: 14px; height: 14px; border-radius: 4px; display: inline-block; border: 1.5px solid; }
  .sw-off { background: var(--frame-off); border-color: var(--frame-off-bd); }
  .sw-wip { background: var(--frame-wip); border-color: var(--frame-wip-bd); }
  .sw-done { background: var(--frame-done); border-color: var(--frame-done-bd); }
  .sw-blk { background: #fff; border: 2px dashed var(--danger); }

  /* ---------- Horizontal flow ---------- */
  .flow-scroll {
    margin-top: 22px; overflow-x: auto; overflow-y: hidden; padding: 6px 2px 18px;
    scrollbar-color: var(--accent-soft) rgba(0,0,0,0.08);
  }
  .flow-scroll::-webkit-scrollbar { height: 12px; }
  .flow-scroll::-webkit-scrollbar-track { background: rgba(0,0,0,0.06); border-radius: 99px; }
  .flow-scroll::-webkit-scrollbar-thumb { background: var(--accent-soft); border-radius: 99px; }
  .flow { display: flex; align-items: stretch; width: max-content; }
  .branches { display: flex; flex-direction: column; gap: 26px; }
  .trunk { display: flex; flex-direction: column; justify-content: center; }

  .lane-head { display: flex; align-items: baseline; gap: 10px; margin: 0 4px 8px; }
  .lane-head h2 { font-family: var(--display); font-weight: 700; font-size: 1.1rem; margin: 0; white-space: nowrap; }
  .lane-head .tag {
    font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700;
    color: var(--ink-soft); padding: 3px 9px; border-radius: 99px; background: rgba(0,0,0,0.06); white-space: nowrap;
  }
  .strip {
    background: linear-gradient(180deg, var(--strip-2), var(--strip));
    border-radius: 14px; box-shadow: 0 14px 30px -18px rgba(0,0,0,0.55);
    overflow: hidden; width: max-content;
  }
  .sprockets {
    height: 20px;
    background-image: radial-gradient(var(--paper) 0 3.2px, transparent 3.6px);
    background-size: 26px 20px; background-position: 6px center; background-repeat: repeat-x;
  }
  .frames {
    display: flex; gap: 16px; padding: 14px 18px; flex-wrap: nowrap;
    border-top: 1px solid rgba(255,255,255,0.06); border-bottom: 1px solid rgba(255,255,255,0.06);
  }

  /* ---------- Merge connector ---------- */
  .flow-merge { position: relative; width: 132px; flex: 0 0 132px; align-self: stretch; }
  .flow-merge svg { width: 100%; height: 100%; display: block; }
  .flow-merge::after {
    content: ""; position: absolute; right: 4px; top: 50%; transform: translateY(-50%);
    border-left: 11px solid var(--accent); border-top: 8px solid transparent; border-bottom: 8px solid transparent;
  }
  .merge-badge {
    position: absolute; left: 50%; top: 50%; transform: translate(-58%, -50%);
    font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
    color: #fff; background: var(--accent); padding: 4px 9px; border-radius: 99px; white-space: nowrap;
    box-shadow: 0 4px 10px -3px rgba(232,89,12,0.6);
  }

  /* ---------- Frame (card) ---------- */
  .frame {
    position: relative; width: 208px; min-height: 172px;
    background: var(--frame-off); border: 1px solid var(--frame-off-bd);
    border-radius: 10px; padding: 14px 12px 12px; user-select: none;
    display: flex; flex-direction: column; align-items: center; text-align: center; gap: 7px;
    box-shadow: 0 2px 0 rgba(0,0,0,0.18), inset 0 1px 0 rgba(255,255,255,0.6);
    transition: transform .12s ease, box-shadow .12s ease;
  }
  .frame.has-children { cursor: pointer; }
  .frame.has-children:hover { transform: translateY(-3px); box-shadow: 0 12px 22px -10px rgba(0,0,0,0.4); }
  .frame.st-wip  { background: var(--frame-wip);  border-color: var(--frame-wip-bd); }
  .frame.st-done { background: var(--frame-done); border-color: var(--frame-done-bd); }
  .frame.blocked { outline: 2.5px dashed var(--danger); outline-offset: 2px; }
  .frame.end::after {
    content: "🏁 CÉL"; position: absolute; bottom: -1px; left: 50%; transform: translate(-50%, 50%);
    font-size: 0.6rem; font-weight: 800; letter-spacing: 0.1em; color: #fff;
    background: var(--accent); padding: 3px 10px; border-radius: 99px; white-space: nowrap;
  }

  .scene {
    position: absolute; top: -1px; left: -1px;
    font-family: var(--display); font-weight: 800; font-size: 0.8rem; color: #fff;
    background: var(--strip); padding: 3px 9px 4px; border-radius: 10px 0 10px 0;
  }
  .frame.st-wip .scene  { background: var(--frame-wip-bd); }
  .frame.st-done .scene { background: var(--frame-done-bd); }

  /* top-right cluster: blocked flag + status lamp */
  .tr-cluster { position: absolute; top: 7px; right: 7px; display: flex; align-items: center; gap: 6px; }
  .flag-btn {
    width: 24px; height: 24px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.18);
    background: rgba(255,255,255,0.85); font-size: 0.76rem; cursor: pointer; line-height: 1;
    display: flex; align-items: center; justify-content: center; opacity: 0.38; transition: all .12s;
  }
  .flag-btn:hover { opacity: 0.85; }
  .flag-btn.active { opacity: 1; background: #ffe1de; border-color: var(--danger); }

  .lamp {
    display: flex; gap: 4px; padding: 5px 7px; border-radius: 99px; cursor: pointer;
    background: rgba(20,18,14,0.42); box-shadow: inset 0 1px 2px rgba(0,0,0,0.45);
    transition: background .12s;
  }
  .lamp:hover { background: rgba(20,18,14,0.6); }
  .lamp .bulb { width: 11px; height: 11px; border-radius: 50%; background: rgba(255,255,255,0.14); transition: all .2s; }
  .lamp .bulb.grey.on  { background: #ece6d8; box-shadow: 0 0 0 1px rgba(255,255,255,0.3), 0 0 7px 1px rgba(236,230,216,0.75); }
  .lamp .bulb.amber.on { background: #ffc23a; box-shadow: 0 0 8px 1px rgba(255,194,58,0.9); }
  .lamp .bulb.green.on { background: #54c163; box-shadow: 0 0 8px 1px rgba(84,193,99,0.9); }

  .frame-icon {
    font-size: 1.85rem; margin-top: 14px;
    width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;
    background: rgba(255,255,255,0.55); border-radius: 12px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
  }
  .frame-title { font-size: 0.9rem; font-weight: 600; line-height: 1.22; }
  .frame-ref { font-size: 0.7rem; color: var(--ink-soft); font-weight: 500; }
  .frame-foot { margin-top: auto; width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
  .frame-status {
    display: inline-flex; align-items: center; gap: 6px;
    font-size: 0.7rem; font-weight: 700; letter-spacing: 0.02em;
    padding: 3px 10px; border-radius: 99px; background: rgba(0,0,0,0.06); color: var(--ink-soft);
  }
  .frame.st-wip .frame-status  { background: rgba(224,169,43,0.22); color: #96690a; }
  .frame.st-done .frame-status { background: rgba(63,157,76,0.2); color: #226b2c; }
  .frame-status .dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
  .drill { font-size: 0.82rem; opacity: 0.5; }
  .frame.has-children:hover .drill { opacity: 0.9; }

  .frame-small { width: 184px; min-height: 156px; }
  .frame-small .frame-icon { font-size: 1.5rem; width: 40px; height: 40px; }

  /* ---------- Cast ---------- */
  .cast { margin-top: 40px; }
  .cast-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
  .cast-card {
    display: flex; gap: 15px; padding: 16px 18px; align-items: flex-start;
    background: rgba(255,255,255,0.6); border: 1px solid rgba(0,0,0,0.08); border-radius: 14px;
    box-shadow: 0 8px 22px -18px rgba(0,0,0,0.5);
  }
  .cast-avatar {
    font-size: 1.9rem; width: 54px; height: 54px; flex: 0 0 auto;
    display: flex; align-items: center; justify-content: center;
    background: var(--paper); border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.05);
  }
  .cast-name { font-family: var(--display); font-weight: 700; font-size: 1.08rem; line-height: 1.15; }
  .cast-role {
    font-size: 0.66rem; letter-spacing: 0.07em; text-transform: uppercase; font-weight: 700;
    color: var(--accent); margin: 3px 0 7px;
  }
  .cast-bio { font-size: 0.85rem; line-height: 1.5; color: var(--ink-soft); }

  /* ---------- Story ---------- */
  .script { margin-top: 40px; }
  .script-head { display: flex; align-items: baseline; gap: 12px; margin: 0 2px 4px; }
  .script-head h2 { font-family: var(--display); font-weight: 700; font-size: 1.35rem; margin: 0; }
  .script-head .tag {
    font-size: 0.66rem; letter-spacing: 0.1em; text-transform: uppercase; font-weight: 700;
    color: var(--ink-soft); padding: 3px 9px; border-radius: 99px; background: rgba(0,0,0,0.06);
  }
  .script-sub { color: var(--ink-soft); font-size: 0.85rem; margin: 0 2px 16px; }
  .script-paper {
    background: #fbf8f1; border: 1px solid rgba(0,0,0,0.08); border-radius: 14px;
    padding: 28px 34px; box-shadow: 0 14px 34px -22px rgba(0,0,0,0.5);
  }
  .story-lead {
    font-family: var(--display); font-style: italic; font-size: 1.05rem; line-height: 1.6;
    color: var(--ink-soft); margin: 0 0 8px; padding-bottom: 18px; border-bottom: 1px solid rgba(0,0,0,0.08);
  }
  .act-title {
    font-weight: 700; font-size: 0.82rem; letter-spacing: 0.14em; text-transform: uppercase;
    color: var(--accent); margin: 26px 0 14px; padding-bottom: 6px; border-bottom: 1.5px dashed rgba(232,89,12,0.3);
  }

  .scene-block {
    position: relative; margin: 0 0 14px; padding: 16px 20px; border-radius: 12px;
    border-left: 5px solid var(--frame-off-bd); background: rgba(0,0,0,0.025);
    transition: background .2s, border-color .2s;
  }
  .scene-block.st-wip  { border-left-color: var(--frame-wip-bd);  background: rgba(224,169,43,0.11); }
  .scene-block.st-done { border-left-color: var(--frame-done-bd); background: rgba(63,157,76,0.1); }
  .scene-block.blocked { outline: 2px dashed var(--danger); outline-offset: 2px; }
  .scene-block.current { box-shadow: 0 0 0 2px var(--accent); }

  .scene-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 4px; }
  .scene-no {
    font-family: var(--display); font-weight: 800; font-size: 0.82rem; color: #fff; background: var(--strip);
    padding: 3px 9px; border-radius: 7px; letter-spacing: 0.03em;
  }
  .scene-block.st-wip  .scene-no { background: var(--frame-wip-bd); }
  .scene-block.st-done .scene-no { background: var(--frame-done-bd); }
  .chapter-title { font-family: var(--display); font-weight: 700; font-size: 1.22rem; line-height: 1.15; }
  .scene-badge {
    margin-left: auto; font-size: 0.68rem; font-weight: 700; padding: 2px 10px; border-radius: 99px;
    background: rgba(0,0,0,0.07); color: var(--ink-soft); letter-spacing: 0.03em; font-family: var(--sans);
  }
  .scene-block.st-wip  .scene-badge { background: rgba(224,169,43,0.25); color: #8a5f08; }
  .scene-block.st-done .scene-badge { background: rgba(63,157,76,0.22); color: #1f6329; }
  .here-marker {
    display: inline-flex; align-items: center; gap: 5px; font-family: var(--sans);
    font-size: 0.64rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
    color: #fff; background: var(--accent); padding: 3px 9px; border-radius: 99px;
    animation: pulse 1.6s ease-in-out infinite;
  }
  @keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.55; } }

  .scene-tech { font-size: 0.72rem; color: var(--ink-soft); font-weight: 500; margin: 0 0 8px; }
  .scene-story { font-size: 0.98rem; line-height: 1.62; color: var(--ink); margin: 0; }
  .scene-block.st-notstarted .scene-story { color: rgba(90,84,74,0.6); }

  .journey-done-note {
    margin-top: 20px; text-align: center; font-family: var(--display); font-style: italic; font-size: 1.05rem;
    color: #1f6329; background: rgba(63,157,76,0.14); padding: 16px; border-radius: 12px;
  }

  /* ---------- Modal ---------- */
  .modal-backdrop {
    position: fixed; inset: 0; background: rgba(20,18,14,0.62); backdrop-filter: blur(3px);
    display: flex; align-items: center; justify-content: center; padding: 24px; z-index: 50;
    animation: fade .15s ease;
  }
  @keyframes fade { from { opacity: 0; } to { opacity: 1; } }
  .modal-backdrop.hidden { display: none; }
  .modal-panel {
    background: radial-gradient(800px 300px at 20% -10%, #fbf7ee, transparent 60%), var(--paper);
    border-radius: 18px; padding: 24px 26px 28px; max-width: 1040px; width: 100%;
    max-height: 88vh; overflow-y: auto; box-shadow: 0 30px 70px -20px rgba(0,0,0,0.6);
  }
  #modal-back {
    font: inherit; font-size: 0.82rem; font-weight: 600; padding: 7px 14px; border-radius: 99px;
    border: 1px solid rgba(0,0,0,0.16); background: rgba(255,255,255,0.7); cursor: pointer; margin-bottom: 18px;
  }
  #modal-back:hover { background: #fff; }
  .modal-kicker { font-size: 0.7rem; letter-spacing: 0.16em; text-transform: uppercase; font-weight: 700; color: var(--accent); }
  #modal-title { font-family: var(--display); font-weight: 700; margin: 4px 0 2px; font-size: 1.5rem; }
  #modal-ref { margin: 0 0 20px; color: var(--ink-soft); font-size: 0.84rem; }
  #modal-children { display: flex; gap: 14px; flex-wrap: wrap; }

  footer { margin-top: 30px; font-size: 0.78rem; color: var(--ink-soft); line-height: 1.5; }
  footer strong { color: var(--ink); font-weight: 600; }

[hidden] { display: none !important; }

/* ================= Backend app: admin bar, editor, login, toast ================= */
.admin-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.mode-tag { font-size: 0.72rem; font-weight: 800; letter-spacing: 0.06em; color: #fff; background: var(--accent); padding: 4px 10px; border-radius: 99px; }
.seg { display: inline-flex; background: rgba(0,0,0,0.06); border-radius: 99px; padding: 3px; }
.seg-btn { font: inherit; font-size: 0.82rem; font-weight: 600; border: none; background: transparent; color: var(--ink-soft); padding: 6px 14px; border-radius: 99px; cursor: pointer; }
.seg-btn.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.15); }
.admin-bar .primary { font: inherit; font-size: 0.82rem; font-weight: 600; padding: 8px 15px; border-radius: 99px; border: none; background: var(--accent); color: #fff; cursor: pointer; }
.admin-bar .primary:hover { background: #d24e08; }
.admin-bar .ghost { font: inherit; font-size: 0.82rem; font-weight: 600; padding: 8px 14px; border-radius: 99px; border: 1px solid rgba(0,0,0,0.16); background: rgba(255,255,255,0.7); color: var(--ink); cursor: pointer; }
.save-note { font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); min-width: 84px; }

.lamp.readonly, .flag-btn.readonly { cursor: default; }
body.is-admin .frame .lamp { cursor: pointer; }

/* Editor */
#editor-root { margin-top: 22px; }
.ed-section { background: rgba(255,255,255,0.55); border: 1px solid rgba(0,0,0,0.08); border-radius: 16px; padding: 18px 20px 22px; margin-bottom: 18px; }
.ed-h { font-family: var(--display); font-weight: 700; font-size: 1.15rem; margin: 0 0 14px; }
.ed-acts { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; margin-top: 12px; }
.ed-field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.ed-field.wide { flex: 1 1 100%; }
.ed-label { font-size: 0.68rem; letter-spacing: 0.05em; text-transform: uppercase; font-weight: 700; color: var(--ink-soft); }
.ed-field input, .ed-field textarea { font: inherit; font-size: 0.9rem; padding: 8px 10px; border: 1px solid rgba(0,0,0,0.16); border-radius: 8px; background: #fff; color: var(--ink); width: 100%; }
.ed-field textarea { min-height: 74px; resize: vertical; line-height: 1.5; }
.ed-field input.ed-small { width: 64px; text-align: center; font-size: 1.1rem; }
.ed-field.wide input, .ed-field.wide textarea { width: 100%; }

.ed-card { background: #fbf8f1; border: 1px solid rgba(0,0,0,0.09); border-radius: 12px; padding: 14px 16px; margin-bottom: 14px; }
.ed-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ed-chip { font-size: 0.78rem; font-weight: 700; color: var(--ink-soft); background: rgba(0,0,0,0.06); padding: 3px 10px; border-radius: 99px; }
.ed-mini { width: 30px; height: 30px; border-radius: 8px; border: 1px solid rgba(0,0,0,0.16); background: #fff; cursor: pointer; font-size: 0.9rem; }
.ed-mini:hover { background: #f3f0e9; }
.ed-row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.ed-row .ed-field { flex: 1 1 200px; }
.ed-row .ed-field.wide { flex: 2 1 300px; }

.ed-check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.85rem; color: var(--ink-soft); margin: 4px 0 12px; }
.ed-steps { margin-top: 8px; border-top: 1px dashed rgba(0,0,0,0.14); padding-top: 12px; }
.ed-steps-h { font-size: 0.72rem; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 700; color: var(--ink-soft); margin-bottom: 10px; }
.ed-step-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; background: rgba(0,0,0,0.02); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; }
.ed-step-row .ed-field { flex: 1 1 160px; margin-bottom: 0; }
.ed-step-row .ed-field.wide { flex: 2 1 240px; }
.ed-step-ctrls { display: flex; gap: 6px; }
.ed-add { font: inherit; font-size: 0.85rem; font-weight: 600; padding: 9px 16px; border-radius: 10px; border: 1.5px dashed var(--accent-soft); background: rgba(240,140,0,0.06); color: #b4560a; cursor: pointer; }
.ed-add.sm { font-size: 0.8rem; padding: 6px 12px; }
.ed-add:hover { background: rgba(240,140,0,0.14); }

/* Login */
.login-panel { background: var(--paper); border-radius: 18px; padding: 28px 30px; max-width: 420px; width: 100%; box-shadow: 0 30px 70px -20px rgba(0,0,0,0.6); }
.login-title { font-family: var(--display); font-weight: 700; font-size: 1.3rem; margin: 6px 0 18px; }
#login-form { display: flex; gap: 10px; }
#login-form input { font: inherit; flex: 1; padding: 10px 12px; border: 1px solid rgba(0,0,0,0.2); border-radius: 10px; }
#login-form .primary { font: inherit; font-weight: 600; padding: 10px 18px; border-radius: 10px; border: none; background: var(--accent); color: #fff; cursor: pointer; }
.login-error { color: var(--danger); font-weight: 600; font-size: 0.85rem; margin: 12px 0 0; }
.login-hint { margin: 16px 0 0; font-size: 0.85rem; }
.login-hint a, footer a { color: var(--accent); text-decoration: none; font-weight: 600; }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); background: var(--strip); color: #fff; padding: 12px 20px; border-radius: 12px; font-size: 0.88rem; font-weight: 600; box-shadow: 0 12px 30px -10px rgba(0,0,0,0.5); z-index: 80; }

/* ================= Images (scene / cast / story / editor) ================= */
.frame-photo {
  width: 100%; height: 84px; object-fit: cover; border-radius: 8px; margin-top: 14px;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.cast-photo {
  width: 54px; height: 54px; flex: 0 0 auto; object-fit: cover;
  border-radius: 14px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.scene-illus-row { display: flex; gap: 16px; align-items: flex-start; }
.scene-illus {
  width: 150px; height: 108px; flex: 0 0 auto; object-fit: cover; border-radius: 10px;
  box-shadow: 0 6px 16px -10px rgba(0,0,0,0.5), inset 0 0 0 1px rgba(0,0,0,0.06);
}
.scene-illus-text { flex: 1; min-width: 0; }
@media (max-width: 560px) {
  .scene-illus-row { flex-direction: column; }
  .scene-illus { width: 100%; height: 160px; }
}

/* editor image control */
.ed-image { margin: 4px 0 12px; }
.ed-image-row { display: flex; align-items: center; gap: 12px; }
.ed-image-prev {
  width: 84px; height: 60px; border-radius: 8px; overflow: hidden; flex: 0 0 auto;
  border: 1px solid rgba(0,0,0,0.14); background: #fff; display: flex; align-items: center; justify-content: center;
}
.ed-image-prev img { width: 100%; height: 100%; object-fit: cover; }
.ed-image-prev.empty { font-size: 0.72rem; color: var(--ink-soft); background: rgba(0,0,0,0.03); }
