:root {
  --bg: #0d0a10;
  --panel: #1b1523;
  --panel-2: #241c2e;
  --line: #2f2439;
  --text: #f3ebf6;
  --muted: #a293ad;
  --accent: #ff4f8b;
  --accent-2: #ff8a5c;
  --action: #ffb347;
  --action-soft: #a8a1b0;
  --danger: #ff6b6b;
  --serif: Georgia, 'Times New Roman', serif;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

html, body { margin: 0; height: 100%; }
body {
  color: var(--text);
  background:
    radial-gradient(1100px 600px at 85% -10%, #3b1231 0%, transparent 60%),
    radial-gradient(900px 500px at -10% 110%, #1b1a45 0%, transparent 60%),
    var(--bg);
  background-attachment: fixed;
  font-size: 15px;
  line-height: 1.5;
}

.screen { min-height: 100dvh; }
.centered { display: grid; place-items: center; padding: 24px; }

.card {
  background: rgba(27, 21, 35, 0.86);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 32px;
  backdrop-filter: blur(10px);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.5);
}
.narrow { max-width: 440px; text-align: center; }
.wide { width: min(780px, 100%); }

.logo {
  font-family: var(--serif);
  font-style: italic;
  font-weight: 700;
  font-size: 58px;
  margin: 0 0 8px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.small-logo { font-size: 30px; margin: 0; }
.tiny-logo { font-size: 22px; margin: 0; }

h2 { font-family: var(--serif); font-weight: 400; font-size: 30px; margin: 4px 0 20px; }
h3 { font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); margin: 26px 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.error { color: var(--danger); }
.stack { display: grid; gap: 10px; margin-top: 20px; }
.code-field { text-align: left; margin-top: 18px; }

.btn {
  font: inherit;
  border: 0;
  border-radius: 999px;
  padding: 11px 22px;
  cursor: pointer;
  color: var(--text);
  transition: transform 0.12s ease, opacity 0.2s;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.primary { background: linear-gradient(135deg, var(--accent), #c9357a); font-weight: 600; box-shadow: 0 8px 24px rgba(255, 79, 139, 0.3); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { padding: 6px 14px; font-size: 13px; }
.btn.big { width: 100%; padding: 15px; font-size: 16px; margin-top: 26px; }

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.field { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 11px 13px;
  width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(255, 79, 139, 0.5); outline-offset: 1px; }

.personas { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.persona {
  display: grid;
  gap: 4px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.persona { position: relative; }
.persona input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.persona strong { font-size: 14px; }
.persona span { font-size: 12.5px; color: var(--muted); line-height: 1.4; }
.persona:has(input:checked) { border-color: var(--accent); background: rgba(255, 79, 139, 0.1); }
#custom-persona { margin-top: 10px; resize: vertical; }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented label { position: relative; }
.segmented input { position: absolute; top: 0; left: 0; width: 1px; height: 1px; opacity: 0; }
.segmented span {
  display: block;
  text-align: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel-2);
  cursor: pointer;
}
.segmented input:checked + span { border-color: var(--accent); background: rgba(255, 79, 139, 0.12); }

/* ---------- story ---------- */
/* --app-height follows the visual viewport (set in app.js) so the composer stays above the on-screen keyboard. */
#story { display: flex; flex-direction: column; height: var(--app-height, 100dvh); overflow: hidden; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: max(12px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) 12px max(20px, env(safe-area-inset-left));
  border-bottom: 1px solid var(--line);
  background: rgba(13, 10, 16, 0.75);
  backdrop-filter: blur(10px);
}
.chapter-label { flex: 1; text-align: center; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.feed {
  flex: 1;
  overflow-y: auto;
  padding: 24px max(16px, calc((100% - 720px) / 2)) 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  /* The empty set of the current place, faint behind the chat (set per chapter in app.js). */
  background: linear-gradient(rgba(13, 10, 16, 0.88), rgba(13, 10, 16, 0.95)), var(--backdrop, none) center / cover no-repeat;
}

.appear { animation: appear 0.35s ease both; }
@keyframes appear { from { opacity: 0; transform: translateY(8px); } }

.msg { max-width: min(82%, 560px); }
.msg.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), #c2367a);
  padding: 10px 15px;
  border-radius: 18px 18px 4px 18px;
  white-space: pre-wrap;
}
.msg.char { align-self: flex-start; }
.msg.char .speaker { font-size: 12px; font-weight: 700; margin: 0 0 4px 4px; letter-spacing: 0.02em; }
.msg.char .bubble {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 10px 15px;
  border-radius: 18px 18px 18px 4px;
  white-space: pre-wrap;
}
.narration em { opacity: 0.8; }
/* *actions* inside a line: calm gray italic serif, so what they do never reads like what they say. */
.msg.char .bubble em, .media-caption em {
  font-family: var(--serif);
  font-style: italic;
  color: var(--action-soft);
  letter-spacing: 0.01em;
}
.msg.user em {
  font-family: var(--serif);
  font-style: italic;
  background: rgba(20, 8, 16, 0.28);
  padding: 1px 6px;
  border-radius: 6px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}
.msg.user.act em { background: none; padding: 0; }

.narration {
  align-self: center;
  max-width: 580px;
  text-align: center;
  color: var(--muted);
  font-family: var(--serif);
  font-style: italic;
  font-size: 15.5px;
  line-height: 1.6;
  margin: 4px 0;
}

.action {
  align-self: stretch;
  border-left: 3px solid var(--action);
  background: linear-gradient(90deg, rgba(255, 179, 71, 0.16), transparent 80%);
  padding: 12px 16px;
  border-radius: 6px;
  font-weight: 600;
}
.action::before { content: '⚡ '; }

.sms {
  align-self: center;
  width: min(320px, 92%);
  background: #f5f4f8;
  color: #16121a;
  border-radius: 18px;
  padding: 10px 14px 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}
.sms .from { font-size: 11.5px; color: #6b6474; display: flex; justify-content: space-between; margin-bottom: 3px; }
.sms .from b { color: #16121a; font-size: 13px; }

.chapter { align-self: center; text-align: center; margin: 26px 0 10px; }
.chapter small { color: var(--accent); letter-spacing: 0.32em; text-transform: uppercase; font-size: 11px; }
.chapter h3 { font-family: var(--serif); font-style: italic; font-weight: 400; font-size: 30px; letter-spacing: 0; text-transform: none; color: var(--text); margin: 4px 0 0; }
.chapter::after { content: ''; display: block; width: 60px; height: 1px; margin: 14px auto 0; background: linear-gradient(90deg, transparent, var(--accent), transparent); }

.ending { align-self: center; text-align: center; margin: 30px 0; }
.ending h3 { font-family: var(--serif); font-style: italic; font-size: 40px; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text); margin: 0 0 16px; }

.notice { align-self: center; color: var(--danger); font-size: 13px; text-align: center; }

.typing { align-self: flex-start; display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.dots { display: inline-flex; gap: 4px; background: var(--panel); border: 1px solid var(--line); padding: 10px 13px; border-radius: 16px; }
.dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); animation: blink 1.2s infinite; }
.dots i:nth-child(2) { animation-delay: 0.2s; }
.dots i:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }

.shake { animation: shake 0.45s ease; }
@keyframes shake {
  20% { transform: translate(-6px, 2px); }
  40% { transform: translate(5px, -2px); }
  60% { transform: translate(-3px, 1px); }
  80% { transform: translate(2px, 0); }
}

.phone-toast {
  position: fixed;
  top: 64px;
  left: 50%;
  transform: translateX(-50%);
  width: min(360px, 92%);
  z-index: 10;
  background: rgba(245, 244, 248, 0.97);
  color: #16121a;
  border-radius: 18px;
  padding: 12px 16px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.55);
  animation: drop 0.4s cubic-bezier(0.2, 1.4, 0.4, 1) both;
}
.phone-toast b { display: block; font-size: 13px; }
@keyframes drop { from { transform: translate(-50%, -140%); } }

.composer {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 12px max(16px, calc((100% - 720px) / 2)) max(14px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(13, 10, 16, 0.85);
  backdrop-filter: blur(10px);
}
.composer-fields { flex: 1; min-width: 0; display: grid; gap: 6px; }
.cfield { position: relative; display: block; }
.cfield .ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 16px; pointer-events: none; }
.cfield.say .ico { top: 22px; }
.cfield input, .cfield textarea { padding-left: 42px; border-radius: 20px; }
/* Do and say are equal partners — same size, same weight; neither reads as the "real" one.
   The do-box keeps the italic serif that actions get in the story, so you see what it becomes. */
.cfield input, .cfield textarea { padding-top: 11px; padding-bottom: 11px; }
.cfield textarea { resize: none; max-height: 140px; display: block; }
.cfield.do input { font-family: var(--serif); font-style: italic; color: var(--action-soft); }
.cfield input::placeholder, .cfield textarea::placeholder { color: rgba(168, 161, 176, 0.75); }
.composer .btn { flex: none; min-height: 44px; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .centered { padding: 14px; align-items: start; }
  .card { padding: 22px 18px; border-radius: 20px; }
  .grid2 { grid-template-columns: 1fr; }
  .logo:not(.small-logo):not(.tiny-logo) { font-size: 46px; }
  h2 { font-size: 26px; }
  .personas { grid-template-columns: 1fr; }
  .persona { padding: 12px 14px; }
  .topbar { gap: 10px; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  .chapter-label { font-size: 12px; text-align: left; }
  .feed { padding: 18px 12px 24px; gap: 10px; }
  .msg { max-width: 88%; }
  .narration { font-size: 16px; padding: 0 6px; }
  .chapter h3 { font-size: 26px; }
  .phone-toast { top: calc(58px + env(safe-area-inset-top)); }
  .composer { padding: 10px max(10px, env(safe-area-inset-right)) max(10px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left)); }
  .composer .btn { padding: 11px 16px; min-height: 44px; }
}

/* iOS zooms into any focused field under 16px; keep all inputs at 16px on touch devices. */
@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }
}

/* ---------- versions, notebook, say/do, compare ---------- */
.compare-link { margin-top: 18px; }
.compare-link a { color: var(--accent); }
.sync-note {
  background: rgba(255, 79, 139, 0.12);
  border: 1px solid rgba(255, 79, 139, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13.5px;
  margin: 12px 0 0;
}
.versions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 8px; }
.version-fixed { color: var(--accent); font-size: 13.5px; margin: -8px 0 18px; }
.how-to {
  display: grid;
  gap: 4px;
  margin-top: 24px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--panel-2);
  border: 1px dashed var(--line);
  font-size: 13.5px;
  color: var(--muted);
}
.how-to strong { color: var(--text); }
.how-to b { color: var(--text); }

