/* ══════════════════════════════════════════════════════════════
   Sastera — interactive AI storytelling
   Dark anime-fantasy UI. Original design.
   ══════════════════════════════════════════════════════════════ */

:root {
  --bg:          #0b0a0f;
  --bg-2:        #12111a;
  --surface:     #17161f;
  --surface-2:   #1e1c28;
  --surface-3:   #262332;
  --line:        #2c2938;
  --line-soft:   #23212d;

  --text:        #ece9f3;
  --text-2:      #a9a4b8;
  --text-3:      #6f6a80;

  --accent:      #b98cff;
  --accent-2:    #7c5cff;
  --accent-soft: rgba(185, 140, 255, 0.14);
  --gold:        #e8c07d;
  --ember:       #ff8a5c;
  --green:       #5fd39a;
  --amber:       #e8b04b;
  --red:         #ff6b6b;

  --radius:      14px;
  --radius-sm:   10px;
  --radius-lg:   20px;

  --serif: "Lora", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans:  ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

  --composer-h: 150px;
  --safe-b: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  overscroll-behavior-y: none;
}

body { overflow: hidden; }

button { font: inherit; color: inherit; cursor: pointer; border: none; background: none; }
input, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 6px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #3a3650; }

.screen { position: fixed; inset: 0; display: flex; flex-direction: column; }
.screen[hidden] { display: none; }

/* ══════════════════════════ LANDING ══════════════════════════ */

.landing-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(1200px 700px at 78% -10%, rgba(124, 92, 255, 0.20), transparent 60%),
    radial-gradient(900px 600px at 10% 110%, rgba(255, 138, 92, 0.10), transparent 60%),
    linear-gradient(180deg, #0d0c13 0%, #0b0a0f 60%);
}
.landing-bg::after {
  content: ''; position: absolute; inset: 0;
  background-image: radial-gradient(rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 3px 3px; opacity: 0.5; pointer-events: none;
}

.gnb {
  position: relative; z-index: 2;
  display: flex; align-items: center; gap: 20px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line-soft);
  backdrop-filter: blur(12px);
}
.brand { display: flex; align-items: center; gap: 9px; font-weight: 700; letter-spacing: 0.2px; }
.brand-mark {
  display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-size: 14px;
  box-shadow: 0 0 18px rgba(124, 92, 255, 0.45);
}
.brand-name { font-size: 16px; }
.gnb-nav { display: flex; gap: 4px; margin-left: 6px; }
.gnb-link {
  padding: 7px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  color: var(--text-3); transition: 0.16s;
}
.gnb-link:hover { color: var(--text-2); background: var(--surface); }
.gnb-link.active { color: var(--text); background: var(--surface-2); }
.gnb-right { margin-left: auto; }
.pill {
  padding: 5px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line);
}
.pill-free {
  color: var(--green);
  border-color: rgba(95, 211, 154, 0.3);
  background: rgba(95, 211, 154, 0.09);
}

.landing-main {
  position: relative; z-index: 1;
  flex: 1; overflow-y: auto;
  display: flex; align-items: center; justify-content: center;
  padding: 28px 22px 48px;
}

.hero-card {
  width: min(980px, 100%);
  background: linear-gradient(180deg, var(--surface) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 30px 90px rgba(0,0,0,0.55);
}

.hero-art { position: relative; aspect-ratio: 1644 / 620; overflow: hidden; background: #0a0910; }
.hero-art img { width: 100%; height: 100%; object-fit: cover; object-position: center 22%; }
.hero-art-fade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,10,15,0.15) 0%, transparent 35%, rgba(18,17,26,0.85) 78%, var(--bg-2) 100%);
}
.hero-art-meta { position: absolute; top: 16px; left: 16px; display: flex; gap: 8px; }
.badge {
  padding: 5px 11px; border-radius: 8px; font-size: 11.5px; font-weight: 700;
  letter-spacing: 0.4px; text-transform: uppercase;
  background: rgba(124, 92, 255, 0.9); color: #fff;
}
.badge-dim { background: rgba(20,18,28,0.78); color: var(--text-2); backdrop-filter: blur(6px); }

.hero-body { padding: 4px 30px 30px; margin-top: -34px; position: relative; }
.hero-title {
  margin: 0 0 6px; font-family: var(--serif); font-size: clamp(30px, 5vw, 44px);
  font-weight: 700; letter-spacing: -0.4px; line-height: 1.1;
}
.hero-tagline {
  margin: 0 0 14px; color: var(--gold); font-size: 14.5px; font-weight: 600; letter-spacing: 0.2px;
}
.hero-synopsis {
  margin: 0 0 20px; color: var(--text-2); font-size: 14.5px; line-height: 1.68; max-width: 68ch;
}

.cast-strip { display: flex; gap: 10px; overflow-x: auto; padding: 4px 2px 16px; scrollbar-width: none; }
.cast-strip::-webkit-scrollbar { display: none; }
.cast-card {
  flex: 0 0 auto; width: 92px; text-align: center; cursor: pointer;
  transition: transform 0.18s;
}
.cast-card:hover { transform: translateY(-3px); }
.cast-avatar {
  width: 76px; height: 76px; margin: 0 auto 7px; border-radius: 50%; overflow: hidden;
  border: 2px solid var(--line); background: var(--surface-2);
  box-shadow: 0 6px 18px rgba(0,0,0,0.4);
}
.cast-avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 18%; }
.cast-name { font-size: 11.5px; font-weight: 600; color: var(--text-2); line-height: 1.25; }
.cast-tier { font-size: 10px; color: var(--text-3); }

.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.hero-note { margin: 0; font-size: 12.5px; color: var(--text-3); }

/* ══════════════════════════ BUTTONS ══════════════════════════ */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 20px; border-radius: 11px;
  font-size: 14px; font-weight: 600;
  transition: 0.16s; border: 1px solid transparent; white-space: nowrap;
}
.btn-lg { padding: 15px 28px; font-size: 15.5px; border-radius: 13px; }
.btn-block { width: 100%; }
.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
  color: #fff;
  box-shadow: 0 8px 26px rgba(124, 92, 255, 0.34);
}
.btn-primary:hover { filter: brightness(1.09); transform: translateY(-1px); box-shadow: 0 12px 32px rgba(124, 92, 255, 0.44); }
.btn-primary:active { transform: translateY(0); }
.btn-primary[disabled] { opacity: 0.5; cursor: not-allowed; transform: none; filter: none; }
.btn-ghost { background: var(--surface-2); color: var(--text-2); border-color: var(--line); }
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }

.icon-btn {
  display: grid; place-items: center; width: 36px; height: 36px;
  border-radius: 9px; color: var(--text-2); transition: 0.15s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ═════════════════════ CHARACTER CREATION ═════════════════════ */

.creation-wrap {
  flex: 1; overflow-y: auto; width: min(620px, 100%); margin: 0 auto;
  padding: 20px 22px 60px;
}
.back-btn {
  display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px;
  color: var(--text-3); font-size: 13.5px; padding: 6px 10px; border-radius: 8px;
}
.back-btn:hover { color: var(--text); background: var(--surface); }
.creation-head { margin-bottom: 26px; }
.creation-head h2 { margin: 0 0 6px; font-family: var(--serif); font-size: 26px; }
.creation-head p { margin: 0; color: var(--text-3); font-size: 14px; }

.form-group { margin-bottom: 26px; }
.form-label {
  display: block; margin-bottom: 9px; font-size: 12px; font-weight: 700;
  letter-spacing: 0.6px; text-transform: uppercase; color: var(--text-3);
}
.input {
  width: 100%; padding: 13px 15px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); font-size: 15px; outline: none; transition: 0.15s;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input::placeholder { color: var(--text-3); }

.chip-row { display: flex; gap: 8px; flex-wrap: wrap; }
.chip {
  padding: 9px 16px; border-radius: 999px; font-size: 13.5px; font-weight: 500;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2); transition: 0.15s;
}
.chip:hover { border-color: #3a3650; color: var(--text); }
.chip.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

.opt-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.opt-card {
  text-align: left; padding: 14px 15px; border-radius: 12px;
  background: var(--surface); border: 1.5px solid var(--line); transition: 0.15s;
}
.opt-card:hover { border-color: #3a3650; background: var(--surface-2); }
.opt-card.active { border-color: var(--accent); background: var(--accent-soft); }
.opt-card-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14.5px; margin-bottom: 4px; }
.opt-card-blurb { font-size: 12.5px; color: var(--text-3); line-height: 1.45; }
.opt-sigil { font-size: 16px; }

/* ══════════════════════════ PLAY ══════════════════════════ */

.play-top {
  position: relative; z-index: 5;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; padding-top: calc(10px + env(safe-area-inset-top, 0px));
  border-bottom: 1px solid var(--line-soft);
  background: rgba(11,10,15,0.92); backdrop-filter: blur(12px);
}
.play-title { font-family: var(--serif); font-size: 16px; font-weight: 600; }
.play-top-right { margin-left: auto; display: flex; gap: 2px; }

/* scene art — kept deliberately short: it is atmosphere, not the point. The
   reading area below it is what the player needs to make a decision. */
.scene-art {
  position: relative; z-index: 1; flex: 0 0 auto; height: 22vh; min-height: 108px; max-height: 190px;
  overflow: hidden; background: #0a0910;
  transition: height 0.28s ease, opacity 0.5s;
}
/* Once the player scrolls into the prose, the art shrinks to a slim band so
   the transcript gets the full height. */
#play.scrolled .scene-art { height: 56px; min-height: 56px; }
#play.scrolled .scene-loc { font-size: 10px; padding: 3px 8px; bottom: 6px; }
.scene-art img {
  width: 100%; height: 100%; object-fit: cover; object-position: center 20%;
  animation: artIn 0.6s ease;
}
@keyframes artIn { from { opacity: 0; transform: scale(1.04); } to { opacity: 1; transform: none; } }
.scene-art-fade {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(11,10,15,0.45) 0%, transparent 30%, rgba(11,10,15,0.55) 70%, var(--bg) 100%);
}
.scene-loc {
  position: absolute; left: 16px; bottom: 12px;
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.6px; text-transform: uppercase;
  color: var(--text-2); text-shadow: 0 2px 10px rgba(0,0,0,0.9);
  padding: 5px 11px; border-radius: 7px;
  background: rgba(12,11,18,0.6); backdrop-filter: blur(6px);
}