#story { position: relative; }

.badge {
  flex: none;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--accent);
  border: 1px solid rgba(255, 79, 139, 0.45);
  cursor: help;
}
.icon-btn {
  position: relative;
  flex: none;
  font: inherit;
  font-size: 18px;
  line-height: 1;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 999px;
  width: 36px;
  height: 36px;
  cursor: pointer;
}
.icon-btn .dot { position: absolute; top: 3px; right: 3px; width: 9px; height: 9px; border-radius: 50%; background: var(--accent); }

.notebook {
  position: absolute;
  z-index: 20;
  top: 62px;
  right: 12px;
  bottom: 12px;
  width: min(360px, calc(100% - 24px));
  overflow-y: auto;
  background: rgba(27, 21, 35, 0.97);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px 16px 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
  animation: appear 0.25s ease both;
}
.notebook header { display: flex; align-items: center; justify-content: space-between; }
.notebook h3 { margin: 0; color: var(--text); letter-spacing: 0.1em; }
.notebook h4 { margin: 16px 0 6px; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--accent); }
.notebook ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.notebook li { font-size: 13.5px; line-height: 1.4; display: grid; gap: 1px; }
.notebook li.important span:last-child { color: var(--text); font-weight: 600; }
.notebook .fact-meta { font-size: 11px; color: var(--muted); }
.notebook p { margin: 0; font-size: 13.5px; color: var(--muted); line-height: 1.5; }