/* transcript */
.transcript {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  scroll-behavior: smooth; -webkit-overflow-scrolling: touch;
  padding-bottom: 8px;
}
.transcript-inner { width: min(760px, 100%); margin: 0 auto; padding: 6px 20px 20px; }

/* Give the reading area breathing room — a cramped transcript is unreadable. */
.transcript { min-height: 0; }
.prose p { margin: 0 0 14px; }
.prose p:last-child { margin-bottom: 0; }

.turn { margin-bottom: 26px; animation: turnIn 0.35s ease; }
@keyframes turnIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.turn-header {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 10px; padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--text-3); letter-spacing: 0.2px;
  font-variant-numeric: tabular-nums;
}
.turn-header .turn-day { color: var(--accent); font-weight: 700; }
.turn-header .turn-loc { color: var(--text-2); font-weight: 600; }

.player-move {
  display: flex; gap: 10px; margin: 0 0 12px;
  padding: 10px 14px; border-radius: 11px;
  background: var(--surface); border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
}
.player-move .pm-mark { color: var(--accent); font-weight: 700; flex: 0 0 auto; }
.player-move .pm-text { color: var(--text-2); font-style: italic; font-size: 14px; line-height: 1.5; }

.prose { font-family: var(--serif); font-size: 16.5px; line-height: 1.78; color: #ded9ea; }
.prose p { margin: 0 0 15px; }
.prose p:last-child { margin-bottom: 0; }
.prose em { font-style: italic; color: var(--text-2); }

/* dialogue, OOC style: 💬Name | "…" */
.dlg { margin: 0 0 14px; padding-left: 14px; border-left: 2px solid var(--accent-2); }
.dlg-speaker {
  display: flex; align-items: center; gap: 7px;
  font-family: var(--sans); font-size: 12.5px; font-weight: 700;
  color: var(--gold); letter-spacing: 0.3px; margin-bottom: 3px;
}
.dlg-avatar {
  width: 22px; height: 22px; border-radius: 50%; object-fit: cover;
  object-position: center 18%; border: 1px solid var(--line); flex: 0 0 auto;
}
.dlg-beat { font-family: var(--sans); font-style: italic; font-size: 13.5px; color: var(--text-3); margin-bottom: 4px; }
.dlg-line { font-family: var(--serif); font-size: 16.5px; line-height: 1.72; color: #ece6f7; }

.stream-cursor {
  display: inline-block; width: 8px; height: 1.05em; margin-left: 2px;
  background: var(--accent); vertical-align: text-bottom;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { to { visibility: hidden; } }

/* status block — mirrors OOC's per-turn info panel */
.status-block {
  margin-top: 14px; padding: 12px 14px; border-radius: 11px;
  background: rgba(23,22,31,0.7); border: 1px solid var(--line-soft);
  font-family: var(--sans); font-size: 12px; line-height: 1.6; color: var(--text-2);
}
.status-block summary {
  cursor: pointer; list-style: none; display: flex; align-items: center; gap: 7px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.7px; text-transform: uppercase; color: var(--text-3);
  user-select: none;
}
/* Add an affordance so it reads as collapsible rather than a dead label. */
.status-block summary::after {
  content: '▾'; margin-left: auto; font-size: 10px; opacity: 0.65;
  transition: transform 0.18s ease;
}
.status-block:not([open]) summary::after { transform: rotate(-90deg); }
.status-block summary::-webkit-details-marker { display: none; }
.status-block summary:hover { color: var(--text-2); }
.status-body { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.status-row { display: flex; gap: 8px; padding: 2px 0; }
.status-k { flex: 0 0 84px; color: var(--text-3); font-weight: 600; }
.status-v { flex: 1; color: var(--text-2); }
.status-div { height: 1px; background: var(--line-soft); margin: 7px 0; }
.rel-item { display: flex; align-items: center; gap: 8px; padding: 3px 0; }
.rel-bar { flex: 1; height: 4px; border-radius: 3px; background: var(--surface-3); overflow: hidden; max-width: 110px; }
.rel-fill { height: 100%; border-radius: 3px; transition: width 0.5s; }
.rel-val { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 30px; text-align: right; }
.talent-row { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 4px; }
.talent {
  padding: 3px 9px; border-radius: 7px; font-size: 11px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-3);
}
.talent.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.flag-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-left: 5px; }
.flag-green { background: var(--green); }
.flag-amber { background: var(--amber); }
.flag-red { background: var(--red); }

/* ══════════════════════════ COMPOSER ══════════════════════════ */

.composer {
  flex: 0 0 auto; z-index: 6;
  padding: 10px 14px calc(10px + var(--safe-b));
  background: rgba(13,12,18,0.96); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line-soft);
  /* Never let the composer crowd out the reading area — the transcript is the
     point of the screen. Suggestions scroll inside their own capped region. */
  max-height: 42vh;
  display: flex; flex-direction: column;
}
.composer-inner { width: min(760px, 100%); margin: 0 auto; }

.route-row {
  display: flex; flex-wrap: wrap; gap: 8px; padding: 2px 0 9px;
  max-height: 20vh; overflow-y: auto; scrollbar-width: thin;
}
.route-chip {
  flex: 1 1 240px; min-width: 0; max-width: 100%; text-align: left;
  padding: 9px 13px; border-radius: 11px; font-size: 12.5px; line-height: 1.4;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2);
  transition: 0.15s; white-space: normal; word-break: break-word;
}
.route-chip:hover { border-color: var(--accent); color: var(--text); background: var(--surface-2); }
.route-chip:disabled { opacity: 0.45; cursor: not-allowed; }

.composer-input-row {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 13px; padding: 6px 6px 6px 14px; transition: 0.15s;
}
.composer-input-row:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.composer-input {
  flex: 1; border: none; background: none; outline: none; resize: none;
  max-height: 140px; min-height: 24px; padding: 7px 0;
  font-size: 14.5px; line-height: 1.5; color: var(--text);
}
.composer-input::placeholder { color: var(--text-3); }
.send-btn {
  flex: 0 0 auto; display: grid; place-items: center; width: 38px; height: 38px;
  border-radius: 10px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  transition: 0.15s;
}
.send-btn:hover { filter: brightness(1.1); }
.send-btn:disabled { opacity: 0.4; cursor: not-allowed; filter: none; }

.composer-foot { display: flex; align-items: center; gap: 12px; margin-top: 8px; }
.btn-continue {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 15px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--line); color: var(--text-2); transition: 0.15s;
}
.btn-continue:hover { background: var(--surface-2); color: var(--text); border-color: #3a3650; }
.btn-continue:disabled { opacity: 0.4; cursor: not-allowed; }
.composer-hint { margin-left: auto; font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }

.thinking {
  position: absolute; left: 50%; bottom: calc(var(--composer-h) + 16px); transform: translateX(-50%);
  z-index: 7; display: flex; align-items: center; gap: 5px;
  padding: 8px 15px; border-radius: 999px;
  background: rgba(23,22,31,0.95); border: 1px solid var(--line);
  box-shadow: 0 8px 26px rgba(0,0,0,0.5); backdrop-filter: blur(8px);
}
.thinking[hidden] { display: none; }
.thinking .dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); animation: bounce 1.3s infinite; }
.thinking .dot:nth-child(2) { animation-delay: 0.16s; }
.thinking .dot:nth-child(3) { animation-delay: 0.32s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-4px); opacity: 1; } }
.thinking-label { margin-left: 5px; font-size: 12px; color: var(--text-3); }