.tip {
  align-self: stretch;
  margin: 8px 0 0;
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(126, 200, 255, 0.08);
  border: 1px solid rgba(126, 200, 255, 0.3);
  font-size: 13.5px;
}
.tip ul { margin: 6px 0 0; padding-left: 18px; display: grid; gap: 3px; }

.msg.user.act { background: linear-gradient(135deg, #4a4452, #37323e); color: #cfc9d6; }

/* cost meter (test info) */
.usage-pill {
  flex: none;
  font: inherit;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
  border-radius: 999px;
  padding: 3px 9px;
  cursor: pointer;
  white-space: nowrap;
}
.usage-list { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 13px; }
.usage-list dt { color: var(--muted); }
.usage-list dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }

@media (max-width: 560px) {
  .versions { grid-template-columns: 1fr; }
  .topbar .tiny-logo { display: none; }
  .topbar #new-story { padding: 6px 10px; }
  .usage-pill .tok { display: none; }
  .usage-pill { padding: 3px 7px; }
  .notebook { top: 56px; }
}

/* Inside the compare page every frame is narrow; keep the chrome light. */
body.embedded .centered { padding: 10px; }
body.embedded .card { box-shadow: none; }

.compare-page { overflow: hidden; }
.compare { display: flex; flex-direction: column; height: 100dvh; }
.compare-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(13, 10, 16, 0.85);
}
.compare-bar .grow { flex: 1; }
.compare-bar .btn { white-space: nowrap; }
.compare-tabs { display: none; gap: 6px; }
.compare-tabs button { font: inherit; font-size: 13px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: transparent; color: var(--text); cursor: pointer; }
.compare-tabs button.active { background: var(--accent); border-color: var(--accent); }
.compare-grid { flex: 1; display: grid; grid-template-columns: repeat(var(--cols, 4), minmax(0, 1fr)); gap: 1px; background: var(--line); min-height: 0; }
.pane { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.pane-head { padding: 8px 12px; border-bottom: 1px solid var(--line); font-size: 12.5px; color: var(--muted); display: grid; gap: 1px; }
.pane-head b { color: var(--text); font-size: 13.5px; }
.pane iframe { flex: 1; width: 100%; border: 0; min-height: 0; background: var(--bg); }

@media (max-width: 700px) {
  .compare-tabs { display: flex; }
  .compare-bar .muted { display: none; }
  .compare-grid { grid-template-columns: 1fr; }
  .pane:not(.active) { display: none; }
  .pane-head { display: none; }
}

/* ---------- portraits ---------- */
.msg.char { display: flex; gap: 10px; align-items: flex-end; max-width: min(90%, 620px); }
.msg.char .body { min-width: 0; display: grid; }
.msg.char.cont { margin-top: -6px; }
.msg.char.cont .speaker { display: none; }
.msg.char.cont .avatar { visibility: hidden; }
.speaker .role { color: var(--muted); font-weight: 500; }

.avatar {
  --c: var(--accent);
  position: relative;
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--c) 22%, var(--panel-2));
  box-shadow: 0 0 0 2px var(--c);
}
.avatar .initial { font-weight: 700; font-size: 16px; color: var(--c); }
.avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.avatar.has-img { cursor: zoom-in; }
.typing .avatar { width: 28px; height: 28px; box-shadow: 0 0 0 1.5px var(--c); }
.typing .avatar .initial { font-size: 12px; }

.notebook li.person { display: flex; gap: 10px; align-items: flex-start; }
.notebook li.person .avatar { width: 34px; height: 34px; margin-top: 2px; }

.profile {
  position: absolute;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 6, 10, 0.82);
  backdrop-filter: blur(6px);
  cursor: zoom-out;
  animation: appear 0.2s ease both;
}
.profile figure { margin: 0; text-align: center; }
.profile img { width: min(300px, 75vw); aspect-ratio: 1; border-radius: 22px; object-fit: cover; box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6); }
.profile figcaption { display: grid; gap: 2px; margin-top: 12px; }
.profile figcaption b { font-size: 18px; }
.profile figcaption span { color: var(--muted); font-size: 14px; }

@media (max-width: 560px) {
  .avatar { width: 34px; height: 34px; }
  .msg.char { gap: 8px; max-width: 94%; }
}

.notice .btn { margin-left: 6px; }

/* ---------- what she sends you ---------- */
.media-card {
  align-self: flex-start;
  width: min(300px, 78%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px 18px 18px 6px;
  padding: 8px;
  display: grid;
  gap: 6px;
}
.media-head { display: flex; justify-content: space-between; align-items: center; font-size: 12px; color: var(--muted); padding: 0 4px; }
.media-head b { color: var(--text); }
.media-frame { position: relative; border-radius: 13px; overflow: hidden; background: #000; }
.media-frame img, .media-frame video { display: block; width: 100%; height: 100%; object-fit: cover; }
.media-frame img { cursor: zoom-in; }
.media-caption { font-size: 14px; padding: 0 4px 2px; }
/* V1: seen right there, not sent — a shot of the scene rather than a chat bubble */
.media-card.moment { align-self: center; width: min(340px, 92%); border-radius: 18px; }
.media-card.moment .media-caption { font-style: italic; text-align: center; }
/* A shot of the scene itself: the place, a clue, the player's own things — no sender. */
.media-card.scene { align-self: center; width: min(420px, 100%); border-radius: 18px; padding: 6px; }

.media-card.locked .media-frame img { filter: saturate(0.7); }
.media-veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(13, 10, 16, 0.2), rgba(13, 10, 16, 0.66)); }
.media-lock {
  position: absolute;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 16px;
  text-align: center;
  cursor: pointer;
}
.media-lock .lock-title { font-size: 13.5px; font-weight: 600; text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }

.viewer {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(6, 4, 8, 0.92);
  cursor: zoom-out;
}
.viewer-inner { display: grid; gap: 10px; justify-items: center; max-height: 100%; }
.viewer img, .viewer video { max-width: min(560px, 92vw); max-height: 78dvh; border-radius: 16px; }
.viewer p { margin: 0; color: var(--muted); font-size: 13.5px; text-align: center; }

.plans-sheet { position: absolute; inset: 0; z-index: 45; display: grid; place-items: end center; background: rgba(6, 4, 8, 0.7); }
.plans-card {
  position: relative;
  width: min(460px, 100%);
  max-height: 92%;
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(20px + env(safe-area-inset-bottom));
  animation: rise 0.25s ease both;
}
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }
.plans-card h3 { font-family: var(--serif); font-style: italic; font-size: 24px; text-transform: none; letter-spacing: 0; color: var(--text); margin: 0 0 4px; }
.plans-x { position: absolute; top: 14px; right: 14px; }
.plans-list { display: grid; gap: 10px; margin: 16px 0 12px; }
.plan {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--panel-2);
}
.plan strong { display: block; font-size: 14px; }
.plan span { font-size: 12.5px; color: var(--muted); }
.plan .plan-side { display: grid; gap: 6px; justify-items: end; flex: none; }
.plan .price { color: var(--accent); font-weight: 600; font-size: 13px; }
.plan.current { border-color: var(--line); opacity: 0.75; }
.plans-account { margin: 4px 0 0; color: var(--muted); }
.plans-account .link-btn { color: var(--accent); }
.plan.wanted { border-color: var(--accent); background: rgba(255, 79, 139, 0.12); }

.album { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.album-cell { position: relative; padding: 0; border: 0; border-radius: 10px; overflow: hidden; aspect-ratio: 3 / 4; background: #000; cursor: pointer; }
.album-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.album-cell.locked img { filter: brightness(0.7); }
.album-play, .album-lock { position: absolute; right: 5px; bottom: 4px; font-size: 12px; text-shadow: 0 1px 4px #000; }

/* ---------- chapter cover ---------- */
.chapter .cover {
  position: relative;
  width: min(560px, 100%);
  aspect-ratio: 3 / 2;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55);
  animation: appear 0.5s ease both;
}
.chapter .cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.chapter .cover-shade { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(13, 10, 16, 0.15) 30%, rgba(13, 10, 16, 0.92)); }
.chapter .cover-text { position: absolute; left: 0; right: 0; bottom: 0; padding: 16px 18px 18px; text-align: center; }
.chapter .cover-text h3 { margin: 2px 0 0; font-size: 28px; text-shadow: 0 2px 12px rgba(0, 0, 0, 0.7); }
.chapter:has(.cover)::after { display: none; }

/* ---------- your girls ---------- */
#girls { display: flex; flex-direction: column; height: var(--app-height, 100dvh); overflow: hidden; }
.ghost-space { border-color: transparent; pointer-events: none; }
.girls-body { flex: 1; overflow-y: auto; padding: 18px max(16px, calc((100% - 720px) / 2)) 32px; }
.girls-empty { text-align: center; margin-top: 40px; }
.girls-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.girl-card {
  display: grid;
  gap: 0;
  padding: 0;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--panel);
  color: var(--text);
  font: inherit;
  cursor: pointer;
}
.girl-shot { aspect-ratio: 3 / 4; background: var(--panel-2); }
.girl-shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.girl-body { display: grid; gap: 2px; padding: 10px 12px 12px; }
.girl-body strong { font-size: 15px; }
.girl-body span { font-size: 12px; color: var(--muted); }
.girl-counts { color: var(--accent) !important; }