/* ══════════════════════════ DRAWER ══════════════════════════ */

.drawer-backdrop {
  position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,0.6);
  backdrop-filter: blur(2px); animation: fadeIn 0.2s;
}
.drawer-backdrop[hidden] { display: none; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(410px, 90vw); display: flex; flex-direction: column;
  background: var(--bg-2); border-left: 1px solid var(--line);
  box-shadow: -20px 0 60px rgba(0,0,0,0.6);
  animation: slideIn 0.24s cubic-bezier(0.32, 0.72, 0, 1);
}
.drawer[hidden] { display: none; }
@keyframes slideIn { from { transform: translateX(100%); } to { transform: none; } }

.drawer-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px;
  border-bottom: 1px solid var(--line-soft);
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}
.drawer-tabs { display: flex; gap: 3px; }
.drawer-tab {
  padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--text-3);
}
.drawer-tab:hover { color: var(--text-2); background: var(--surface); }
.drawer-tab.active { color: var(--text); background: var(--surface-2); }
.drawer-head .icon-btn { margin-left: auto; }

.drawer-body { flex: 1; overflow-y: auto; padding: 14px; }
.drawer-panel[hidden] { display: none; }

.panel-section { margin-bottom: 20px; }
.panel-section-title {
  font-size: 11px; font-weight: 700; letter-spacing: 0.8px; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 9px; padding-bottom: 6px;
  border-bottom: 1px solid var(--line-soft);
}
.kv { display: flex; gap: 10px; padding: 4px 0; font-size: 13px; }
.kv-k { flex: 0 0 96px; color: var(--text-3); }
.kv-v { flex: 1; color: var(--text-2); }

.cast-row { display: flex; gap: 11px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line-soft); }
.cast-row:last-child { border-bottom: none; }
.cast-row-avatar { width: 44px; height: 44px; border-radius: 9px; object-fit: cover; object-position: center 18%; border: 1px solid var(--line); flex: 0 0 auto; background: var(--surface-2); }
/* Characters named in canon but with no portrait on the CDN get an initial
   rather than a request that would 404. */
.cast-avatar-none, .cast-row-avatar.cast-avatar-none {
  display: grid; place-items: center; width: 44px; height: 44px;
  border-radius: 9px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--text-3); font-weight: 700; font-size: 15px; flex: 0 0 auto;
}
.cast-avatar .cast-avatar-none { width: 100%; height: 100%; border-radius: 50%; border: none; background: var(--surface-3); font-size: 22px; }
.cast-row-main { flex: 1; min-width: 0; }
.cast-row-name { font-size: 13.5px; font-weight: 600; display: flex; align-items: center; gap: 6px; }
.cast-row-tier { font-size: 10.5px; padding: 2px 7px; border-radius: 5px; background: var(--surface-2); color: var(--text-3); border: 1px solid var(--line); font-weight: 600; }
.cast-row-sum { font-size: 12px; color: var(--text-3); line-height: 1.42; margin-top: 2px; }
.cast-row-affinity { flex: 0 0 auto; font-size: 12px; font-weight: 700; font-variant-numeric: tabular-nums; }

.fact-item { padding: 7px 0; font-size: 12.5px; color: var(--text-2); line-height: 1.5; border-bottom: 1px solid var(--line-soft); }
.fact-item:last-child { border-bottom: none; }
.event-item { display: flex; gap: 8px; padding: 5px 0; font-size: 12px; color: var(--text-3); }
.event-item .ev-turn { flex: 0 0 auto; color: var(--text-3); opacity: 0.7; font-variant-numeric: tabular-nums; }
.empty-note { color: var(--text-3); font-size: 13px; font-style: italic; padding: 12px 0; }

/* ══════════════════════════ RESPONSIVE ══════════════════════════ */

@media (max-width: 720px) {
  .hero-body { padding: 4px 20px 24px; }
  .hero-art { aspect-ratio: 1644 / 900; }
  .prose, .dlg-line { font-size: 16px; }
  .transcript-inner { padding: 6px 16px 16px; }
  .scene-art { height: 26vh; }
  :root { --composer-h: 148px; }
}

@media (max-width: 420px) {
  .gnb { padding: 12px 14px; gap: 10px; }
  .gnb-nav { display: none; }
  .composer-input-row { padding-left: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