.girl-profile { display: grid; gap: 16px; }
.girl-head { display: flex; gap: 14px; align-items: flex-start; }
.girl-head img { width: 110px; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 14px; flex: none; }
.girl-head h3 { margin: 0 0 4px; font-family: var(--serif); font-style: italic; font-size: 26px; letter-spacing: 0; text-transform: none; color: var(--text); }
.girl-relation { margin: 8px 0 0; font-size: 13.5px; color: var(--text); opacity: 0.9; }
.girl-shot { position: relative; }
.girl-card.locked .girl-shot img { filter: grayscale(0.6) brightness(0.55); }
.girl-lock { position: absolute; inset: 0; display: grid; place-items: center; font-size: 28px; text-shadow: 0 2px 10px #000; }
.girl-card.locked .girl-counts { color: var(--muted) !important; }
.girl-section { margin: 4px 0 -6px; font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.girl-note { margin: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); font-size: 13.5px; }
.girl-note.upsell { display: flex; align-items: center; justify-content: space-between; gap: 12px; border-color: rgba(255, 79, 139, 0.4); background: rgba(255, 79, 139, 0.08); }

.coming-soon { align-self: center; text-align: center; display: grid; gap: 8px; justify-items: center; max-width: 420px; margin: 12px auto 18px; padding: 16px 18px; border: 1px solid rgba(255, 179, 71, 0.45); border-radius: 18px; background: rgba(255, 179, 71, 0.08); }
.coming-soon p { margin: 0; font-size: 13.5px; color: var(--text); opacity: 0.9; }
.coming-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.free-left { align-self: center; display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); }

.unlocked { align-self: center; text-align: center; display: grid; gap: 10px; justify-items: center; margin: 12px 0 4px; padding: 14px 18px; border: 1px solid rgba(255, 79, 139, 0.4); border-radius: 18px; background: rgba(255, 79, 139, 0.08); }
.unlocked-row { display: flex; gap: 12px; }
.unlocked-girl { display: grid; gap: 4px; justify-items: center; background: none; border: 0; color: var(--text); font: inherit; font-size: 12px; cursor: pointer; padding: 0; }
.unlocked-girl img { width: 64px; height: 84px; object-fit: cover; border-radius: 10px; }

/* V1: a moment with no photo yet — which photo belongs here */
.media-card.placeholder .media-frame {
  display: grid;
  place-items: center;
  background: repeating-linear-gradient(135deg, rgba(255, 255, 255, 0.03) 0 12px, transparent 12px 24px), linear-gradient(160deg, #2a1830, #120c16);
  border: 1.5px dashed rgba(255, 126, 182, 0.45);
}
.ph-note { display: grid; gap: 8px; padding: 18px; text-align: center; }
.ph-title { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.ph-meta { font-size: 13.5px; font-weight: 600; }
.ph-shot { font-size: 13px; line-height: 1.4; font-style: italic; }
.ph-where { font-size: 12px; color: var(--muted); }

/* payment result, back from the processor's page */
.pay-banner {
  position: fixed; z-index: 60; top: max(12px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%);
  width: min(460px, calc(100vw - 32px)); padding: 12px 16px; border-radius: 14px;
  background: var(--panel-2); color: var(--text); border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); font-size: 14px; line-height: 1.4; text-align: center; cursor: pointer;
}
.pay-banner.good { border-color: #5fd38d; }
.pay-banner.bad { border-color: var(--danger); }
.pay-banner[hidden] { display: none; }
.plan-side .link-btn.small { font-size: 12px; }
