:root {
  --bg: #0e0d0c;
  --bg-2: #171513;
  --bg-3: #221f1b;
  --line: #34302a;
  --text: #ece6dc;
  --muted: #a39a8c;
  --accent: #e8b44c;
  --accent-ink: #1a1307;
  --danger: #e0625a;
  --ok: #7cbf7a;
  --death: #c9534b;
  --survive: #7cbf7a;
  --other: #9b8ce0;
  --radius: 12px;
  --live: #7fd1c7;          /* "en emisión" y cosas en vivo */
  --live-line: #7fd1c766;
  --prose: var(--text);     /* color del texto de lectura */
  --serif: Georgia, 'Iowan Old Style', 'Palatino Linotype', serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--sans); font-size: 16px; line-height: 1.5; }
body { min-height: 100dvh; display: flex; flex-direction: column; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h1 { font-family: var(--serif); font-size: 1.7rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.hidden { display: none !important; }

/* Barra superior */
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.brand { font-family: var(--serif); font-weight: 700; color: var(--text); text-decoration: none; font-size: 1.1rem; margin-right: auto; display: flex; align-items: center; gap: 8px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px 3px color-mix(in srgb, var(--accent) 60%, transparent); }
.top nav { display: flex; gap: 4px; align-items: center; }
.top nav a { color: var(--muted); text-decoration: none; padding: 6px 10px; border-radius: 8px; font-size: .95rem; }
.top nav a.on, .top nav a:hover { color: var(--text); background: var(--bg-3); }

main { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 16px; }
main.wide { max-width: none; padding: 0; }
footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 24px 16px; }
footer a { color: var(--muted); }

/* Controles */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 10px 16px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-3); cursor: pointer; text-decoration: none; color: var(--text); font-weight: 600; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--danger); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: .9rem; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: 12px; }
label { display: block; font-size: .9rem; color: var(--muted); margin-bottom: 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); }
textarea { resize: vertical; line-height: 1.55; }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.check { display: flex; gap: 10px; align-items: flex-start; color: var(--text); font-size: .95rem; }
.check input { width: 20px; height: 20px; margin-top: 2px; accent-color: var(--accent); flex: none; }

.card { background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line); color: var(--muted); }
.badge.age { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.badge.warn { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.notice { padding: 12px 14px; border-radius: 10px; background: var(--bg-3); border-left: 3px solid var(--accent); }
.notice.error { border-left-color: var(--danger); }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 100; background: var(--text); color: var(--bg);
  padding: 10px 16px; border-radius: 10px; font-weight: 600; max-width: calc(100% - 32px); box-shadow: 0 6px 24px #0008; }
.toast.error { background: var(--danger); color: #fff; }

/* Lista de historias */
.story-list { display: grid; gap: 12px; }
.story-card { display: block; text-decoration: none; color: inherit; }
.story-card h2 { font-family: var(--serif); font-size: 1.3rem; margin-bottom: 4px; }
.story-card:hover { border-color: var(--muted); }
.meta { display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: .85rem; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs button, .tabs a { background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 12px; color: var(--muted); cursor: pointer; white-space: nowrap; text-decoration: none; font-weight: 600; }
.tabs .on { color: var(--text); border-bottom-color: var(--accent); }

/* Lector */
.reader { max-width: 640px; margin: 0 auto; }
.reader .scene-title { font-family: var(--serif); font-size: 1.1rem; color: var(--muted); font-style: italic; margin-bottom: 1em; }
.reader .prose { font-family: var(--serif); font-size: 1.18rem; line-height: 1.7; }
.reader .prose p { margin-bottom: 1.1em; }
.choices { display: grid; gap: 10px; margin: 28px 0 12px; }
.choice { text-align: left; min-height: 56px; padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2);
  cursor: pointer; font-size: 1.02rem; display: flex; gap: 12px; align-items: center; transition: border-color .15s, transform .1s; }
.choice:hover { border-color: var(--accent); }
.choice:active { transform: scale(.99); }
.choice .arrow { color: var(--accent); font-weight: 700; }
.ending-box { text-align: center; padding: 24px 16px; border-radius: var(--radius); margin: 28px 0; border: 1px solid var(--line); background: var(--bg-2); }
.ending-box .kind { font-size: .8rem; letter-spacing: .15em; text-transform: uppercase; font-weight: 700; }
.ending-box.muerte .kind { color: var(--death); }
.ending-box.sobrevive .kind { color: var(--survive); }
.ending-box.otro .kind { color: var(--other); }
.ending-box h2 { font-family: var(--serif); font-size: 1.5rem; margin: 6px 0 10px; }
.fade-in { animation: fade .5s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.endings-found { display: flex; gap: 6px; justify-content: center; margin: 10px 0 16px; flex-wrap: wrap; }
.endings-found span { width: 14px; height: 14px; border-radius: 50%; border: 1px solid var(--line); }
.endings-found .muerte { background: var(--death); } .endings-found .sobrevive { background: var(--survive); } .endings-found .otro { background: var(--other); }
.gate { text-align: center; padding: 32px 16px; }

/* Comentarios */
.comment { padding: 12px 0; border-top: 1px solid var(--line); }
.comment .who { font-weight: 700; font-size: .9rem; }
.comment p { margin: 4px 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.linklike { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: .8rem; text-decoration: underline; }

/* Editor */
.editor { display: flex; flex-direction: column; height: calc(100dvh - 57px); }
.editor-head { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.editor-head .title { font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.editor-head .save { font-size: .8rem; color: var(--muted); white-space: nowrap; }
.editor .tabs { margin: 0; padding: 0 8px; background: var(--bg-2); }
.editor-body { flex: 1; position: relative; overflow: hidden; }
.editor-pane { position: absolute; inset: 0; overflow: auto; padding: 16px; }
.editor-pane.map-pane { padding: 0; overflow: hidden; touch-action: none; background:
  radial-gradient(circle at 1px 1px, #2a2621 1px, transparent 0) 0 0 / 22px 22px; }
.map-svg { width: 100%; height: 100%; display: block; user-select: none; -webkit-user-select: none; cursor: grab; }
.map-svg .node rect { fill: var(--bg-3); stroke: var(--line); stroke-width: 1.5; }
.map-svg .node.start rect { stroke: var(--accent); stroke-width: 2.5; }
.map-svg .node.muerte rect { fill: #2c1715; stroke: var(--death); }
.map-svg .node.sobrevive rect { fill: #17241a; stroke: var(--survive); }
.map-svg .node.otro rect { fill: #1e1a2e; stroke: var(--other); }
.map-svg .node.error rect { stroke: var(--danger); stroke-dasharray: 5 3; stroke-width: 2.5; }
.map-svg .node.selected rect { stroke: #fff; stroke-width: 3; }
.map-svg .node.orphan { opacity: .65; }
.map-svg .node text { fill: var(--text); font-size: 13px; font-family: var(--sans); pointer-events: none; }
.map-svg .node text.sub { fill: var(--muted); font-size: 11px; }
.map-svg .edge { fill: none; stroke: #6d6458; stroke-width: 1.6; }
.map-svg .edge.back { stroke-dasharray: 6 4; }
.map-svg .edge.hl { stroke: var(--accent); stroke-width: 2.4; }
.map-svg .lane-label { fill: var(--muted); font-size: 12px; font-family: var(--sans); }
.map-tools { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.map-tools .btn { width: 48px; height: 48px; padding: 0; border-radius: 50%; font-size: 1.3rem; box-shadow: 0 4px 14px #0007; }
.map-tools .btn.add { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.map-legend { position: absolute; left: 12px; top: 12px; font-size: .75rem; color: var(--muted); background: #0e0d0ccc; padding: 6px 10px; border-radius: 8px; pointer-events: none; }
.map-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin: 0 4px 0 8px; vertical-align: -1px; }

/* Hoja de edición de escena: panel inferior en celular, lateral en pantallas grandes */
.sheet-backdrop { position: fixed; inset: 0; background: #0009; z-index: 40; }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 92dvh; overflow: auto; background: var(--bg-2);
  border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; padding: 0 16px 24px; animation: up .2s ease; }
@keyframes up { from { transform: translateY(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet-head { position: sticky; top: 0; background: var(--bg-2); display: flex; align-items: center; gap: 8px; padding: 12px 0; z-index: 2; border-bottom: 1px solid var(--line); margin-bottom: 14px; }
.sheet-head .grab { position: absolute; top: 4px; left: 50%; width: 40px; height: 4px; margin-left: -20px; border-radius: 4px; background: var(--line); }
.sheet-head h2 { flex: 1; margin: 0; font-size: 1rem; }
@media (min-width: 900px) {
  .sheet-backdrop { background: transparent; pointer-events: none; }
  .sheet { left: auto; top: 57px; width: 440px; max-height: none; border-radius: 0; border-top: 0; border-left: 1px solid var(--line); box-shadow: -8px 0 30px #0006; }
}
.seg { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; }
.seg button { min-height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; font-size: .9rem; padding: 6px; }
.seg button.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg)); color: var(--text); font-weight: 700; }
.seg button[data-v=muerte].on { border-color: var(--death); background: #2c1715; }
.seg button[data-v=sobrevive].on { border-color: var(--survive); background: #17241a; }
.seg button[data-v=otro].on { border-color: var(--other); background: #1e1a2e; }
.choice-edit { border: 1px solid var(--line); border-radius: 10px; padding: 10px; background: var(--bg); }
.choice-edit + .choice-edit { margin-top: 8px; }
.choice-edit .row { flex-wrap: nowrap; }
.choice-edit select { flex: 1; min-width: 0; }
.icon-btn { flex: none; width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-3); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.issues li { margin-bottom: 6px; }
.issues .err { color: var(--danger); }
.scene-row { display: block; width: 100%; text-align: left; cursor: pointer; color: inherit; }
.scene-row .t { font-weight: 700; }
.scene-row .targets { font-size: .85rem; color: var(--muted); margin-top: 4px; }

/* Estadísticas */
.kpis { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.kpis > .card + .card { margin-top: 0; }
@media (min-width: 600px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi .v { font-size: 1.6rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { font-size: .8rem; color: var(--muted); }
.bar { height: 8px; border-radius: 4px; background: var(--bg-3); overflow: hidden; margin-top: 4px; }
.bar > i { display: block; height: 100%; background: var(--accent); }
.stat-row { padding: 8px 0; border-top: 1px solid var(--line); }
.stat-row .row { justify-content: space-between; flex-wrap: nowrap; }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 60px; }
.spark i { flex: 1; background: var(--accent); border-radius: 2px 2px 0 0; min-height: 2px; }

.modal { position: fixed; inset: 0; z-index: 60; background: #000a; display: flex; align-items: flex-end; justify-content: center; }
.modal .box { background: var(--bg-2); width: 100%; max-width: 480px; border-radius: 16px 16px 0 0; padding: 20px 16px; max-height: 90dvh; overflow: auto; }
@media (min-width: 600px) { .modal { align-items: center; } .modal .box { border-radius: 16px; } }

@media (max-width: 420px) {
  .top nav a { padding: 6px 7px; font-size: .88rem; }
  .brand span.full { display: none; }
}

/* ===================== Pulido visual v2 ===================== */
body { background:
  radial-gradient(1200px 500px at 50% -200px, #2a1f0f55, transparent 70%), var(--bg); }
main.home { max-width: 1100px; }
.btn { transition: transform .1s, border-color .15s, background .15s; }
.btn:active { transform: scale(.98); }
.btn.liked { color: var(--death); border-color: color-mix(in srgb, var(--death) 50%, transparent); }

/* Portadas generadas */
.cover { position: relative; overflow: hidden; border-radius: 10px; isolation: isolate; background: #15120f; box-shadow: 0 8px 24px #0008, inset 0 0 0 1px #ffffff10; }
.cover::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 35%, #000c 100%); z-index: 0; }
.cover-glow { position: absolute; inset: 0; z-index: -1; }
.cover-card { aspect-ratio: 2 / 3; width: 100%; }
.cover-detail { aspect-ratio: 2 / 3; width: 132px; flex: none; }
.cover-hero { position: absolute; inset: 0; border-radius: 0; box-shadow: none; }
.cover-text { position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 1; }
.cover-title { font-family: var(--serif); font-weight: 700; font-size: 1.05rem; line-height: 1.15; color: #fff; text-shadow: 0 2px 8px #000; overflow-wrap: anywhere; }
.cover-author { font-size: .72rem; color: #fffb; margin-top: 4px; letter-spacing: .04em; text-transform: uppercase; }
.cover-luz { background: linear-gradient(170deg, #1d160c, #0b0906 70%); }
.cover-luz .cover-glow { background: radial-gradient(circle at 62% 34%, #ffe7a3 0 3%, #e8b44c88 6%, #e8b44c22 18%, transparent 40%),
  linear-gradient(180deg, transparent 62%, #0f1a0c 62%, #060805); }
.cover-sangre { background: linear-gradient(170deg, #2a0b0a, #0c0505); }
.cover-sangre .cover-glow { background: radial-gradient(ellipse 30% 55% at 70% 0%, #c9534b99, transparent 70%), repeating-linear-gradient(90deg, transparent 0 22px, #6b141133 22px 24px); }
.cover-niebla { background: linear-gradient(175deg, #2b3138, #0f1215); }
.cover-niebla .cover-glow { background: radial-gradient(ellipse 80% 22% at 30% 62%, #cfd8e055, transparent 70%), radial-gradient(ellipse 70% 18% at 75% 45%, #cfd8e033, transparent 70%); }
.cover-monte { background: linear-gradient(175deg, #0f1f13, #050a06); }
.cover-monte .cover-glow { background: radial-gradient(circle at 30% 40%, #b6e39a55 0 2%, transparent 3%), radial-gradient(circle at 38% 40%, #b6e39a55 0 2%, transparent 3%),
  repeating-linear-gradient(100deg, transparent 0 18px, #1d3a2233 18px 30px), radial-gradient(ellipse at 50% 120%, #2f5a3366, transparent 60%); }
.cover-noche { background: linear-gradient(175deg, #151530, #07070f); }
.cover-noche .cover-glow { background: radial-gradient(circle at 75% 22%, #e9e6ff 0 5%, #9b8ce044 9%, transparent 22%),
  radial-gradient(1px 1px at 20% 30%, #fff, transparent), radial-gradient(1px 1px at 40% 15%, #fff, transparent), radial-gradient(1px 1px at 55% 40%, #fffa, transparent), radial-gradient(1px 1px at 12% 52%, #fff8, transparent); }
.cover-ceniza { background: linear-gradient(175deg, #2b2724, #0d0b0a); }
.cover-ceniza .cover-glow { background: radial-gradient(circle at 50% 110%, #ff7a3a55, transparent 45%), radial-gradient(2px 2px at 30% 60%, #ffb07a, transparent), radial-gradient(2px 2px at 64% 48%, #ffb07a99, transparent), radial-gradient(2px 2px at 45% 75%, #ffb07acc, transparent); }

/* Home */
.hero-wrap { position: relative; margin: -16px -16px 8px; }
.hero-track { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.hero-track::-webkit-scrollbar { display: none; }
.hero { position: relative; flex: 0 0 100%; scroll-snap-align: start; min-height: 440px; display: flex; align-items: flex-end; overflow: hidden; }
.hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 20%, #0e0d0cee 72%, var(--bg)); }
.hero-body { position: relative; z-index: 1; padding: 24px 16px 20px; max-width: 640px; }
.hero h1 { font-size: 2.2rem; margin: 6px 0 8px; text-shadow: 0 2px 16px #000; }
.hero-syn { color: #e9e2d6; margin: 10px 0 16px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.kicker { font-size: .72rem; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--accent); }
.hero-dots { position: absolute; bottom: 8px; left: 0; right: 0; display: flex; gap: 6px; justify-content: center; z-index: 2; }
.hero-dots i { width: 6px; height: 6px; border-radius: 50%; background: #fff4; }
.hero-dots i.on { background: var(--accent); width: 18px; border-radius: 3px; }
@media (min-width: 900px) { .hero { min-height: 420px; } .hero-wrap { margin: 0 0 8px; border-radius: 16px; overflow: hidden; } .hero-body { padding: 40px; } }

.shelf { margin: 28px 0; }
.shelf-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 10px; }
.shelf-head h2 { margin: 0; font-size: 1.15rem; }
.shelf-row { display: grid; grid-auto-flow: column; grid-auto-columns: 140px; gap: 12px; overflow-x: auto; scroll-snap-type: x proximity; padding: 8px 16px 6px; margin: -8px -16px 0; scrollbar-width: thin; }
.shelf-row > * { scroll-snap-align: start; }
@media (min-width: 700px) { .shelf-row { grid-auto-columns: 160px; } }
.tile { display: block; text-decoration: none; color: inherit; }
.tile:hover .cover { transform: translateY(-3px); box-shadow: 0 12px 28px #000a, 0 0 0 1px var(--accent); }
.tile .cover { transition: transform .15s, box-shadow .15s; }
.tile-meta { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: 6px; font-size: .78rem; color: var(--muted); }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 14px; }
.authors { grid-auto-columns: 104px; }
.author-chip { display: flex; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; color: var(--text); text-align: center; padding: 8px 0; }
.author-chip strong { font-size: .85rem; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #1a1307; font-weight: 800; flex: none; font-family: var(--serif); box-shadow: inset 0 -6px 12px #0003; }
.cta { display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; margin: 28px 0;
  background: linear-gradient(120deg, #2a1f0f, var(--bg-2)); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.cta h2 { margin-bottom: 4px; }

/* Página de historia */
.story-head { display: flex; gap: 16px; align-items: flex-end; }
.story-info { min-width: 0; }
.story-info h1 { font-size: 1.8rem; margin-bottom: 8px; }
.by { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; font-weight: 600; }
.stat-line { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 10px; color: var(--muted); font-size: .88rem; }
.stat-line strong { color: var(--text); }
.synopsis { font-family: var(--serif); font-size: 1.12rem; line-height: 1.6; margin: 20px 0 8px; }

/* Perfil */
.profile-head { display: flex; gap: 16px; align-items: center; margin-top: 8px; }
.profile-id h1 { margin: 0 0 6px; }
.profile-id .bio { margin: 8px 0 0; }
.pstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 16px; }
@media (min-width: 600px) { .pstats { grid-template-columns: repeat(6, 1fr); } }
.pstat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px; text-align: center; display: flex; flex-direction: column; }
.pstat strong { font-size: 1.3rem; font-variant-numeric: tabular-nums; }
.pstat span { font-size: .75rem; color: var(--muted); }

/* Mis historias y asistente */
.mine { display: flex; gap: 14px; align-items: flex-start; }
.mine-cover { width: 84px; flex: none; }
.mine-cover .cover-title { font-size: .75rem; } .mine-cover .cover-author { display: none; }
.mine-body { flex: 1; min-width: 0; }
.mine-body h2 { font-family: var(--serif); margin-bottom: 6px; }
.empty { text-align: center; padding: 28px 16px; }
.guide summary { cursor: pointer; list-style: none; }
.guide summary::after { content: ' ▾'; color: var(--muted); }
.guide ol { margin: 12px 0 0; padding-left: 20px; }
.guide li { margin-bottom: 10px; }
.wizard { max-width: 560px; margin: 0 auto; }
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps span { flex: 1; font-size: .78rem; color: var(--muted); padding-top: 8px; border-top: 3px solid var(--line); }
.steps span.on { color: var(--text); border-top-color: var(--accent); font-weight: 700; }
.steps span.done { border-top-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.wiz-nav { justify-content: space-between; margin-top: 24px; }
.wiz-cover { display: flex; gap: 16px; align-items: flex-start; }
.wiz-preview { width: 120px; flex: none; }
.swatches { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; flex: 1; }
.swatch { position: relative; height: 52px; border-radius: 10px; border: 2px solid transparent; cursor: pointer; overflow: hidden; color: #fff; font-size: .8rem; font-weight: 700; display: flex; align-items: flex-end; padding: 6px 8px; }
.swatch span { position: relative; z-index: 1; text-shadow: 0 1px 4px #000; }
.swatch.on { border-color: var(--accent); }
.tpl { display: flex; gap: 14px; align-items: center; width: 100%; text-align: left; cursor: pointer; }
.tpl.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--bg-2)); }
.tpl-ic { width: 44px; height: 44px; flex: none; border-radius: 10px; background: var(--bg-3); display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: var(--accent); }

/* Barra inferior en celular */
.bottom-nav { display: none; }
.ico { display: inline-flex; }
@media (max-width: 699px) {
  .top nav { display: none; }
  .top { justify-content: center; }
  .brand { margin-right: 0; }
  .bottom-nav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: color-mix(in srgb, var(--bg-2) 94%, transparent);
    backdrop-filter: blur(8px); border-top: 1px solid var(--line); padding: 4px 0 calc(4px + env(safe-area-inset-bottom)); }
  .bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; color: var(--muted); text-decoration: none; font-size: .7rem; font-weight: 600; }
  .bottom-nav a.on { color: var(--accent); }
  body:not(.immersive) { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  body.immersive .bottom-nav { display: none; }
  .toast { bottom: 84px; }
  .story-head { align-items: flex-start; }
  .cover-detail { width: 112px; }
  .story-info h1 { font-size: 1.45rem; }
}

/* Favoritos y estado de emisión */
.badge.live { color: var(--live); border-color: var(--live-line); }
.btn.fav { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.tile-cover { position: relative; }
.ribbon { position: absolute; top: 8px; left: 8px; z-index: 2; font-size: .66rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 7px; border-radius: 6px; background: #0e2f2b; color: var(--live); border: 1px solid var(--live-line); }
.choice.soon { opacity: .55; cursor: not-allowed; border-style: dashed; }
.choice.soon .arrow { color: var(--muted); }
.soon-tag { margin-left: auto; flex: none; font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--live); }
.ending-box.continua .kind { color: var(--live); }
.ending-box.continua { border-style: dashed; }
.badge.live::before { content: ''; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--live); margin-right: 5px; vertical-align: 1px; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

/* Portadas v3: símbolos, imagen propia y selector */
.cover-symbol { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.cover-symbol svg { display: block; }
.cover-text { z-index: 2; }
.cover-text.caps .cover-title { font-family: var(--sans); text-transform: uppercase; letter-spacing: .08em; font-size: .9rem; font-weight: 800; }
.cover-img { background-size: cover; background-position: center; }
.cover-img.no-shade::after { display: none; }
.cover-rio { background: linear-gradient(175deg, #0d2326, #050c0d); }
.cover-rio .cover-glow { background: repeating-linear-gradient(170deg, transparent 0 14px, #9fe3e014 14px 16px), radial-gradient(ellipse 90% 30% at 50% 100%, #1f5a5c88, transparent 70%); }
.cover-tierra { background: linear-gradient(175deg, #3a160c, #120604); }
.cover-tierra .cover-glow { background: radial-gradient(ellipse 120% 40% at 50% 100%, #a8452a99, transparent 70%), radial-gradient(circle at 80% 15%, #ffb08a33, transparent 30%); }
.swatches.four { grid-template-columns: repeat(4, 1fr); }
.swatches.four .swatch { height: 46px; font-size: .68rem; padding: 4px 5px; }
.symbols { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.symbol-btn { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 58px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--bg); cursor: pointer; font-size: .8rem; font-weight: 700; color: var(--text); padding: 4px 2px; }
.symbol-btn span { font-size: .62rem; font-weight: 600; color: var(--muted); }
.symbol-btn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
@media (max-width: 599px) {
  .cover-picker .wiz-cover { flex-direction: column; align-items: center; }
  .cover-picker .wiz-preview { width: 140px; }
  .cover-picker .wiz-cover > div:last-child { width: 100%; }
}

/* Etiquetas y compartir */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px; padding: 0 16px 6px; scrollbar-width: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line);
  background: var(--bg-2); color: var(--text); text-decoration: none; font-size: .85rem; font-weight: 600; cursor: pointer; }
.chip span { color: var(--muted); font-weight: 500; font-size: .75rem; }
.chip:hover { border-color: var(--accent); }
.chip.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--bg-2)); }
.chip:disabled { opacity: .4; cursor: default; }
/* Editor de etiquetas (lista curada): chips grandes para el dedo, grupos plegables. */
.tag-editor input { margin-bottom: 6px; }
.tag-top { display: flex; align-items: flex-start; gap: 8px; }
.tag-top .tag-picked { flex: 1; margin: 0 0 8px; min-height: 36px; align-items: center; }
.tag-count { white-space: nowrap; padding-top: 8px; }
.tag-picked .chip span { font-size: .85rem; }
.tag-results .chips { margin: 2px 0 6px; }
.tag-results .chip span { font-style: italic; }
.tag-groups[hidden] { display: none; }
.tag-group { margin-top: 6px; border-top: 1px solid var(--line); padding-top: 6px; }
.tag-group > summary { cursor: pointer; min-height: 36px; display: flex; align-items: center; gap: 8px; font-size: .85rem; font-weight: 600; color: var(--muted); list-style-position: inside; }
.tag-group[open] > summary { color: var(--text); }
.tag-group .tag-n { font-size: .72rem; font-weight: 500; color: var(--accent); }
.tag-group .chips { margin: 4px 0 6px; }
.tag-group .chip, .tag-results .chip { font-size: .82rem; padding: 7px 12px; min-height: 36px; }
.tag-others .tag-group { margin-left: 10px; }
@media (max-width: 600px) {
  .tag-results .chips, .tag-group .chips { gap: 8px; }
}
/* Moderar: lista de etiquetas */
.tag-admin-group > summary { cursor: pointer; min-height: 40px; display: flex; align-items: center; gap: 4px; font-weight: 600; }
.tag-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.tag-row.off { opacity: .6; }
.tag-row-main { min-width: 0; flex: 1 1 180px; }
.tag-row-btns { gap: 6px; flex-wrap: wrap; }
.tag-alias { margin-top: 2px; overflow-wrap: anywhere; }

/* Porcentaje de lectores que tomó la misma decisión */
.choice-stat { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-bottom: 18px; background: rgba(232,180,76,.06); animation: fade .4s ease; }
.choice-stat .cs-text { font-size: .95rem; line-height: 1.4; }
.choice-stat .cs-text strong { color: var(--accent); font-size: 1.15rem; margin-right: 2px; }
.choice-stat .cs-bar { height: 6px; border-radius: 3px; background: rgba(255,255,255,.08); margin-top: 8px; overflow: hidden; }
.choice-stat .cs-bar span { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .6s ease; }
.choice-stat .cs-foot { font-size: .78rem; opacity: .65; margin-top: 6px; }

/* Respuestas a comentarios */
.comment .replies { margin: 10px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--line); }
.comment.reply { padding: 8px 0; border: 0; }
.comment .composer { margin-top: 10px; }
.op-chip { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: .7rem; font-weight: 600; background: var(--accent); color: var(--accent-ink); vertical-align: 1px; }
.comment.flash { animation: flash 2.4s ease; border-radius: 8px; }
@keyframes flash { 0%, 40% { background: rgba(232,180,76,.18); } 100% { background: transparent; } }

/* Campanita */
#nav a, .bottom-nav a { position: relative; }
.nav-count { display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 6px; border-radius: 9px; background: var(--danger); color: #fff; font: 700 11px/18px var(--sans); text-align: center; vertical-align: 1px; }
.bottom-nav .nav-count { position: absolute; top: 4px; left: calc(50% + 4px); margin: 0; }
.nav-count.hidden { display: none; }
.notif-list { display: flex; flex-direction: column; gap: 2px; }
.notif { display: flex; gap: 12px; padding: 12px; border-radius: var(--radius); color: var(--text); text-decoration: none; }
.notif:hover { background: var(--bg-2); }
.notif.unread { background: var(--bg-2); box-shadow: inset 3px 0 0 var(--accent); }
.notif-ico { font-size: 1.2rem; line-height: 1.4; width: 24px; text-align: center; flex: none; }
.notif-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.notif-body em { font-style: normal; color: var(--accent); }
.notif-quote { color: var(--muted); font-size: .9rem; overflow-wrap: anywhere; }
.notif-time { color: var(--muted); font-size: .78rem; }

/* Estadísticas: primera vez / todas las veces */
.stats-mode { margin-top: 16px; max-width: 360px; }
.first-summary { border-color: rgba(232,180,76,.45); }
.first-summary p { margin: 0 0 8px; }
.first-list { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; font-size: .92rem; }

/* ==========================================================================
   Estilo "cinta VHS" (analog horror): pantalla de TV vieja, letra de menú de
   videograbadora (VT323), líneas de barrido, colores corridos y "● REC".
   ========================================================================== */
:root {
  --bg: #050605;
  --bg-2: #0b0e0b;
  --bg-3: #121712;
  --line: #243024;
  --text: #d8e8d0;
  --prose: #cfe0c6;
  --muted: #7f927b;
  --accent: #e8f0e0;
  --accent-ink: #050605;
  --rec: #ff2a2a;
  --blood: #ff2a2a;
  --cyan: #2ad4ff;
  --danger: #ff4d4d;
  --death: #ff3b3b;
  --survive: #7dff9a;
  --radius: 0;
  --display: 'VT323', 'Courier New', monospace;
  --serif: 'IBM Plex Mono', 'Courier New', monospace;
  --sans: 'IBM Plex Mono', 'Courier New', monospace;
  --glitch: 2px 0 rgba(255, 42, 42, .7), -2px 0 rgba(42, 212, 255, .7);
}
html { background: var(--bg); }
html, body { font-family: var(--sans); font-size: 15px; }
body { background: radial-gradient(ellipse 120% 90% at 50% 40%, #0d140d 0%, var(--bg) 70%) fixed; }
/* Líneas de barrido y viñeta de tubo, por encima de todo pero sin bloquear toques. */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 90;
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0) 0 2px, rgba(0, 0, 0, .28) 2px 3px),
    radial-gradient(ellipse 110% 95% at 50% 50%, transparent 60%, rgba(0, 0, 0, .75) 100%);
}
/* Parpadeo muy suave de la imagen, como un televisor viejo. */
body::before {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 89;
  background: rgba(200, 255, 200, .015); animation: vhs-flicker 4s infinite steps(1);
}
@keyframes vhs-flicker { 0%, 100% { opacity: 1; } 41% { opacity: .2; } 42% { opacity: 1; } 77% { opacity: .5; } 78% { opacity: 1; } }
@keyframes vhs-blink { 50% { opacity: 0; } }
::selection { background: var(--rec); color: #fff; }

/* Títulos: letra de pantalla con colores corridos */
h1, h2, h3, .brand, .cover-title, .hero h1, .story-info h1, .story-card h2, .mine-body h2, .ending-box h2, .shelf-head h2, .kpi .v {
  font-family: var(--display); font-weight: 400; text-transform: uppercase; letter-spacing: .04em; text-shadow: var(--glitch);
}
h1 { font-size: 2.4rem; line-height: 1; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }

/* Barra superior: "● REC" */
.top { background: rgba(5, 6, 5, .94); border-bottom: 1px solid var(--line); backdrop-filter: none; }
.brand { font-size: 1.9rem; color: var(--text); }
.brand .dot { width: 11px; height: 11px; border-radius: 50%; background: var(--rec); box-shadow: 0 0 8px var(--rec); animation: vhs-blink 1.2s steps(1) infinite; }
.brand::after { content: 'REC'; font-size: .9rem; color: var(--rec); text-shadow: none; letter-spacing: .1em; }
.top nav a { font-family: var(--display); font-size: 1.25rem; text-transform: uppercase; border-radius: 0; color: var(--muted); }
.top nav a.on, .top nav a:hover { background: var(--accent); color: var(--accent-ink); }

/* Botones: como el menú de la videograbadora */
.btn { border-radius: 0; border: 1px solid var(--line); background: transparent; color: var(--text);
  font-family: var(--display); font-weight: 400; font-size: 1.3rem; text-transform: uppercase; letter-spacing: .06em; }
.btn:hover { border-color: var(--accent); background: rgba(232, 240, 224, .06); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 3px 0 0 var(--rec), -3px 0 0 var(--cyan); }
.btn.primary:hover { background: #fff; }
.btn.danger { color: var(--danger); }
.btn.sm { font-size: 1.1rem; }
.linklike { color: var(--muted); font-family: var(--sans); }
a { color: var(--accent); }

/* Formularios, tarjetas y avisos */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea {
  border-radius: 0; border: 1px solid var(--line); background: #030403; font-family: var(--sans); }
input:focus, select:focus, textarea:focus, .btn:focus-visible { outline: 1px solid var(--accent); outline-offset: 0; box-shadow: 2px 0 0 var(--rec), -2px 0 0 var(--cyan); }
.card { border-radius: 0; background: rgba(11, 14, 11, .92); border: 1px solid var(--line); }
.notice { border-radius: 0; background: var(--bg-3); border-left: 3px solid var(--rec); }
.badge { border-radius: 0; border: 1px solid var(--line); font-family: var(--sans); }
.badge.age { color: var(--accent); border-color: var(--accent); }
.badge.live { color: var(--rec); border-color: var(--rec); background: transparent; }
.badge.live::before { content: '● '; animation: vhs-blink 1.2s steps(1) infinite; }
.chip, .tag-chip { border-radius: 0; border: 1px solid var(--line); background: transparent; }
.toast { border-radius: 0; background: var(--accent); color: var(--accent-ink); font-family: var(--display); font-size: 1.3rem; text-transform: uppercase; box-shadow: 3px 0 0 var(--rec), -3px 0 0 var(--cyan); }
.toast.error { background: var(--rec); color: #fff; }
.tabs { border-bottom: 1px solid var(--line); }
.tabs button, .tabs a { font-family: var(--display); font-size: 1.25rem; text-transform: uppercase; font-weight: 400; letter-spacing: .05em; }
.tabs .on { color: var(--accent); border-bottom-color: var(--rec); }
.seg button { border-radius: 0; border: 1px solid var(--line); font-family: var(--display); font-size: 1.15rem; text-transform: uppercase; }
.seg button.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.modal .box, .sheet { border-radius: 0; border-top: 2px solid var(--rec); }

/* Secciones: "▶ NOVEDADES" */
.shelf-head { border-bottom: 1px dashed var(--line); padding-bottom: 4px; }
.shelf-head h2 { font-size: 1.7rem; display: flex; align-items: center; gap: 10px; }
.shelf-head h2::before { content: '▶'; color: var(--rec); font-size: .7em; text-shadow: none; }
.shelf-row { scroll-padding-inline: 16px; }
.kicker { font-family: var(--display); font-size: 1.2rem; font-weight: 400; letter-spacing: .12em; color: var(--rec); }
.kicker::before { content: 'PLAY ▶  '; color: var(--text); }

/* Portadas: imagen de video gastado */
.cover { border-radius: 0; box-shadow: 0 0 0 1px var(--line), 0 10px 24px #000; }
.cover > :not(.cover-text):not(.cover-photo) { filter: saturate(.45) contrast(1.25) hue-rotate(55deg); }
.cover::after {
  z-index: 1; pointer-events: none;
  background:
    repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .35) 2px 3px),
    linear-gradient(180deg, transparent 35%, #000d 100%);
}
.cover-title { font-family: var(--display); font-size: 1.45rem; line-height: .95; text-transform: uppercase; }
.cover-text.caps .cover-title { font-family: var(--display); letter-spacing: .04em; font-weight: 400; font-size: 1.4rem; }
.cover-author { font-family: var(--sans); }
.cover-text, .ribbon { z-index: 3; }
.tile:hover .cover { box-shadow: 3px 0 0 var(--rec), -3px 0 0 var(--cyan), 0 10px 24px #000; transform: none; }
.ribbon { border-radius: 0; background: #000c; color: var(--rec); border: 1px solid var(--rec); font-family: var(--display); font-weight: 400; font-size: .95rem; letter-spacing: .08em; }
.ribbon::before { content: '● '; animation: vhs-blink 1.2s steps(1) infinite; }

/* Destacada */
.hero::before {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 1;
  background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .35) 2px 3px);
}
.hero-body { z-index: 2; }
.hero h1 { font-size: 3.6rem; line-height: .95; }
@media (min-width: 900px) { .hero h1 { font-size: 4.6rem; } .hero-wrap { border: 1px solid var(--line); border-radius: 0; } }
.hero-syn { font-size: .98rem; }
.hero-dots i { border-radius: 0; }
.hero-dots i.on { background: var(--rec); }

/* Página de historia */
.story-info h1 { font-size: 2.6rem; }
.synopsis { font-family: var(--sans); font-size: 1rem; line-height: 1.7; }

/* Lector: subtítulos de cinta */
.reader .scene-title { font-family: var(--display); font-style: normal; text-transform: uppercase; color: var(--rec); font-size: 1.6rem;
  letter-spacing: .04em; display: flex; align-items: center; gap: 10px; text-shadow: var(--glitch); }
.reader .scene-title::before { content: '■'; font-size: .8em; animation: vhs-blink 1.2s steps(1) infinite; }
.reader .scene-title::after { content: ''; flex: 1; height: 1px; background: repeating-linear-gradient(90deg, var(--muted) 0 4px, transparent 4px 8px); }
.reader .prose { font-family: var(--sans); font-size: 1.13rem; line-height: 1.8; color: var(--prose); }
/* El texto de lectura queda por encima de las líneas de barrido y la viñeta (body::after), con un barrido
   propio mucho más suave detrás de las letras: se mantiene el VHS sin ensuciar los caracteres. */
.reader .prose { position: relative; z-index: 91; background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .12) 2px 3px); }
.reader .prose p:first-child::first-letter { float: none; font: inherit; color: inherit; padding: 0; text-shadow: none; }
.scene-rule { display: none; }
.choices { gap: 10px; }
.choice { border-radius: 0; background: transparent; border: 1px solid var(--line); color: var(--text);
  font-family: var(--display); font-size: 1.35rem; text-transform: uppercase; letter-spacing: .04em; transition: none; }
.choice .arrow { color: var(--rec); visibility: hidden; }
.choice:hover, .choice:focus-visible { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 3px 0 0 var(--rec), -3px 0 0 var(--cyan); }
.choice:hover .arrow, .choice:focus-visible .arrow { visibility: visible; color: var(--accent-ink); }
.choice.soon { color: var(--muted); border-style: dashed; }
.ending-box { border-radius: 0; border: 1px solid var(--line); background: #000; }
.ending-box .kind { font-family: var(--display); font-weight: 400; font-size: 1.3rem; letter-spacing: .15em; }
.ending-box .kind::before { content: '■ STOP · '; color: var(--muted); }
.ending-box h2 { font-size: 2.6rem; }
.ending-box.muerte { border-color: var(--rec); box-shadow: inset 0 0 60px rgba(255, 42, 42, .2); }
.ending-box.muerte h2 { color: var(--rec); }
.ending-box.sobrevive .kind { color: var(--survive); }
.endings-found span { border-radius: 0; }
.choice-stat { border-radius: 0; background: #000; border: 1px solid var(--line); }
.choice-stat .cs-text strong { font-family: var(--display); font-weight: 400; font-size: 1.9rem; color: var(--accent); text-shadow: var(--glitch); }
.choice-stat .cs-bar { border-radius: 0; height: 10px; background: repeating-linear-gradient(90deg, #1b241b 0 6px, transparent 6px 8px); }
.choice-stat .cs-bar span { border-radius: 0; background: repeating-linear-gradient(90deg, var(--accent) 0 6px, transparent 6px 8px); }

/* Estadísticas, perfil, avisos, comentarios */
.kpi .v { font-size: 2.3rem; }
.bar, .bar i { border-radius: 0; }
.bar i { background: var(--accent); }
.comment { border-top: 1px dashed var(--line); }
.op-chip { border-radius: 0; background: var(--rec); color: #fff; font-family: var(--display); font-weight: 400; font-size: .95rem; }
.notif { border-radius: 0; }
.notif.unread { background: var(--bg-2); box-shadow: inset 3px 0 0 var(--rec); }
.notif-body em { color: var(--accent); font-style: normal; }
.nav-count { background: var(--rec); border-radius: 0; font-family: var(--sans); }
.author-chip strong { font-family: var(--display); font-weight: 400; font-size: 1.1rem; text-transform: uppercase; }
.avatar { filter: saturate(.4) hue-rotate(55deg); }
.cta { background: #000; border: 1px solid var(--rec); }
.cta h2 { color: var(--text); }

/* Barra inferior en el celular */
.bottom-nav { background: rgba(5, 6, 5, .96); border-top: 1px solid var(--line); }
.bottom-nav a { font-family: var(--display); font-weight: 400; font-size: .95rem; text-transform: uppercase; letter-spacing: .05em; }
.bottom-nav a.on { color: var(--accent); }

/* Editor */
.map-svg .node rect { rx: 0; }
.map-svg .node text { font-family: var(--sans); }
.editor-head { border-bottom: 1px solid var(--line); }

footer { font-family: var(--sans); }
@media (prefers-reduced-motion: reduce) {
  body::before, .brand .dot, .badge.live::before, .ribbon::before, .reader .scene-title::before { animation: none; }
}

/* ==========================================================================
   Tema opcional "Limpio y moderno" (Ajustes → Apariencia). Se activa con
   <html data-theme="limpio"> y apaga los efectos de la cinta VHS.
   ========================================================================== */
html[data-theme="limpio"] {
  /* Estilo "Nocturn" (antes "Ramas"): monte de noche, acento lima frío (luz mala) y las decisiones dibujadas como ramas */
  --bg: #0e1211; --bg-2: #151b19; --bg-3: #1f2724; --line: #2c3732; --rama: #4a5a53;
  --text: #e9efea; --muted: #8e9d96; --accent: #c6ef6c; --accent-ink: #10160a;
  --rec: #ff6f5c; --blood: #ff6f5c; --danger: #ff6f5c; --death: #ff6f5c; --survive: #66bb6a;
  --radius: 14px;
  --display: 'Bricolage Grotesque', 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --serif: 'Source Serif 4', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --glitch: none;
}
html[data-theme="limpio"], html[data-theme="limpio"] body { font-family: var(--sans); font-size: 16px; }
html[data-theme="limpio"] body { background: var(--bg); }
html[data-theme="limpio"] body::before, html[data-theme="limpio"] body::after,
html[data-theme="limpio"] .hero::before { display: none; }
html[data-theme="limpio"] :is(h1, h2, h3, .brand, .cover-title, .hero h1, .story-info h1, .story-card h2, .mine-body h2, .ending-box h2, .shelf-head h2, .kpi .v) {
  font-family: var(--display); text-transform: none; text-shadow: none; letter-spacing: -.02em; font-weight: 800;
}
html[data-theme="limpio"] h1 { font-size: 1.9rem; line-height: 1.15; }
html[data-theme="limpio"] h2 { font-size: 1.2rem; font-weight: 700; }
html[data-theme="limpio"] h3 { font-size: 1rem; font-weight: 700; }
/* Barra superior y navegación */
html[data-theme="limpio"] .top { background: color-mix(in srgb, var(--bg) 90%, transparent); backdrop-filter: blur(8px); }
html[data-theme="limpio"] .brand { font-size: 1.25rem; }
html[data-theme="limpio"] .brand::after { content: none; }
html[data-theme="limpio"] .brand .dot { background: var(--accent); box-shadow: none; animation: none; }
html[data-theme="limpio"] .top nav a { font-family: var(--sans); font-size: .95rem; text-transform: none; border-radius: 8px; }
html[data-theme="limpio"] .top nav a.on, html[data-theme="limpio"] .top nav a:hover { background: var(--bg-3); color: var(--text); }
html[data-theme="limpio"] .bottom-nav { background: color-mix(in srgb, var(--bg) 95%, transparent); }
html[data-theme="limpio"] .bottom-nav a { font-family: var(--sans); font-weight: 600; font-size: .72rem; text-transform: none; letter-spacing: 0; }
/* Botones y controles */
html[data-theme="limpio"] .btn { border-radius: 999px; font-family: var(--sans); font-size: .95rem; font-weight: 600; text-transform: none; letter-spacing: 0; background: var(--bg-3); }
html[data-theme="limpio"] .btn.sm { font-size: .88rem; }
html[data-theme="limpio"] .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: none; }
html[data-theme="limpio"] .btn.ghost { background: transparent; }
html[data-theme="limpio"] :is(input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], select, textarea) { border-radius: 10px; background: var(--bg-2); font-family: var(--sans); }
html[data-theme="limpio"] :is(input, select, textarea):focus, html[data-theme="limpio"] .btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; box-shadow: none; }
html[data-theme="limpio"] .card { border-radius: 16px; background: var(--bg-2); }
html[data-theme="limpio"] .notice { border-radius: 10px; border-left-color: var(--accent); }
html[data-theme="limpio"] .badge { border-radius: 99px; font-family: var(--sans); }
html[data-theme="limpio"] .badge.live { color: var(--live); border-color: var(--live-line); }
html[data-theme="limpio"] .badge.live::before, html[data-theme="limpio"] .ribbon::before { content: none; }
html[data-theme="limpio"] :is(.chip, .tag-chip) { border-radius: 99px; }
html[data-theme="limpio"] .toast { border-radius: 12px; font-family: var(--sans); font-size: .95rem; text-transform: none; box-shadow: 0 6px 24px #0008; }
html[data-theme="limpio"] :is(.tabs button, .tabs a) { font-family: var(--sans); font-size: .95rem; font-weight: 600; text-transform: none; letter-spacing: 0; }
html[data-theme="limpio"] .tabs .on { border-bottom-color: var(--accent); }
html[data-theme="limpio"] .seg button { border-radius: 10px; font-family: var(--sans); font-size: .9rem; text-transform: none; }
html[data-theme="limpio"] .modal .box, html[data-theme="limpio"] .sheet { border-radius: 16px 16px 0 0; border-top: 0; }
/* Secciones del inicio */
html[data-theme="limpio"] .shelf-head { border-bottom: 0; }
html[data-theme="limpio"] .shelf-head h2 { font-size: 1.2rem; }
html[data-theme="limpio"] .shelf-head h2::before { content: none; }
html[data-theme="limpio"] .kicker { font-family: var(--sans); font-size: .72rem; font-weight: 800; letter-spacing: .12em; color: var(--accent); text-transform: uppercase; }
html[data-theme="limpio"] .kicker::before { content: none; }
/* Portadas */
html[data-theme="limpio"] .cover { border-radius: 12px; box-shadow: 0 6px 18px #0007; }
html[data-theme="limpio"] .cover > :not(.cover-text) { filter: none; }
html[data-theme="limpio"] .cover::after { background: linear-gradient(180deg, transparent 35%, #000c 100%); }
html[data-theme="limpio"] .cover-title, html[data-theme="limpio"] .cover-text.caps .cover-title { font-family: var(--display); font-size: 1.05rem; line-height: 1.1; font-weight: 800; letter-spacing: -.01em; text-transform: none; }
html[data-theme="limpio"] .tile:hover .cover { box-shadow: 0 10px 26px #000a, 0 0 0 2px var(--accent); transform: translateY(-3px); }
html[data-theme="limpio"] .ribbon { border-radius: 6px; background: #0b2a27e6; color: var(--live); border: 0; font-family: var(--sans); font-weight: 800; font-size: .66rem; }
/* Destacada */
html[data-theme="limpio"] .hero h1 { font-size: 2.4rem; line-height: 1.05; }
@media (min-width: 900px) { html[data-theme="limpio"] .hero h1 { font-size: 3rem; } html[data-theme="limpio"] .hero-wrap { border: 0; border-radius: 20px; } }
html[data-theme="limpio"] .hero-dots i { border-radius: 3px; }
html[data-theme="limpio"] .hero-dots i.on { background: var(--accent); }
/* Historia */
html[data-theme="limpio"] .story-info h1 { font-size: 2rem; }
html[data-theme="limpio"] .synopsis { font-family: var(--serif); font-size: 1.12rem; line-height: 1.65; }
/* Lector: texto en una letra cómoda para leer largo */
html[data-theme="limpio"] .reader .scene-title { font-family: var(--sans); font-size: .78rem; font-weight: 700; letter-spacing: .14em; color: var(--muted); text-shadow: none; }
html[data-theme="limpio"] .reader .scene-title::before { content: none; }
html[data-theme="limpio"] .reader .scene-title::after { content: none; }
html[data-theme="limpio"] .reader .prose { font-family: var(--serif); font-size: 1.18rem; line-height: 1.75; color: var(--text); }
html[data-theme="limpio"] .choice { border-radius: 14px; background: var(--bg-2); font-family: var(--sans); font-size: 1rem; font-weight: 600; text-transform: none; letter-spacing: 0; }
html[data-theme="limpio"] .choice .arrow { visibility: visible; color: var(--accent); }
html[data-theme="limpio"] .choice:hover, html[data-theme="limpio"] .choice:focus-visible { background: var(--bg-3); color: var(--text); border-color: var(--accent); box-shadow: none; }
html[data-theme="limpio"] .choice:hover .arrow { color: var(--accent); }
html[data-theme="limpio"] .ending-box { border-radius: 16px; background: var(--bg-2); }
html[data-theme="limpio"] .ending-box .kind { font-family: var(--sans); font-size: .8rem; font-weight: 700; }
html[data-theme="limpio"] .ending-box .kind::before { content: none; }
html[data-theme="limpio"] .ending-box h2 { font-size: 1.6rem; }
html[data-theme="limpio"] .ending-box.muerte { box-shadow: none; }
html[data-theme="limpio"] .ending-box.muerte h2 { color: var(--text); }
html[data-theme="limpio"] .endings-found span { border-radius: 50%; }
html[data-theme="limpio"] .choice-stat { border-radius: 14px; background: var(--bg-2); }
html[data-theme="limpio"] .choice-stat .cs-text strong { font-family: var(--sans); font-size: 1.15rem; font-weight: 800; text-shadow: none; color: var(--accent); }
html[data-theme="limpio"] .choice-stat .cs-bar { border-radius: 3px; height: 6px; background: rgba(255, 255, 255, .08); }
html[data-theme="limpio"] .choice-stat .cs-bar span { border-radius: 3px; background: var(--accent); }
/* Resto */
html[data-theme="limpio"] .kpi .v { font-size: 1.7rem; }
html[data-theme="limpio"] :is(.bar, .bar i) { border-radius: 4px; }
html[data-theme="limpio"] .bar i { background: var(--accent); }
html[data-theme="limpio"] .comment { border-top: 1px solid var(--line); }
html[data-theme="limpio"] .op-chip { border-radius: 99px; background: var(--accent); color: var(--accent-ink); font-family: var(--sans); font-weight: 700; font-size: .7rem; }
html[data-theme="limpio"] .notif { border-radius: 12px; }
html[data-theme="limpio"] .notif.unread { box-shadow: inset 3px 0 0 var(--accent); }
html[data-theme="limpio"] .nav-count { border-radius: 9px; }
html[data-theme="limpio"] .author-chip strong { font-family: var(--sans); font-weight: 700; font-size: .85rem; text-transform: none; }
html[data-theme="limpio"] .avatar { filter: none; }
html[data-theme="limpio"] .cta { background: linear-gradient(120deg, #1c2a14, var(--bg-2)); border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line)); }
html[data-theme="limpio"] .map-svg .node rect { rx: 8; }

/* --- Estilo "Nocturn" (identidad del tema limpio) --- */
html[data-theme="limpio"] :is(h1, h2, .brand, .cover-title, .hero h1, .story-info h1, .story-card h2, .mine-body h2, .ending-box h2, .shelf-head h2, .kpi .v) {
  font-weight: 800; letter-spacing: -.025em; font-variation-settings: 'wdth' 80;
}
html[data-theme="limpio"] .hero h1 { font-size: 3rem; line-height: .95; }
@media (min-width: 900px) { html[data-theme="limpio"] .hero h1 { font-size: 3.6rem; } }
html[data-theme="limpio"] .brand { font-size: 1.45rem; }
html[data-theme="limpio"] .brand .dot { width: 9px; height: 9px; box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
html[data-theme="limpio"] .shelf-head h2 { display: flex; align-items: center; gap: 10px; font-size: 1.4rem; }
html[data-theme="limpio"] .shelf-head h2::before { content: ''; display: block; width: 14px; height: 14px; flex: none;
  border-left: 2px solid var(--accent); border-bottom: 2px solid var(--accent); border-bottom-left-radius: 8px; transform: translateY(-4px); }
html[data-theme="limpio"] .btn { border-radius: 8px; }
html[data-theme="limpio"] .btn.primary { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent); }
html[data-theme="limpio"] .cover { border-radius: 4px 18px 4px 4px; }
html[data-theme="limpio"] .cover.cv.cv:not([class*="cv-f-"]) .cover-text .cover-title { font-family: var(--display); font-weight: 800; font-variation-settings: 'wdth' 78; letter-spacing: -.02em; }
html[data-theme="limpio"] .reader .scene-title { color: var(--accent); }
/* Decisiones: un tronco y una rama hacia cada opción (no en las decisiones con imagen) */
html[data-theme="limpio"] .choices:not(.with-pics):not(.lay-mosaico):not(.lay-carrusel) { position: relative; padding-left: 26px; gap: 12px; margin-top: 34px; }
html[data-theme="limpio"] .choices:not(.with-pics):not(.lay-mosaico):not(.lay-carrusel)::before { content: ''; position: absolute; left: 7px; top: -22px; bottom: 28px; width: 2px;
  background: linear-gradient(180deg, transparent, var(--rama) 22px); transform-origin: top; animation: ramas-tronco .5s ease-out both; }
html[data-theme="limpio"] .choices:not(.with-pics):not(.lay-mosaico):not(.lay-carrusel) .choice { position: relative; overflow: visible; }
html[data-theme="limpio"] .choices:not(.with-pics):not(.lay-mosaico):not(.lay-carrusel) .choice::before { content: ''; position: absolute; left: -19px; top: -13px; height: calc(50% + 12px); width: 18px;
  border-left: 2px solid var(--rama); border-bottom: 2px solid var(--rama); border-bottom-left-radius: 12px; transition: border-color .2s; pointer-events: none; }
html[data-theme="limpio"] .choices:not(.with-pics):not(.lay-mosaico):not(.lay-carrusel) .choice .arrow { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); color: transparent; overflow: hidden; flex: none; transition: background .2s, box-shadow .2s; }
html[data-theme="limpio"] .choices:not(.with-pics):not(.lay-mosaico):not(.lay-carrusel) .choice.soon .arrow { border-color: var(--muted); border-style: dashed; }
html[data-theme="limpio"] .choices:not(.with-pics):not(.lay-mosaico):not(.lay-carrusel) .choice:not(.soon):is(:hover, :focus-visible)::before { border-color: var(--accent); }
html[data-theme="limpio"] .choices:not(.with-pics):not(.lay-mosaico):not(.lay-carrusel) .choice:not(.soon):is(:hover, :focus-visible) .arrow { background: var(--accent); box-shadow: 0 0 10px var(--accent); }
@keyframes ramas-tronco { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@media (prefers-reduced-motion: reduce) { html[data-theme="limpio"] .choices::before { animation: none; } }

/* Selector de apariencia */
.theme-pick { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.theme-opt { display: flex; flex-direction: column; gap: 8px; padding: 10px; border: 1px solid var(--line); background: var(--bg); cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.theme-opt.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.theme-opt .sw { height: 64px; display: flex; align-items: flex-end; padding: 8px; }
.theme-opt .sw.vhs { background: repeating-linear-gradient(0deg, transparent 0 2px, #0006 2px 3px), radial-gradient(circle at 70% 35%, #cfe0c6 0 6px, #1b261b 14px, #050605 40px);
  font: 400 1.3rem 'VT323', monospace; color: #d8e8d0; text-shadow: 2px 0 #ff2a2aaa, -2px 0 #2ad4ffaa; }
.theme-opt .sw.limpio { background: linear-gradient(135deg, #1f2724, #0e1211); border-radius: 10px; font: 800 1.1rem 'Bricolage Grotesque', 'Inter', system-ui, sans-serif; font-variation-settings: 'wdth' 80; letter-spacing: -.02em; color: #e9efea; }
.theme-opt .sw.limpio::after { content: ''; width: 34px; height: 12px; border-radius: 6px; background: #c6ef6c; margin-left: auto; }
.theme-foot { background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }

/* ---------- Portadas: título, frase, filtros (cv = portada con medidas relativas a su ancho) ---------- */
.cover.cv { container-type: inline-size; --ls: 1; }
.cover.cv-long { --ls: .78; }
.cover.cv-xlong { --ls: .62; }
.cover.cv .cover-text { left: 7cqw; right: 7cqw; bottom: 7cqw; }
.cover.cv-p-arriba .cover-text { top: 7cqw; bottom: auto; }
.cover.cv-p-centro .cover-text { top: 50%; bottom: auto; transform: translateY(-50%); text-align: center; }
.cover.cv.cv .cover-text .cover-title { font-size: max(9px, calc(15cqw * var(--ls))); line-height: .92; overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
html[data-theme="limpio"] .cover.cv.cv:not([class*="cv-f-"]) .cover-text .cover-title { font-size: max(9px, calc(11cqw * var(--ls))); line-height: 1.05; }
html .cover.cv.cv.cv-f-vhs .cover-text .cover-title { font-family: 'VT323', monospace; font-weight: 400; font-size: max(9px, calc(15cqw * var(--ls))); line-height: .92; text-transform: uppercase; letter-spacing: .02em; }
html .cover.cv.cv.cv-f-terror .cover-text .cover-title { font-family: 'Pirata One', serif; font-weight: 400; font-size: max(9px, calc(14cqw * var(--ls))); line-height: .98; text-transform: none; letter-spacing: .01em; }
html .cover.cv.cv.cv-f-maquina .cover-text .cover-title { font-family: 'Special Elite', monospace; font-weight: 400; font-size: max(8px, calc(10.5cqw * var(--ls))); line-height: 1.08; text-transform: none; letter-spacing: 0; }
html .cover.cv.cv.cv-f-manuscrita .cover-text .cover-title { font-family: 'Rock Salt', cursive; font-weight: 400; font-size: max(7px, calc(8.2cqw * var(--ls))); line-height: 1.35; text-transform: none; letter-spacing: 0; }
html .cover.cv.cv.cv-f-moderna .cover-text .cover-title { font-family: 'Inter', sans-serif; font-weight: 800; font-size: max(9px, calc(11cqw * var(--ls))); line-height: 1.05; text-transform: none; letter-spacing: -.01em; }
.cover.cv .cover-tagline { font: 700 max(5px, 3.9cqw)/1 'Inter', sans-serif; letter-spacing: .16em; text-transform: uppercase; color: #ffffffd9; margin-bottom: .6em; text-shadow: 0 1px 6px #000; }
.cover.cv.cv .cover-author { font: 600 max(6px, 3.6cqw)/1.2 'Inter', sans-serif; letter-spacing: .08em; margin-top: .7em; }
.cover.cv.cv-p-arriba::after { background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .35) 2px 3px), linear-gradient(0deg, transparent 35%, #000d 100%); }
.cover.cv.cv-p-centro::after { background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .35) 2px 3px), linear-gradient(180deg, transparent 22%, #000a 50%, transparent 78%); }
html[data-theme="limpio"] .cover.cv.cv-p-arriba::after { background: linear-gradient(0deg, transparent 35%, #000c 100%); }
html[data-theme="limpio"] .cover.cv.cv-p-centro::after { background: linear-gradient(180deg, transparent 22%, #000a 50%, transparent 78%); }
.mine-cover .cover.cv .cover-tagline { display: none; }

.cover-img { background: #000; }
.cover-photo { position: absolute; inset: 0; z-index: 0; background-size: cover; background-position: center; }
.cover-photo.grain::after, .filter-thumb.grain::after { content: ''; position: absolute; inset: 0; opacity: .32; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); }
.cover-photo.lines::after, .filter-thumb.lines::after { content: ''; position: absolute; inset: 0; background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .3) 2px 3px); }

/* Selector de portada */
.cover-picker .wiz-preview { width: 150px; }
@media (max-width: 599px) { .cover-picker .wiz-preview { width: 190px; } }
.cover-dl .btn { padding: 4px 10px; min-height: 34px; font-size: .85rem; }
.cover-dl { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; justify-content: center; margin-top: 10px; }
.cover-dl .small.muted { width: 100%; text-align: center; }
.seg.seg-sm { display: inline-grid; grid-auto-flow: column; grid-template-columns: none; gap: 4px; }
.seg.seg-sm button { min-height: 36px; padding: 4px 12px; font-size: .85rem; }
.fonts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 600px) { .fonts { grid-template-columns: repeat(6, 1fr); } }
.font-btn, .filter-btn { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 4px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; border-radius: 10px; }
.font-btn .font-sample { font-size: 1.5rem; line-height: 1.2; }
.font-btn span:last-child, .filter-btn span:last-child { font-size: .66rem; color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; font-family: var(--sans); }
.font-btn.on, .filter-btn.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--bg)); }
.filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
@media (min-width: 600px) { .filters { grid-template-columns: repeat(6, 1fr); } }
.filter-thumb { position: relative; display: block; width: 100%; aspect-ratio: 2 / 3; background-size: cover; background-position: center; border-radius: 4px; overflow: hidden; }
.crop-back { position: fixed; inset: 0; z-index: 200; background: #000d; display: grid; place-items: center; padding: 16px; }
.crop-box { background: var(--bg-2); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; align-items: center; max-width: 100%; }
.crop-box h2 { margin: 0; font-size: 1.3rem; align-self: flex-start; }
.crop-box p { margin: 0; align-self: flex-start; }
.crop-frame { position: relative; overflow: hidden; touch-action: none; cursor: grab; background: #000; outline: 2px solid var(--accent); }
.crop-frame img { position: absolute; left: 0; top: 0; max-width: none; user-select: none; -webkit-user-drag: none; transform-origin: 0 0; }
.crop-grid { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent calc(33.3% - .5px), #fff5 calc(33.3% - .5px) calc(33.3% + .5px), transparent 0, transparent calc(66.6% - .5px), #fff5 calc(66.6% - .5px) calc(66.6% + .5px), transparent 0),
    linear-gradient(0deg, transparent calc(33.3% - .5px), #fff5 calc(33.3% - .5px) calc(33.3% + .5px), transparent 0, transparent calc(66.6% - .5px), #fff5 calc(66.6% - .5px) calc(66.6% + .5px), transparent 0); }
.crop-zoom { display: flex; align-items: center; gap: 8px; width: 100%; font-size: 1.2rem; }
.crop-zoom input { flex: 1; }
.cover-title-opts { margin-top: 14px; }

/* ---------- Accesibilidad del lector (auditoría) ---------- */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
/* El título de la escena es un h1 que recibe el foco al elegir; no es un control, así que no lleva contorno. */
.reader h1.scene-title { margin: 0 0 1em; line-height: 1.1; }
.reader h1.scene-title:focus { outline: none; }
html[data-theme="limpio"] .reader h1.scene-title { line-height: 1.4; letter-spacing: .14em; text-transform: uppercase; }
html[data-theme="limpio"] .reader .prose { background: none; z-index: auto; }
/* Acciones en forma de texto: área táctil de 44 px sin cambiar su aspecto. */
.linklike { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; }
.reader-foot { margin-top: 8px; gap: 4px; flex-wrap: wrap; }
.reader-foot .linklike { font-size: .85rem; }
.reader-foot .linklike:first-child { padding-left: 0; }
.reader-foot .linklike:last-child { padding-right: 0; }
/* Reducir movimiento: sin desplazamientos ni deslizamientos, sólo fundidos cortos. */
@keyframes fade-still { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .fade-in, .choice-stat { animation: fade-still .2s ease; }
  .sheet { animation: none; }
  .choice-stat .cs-bar span { transition: none; }
  .comment.flash { animation: none; background: rgba(232, 180, 76, .14); }
  html { scroll-behavior: auto; }
}
.reader .prose p { text-wrap: pretty; }
.cover-show { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.story-state { flex: none; font-size: .7rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); border: 1px dashed var(--line); padding: 2px 6px; }
.story-state:empty { display: none; }
html[data-theme="limpio"] .story-state { border-radius: 6px; }

/* ---------- Barra superior: campanita y foto de perfil ---------- */
.nav-tools { display: flex; align-items: center; gap: 4px; margin-left: 8px; }
.nav-ic, .nav-me { position: relative; display: inline-flex; align-items: center; justify-content: center; min-width: 44px; height: 44px; color: var(--muted); text-decoration: none; border-radius: 50%; }
.nav-ic svg { width: 24px; height: 24px; }
.nav-ic:hover, .nav-ic.on { color: var(--text); }
.nav-ic.on::after { content: ''; position: absolute; left: 12px; right: 12px; bottom: 2px; height: 2px; background: var(--accent); }
.nav-ic .nav-count { position: absolute; top: 4px; right: 2px; margin: 0; }
.nav-me .avatar { box-shadow: 0 0 0 1px var(--line); }
.nav-me:hover .avatar, .nav-me.on .avatar { box-shadow: 0 0 0 2px var(--accent); }
.avatar.photo { object-fit: cover; display: inline-block; background: var(--bg-3); filter: none; }
.avatar-pick { display: flex; gap: 14px; align-items: center; }
.crop-frame.round .crop-grid { border-radius: 50%; box-shadow: 0 0 0 999px #0009; }
@media (max-width: 699px) {
  .top { justify-content: flex-start; padding-top: 6px; padding-bottom: 6px; }
  .brand { margin-right: auto; }
  body.no-tabs .bottom-nav { display: none; }
  body.no-tabs:not(.immersive) { padding-bottom: env(safe-area-inset-bottom); }
  body.no-tabs .toast { bottom: 24px; }
}

/* ---------- Carrusel de destacadas ---------- */
.hero-n { color: var(--muted); letter-spacing: .08em; }
.hero-ctrl { position: absolute; bottom: 2px; left: 0; right: 0; z-index: 3; display: flex; align-items: center; justify-content: center; gap: 4px; }
.hero-ctrl .hero-dots { position: static; gap: 0; }
.hero-dots button { width: 28px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; padding: 0; cursor: pointer; }
.hero-dots button i { width: 6px; height: 6px; border-radius: 50%; background: #fff6; transition: width .2s; }
.hero-dots button.on i { background: var(--accent); width: 18px; border-radius: 3px; }
.hero-play { width: 44px; height: 44px; background: none; border: 0; color: var(--text); font-size: .8rem; cursor: pointer; opacity: .75; }
.hero-play:hover { opacity: 1; }
.hero-body { padding-bottom: 48px; }
/* Cinta VHS */
html:not([data-theme="limpio"]) .hero-dots button i { border-radius: 0; }
html:not([data-theme="limpio"]) .hero-dots button.on i { background: var(--rec); border-radius: 0; }
html:not([data-theme="limpio"]) .hero-play { font-family: var(--display); font-size: 1.1rem; }
html:not([data-theme="limpio"]) .nav-ic.on::after { background: var(--rec); }
@media (prefers-reduced-motion: reduce) { .hero-dots button i { transition: none; } }

/* ---------- Flechas para las filas horizontales y el carrusel ---------- */
.row-scroll { position: relative; }
.row-scroll > .shelf-row, .row-scroll > .chips.scroll { scrollbar-width: none; }
.row-scroll > .shelf-row::-webkit-scrollbar, .row-scroll > .chips.scroll::-webkit-scrollbar { display: none; }
.row-arrow { position: absolute; top: 50%; z-index: 4; width: 44px; height: 44px; margin-top: -22px; display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg-2) 92%, transparent); color: var(--text);
  font-size: 1.9rem; line-height: 1; padding: 0 0 4px; cursor: pointer; box-shadow: 0 4px 16px #0008; transition: opacity .15s, border-color .15s; }
.row-arrow:hover { border-color: var(--accent); }
.row-arrow:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.row-arrow.prev { left: -6px; }
.row-arrow.next { right: -6px; }
.row-arrow:disabled, .row-scroll.no-overflow .row-arrow { opacity: 0; pointer-events: none; }
.row-scroll > .shelf-row ~ .row-arrow { top: 42%; }
.row-scroll > .chips.scroll ~ .row-arrow { width: 40px; height: 40px; margin-top: -23px; font-size: 1.6rem; }
.hero-arrow { width: 44px; height: 44px; background: none; border: 0; color: var(--text); font-size: 1.9rem; line-height: 1; padding: 0 0 4px; cursor: pointer; opacity: .8; }
.hero-arrow:hover { opacity: 1; color: var(--accent); }
/* En pantallas táctiles se desliza con el dedo: las flechas de las filas no hacen falta. */
@media (hover: none) { .row-scroll .row-arrow { display: none; } }
@media (min-width: 1100px) { .row-arrow.prev { left: -22px; } .row-arrow.next { right: -22px; } }
@media (prefers-reduced-motion: reduce) { .row-arrow { transition: none; } }
/* Cinta VHS */
html:not([data-theme="limpio"]) .row-arrow { border-radius: 0; background: rgba(5, 6, 5, .94); font-family: var(--display); font-size: 2.2rem; box-shadow: none; }
html:not([data-theme="limpio"]) .row-arrow:hover { background: var(--accent); color: var(--accent-ink); }
html:not([data-theme="limpio"]) .hero-arrow { font-family: var(--display); font-size: 2.2rem; }

/* ---------- Ventanita de avisos (campanita) ---------- */
button.nav-ic { background: none; border: 0; padding: 0; cursor: pointer; font: inherit; }
button.nav-ic[aria-expanded="true"] { color: var(--text); }
.notif-pop { position: absolute; top: calc(100% + 6px); right: 12px; z-index: 40; width: min(380px, calc(100vw - 24px));
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px #000a;
  display: flex; flex-direction: column; max-height: min(70vh, 560px); overflow: hidden; }
.notif-pop-head { padding: 12px 14px; border-bottom: 1px solid var(--line); }
.notif-pop .notif-list { overflow-y: auto; padding: 4px; }
.notif-pop .notif { padding: 10px; }
.notif-pop .notif:hover, .notif-pop .notif.unread { background: var(--bg-3); }
.notif-pop-all { display: flex; align-items: center; justify-content: center; min-height: 44px; border-top: 1px solid var(--line); color: var(--accent); text-decoration: none; font-weight: 600; }
.notif-pop-all:hover { background: var(--bg-3); }
@media (max-width: 699px) { .notif-pop { left: 8px; right: 8px; width: auto; } }
/* Cinta VHS */
html:not([data-theme="limpio"]) .notif-pop { border-radius: 0; background: rgba(5, 6, 5, .98); box-shadow: 0 0 0 1px var(--line), 0 16px 40px #000; }
html:not([data-theme="limpio"]) .notif-pop-head strong, html:not([data-theme="limpio"]) .notif-pop-all { font-family: var(--display); font-weight: 400; font-size: 1.25rem; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Explorar ---------- */
.explore-cta { display: flex; justify-content: center; }

/* ---------- Barra superior: Explorar a la izquierda, buscador al medio ---------- */
.top .brand { margin-right: 4px; }
#navleft { margin-right: 8px; }
.top-search { position: relative; flex: 1 1 auto; max-width: 460px; margin: 0 auto; display: flex; align-items: center; }
.top-search > .ico { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }
.top-search > .ico svg { width: 18px; height: 18px; }
.top-search input { width: 100%; min-height: 40px; padding: 8px 12px 8px 38px; border-radius: 999px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: inherit; font-size: .95rem; }
.top-search input:focus { outline: none; border-color: var(--accent); }
.search-pop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 40; background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px #000a; overflow: hidden; }
.search-hit { display: flex; gap: 12px; align-items: center; padding: 8px 12px; color: var(--text); text-decoration: none; min-height: 44px; }
.search-hit:hover, .search-hit:focus { background: var(--bg-3); outline: none; }
.search-hit-cover { width: 36px; flex: none; }
.search-hit-cover .cv, .search-hit-cover .cover { width: 36px; }
.search-hit-cover .cv-title, .search-hit-cover .cv-tag, .search-hit-cover .cv-author, .search-hit-cover .cover-title { display: none; }
.search-hit-body { display: flex; flex-direction: column; min-width: 0; }
.search-hit-body strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-all { display: flex; align-items: center; justify-content: center; min-height: 44px; border-top: 1px solid var(--line); color: var(--accent); text-decoration: none; font-weight: 600; font-size: .92rem; }
.search-all:hover, .search-all:focus { background: var(--bg-3); outline: none; }
.nav-search { display: none; }
@media (min-width: 700px) { .explore-search { display: none; } }
@media (max-width: 899px) and (min-width: 700px) { .top-search { max-width: 280px; } }
@media (max-width: 699px) {
  #navleft, .top-search { display: none; }
  .top .brand { margin-right: auto; }
  .nav-search { display: inline-flex; }
}
/* Cinta VHS */
html:not([data-theme="limpio"]) .top-search input { border-radius: 0; background: #000; font-family: var(--mono, inherit); }
html:not([data-theme="limpio"]) .search-pop { border-radius: 0; background: rgba(5, 6, 5, .98); }

/* ---------- Espacios de publicidad ---------- */
.ad { margin: 24px auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.ad-label { font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); align-self: center; }
.ad-box { display: flex; align-items: center; justify-content: center; text-align: center; color: var(--muted); font-size: .8rem;
  background: var(--bg-2); border: 1px dashed var(--line); border-radius: 8px; padding: 8px; }
.ad-banner .ad-box { width: min(320px, 100%); height: 50px; }
@media (min-width: 760px) { .ad-banner .ad-box { width: 728px; max-width: 100%; height: 90px; } }
.ad-final .ad-box, .ad-card .ad-box { width: min(300px, 100%); height: 250px; }
/* Cinta VHS */
html:not([data-theme="limpio"]) .ad-box { border-radius: 0; background: #000; }
html:not([data-theme="limpio"]) .ad-label { font-family: var(--display); font-size: .95rem; }

/* ---------- Menú de la cuenta (foto de perfil) ---------- */
button.nav-me { background: none; border: 0; padding: 0; cursor: pointer; }
button.nav-me[aria-expanded="true"] .avatar { box-shadow: 0 0 0 2px var(--accent); }
.me-menu { position: absolute; top: calc(100% + 6px); right: 12px; z-index: 40; width: 260px; max-width: calc(100vw - 24px);
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px #000a; padding: 6px; display: flex; flex-direction: column; }
.me-head { display: flex; gap: 10px; align-items: center; padding: 8px 8px 12px; margin-bottom: 4px; border-bottom: 1px solid var(--line); min-width: 0; }
.me-head > div { display: flex; flex-direction: column; min-width: 0; }
.me-head strong, .me-head .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-item { display: flex; align-items: center; gap: 12px; min-height: 44px; padding: 0 10px; border-radius: 8px; color: var(--text); text-decoration: none; background: none; border: 0; font: inherit; text-align: left; cursor: pointer; width: 100%; }
.me-item svg { width: 20px; height: 20px; color: var(--muted); }
.me-item:hover, .me-item:focus { background: var(--bg-3); outline: none; }
.me-item:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.me-out { margin-top: 4px; border-top: 1px solid var(--line); border-radius: 0 0 8px 8px; }
/* Cinta VHS */
html:not([data-theme="limpio"]) .me-menu { border-radius: 0; background: rgba(5, 6, 5, .98); }
html:not([data-theme="limpio"]) .me-item { border-radius: 0; font-family: var(--display); font-size: 1.2rem; text-transform: uppercase; letter-spacing: .05em; }

/* ---------- Métricas (Moderar) ---------- */
.metrics h3 { margin: 22px 0 8px; font-size: 1rem; }
.kpi-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin: 14px 0 8px; }
@media (min-width: 760px) { .kpi-grid { grid-template-columns: repeat(4, 1fr); } }
.kpi-m { margin: 0; padding: 14px; display: flex; flex-direction: column; gap: 4px; }
.kpi-label { font-size: .8rem; color: var(--muted); }
.kpi-value { font-size: 1.8rem; font-weight: 800; line-height: 1.1; }
.kpi-bar { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; margin: 4px 0 2px; }
.kpi-bar span { display: block; height: 100%; background: var(--muted); }
.kpi-m.ok .kpi-bar span { background: var(--ok, #7cbf7a); }
.kpi-m.below .kpi-bar span { background: var(--accent); }
.mtable-wrap { overflow-x: auto; }
.mtable { width: 100%; border-collapse: collapse; font-size: .9rem; }
.mtable th, .mtable td { padding: 8px 10px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.mtable th:first-child { text-align: left; font-weight: 600; white-space: normal; }
.mtable thead th { color: var(--muted); font-weight: 600; font-size: .8rem; }
html:not([data-theme="limpio"]) .kpi-bar { border-radius: 0; }
html:not([data-theme="limpio"]) .kpi-value { font-family: var(--display); font-weight: 400; font-size: 2.4rem; }
.kpi-grid > .card.kpi-m { margin: 0; }

/* ---------- Mapa de finales del lector ---------- */
.modal .box.rmap-modal { max-width: 760px; }
.rmap-sum { margin: 12px 0 6px; }
.rmap-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: .78rem; color: var(--muted); margin-bottom: 10px; }
.rmap-legend .lg::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -2px; border: 1px solid var(--line); }
.rmap-legend .seen::before { background: var(--bg-3); border-color: var(--text); }
.rmap-legend .unseen::before { border-style: dashed; }
.rmap-legend .muerte::before { background: #2c1715; border-color: var(--death); }
.rmap-legend .sobrevive::before { background: #17241a; border-color: var(--survive); }
.rmap-legend .here::before { border: 2px solid var(--accent); }
.rmap-scroll { overflow: auto; max-height: 60dvh; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); padding: 4px; }
.rmap { display: block; margin: 0 auto; }
.rmap-edges path { fill: none; stroke: var(--line); stroke-width: 1.5; }
.rmap-edges path.used { stroke: var(--text); stroke-width: 2; opacity: .75; }
.rmap-edges path.soon { stroke-dasharray: 3 4; }
.rmap .node rect { fill: var(--bg-2); stroke: var(--line); stroke-width: 1.2; }
.rmap .node text { fill: var(--muted); font: 600 11.5px var(--sans); }
.rmap .node text.sub { font-size: 10px; font-weight: 400; }
.rmap .node.unseen rect { stroke-dasharray: 4 3; fill: transparent; stroke: var(--muted); opacity: .7; }
.rmap .node.seen rect { fill: var(--bg-3); stroke: var(--text); }
.rmap .node.seen text { fill: var(--text); }
.rmap .node.muerte rect { fill: #2c1715; stroke: var(--death); }
.rmap .node.sobrevive rect { fill: #17241a; stroke: var(--survive); }
.rmap .node.otro rect { stroke: var(--other, var(--accent)); }
.rmap .node.soon rect { stroke-dasharray: 2 3; opacity: .6; }
.rmap .node.here rect { stroke: var(--accent); stroke-width: 3; }
.rmap-list { margin: 12px 0 0; padding-left: 18px; font-size: .9rem; }
.rmap-list li.muerte::marker { color: var(--death); } .rmap-list li.sobrevive::marker { color: var(--survive); }
html:not([data-theme="limpio"]) .rmap-scroll { border-radius: 0; background: #000; }
html:not([data-theme="limpio"]) .rmap .node rect { rx: 0; }
/* El texto de la escena va sobre las líneas de la TV (z 90-91); la barra de arriba y sus menús, por encima del texto. */
.top { z-index: 95; }
.toast { z-index: 120; }
.modal { z-index: 110; }

/* ---------- Ajustes de lectura ---------- */
.read-tools { position: relative; display: flex; justify-content: flex-end; margin-bottom: -8px; z-index: 92; }
.read-aa { min-width: 44px; height: 44px; padding: 0 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); font: 700 1rem var(--serif); cursor: pointer; }
.read-aa[aria-expanded="true"] { border-color: var(--accent); }
.read-panel { position: absolute; top: calc(100% + 6px); right: 0; z-index: 93; width: min(340px, calc(100vw - 32px)); padding: 14px; display: flex; flex-direction: column; gap: 12px;
  background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 16px 40px #000a; }
.read-row { display: flex; flex-direction: column; gap: 6px; }
.read-label { font-size: .78rem; color: var(--muted); }
.read-size { display: flex; align-items: center; gap: 10px; }
.read-size .btn { min-width: 52px; min-height: 44px; }
.read-dots { display: flex; gap: 5px; flex: 1; justify-content: center; }
.read-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--bg-3); border: 1px solid var(--line); }
.read-dots i.on { background: var(--accent); border-color: var(--accent); }
.read-panel .seg button { min-height: 40px; }
.read-panel .linklike { align-self: flex-start; }
/* Valores elegidos por el lector (en <html>: data-rsize, data-rlh, data-rfont, data-rbg) */
html[data-rsize="1"] .reader .prose { font-size: .95rem; }
html[data-rsize="2"] .reader .prose { font-size: 1.05rem; }
html[data-rsize="4"] .reader .prose { font-size: 1.32rem; }
html[data-rsize="5"] .reader .prose { font-size: 1.5rem; }
html[data-rlh="amplio"] .reader .prose { line-height: 2.1; }
html[data-rfont="serif"] .reader .prose { font-family: 'Source Serif 4', Georgia, serif; }
html[data-rfont="sans"] .reader .prose { font-family: 'Inter', system-ui, sans-serif; }
html[data-rbg="sepia"] .reader .prose { background: #f3e8cf; color: #3b2e1c; padding: 18px 16px 4px; border-radius: 10px; }
html[data-rbg="claro"] .reader .prose { background: #fbfbf8; color: #1c1c1e; padding: 18px 16px 4px; border-radius: 10px; }
html[data-rbg] .reader .prose p:first-child::first-letter { color: inherit; }
/* Cinta VHS */
html:not([data-theme="limpio"]) .read-aa, html:not([data-theme="limpio"]) .read-panel { border-radius: 0; }
html:not([data-theme="limpio"]) .read-aa { font-family: var(--display); font-size: 1.4rem; font-weight: 400; background: #000; }
html:not([data-theme="limpio"]) .read-panel { background: #050605 !important; }
html:not([data-theme="limpio"])[data-rbg] .reader .prose { border-radius: 0; text-shadow: none; }

/* Entrar con Google */
.gsign { gap: 10px; }
.gbtn { min-height: 44px; display: flex; justify-content: center; }
.or-sep { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .8rem; }
.or-sep::before, .or-sep::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.rmap-legend .otro::before { background: #1e1a2e; border-color: var(--other, var(--accent)); }
.rmap-list li.otro::marker { color: var(--other, var(--accent)); }

/* Eliminar historia */
.btn.danger-text { color: var(--danger); }
.del-modal { max-width: 440px; }
.del-modal input { font-family: var(--mono, monospace); }
.del-modal .btn.danger:disabled { opacity: .45; cursor: not-allowed; }

/* Portada: texto en lugar libre (--fx, --fy, --fw van de 0 a 1) */
.cover.cv.cv-free .cover-text { right: auto; bottom: auto; width: calc(86cqw * var(--fw, 1));
  left: calc(7cqw + (86cqw - 86cqw * var(--fw, 1)) * var(--fx, 0));
  top: calc(7cqw + (100% - 14cqw) * var(--fy, 1)); transform: translateY(calc(var(--fy, 1) * -100%)); }
.cover.cv.cv-a-izq .cover-text { text-align: left; }
.cover.cv.cv-a-centro .cover-text { text-align: center; }
.cover.cv.cv-a-der .cover-text { text-align: right; }
.cover.cv.cv-free::after { background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(0, 0, 0, .35) 2px 3px),
  linear-gradient(180deg, transparent calc(var(--fy, 1) * 76% - 18%), #000b calc(12% + var(--fy, 1) * 76%), transparent calc(var(--fy, 1) * 76% + 42%)); }
html[data-theme="limpio"] .cover.cv.cv-free::after { background: linear-gradient(180deg, transparent calc(var(--fy, 1) * 76% - 18%), #000b calc(12% + var(--fy, 1) * 76%), transparent calc(var(--fy, 1) * 76% + 42%)); }
.cv-drag .cover-text { cursor: grab; touch-action: none; outline: 1px dashed #ffffff55; outline-offset: 4px; }
.cv-drag.dragging .cover-text { cursor: grabbing; outline-color: var(--accent); }
.place-sliders { display: grid; gap: 6px; }
.place-slider { display: grid; grid-template-columns: 7.5em 1fr; align-items: center; gap: 10px; margin: 0; }
.place-slider input[type=range] { width: 100%; accent-color: var(--accent); min-height: 32px; }

/* Páginas legales */
.legal { max-width: 720px; margin: 0 auto; }
.legal h2 { margin-top: 18px; }
.legal ul { padding-left: 20px; display: grid; gap: 6px; }

/* Moderar: usuarios */
.user-list { gap: 8px; }
.user-row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 12px 14px; margin: 0; }
.user-row.banned { opacity: .7; border-color: var(--danger); }
.user-main { min-width: 0; flex: 1 1 220px; }
.user-name { font-weight: 700; word-break: break-word; }
.user-main .muted { word-break: break-all; }
.user-main .meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }
.user-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.user-actions select { min-height: 40px; width: auto; }

/* Editor: historial */
.versions { display: grid; gap: 0; max-height: 360px; overflow: auto; }
.version-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }

/* Decisiones con memoria */
.item-gained { margin: 0 0 12px; padding: 10px 14px; border: 1px solid var(--accent); border-radius: var(--radius); color: var(--text); background: var(--bg-2); animation: fade .4s ease; }
.items-bag { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0 0 12px; }
.item-chip { font-size: .78rem; padding: 3px 10px; border-radius: 99px; border: 1px solid var(--line); background: var(--bg-2); }
.choice-mem { border-top: 1px dashed var(--line); padding-top: 8px; }
.choice-mem summary { cursor: pointer; color: var(--muted); }
.choice-mem[open] { display: grid; gap: 8px; }
.choice-mem label { display: grid; gap: 4px; margin: 0; }
.choice-mem select { width: auto; flex: none; }
html:not([data-theme="limpio"]) .item-gained, html:not([data-theme="limpio"]) .item-chip { border-radius: 0; }

/* ---------- Agregar a la pantalla de inicio ---------- */
.install-banner { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin: 4px 0 18px; border: 1px solid var(--line); background: var(--bg-2); border-radius: var(--radius); }
.install-banner img { width: 44px; height: 44px; border-radius: 10px; flex: none; }
.install-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; line-height: 1.35; }
.install-x { flex: none; background: none; border: 0; color: inherit; font-size: 1.5rem; line-height: 1; padding: 6px 8px; cursor: pointer; opacity: .7; min-width: 40px; min-height: 40px; }
.install-x:hover { opacity: 1; }
html:not([data-theme="limpio"]) .install-banner { border-radius: 0; background: rgba(11, 14, 11, .92); }

/* ---------- Ranking (Moderar) y "Para vos" ---------- */
.why { color: var(--accent); }
.rank-panel summary { cursor: pointer; font-weight: 600; }
.rank-rules { margin: 0; padding-left: 18px; display: grid; gap: 6px; }
.rank-table { display: grid; gap: 2px; font-size: .9rem; overflow-x: auto; }
.rank-row { display: grid; grid-template-columns: 24px minmax(0, 1fr) 52px 64px; gap: 8px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rank-meta { display: block; }
.rank-row.head { color: var(--muted); font-size: .8rem; }

/* ---------- Imágenes dentro de la historia ---------- */
.scene-img { margin: 4px 0 22px; border: 1px solid var(--line); background: #000; overflow: hidden; }
.scene-img img { display: block; width: 100%; height: 100%; object-fit: cover; }
.scene-img.h { aspect-ratio: 16 / 9; }
.scene-img.v { aspect-ratio: 3 / 4; width: min(100%, 420px, 62vh); margin-left: auto; margin-right: auto; }
/* Decisiones: diseño (lista, mosaico, carrusel), con o sin imagen cada una. */
.choice-txt { min-width: 0; }
.choice-pic { display: block; flex: none; background: #000; overflow: hidden; }
.choice-pic img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .3s ease, filter .3s ease; }
.choices.with-pics .choice:not(.no-pic) { padding: 0; gap: 0; overflow: hidden; min-height: 0; text-align: left; align-items: stretch; }
.choices.with-pics .choice:not(.no-pic) .arrow { display: none; }
.choices.with-pics .choice:not(.no-pic) .choice-txt { padding: 12px 14px 14px; }
.choices.with-pics .choice:not(.no-pic) :is(.soon-tag, .new-tag) { align-self: flex-start; margin: 0 14px 12px; }
.choices.with-pics .choice:hover .choice-pic img, .choices.with-pics .choice:focus-visible .choice-pic img { transform: scale(1.04); }
.choices.with-pics .choice.soon .choice-pic img { filter: grayscale(1) brightness(.5); }
/* Lista: horizontal arriba de la decisión; vertical, a la izquierda (así no ocupa toda la pantalla). */
.choices.lay-lista.h .choice:not(.no-pic) { flex-direction: column; }
.choices.lay-lista.h .choice-pic { aspect-ratio: 16 / 9; border-bottom: 1px solid var(--line); }
.choices.lay-lista.v .choice:not(.no-pic) { flex-direction: row; flex-wrap: wrap; align-items: center; }
.choices.lay-lista.v .choice-pic { width: 92px; aspect-ratio: 3 / 4; align-self: stretch; border-right: 1px solid var(--line); }
.choices.lay-lista.v .choice:not(.no-pic) .choice-txt { flex: 1; }
.choices.lay-lista.v .choice:not(.no-pic) :is(.soon-tag, .new-tag) { margin: 0 14px 0 0; align-self: center; }
/* Mosaico: de a dos en el celular, hasta cuatro en la PC. Las que no tienen imagen son tarjetas de texto del mismo alto. */
.choices.lay-mosaico { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: stretch; }
.choices.lay-mosaico.one { grid-template-columns: minmax(0, 280px); justify-content: center; }
@media (min-width: 700px) { .choices.lay-mosaico:not(.one) { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
.choices.lay-mosaico .choice { flex-direction: column; align-items: stretch; height: 100%; }
.choices.lay-mosaico .choice.no-pic, .choices.lay-mosaico:not(.with-pics) .choice { justify-content: center; text-align: center; min-height: 104px; padding: 14px 12px; }
.choices.lay-mosaico .choice.no-pic .arrow, .choices.lay-mosaico:not(.with-pics) .choice .arrow { display: none; }
.choices.lay-mosaico .choice.no-pic :is(.soon-tag, .new-tag), .choices.lay-mosaico:not(.with-pics) .choice :is(.soon-tag, .new-tag) { margin: 0 auto; }
.choices.lay-mosaico.h .choice-pic, .choices.lay-carrusel.h .choice-pic { aspect-ratio: 16 / 9; border-bottom: 1px solid var(--line); }
.choices.lay-mosaico.v .choice-pic, .choices.lay-carrusel.v .choice-pic { aspect-ratio: 3 / 4; border-bottom: 1px solid var(--line); }
.choices.lay-mosaico .choice:not(.no-pic) .choice-txt { flex: 1; }
html:not([data-theme="limpio"]) .choices.lay-mosaico .choice, html:not([data-theme="limpio"]) .choices.lay-carrusel .choice { font-size: 1.1rem; }
/* Carrusel: una al lado de la otra, se deslizan con el dedo. Se asoma la siguiente para que se note que hay más. */
.choices.lay-carrusel { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain;
  padding: 4px 2px 10px; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.choices.lay-carrusel .choice { flex: 0 0 min(76%, 280px); scroll-snap-align: start; flex-direction: column; align-items: stretch; }
.choices.lay-carrusel.with-pics.v .choice { flex-basis: min(58%, 220px); }
.choices.lay-carrusel.one .choice { flex-basis: min(100%, 320px); margin: 0 auto; }
.choices.lay-carrusel .choice.no-pic, .choices.lay-carrusel:not(.with-pics) .choice { justify-content: center; min-height: 120px; }
.choices.lay-carrusel .choice.no-pic .arrow, .choices.lay-carrusel:not(.with-pics) .choice .arrow { display: none; }
.choices.lay-carrusel .choice:not(.no-pic) .choice-txt { flex: 1; }
.carrusel-hint { margin: -4px 0 12px; font-size: .8rem; color: var(--muted); text-align: right; }
html[data-theme="limpio"] .scene-img, html[data-theme="limpio"] .choices.with-pics .choice, html[data-theme="limpio"] .choices:is(.lay-mosaico, .lay-carrusel) .choice { border-radius: 14px; }

/* Movimiento de las decisiones (lo elige el autor). Arranca cuando se ven en pantalla (.in). Cada una con su desfase (--i). */
.cfx-aparecer:not(.in) .choice { opacity: 0; }
.cfx-aparecer.in .choice { animation: cfx-in .55s cubic-bezier(.2, .7, .2, 1) both; animation-delay: calc(var(--i, 0) * 170ms); }
.cfx-flotar.in .choice { animation: cfx-in .45s ease-out both, cfx-float 3.8s ease-in-out .45s infinite; animation-delay: calc(var(--i, 0) * 90ms), calc(var(--i, 0) * -1.2s); }
.cfx-latido.in .choice { animation: cfx-beat 2.6s ease-in-out infinite; animation-delay: calc(var(--i, 0) * 260ms); }
.cfx-temblor.in .choice { animation: cfx-shake 4.8s linear infinite; animation-delay: calc(var(--i, 0) * 1.35s + .6s); }
.cfx-parpadeo.in .choice { animation: cfx-flicker 5.5s linear infinite; animation-delay: calc(var(--i, 0) * 1.8s + .4s); }
/* Para tocar tranquilo: se quedan quietas bajo el dedo o el mouse, y se frenan al elegir. */
.cfx:not(.cfx-aparecer).in .choice:is(:hover, :focus-visible) { animation-play-state: paused; }
.cfx:not(.cfx-aparecer) .choice:disabled:not(.soon) { animation: none; }
@keyframes cfx-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes cfx-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes cfx-beat { 0%, 32%, 100% { transform: scale(1); } 8% { transform: scale(1.028); } 16% { transform: scale(1.006); } 24% { transform: scale(1.022); } }
@keyframes cfx-shake { 0%, 84%, 100% { transform: none; } 86% { transform: translate(-2px, 1px) rotate(-.5deg); } 88% { transform: translate(2px, -1px) rotate(.5deg); }
  90% { transform: translate(-2px, 0) rotate(-.3deg); } 92% { transform: translate(1px, 1px); } 94% { transform: none; } }
/* Parpadeo como una luz que falla: dos bajones cortos cada 5,5 s (lejos del límite de destellos que puede afectar a personas fotosensibles). */
@keyframes cfx-flicker { 0%, 78%, 100% { opacity: 1; } 79% { opacity: .45; } 80.5% { opacity: 1; } 83% { opacity: .62; } 84.5% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .choice-pic img { transition: none; } .choices.with-pics .choice:hover .choice-pic img { transform: none; } .cfx .choice { animation: none !important; opacity: 1 !important; } }
/* Editor: imágenes de escenas y decisiones */
.ed-img-row { align-items: center; gap: 12px; flex-wrap: nowrap !important; }
.ed-thumb { flex: none; display: flex; align-items: center; justify-content: center; overflow: hidden; border: 1px solid var(--line); background: #000; color: var(--muted); font-size: .75rem; }
.ed-thumb.h { width: 128px; aspect-ratio: 16 / 9; }
.ed-thumb.v { width: 84px; aspect-ratio: 3 / 4; }
.ed-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ed-thumb.empty { border-style: dashed; }
.ed-img-row.missing .ed-thumb.empty { border-color: var(--danger); color: var(--danger); }
.seg.seg-sm { grid-template-columns: repeat(2, auto); }
.seg.seg-sm button { min-height: 36px; padding: 4px 12px; font-size: .8rem; }
.choice-img-head { margin-bottom: 8px; }
/* Editor: imagen en cada decisión (siempre visible) y "Cómo se ven las decisiones". */
.choice-img-row { gap: 8px; min-height: 36px; }
.choice-img-row .ed-thumb.h { width: 88px; }
.choice-img-row .ed-thumb.v { width: 54px; }
.choice-img-row .ed-img-add { border-style: dashed; }
.look-box { margin-top: 14px; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); gap: 10px; }
.look-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.look-lay button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 62px; font-size: .82rem; }
.lay-ic { display: grid; gap: 2px; width: 26px; height: 20px; }
.lay-ic i { display: block; border: 1.5px solid currentColor; border-radius: 2px; opacity: .85; }
.lay-ic-lista { grid-template-rows: repeat(3, 1fr); }
.lay-ic-mosaico { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.lay-ic-mosaico i:first-child { grid-row: span 2; }
.lay-ic-carrusel { grid-template-columns: 1fr 1fr .45fr; width: 30px; }
.lay-ic-carrusel i:last-child { border-right: 0; border-radius: 2px 0 0 2px; opacity: .5; }
.look-fx { display: grid; gap: 4px; }
.look-fx .chips { margin: 0; }
.look-preview { position: relative; border: 1px dashed var(--line); border-radius: 8px; padding: 22px 10px 6px; overflow: hidden; pointer-events: none; background: var(--bg-2); }
.look-pv-tag { position: absolute; top: 4px; left: 10px; font-size: .68rem; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }
.look-pv-in { zoom: .62; }
.look-pv-in .choices { margin: 6px 0 4px; }
.look-shape { justify-content: space-between; flex-wrap: wrap; gap: 6px; }

/* ---------- Texto con formato y efectos ---------- */
.prose em { font-style: italic; }
.prose strong { font-weight: 700; color: var(--text); }
.scene-sep { border: 0; height: auto; margin: 26px 0; text-align: center; color: var(--muted); }
.scene-sep::before { content: '✦  ✦  ✦'; letter-spacing: .4em; font-size: .8rem; }
.fx-hold { display: none !important; }
.fx-lento.typing::after { content: '▍'; animation: blink .8s steps(1) infinite; margin-left: 1px; color: var(--accent); }
@keyframes blink { 50% { opacity: 0; } }
.fx-tiembla { display: inline-block; animation: tiembla .14s steps(2) infinite; text-shadow: 1px 0 0 rgba(255, 42, 42, .55), -1px 0 0 rgba(0, 220, 255, .45); }
@keyframes tiembla { 0% { transform: translate(0, 0); } 25% { transform: translate(-.6px, .5px) rotate(-.3deg); } 50% { transform: translate(.6px, -.4px); } 75% { transform: translate(-.4px, -.5px) rotate(.3deg); } 100% { transform: translate(.5px, .4px); } }
.prose.fx-off .fx-tiembla { animation: none; }
.fx-negro { min-height: 8px; }
.fx-negro.done { min-height: 0; }
.fx-continue { display: flex; flex-direction: column; align-items: center; gap: 2px; width: 100%; margin: 18px 0; padding: 18px; background: transparent; border: 1px dashed var(--line); color: var(--muted); cursor: pointer; font: inherit; }
.fx-continue span[aria-hidden] { font-size: 1.4rem; letter-spacing: .3em; color: var(--text); animation: blink 1.6s steps(1) infinite; }
.fx-blackout { position: fixed; inset: 0; background: #000; z-index: 130; opacity: 0; transition: opacity .8s ease; pointer-events: none; }
.fx-blackout.on { opacity: 1; }
@media (prefers-reduced-motion: reduce) { .fx-tiembla, .fx-continue span[aria-hidden], .fx-lento.typing::after { animation: none; } .fx-blackout { transition: none; } }

/* Corte de cinta al elegir */
.vhs-cut { position: fixed; inset: 0; z-index: 125; pointer-events: none; animation: vhscut .5s steps(5) forwards;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.07) 0 2px, transparent 2px 4px), rgba(0,0,0,.55); }
.vhs-cut i { position: absolute; left: 0; right: 0; height: 9%; background: rgba(216, 232, 208, .18); mix-blend-mode: screen; box-shadow: 0 0 0 1px rgba(255,42,42,.35); }
.vhs-cut i:nth-child(1) { top: 18%; transform: translateX(-6%); }
.vhs-cut i:nth-child(2) { top: 52%; height: 4%; transform: translateX(5%); }
.vhs-cut i:nth-child(3) { top: 77%; height: 6%; transform: translateX(-3%); }
@keyframes vhscut { 0% { opacity: 1; } 40% { opacity: .9; transform: translateY(-1%); } 100% { opacity: 0; transform: none; } }
html[data-theme="limpio"] .vhs-cut { background: var(--bg); animation: limpiocut .35s ease forwards; }
html[data-theme="limpio"] .vhs-cut i { display: none; }
@keyframes limpiocut { from { opacity: .7; } to { opacity: 0; } }

/* Cuenta regresiva */
.choice-timer { margin: 24px 0 -14px; display: grid; gap: 6px; }
.timer-track { height: 6px; background: var(--bg-3); overflow: hidden; }
.timer-fill { display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(1); }
.choice-timer.urgent .timer-fill { background: var(--danger); }
.choice-timer.urgent strong { color: var(--danger); }
.choice-timer.stopped { opacity: .4; }
.timer-off { margin: 20px 0 -16px; }

/* Comentarios por escena */
.scene-comments-btn { margin-top: 4px; }
.scene-comments { max-height: 50vh; overflow: auto; margin-bottom: 12px; }
.scene-comment { border-bottom: 1px solid var(--line); padding-bottom: 8px; }
.read-panel input[type=text] { width: 100%; min-width: 0; }

/* Editor: formato, concentración, notas, tiempo */
.fmt-bar { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0 6px; }
.fmt-btn { min-width: 36px; min-height: 34px; padding: 4px 9px; border: 1px solid var(--line); background: var(--bg); color: var(--text); cursor: pointer; font: inherit; font-size: .82rem; }
.fmt-btn.fx { color: var(--accent); }
.fmt-btn:hover, .fmt-btn:focus-visible { border-color: var(--accent); }
.fmt-help { flex-basis: 100%; border: 1px solid var(--line); padding: 8px 10px; background: var(--bg); }
.fmt-help p { margin: 0 0 6px; }
.notes-box summary { cursor: pointer; color: var(--muted); }
.notes-box textarea { margin-top: 6px; background: color-mix(in srgb, var(--accent) 6%, var(--bg)); }
.timer-box { margin-bottom: 10px; }
.timer-box select { flex: 1; min-width: 0; }
.focus-mode { position: fixed; inset: 0; z-index: 105; background: var(--bg); display: flex; flex-direction: column; padding: 10px 16px 0; padding-top: max(10px, env(safe-area-inset-top)); }
html.focus-open, html.focus-open body { overflow: hidden; }
.focus-head { display: flex; align-items: center; gap: 10px; max-width: 760px; width: 100%; margin: 0 auto; }
.focus-meta { flex: 1; min-width: 0; text-align: center; font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.focus-head .btn.on { border-color: var(--accent); color: var(--accent); }
.focus-fmt { max-width: 760px; width: 100%; margin: 8px auto 0; }
.focus-fmt .fmt-bar { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.focus-fmt .fmt-bar::-webkit-scrollbar { display: none; }
.focus-fmt .fmt-btn { flex: none; }
.focus-fmt .fmt-help { position: absolute; left: 0; right: 0; top: 100%; z-index: 3; background: var(--bg-2); padding: 10px 12px; }
.focus-page { flex: 1; min-height: 0; display: flex; flex-direction: column; width: 100%; max-width: 680px; margin: 0 auto; padding-top: 14px; }
.focus-title { flex: none; width: 100%; box-sizing: border-box; background: transparent !important; border: 0 !important; border-bottom: 1px dashed var(--line) !important; border-radius: 0 !important; padding: 6px 2px 10px !important; font-family: var(--display, var(--serif)) !important; font-size: 1.5rem !important; font-weight: 700; color: var(--text); box-shadow: none !important; }
.focus-text { flex: 1; min-height: 0; width: 100%; box-sizing: border-box; resize: none; background: transparent !important; border: 0 !important; box-shadow: none !important; outline: none; padding: 16px 2px max(24px, env(safe-area-inset-bottom)) !important;
  font-family: var(--serif) !important; font-size: 1.15rem !important; line-height: 1.8 !important; color: var(--prose, var(--text)); }
/* Sin recuadros ni brillos de foco en la hoja: solo el texto (el cursor ya muestra dónde estás). */
.focus-mode .focus-text:focus, .focus-mode .focus-text:focus-visible, .focus-mode .focus-title:focus, .focus-mode .focus-title:focus-visible { border: 0 !important; outline: none !important; box-shadow: none !important; animation: none !important; background-image: none !important; }
.focus-mode .focus-title:focus { border-bottom: 1px dashed var(--accent) !important; }
.focus-notes { flex: none; max-width: 680px; width: 100%; margin: 0 auto 12px; padding: 10px 12px; box-sizing: border-box; background: color-mix(in srgb, #d9b200 10%, var(--bg-2)); border-left: 3px solid #d9b200; }
.focus-notes textarea { width: 100%; box-sizing: border-box; margin-top: 6px; max-height: 30dvh; }
@media (min-width: 1100px) {
  .focus-mode { display: grid; grid-template-columns: 1fr minmax(0, 680px) 1fr; grid-template-rows: auto auto 1fr; column-gap: 24px; }
  .focus-head, .focus-fmt, .focus-page { grid-column: 2; }
  .focus-notes { grid-column: 3; grid-row: 3; align-self: start; margin: 14px 0 0; max-width: 320px; }
  .focus-notes textarea { max-height: 60dvh; }
}
.scene-row-wrap { position: relative; }
.scene-row-wrap .scene-row { padding-right: 52px; }
.scene-expand { position: absolute; top: 10px; right: 10px; width: 36px; height: 36px; display: grid; place-items: center; background: var(--bg-3); color: var(--text); border: 1px solid var(--line); border-radius: 8px; font-size: 1.05rem; cursor: pointer; }
.scene-expand:hover, .scene-expand:focus-visible { border-color: var(--accent); color: var(--accent); }
html[data-theme="limpio"] .scene-expand { border-radius: 999px; }
.scene-row mark { background: var(--accent); color: var(--accent-ink); }

/* Perfil: cabecera, foto editable, destacadas */
.profile-banner { display: block; width: 100%; aspect-ratio: 3 / 1; max-height: 260px; background: var(--bg-3) center / cover no-repeat; border: 1px solid var(--line); margin-bottom: 14px; }
.profile-banner.empty { aspect-ratio: auto; height: 84px; margin-bottom: 8px; border-style: dashed; color: var(--muted); cursor: pointer; font: inherit; background: transparent; }
.profile-head.with-banner { position: relative; }
.profile-banner:not(.empty) + .profile-head .avatar, .profile-banner:not(.empty) + .profile-head .avatar-edit { box-shadow: 0 0 0 4px var(--bg); }
.avatar-edit { position: relative; padding: 0; border: 0; background: none; cursor: pointer; border-radius: 50%; flex: none; }
.avatar-cam { position: absolute; right: -2px; bottom: -2px; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-size: .8rem; background: var(--bg-2); border: 1px solid var(--line); }
.pinned { margin: 8px 0 20px; }
.pinned h2 { font-size: 1.1rem; }
.banner-prev { aspect-ratio: 3 / 1; background: center / cover no-repeat; border: 1px solid var(--line); }

/* Bienvenida */
.welcome { position: fixed; inset: 0; z-index: 112; background: rgba(0, 0, 0, .78); display: grid; place-items: center; padding: 16px; animation: fade .3s ease; }
.welcome-box { position: relative; width: min(100%, 420px); background: var(--bg-2); border: 1px solid var(--line); padding: 28px 22px 22px; display: grid; gap: 12px; text-align: center; }
.welcome-box h2 { margin: 0; font-size: 1.4rem; }
.welcome-box p { margin: 0 0 4px; }
.welcome-mark { font-size: 2.4rem; color: var(--accent); line-height: 1; }
.welcome-skip { position: absolute; top: 10px; right: 12px; }
.welcome-dots { display: flex; gap: 6px; justify-content: center; margin: 4px 0 6px; }
.welcome-dots i { width: 8px; height: 8px; background: var(--line); }
.welcome-dots i.on { background: var(--accent); }
html[data-theme="limpio"] .welcome-box { border-radius: 18px; }
html[data-theme="limpio"] .welcome-dots i { border-radius: 50%; }

/* ---------- publicado y borrador separados ---------- */
.pending-pill { border-color: var(--accent); color: var(--accent); background: transparent; white-space: nowrap; }
.pending-pill:hover { background: var(--accent); color: var(--accent-ink, #000); }
.badge.pending { border-color: var(--accent); color: var(--accent); }
.changes-card { border-color: var(--accent); }
.changes-card h3 { color: var(--accent); }
.recover { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; margin: 8px 0; padding: 12px 14px; border: 1px solid var(--accent); background: var(--bg-2, #111); }
.recover .row { flex-wrap: nowrap; }
@media (max-width: 600px) { .editor-head .pending-pill { font-size: .7rem; padding: 4px 8px; } }

/* ---------- conflictos, moderación, novedades, orígenes, enlace de prueba ---------- */
.conflict-modal { max-width: 760px; }
.conflict-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 600px) { .conflict-cols { grid-template-columns: 1fr; } }
.conflict-text { white-space: pre-wrap; font: inherit; font-size: .85rem; max-height: 220px; overflow: auto; margin: 6px 0 0; padding: 10px; border: 1px solid var(--line); background: var(--bg); }
.mod-box { margin-top: 10px; padding: 10px 12px; border: 1px solid var(--danger); }
.new-tag { margin-left: auto; padding: 1px 7px; font-size: .68rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--accent-ink, #000); background: var(--accent); border-radius: 3px; white-space: nowrap; }
.badge.new-tag { margin-left: 0; }
.src-row { padding: 8px 0; border-bottom: 1px solid var(--line); }
.src-row:last-child { border-bottom: 0; }
.src-bar { height: 6px; margin-top: 6px; background: var(--bg-3, #222); }
.src-bar i { display: block; height: 100%; background: var(--accent); }
.link-card input { font-size: .8rem; }

/* Panel de escena más amigable: texto primero, barra compacta, efectos en un menú, imagen en una línea, "¿Cómo sigue?" claro. */
.fmt-wrap { position: relative; }
.fmt-bar { flex-wrap: nowrap; align-items: center; }
.fmt-btn.fmt-fx { padding: 4px 10px; white-space: nowrap; }
.fmt-btn .caret { font-size: .7em; opacity: .8; }
.fmt-btn.fmt-q { margin-left: auto; }
.fmt-menu { position: absolute; z-index: 5; top: 40px; left: 0; min-width: 240px; max-width: calc(100vw - 32px); display: flex; flex-direction: column; padding: 4px; background: var(--bg-2); border: 1px solid var(--line); box-shadow: 0 10px 30px #000a; }
.fmt-menu[hidden] { display: none; }
.fmt-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 9px 10px; background: none; border: 0; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.fmt-item strong { color: var(--accent); font-size: .92rem; }
.fmt-item:hover, .fmt-item:focus-visible { background: var(--bg-3); }
.sheet .scene-text { min-height: max(240px, 48dvh); line-height: 1.65; font-size: 1.02rem; resize: vertical; }
.ed-img-line .ed-img-row { flex-wrap: wrap !important; gap: 8px; }
.ed-img-label { font-size: .9rem; margin-right: 2px; }
.ed-img-line .ed-thumb.h { width: 72px; }
.ed-img-line .ed-thumb.v { width: 44px; }
.ed-img-line .fmt-q { margin-left: auto; }
.how-next { border-top: 1px solid var(--line); padding-top: 14px; }
.how-next > label { font-weight: 700; color: var(--text); display: block; margin-bottom: 8px; }
.seg.seg-3 { grid-template-columns: repeat(3, 1fr); }
.end-ask { margin-top: 12px; }
.more-opts { margin-top: 12px; }
.more-opts summary { cursor: pointer; color: var(--muted); }
.btn.add-choice { border-style: dashed; }
/* Mapa: "+" para seguir desde una escena, y nombres en dos renglones al acercar. */
.map-svg .node-add { cursor: pointer; opacity: 0; transition: opacity .15s; }
.map-svg .node-add circle { fill: var(--accent); stroke: var(--bg); stroke-width: 2; }
.map-svg .node-add text { fill: var(--accent-ink, #000); font: 700 16px var(--sans); text-anchor: middle; pointer-events: none; }
.map-svg .node-wrap:hover .node-add, .map-svg .node-wrap.selected .node-add, .map-svg .node-add:focus { opacity: 1; }
@media (hover: none) { .map-svg .node-wrap.recent .node-add { opacity: 1; } }
.map-svg .node .t-long { display: none; }
.map-svg.zoomed .node .t-long { display: inline; }
.map-svg.zoomed .node .t-short { display: none; }
.map-svg .node text.t-long { font-size: 11.5px; }
/* Guía de la primera vez */
.guide-tip { position: absolute; z-index: 6; left: 12px; right: 12px; max-width: 360px; padding: 12px 14px; background: var(--accent); color: var(--accent-ink, #000); box-shadow: 0 10px 30px #000a; font-size: .92rem; border-radius: 10px; }
.guide-tip::before { content: ''; position: absolute; top: -7px; left: var(--ax, 28px); border: 7px solid transparent; border-top: 0; border-bottom-color: var(--accent); }
.guide-tip.arrow-right::before { left: auto; right: var(--ax, 28px); }
.guide-tip.no-arrow::before { content: none; }
.guide-tip p { margin: 0 0 8px; }
.guide-tip .row { justify-content: space-between; align-items: center; }
.guide-tip button { font: inherit; font-size: .85rem; cursor: pointer; }
.guide-tip .g-next { background: var(--accent-ink, #000); color: var(--accent); border: 0; padding: 6px 12px; border-radius: 99px; font-weight: 700; }
.guide-tip .g-skip { background: none; border: 0; color: inherit; text-decoration: underline; opacity: .8; }
.guide-tip .g-step { font-size: .75rem; opacity: .75; }
.guide-target { outline: 2px solid var(--accent) !important; outline-offset: 2px; }

/* Mis historias: el próximo paso de cada una y un botón principal claro */
.next-step { margin: 6px 0 0; font-size: .85rem; color: var(--muted); }
.next-step.todo { color: var(--danger); }
.next-step.ready, .next-step.pending { color: var(--accent); }
.mine-actions { flex-wrap: wrap; gap: 6px; }
.mine-actions .mine-write { min-width: 120px; }
/* Pestañas del editor */
.editor .tabs button .tab-ic { margin-right: 6px; font-size: .95em; }
.editor .tabs button .tab-dot { display: none; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-left: 6px; vertical-align: 2px; }
.editor .tabs button.has-dot .tab-dot { display: inline-block; }
.editor .tabs button { white-space: nowrap; }
@media (max-width: 420px) { .editor .tabs button .tab-ic { display: none; } }

/* ---------- Portada y datos: bloques plegables ---------- */
.meta-secs { gap: 10px; }
.meta-sec { background: var(--bg-2); border: 1px solid var(--line); border-radius: 10px; }
.meta-sec > summary { display: flex; align-items: center; gap: 10px; padding: 14px; cursor: pointer; list-style: none; min-height: 48px; box-sizing: border-box; }
.meta-sec > summary::-webkit-details-marker { display: none; }
.meta-sec > summary::after { content: '▾'; color: var(--muted); margin-left: 4px; transition: transform .15s; }
.meta-sec[open] > summary::after { transform: rotate(180deg); }
.meta-sec[open] > summary { border-bottom: 1px solid var(--line); }
.meta-ic { width: 1.6em; text-align: center; flex: none; }
.meta-name { font-weight: 700; flex: none; }
.meta-hint { color: var(--muted); font-size: .85rem; margin-left: auto; text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.meta-body { padding: 14px; }
.meta-body > .card { background: none; border: 0; padding: 0; box-shadow: none; }
.meta-danger { margin-top: 28px; padding-top: 16px; border-top: 1px dashed var(--line); }
.cover-fine { border: 1px solid var(--line); border-radius: 8px; }
.cover-fine > summary { padding: 10px 12px; cursor: pointer; font-size: .92rem; }
.cover-fine[open] > summary { border-bottom: 1px solid var(--line); }
.cover-fine > :not(summary) { margin: 10px 12px; }
@media (max-width: 420px) { .meta-hint { display: none; } .meta-sec > summary::after { margin-left: auto; } }

/* ---------- Publicar: estado y lista de lo que falta ---------- */
.pub-status.draft { border-left: 4px solid var(--muted); }
.pub-status.pending { border-left: 4px solid var(--accent); }
.pub-status.live { border-left: 4px solid #3fa66b; }
.pub-check { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 6px; }
.pub-check li { display: flex; gap: 8px; align-items: baseline; }
.pub-check .pub-mark { font-weight: 800; width: 1.2em; flex: none; text-align: center; }
.pub-check .ok .pub-mark { color: #3fa66b; }
.pub-check .no .pub-mark { color: var(--danger); }
.pub-check .no a { color: var(--text); }
.pub-unpublish { margin-top: 18px; padding-top: 12px; border-top: 1px dashed var(--line); display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---------- Estadísticas sin lectores ---------- */
.stats-empty { text-align: center; padding: 28px 18px; }
.stats-empty .big { font-size: 2.2rem; margin: 0; }

/* ---------- Entrar, crear cuenta y contraseña ---------- */
.auth-form { max-width: 420px; margin: 24px auto; }
.auth-form .field > label { display: block; margin-bottom: 6px; }
.field-hint { margin: 6px 0 0; }
.field-err { margin: 6px 0 0; color: var(--danger); font-size: .9rem; line-height: 1.35; }
.field-err::before { content: '⚠ '; }
.has-err input[type=text], .has-err input[type=email], .has-err input[type=password] { border-color: var(--danger); }
.check.has-err { flex-wrap: wrap; }
.check.has-err .field-err { flex-basis: 100%; margin-top: 0; }
.auth-form .linklike { font-size: .9rem; min-height: 44px; text-align: left; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 84px; }
.pw-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); min-width: 72px; min-height: 36px; padding: 0 10px;
  background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; cursor: pointer; }
.pw-eye:focus-visible { outline: 2px solid var(--accent); }
.btn[aria-busy=true] { opacity: .75; cursor: progress; }
.verify-bar { max-width: 760px; margin: 8px auto 0; padding: 10px 12px; display: flex; gap: 10px; align-items: center; justify-content: space-between;
  flex-wrap: wrap; background: var(--bg-3); border-left: 3px solid var(--accent); font-size: .9rem; line-height: 1.4; }
.verify-bar > span:first-child { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
@media (max-width: 800px) { .verify-bar { margin: 8px 16px 0; } }
html:not([data-theme="limpio"]) .verify-bar { border-left-color: var(--rec); }

/* Botón flotante para cambiar de estilo (abajo a la izquierda, solo el ícono). No aparece en el lector ni en el editor. */
.tema-fab { position: fixed; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom)); z-index: 31; display: grid; place-items: center;
  width: 46px; height: 46px; padding: 0; border-radius: 50%; border: 1px solid var(--line); background: color-mix(in srgb, var(--bg-2) 92%, transparent);
  color: var(--accent); cursor: pointer; -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); box-shadow: 0 6px 20px #0009; transition: border-color .2s, transform .15s; }
.tema-fab:hover, .tema-fab:focus-visible { border-color: var(--accent); transform: scale(1.06); }
.tema-fab:active { transform: scale(.96); }
@media (max-width: 699px) { .tema-fab { bottom: calc(64px + 12px + env(safe-area-inset-bottom)); } body.no-tabs .tema-fab { bottom: calc(16px + env(safe-area-inset-bottom)); } }
body.immersive .tema-fab, body.no-fab .tema-fab { display: none; }
html:not([data-theme="limpio"]) .tema-fab { border-radius: 0; background: #000; box-shadow: 2px 0 0 var(--rec), -2px 0 0 var(--cyan, #2ad4ff); }
#me-theme svg { color: var(--accent); }
@media (prefers-reduced-motion: reduce) { .tema-fab { transition: none; } }

/* ==========================================================================
   Mapa de la historia: ramas que se afinan, decisiones colgando sobre cada
   escena, finales como frutos y la luz mala que ilumina el camino elegido.
   ========================================================================== */
.editor-pane.map-pane { background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--line) 75%, transparent) 1px, transparent 0) 0 0 / 24px 24px, var(--bg); }
.map-svg .node .card { fill: var(--bg-2); stroke: var(--line); stroke-width: 1.2; transition: stroke .15s; }
.map-svg .node:hover .card { stroke: color-mix(in srgb, var(--line) 50%, var(--text)); }
.map-svg .node text { fill: var(--text); font-family: var(--sans); }
.map-svg .node text.t1 { font: 700 14px/1 var(--display, var(--sans)); letter-spacing: -.005em; }
.map-svg .node text.sub { fill: var(--muted); font: 500 11px var(--sans); }
.map-svg .node.start .card { stroke: var(--accent); stroke-width: 2; }
.map-svg .node.muerte .card { fill: color-mix(in srgb, var(--bg-2) 85%, var(--death)); stroke: color-mix(in srgb, var(--line) 50%, var(--death)); }
.map-svg .node.sobrevive .card { fill: color-mix(in srgb, var(--bg-2) 85%, var(--survive)); stroke: color-mix(in srgb, var(--line) 50%, var(--survive)); }
.map-svg .node.otro .card { fill: color-mix(in srgb, var(--bg-2) 85%, var(--other)); stroke: color-mix(in srgb, var(--line) 50%, var(--other)); }
.map-svg .node.muerte .fruit-dot, .map-svg .node.muerte text.sub { fill: var(--death); }
.map-svg .node.sobrevive .fruit-dot, .map-svg .node.sobrevive text.sub { fill: var(--survive); }
.map-svg .node.otro .fruit-dot, .map-svg .node.otro text.sub { fill: var(--other); }
.map-svg .node.error .card { stroke: var(--danger); stroke-dasharray: 5 4; stroke-width: 1.6; }
.map-svg .node.focus .card { stroke: var(--accent); stroke-width: 2.4; }
.map-svg .node.selected .card { stroke: var(--text); stroke-width: 2.4; }
.map-svg .warn circle { fill: var(--danger); }
.map-svg .warn text { fill: #1a0a07; font: 800 11px var(--sans); text-anchor: middle; }
.map-svg .warn .warn-hit { fill: transparent; }
.map-svg .warn { cursor: help; }
.warn-tip { position: fixed; z-index: 120; max-width: min(320px, calc(100vw - 16px)); padding: 10px 12px; border-radius: 12px; background: var(--bg-2); color: var(--text); border: 1px solid color-mix(in srgb, var(--danger) 55%, var(--line)); box-shadow: 0 10px 30px #0008; font: 400 .86rem/1.4 var(--sans); pointer-events: none; }
.warn-tip strong { display: block; color: var(--danger); font-size: .8rem; letter-spacing: .02em; margin-bottom: 4px; }
.warn-tip ul { margin: 0 0 6px; padding-left: 18px; }
.warn-tip li + li { margin-top: 3px; }
.map-svg .edge { fill: none; stroke: color-mix(in srgb, var(--rama, var(--line)) 80%, var(--text) 8%); stroke-width: 1.6; stroke-linecap: round; transition: opacity .25s; }
.map-svg .edge.back { stroke-width: 1.4; stroke-dasharray: 2 5; opacity: .8; }
.map-svg .edge.hl { stroke: var(--accent); }
.map-svg .arr { fill: var(--rama, var(--line)); }
.map-svg .knot { fill: color-mix(in srgb, var(--rama, var(--line)) 80%, var(--text) 8%); }
.map-svg .elabel rect { fill: var(--bg); stroke: color-mix(in srgb, var(--line) 85%, var(--text) 8%); }
.map-svg .elabel text { fill: color-mix(in srgb, var(--text) 82%, var(--muted)); font: 500 11px var(--sans); text-anchor: middle; }
.map-svg .elabel.empty rect { stroke: var(--danger); stroke-dasharray: 3 3; }
.map-svg .elabel.empty text { fill: var(--danger); font-style: italic; }
.map-svg .elabel.hl rect { stroke: var(--accent); }
.map-svg .elabel.hl text { fill: var(--text); }
.map-svg .luzmala { fill: #eaffb8; }
.map-svg .luzmala-halo { fill: var(--accent); opacity: .9; }
.map-svg .lane-label { fill: var(--muted); font: 600 12px var(--sans); }
/* La luz: lo que no está en el camino queda en penumbra */
.map-svg .node-wrap, .map-svg .elabel { transition: opacity .25s; }
.map-svg .node-wrap.dim, .map-svg .edge.dim, .map-svg .elabel.dim { opacity: .28; }
.map-svg .luz { pointer-events: none; }
html[data-theme="limpio"] .map-svg .node .card { rx: 12px; }
html[data-theme="limpio"] .map-svg .node .card.fruit { rx: 32px; }
@media (prefers-reduced-motion: reduce) { .map-svg .node-wrap, .map-svg .elabel, .map-svg .edge { transition: none; } }

/* Leyenda plegable */
.map-legend2 { position: absolute; left: 12px; top: 12px; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; max-width: min(300px, calc(100% - 24px)); }
.map-legend2 .chip { font-size: .78rem; padding: 4px 10px; background: color-mix(in srgb, var(--bg-2) 88%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--line); color: var(--muted); border-radius: 99px; cursor: pointer; }
.map-legend2 .lg-body { display: none; background: color-mix(in srgb, var(--bg-2) 95%, transparent); border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px; font-size: .78rem; color: var(--muted); flex-direction: column; gap: 4px; }
.map-legend2.open .lg-body { display: flex; }
.map-legend2 i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 8px; vertical-align: -2px; background: var(--bg-2); border: 1px solid var(--line); }
.map-legend2 .lg-start { border: 2px solid var(--accent); }
.map-legend2 .lg-death { border-radius: 99px; background: color-mix(in srgb, var(--bg-2) 70%, var(--death)); border-color: var(--death); }
.map-legend2 .lg-surv { border-radius: 99px; background: color-mix(in srgb, var(--bg-2) 70%, var(--survive)); border-color: var(--survive); }
.map-legend2 .lg-err { border: 1.5px dashed var(--danger); }

/* Zoom agrupado y botón de escena nueva */
.map-tools2 { position: absolute; right: 12px; bottom: 14px; display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.zoom-pill { display: flex; flex-direction: column; background: color-mix(in srgb, var(--bg-2) 90%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; box-shadow: 0 6px 20px #0008; }
.zoom-pill button { width: 44px; height: 44px; border: 0; background: transparent; font-size: 1.2rem; color: var(--text); cursor: pointer; }
.zoom-pill button + button { border-top: 1px solid var(--line); }
.zoom-pill button:focus-visible, .add-scene:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.add-scene { display: flex; align-items: center; gap: 6px; height: 52px; min-width: 52px; justify-content: center; padding: 0 16px; border-radius: 99px; border: 0; background: var(--accent); color: var(--accent-ink); font: 700 .95rem var(--sans); box-shadow: 0 8px 24px #0009, 0 0 0 6px color-mix(in srgb, var(--accent) 14%, transparent); cursor: pointer; }
.add-scene .plus { font-size: 1.4rem; line-height: 1; }
@media (max-width: 599px) { .add-scene .lbl { display: none; } .add-scene { padding: 0; width: 56px; height: 56px; } }

/* Barra de la escena iluminada */
.map-focus { position: absolute; left: 12px; right: 84px; bottom: 14px; max-width: 460px; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; background: color-mix(in srgb, var(--bg-2) 94%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 18px; padding: 10px 10px 10px 14px; box-shadow: 0 10px 30px #000a; }
.mf-head { display: flex; flex-direction: column; gap: 1px; flex: 1 1 140px; min-width: 0; }
.mf-k { font: 800 .64rem var(--sans); letter-spacing: .14em; text-transform: uppercase; color: var(--accent); }
.mf-head strong { font: 700 1rem/1.2 var(--display, var(--sans)); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mf-actions { display: flex; gap: 6px; align-items: center; }
.mf-x { padding-left: 10px; padding-right: 10px; }

/* ---------- Comentarios: corazón de "me gusta" y respuestas ---------- */
.comment-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0 4px; margin-top: 2px; }
.heart-btn { display: inline-flex; align-items: center; gap: 5px; min-height: 44px; min-width: 44px; padding: 0 6px 0 0;
  background: none; border: 0; color: var(--muted); font: inherit; font-size: .85rem; font-variant-numeric: tabular-nums; cursor: pointer;
  -webkit-tap-highlight-color: transparent; }
.heart-btn .heart-ic { display: inline-flex; width: 20px; height: 20px; }
.heart-btn svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linejoin: round; transition: fill .15s, stroke .15s; }
.heart-btn:hover { color: var(--text); }
.heart-btn.on { color: var(--death); }
.heart-btn.on svg { fill: var(--death); stroke: var(--death); }
.heart-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.heart-btn.pop .heart-ic { animation: heart-pop .32s ease-out; }
@keyframes heart-pop { 0% { transform: scale(1); } 45% { transform: scale(1.32); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .heart-btn.pop .heart-ic { animation: none; } }
.comment-actions .linklike { min-height: 44px; }
.composer { display: flex; flex-direction: column; gap: 8px; }
.composer textarea { width: 100%; }
.composer-actions { display: flex; justify-content: flex-end; gap: 8px; }
.comment .reply-box:not(:empty) { margin: 6px 0 0 14px; padding-left: 12px; border-left: 2px solid var(--accent); }
.comment .reply-box .composer { margin-top: 0; }
/* Ventana de la escena */
.scene-comments .comment.compact:first-child { border-top: 0; padding-top: 0; }
.scene-comments .comment.compact { padding: 10px 0 4px; }
.scene-comments .comment.compact .replies { margin-left: 6px; }
.scene-comments .comment.compact .reply-box:not(:empty) { margin-left: 6px; }
.scene-comments-box > .composer { margin-top: 4px; }

/* ---------- Carteles de confirmación propios (en lugar de confirm() del navegador) ---------- */
.modal.ask { z-index: 130; padding: 0; animation: fade-still .15s ease; }
.modal .box.ask-box { max-width: 420px; padding: 22px 18px calc(18px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 12px;
  border: 1px solid var(--line); box-shadow: 0 -10px 40px #000a; animation: up .2s ease; }
.ask-title { margin: 0; font-size: 1.15rem; line-height: 1.25; }
.ask-msg { margin: 0; color: var(--text); line-height: 1.5; overflow-wrap: anywhere; }
.ask-title + .ask-msg { color: var(--muted); }
.ask-actions { display: flex; gap: 10px; margin-top: 6px; }
.ask-actions .btn { flex: 1; }
.btn.danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-solid:hover { background: color-mix(in srgb, var(--danger) 85%, #fff); border-color: var(--danger); }
@media (min-width: 600px) {
  .modal .box.ask-box { padding: 24px 22px 20px; box-shadow: 0 20px 60px #000c; }
  .ask-actions { justify-content: flex-end; }
  .ask-actions .btn { flex: 0 0 auto; min-width: 120px; }
}
/* VHS: menú de la videograbadora, borde REC arriba */
html:not([data-theme="limpio"]) .modal .box.ask-box { border-radius: 0; border-top: 2px solid var(--accent); background: #070907; }
html:not([data-theme="limpio"]) .modal .box.ask-box.is-danger { border-top-color: var(--rec); }
html:not([data-theme="limpio"]) .ask-title { font-family: var(--display); font-weight: 400; font-size: 1.7rem; text-transform: uppercase; letter-spacing: .05em; }
html:not([data-theme="limpio"]) .ask-box.is-danger .ask-title::before { content: '● '; color: var(--rec); animation: vhs-blink 1.2s steps(1) infinite; }
html:not([data-theme="limpio"]) .btn.danger-solid { background: var(--rec); border-color: var(--rec); color: #fff; box-shadow: 3px 0 0 var(--accent), -3px 0 0 var(--cyan); }
html:not([data-theme="limpio"]) .btn.danger-solid:hover { background: #ff4d4d; }
/* Nocturn: tarjeta redondeada, acento lima, peligro coral */
html[data-theme="limpio"] .modal.ask { background: #050807b8; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
html[data-theme="limpio"] .modal .box.ask-box { border-radius: 20px 20px 0 0; border-top: 1px solid var(--line); background: var(--bg-2); }
html[data-theme="limpio"] .ask-title { font-family: var(--display); font-weight: 700; }
html[data-theme="limpio"] .btn.danger-solid { background: var(--danger); color: #1a0705; border-color: var(--danger); }
@media (min-width: 600px) { html[data-theme="limpio"] .modal .box.ask-box { border-radius: 20px; } }
@media (prefers-reduced-motion: reduce) { .modal.ask, .modal .box.ask-box, .ask-box.is-danger .ask-title::before { animation: none !important; } }
/* Conectar arrastrando y deshacer / rehacer */
.map-svg .node-add { cursor: grab; }
.map-svg .node-add .hit { fill: transparent; stroke: none; }
.map-svg .elabel[data-cid] { cursor: grab; }
.map-svg .elabel[data-cid]:hover rect, .map-svg .elabel:focus-visible rect { stroke: var(--accent); }
.map-svg .elabel:focus-visible, .map-svg .node-add:focus-visible { outline: none; }
.map-svg .elabel.lifted { opacity: .35; }
.map-svg.dragging { cursor: grabbing; }
.map-svg.dragging .node-add { opacity: 0 !important; }
.map-svg .drag-edge { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-dasharray: 7 6; stroke-linecap: round; pointer-events: none; animation: drag-flow .6s linear infinite; }
@keyframes drag-flow { to { stroke-dashoffset: -13; } }
.map-svg .node.drop .card { stroke: var(--accent); stroke-width: 3; fill: color-mix(in srgb, var(--bg-2) 82%, var(--accent)); }
.map-drag-hint { position: absolute; left: 50%; top: 12px; transform: translate(-50%, -8px); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
  background: var(--accent); color: var(--accent-ink); font: 700 .85rem var(--sans); padding: 8px 14px; border-radius: 99px; box-shadow: 0 8px 24px #0009; max-width: calc(100% - 24px); text-align: center; }
.map-drag-hint.on { opacity: 1; transform: translate(-50%, 0); }
.map-hist { position: absolute; right: 12px; top: 12px; display: flex; background: color-mix(in srgb, var(--bg-2) 90%, transparent); backdrop-filter: blur(8px); border: 1px solid var(--line); border-radius: 99px; overflow: hidden; box-shadow: 0 6px 20px #0008; }
.map-hist button { display: flex; align-items: center; gap: 6px; height: 40px; padding: 0 14px; border: 0; background: transparent; color: var(--text); font: 600 .85rem var(--sans); cursor: pointer; }
.map-hist button + button { border-left: 1px solid var(--line); }
.map-hist button .ic { font-size: 1.15rem; line-height: 1; }
.map-hist button:disabled { color: var(--muted); opacity: .45; cursor: default; }
.map-hist button:not(:disabled):hover { background: var(--bg-3); }
.map-hist button:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
@media (max-width: 599px) { .map-hist .lbl { display: none; } .map-hist button { width: 44px; height: 44px; padding: 0; justify-content: center; } }
@media (prefers-reduced-motion: reduce) { .map-svg .drag-edge { animation: none; } }
.map-svg :is(.node, .node-add, .elabel):focus:not(:focus-visible) { outline: none; }
@media (max-width: 599px) { .map-drag-hint { top: 66px; font-size: .8rem; } }

/* Mapa: elegir, mover, menú contextual y leyenda de líneas */
.map-svg .edge-hit { fill: none; stroke: transparent; stroke-width: 16; cursor: pointer; pointer-events: stroke; }
.map-svg .edge.sel { stroke: var(--accent); stroke-width: 3px !important; }
.map-svg .edge.side, .map-svg .edge.loop { stroke-width: 1.8; }
.map-svg .elabel.sel rect { stroke: var(--accent); stroke-width: 2; fill: color-mix(in srgb, var(--bg) 80%, var(--accent)); }
.map-svg .elabel.sel text { fill: var(--text); font-weight: 700; }
.map-svg .node.copied .card { stroke-dasharray: 6 4; }
.map-svg .node-wrap.lifted { filter: drop-shadow(0 10px 18px #000c); }
.map-svg .node-wrap.lifted .node .card { stroke: var(--accent); }
.map-svg.moving { cursor: grabbing; }
.map-svg.moving .node-add { opacity: 0 !important; }
@media (hover: hover) { .map-svg .node { cursor: pointer; } }
.mf-sub { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-tools2 .zoom-pill .arrange { display: flex; align-items: center; justify-content: center; }
.map-tools2 .zoom-pill button:disabled { opacity: .35; cursor: default; }

.ctx-menu { position: fixed; z-index: 120; min-width: 220px; max-width: min(300px, calc(100vw - 16px)); padding: 6px; display: flex; flex-direction: column;
  background: color-mix(in srgb, var(--bg-2) 97%, transparent); backdrop-filter: blur(10px); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 14px 40px #000c; animation: fade-still .12s ease; }
.ctx-menu .cm-title { padding: 6px 10px 6px; font: 700 .78rem var(--sans); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ctx-menu .cm-item { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 40px; padding: 0 10px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font: 500 .92rem var(--sans); text-align: left; cursor: pointer; }
.ctx-menu .cm-item:hover:not(:disabled), .ctx-menu .cm-item:focus-visible { background: var(--bg-3); outline: none; }
.ctx-menu .cm-item:disabled { color: var(--muted); opacity: .5; cursor: default; }
.ctx-menu .cm-item.danger { color: var(--danger); }
.ctx-menu kbd { font: 500 .72rem var(--sans); color: var(--muted); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.ctx-menu hr { border: 0; border-top: 1px solid var(--line); margin: 4px 6px; }
@media (hover: none) { .ctx-menu .cm-item { min-height: 46px; } .ctx-menu kbd { display: none; } }

.map-legend2 .lg-body { max-height: min(70vh, 520px); overflow: auto; gap: 6px; max-width: 320px; }
.map-legend2 .lg-body b { color: var(--text); font-size: .74rem; letter-spacing: .08em; text-transform: uppercase; margin-top: 4px; }
.map-legend2 .lg-body > span { display: flex; align-items: flex-start; gap: 8px; line-height: 1.35; }
.map-legend2 .lg-body > span > i { flex: none; margin: 2px 0 0; }
.map-legend2 .lg-line { flex: none; margin-top: 1px; overflow: visible; }
.map-legend2 .lg-edge { fill: none; stroke: color-mix(in srgb, var(--rama, var(--line)) 80%, var(--text) 8%); stroke-width: 1.8; stroke-linecap: round; }
.map-legend2 .lg-edge.thick { stroke-width: 4; }
.map-legend2 .lg-edge.back { stroke-dasharray: 2 4; }
.map-legend2 .lg-edge.hl { stroke: var(--accent); stroke-width: 2.4; }
.map-legend2 .lg-edge.drag { stroke: var(--accent); stroke-width: 2.2; stroke-dasharray: 5 4; }
.map-legend2 .lg-line .arr, .map-legend2 svg .arr { fill: color-mix(in srgb, var(--rama, var(--line)) 80%, var(--text) 8%); }
.map-legend2 .lg-label-empty { width: 30px !important; height: 14px !important; border-radius: 99px !important; border: 1.5px dashed var(--danger) !important; background: transparent !important; }
.map-legend2 .lg-how { display: block !important; color: var(--muted); }

/* Deshacer / rehacer en la barra de formato del texto */
.fmt-bar .fmt-sep { width: 1px; align-self: stretch; background: var(--line); margin: 4px 2px; }
.fmt-bar .fmt-hist { font-size: 1.05rem; }
.fmt-bar .fmt-hist:disabled { opacity: .35; cursor: default; }

/* ---------- Finales con color propio (lo elige quien escribe) ---------- */
/* .ecolor + --end-c: el color elegido le gana al del tipo (muerte, sobrevive, otro). */
.map-svg g.node.ecolor:not(.drop) .card, .map-svg g.node.ecolor:not(.drop) rect { fill: color-mix(in srgb, var(--bg-2) 85%, var(--end-c)); }
.map-svg g.node.ecolor:not(.error):not(.focus):not(.selected):not(.drop) .card, .map-svg g.node.ecolor:not(.error):not(.focus):not(.selected):not(.drop) rect { stroke: color-mix(in srgb, var(--line) 50%, var(--end-c)); }
.map-svg g.node.ecolor .fruit-dot, .map-svg g.node.ecolor text.sub { fill: var(--end-c); }
.ending-box.ecolor.ecolor { border-color: color-mix(in srgb, var(--end-c) 55%, transparent); box-shadow: inset 0 0 60px color-mix(in srgb, var(--end-c) 18%, transparent); }
.ending-box.ecolor.ecolor .kind { color: var(--end-c); }
html:not([data-theme="limpio"]) .ending-box.ecolor.ecolor h2 { color: var(--end-c); }
html[data-theme="limpio"] .ending-box.ecolor.ecolor { box-shadow: none; }
.endings-found span.ecolor.ecolor { background: var(--end-c); }
.rmap g.node.ecolor rect { fill: color-mix(in srgb, var(--bg-2) 82%, var(--end-c)); stroke: var(--end-c); }
.rmap-legend .lg.ecolor::before { background: color-mix(in srgb, var(--bg-2) 82%, var(--end-c)); border-color: var(--end-c); }
.rmap-list li.ecolor::marker { color: var(--end-c); }
.badge.ecolor { color: var(--end-c); border-color: color-mix(in srgb, var(--end-c) 50%, transparent); }
.end-colors { display: flex; flex-wrap: wrap; gap: 8px; }
.end-sw { position: relative; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line); background: var(--sw); cursor: pointer; padding: 0; display: grid; place-items: center; color: var(--muted); font: 600 1rem var(--sans); }
.end-sw.on { border-color: var(--text); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sw) 45%, transparent); }
.end-sw:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.end-sw-custom { background: conic-gradient(#ff4d4d, #e8b44c, #7cbf7a, #59d0c8, #5aa9e6, #9b8ce0, #e87bb5, #ff4d4d); color: #fff; text-shadow: 0 1px 2px #000; }
.end-sw-custom.on { background: var(--sw); }
.end-sw-custom input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: 0; padding: 0; }
.end-preview { display: flex; }
.end-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; border: 1px solid color-mix(in srgb, var(--end-c) 55%, transparent); background: color-mix(in srgb, var(--bg-2) 85%, var(--end-c)); color: var(--end-c); font-weight: 600; font-size: .9rem; }
.end-chip::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--end-c); }

/* "¿Acá termina? Convertir en final": botón visible, pero más tranquilo que "Agregar decisión". */
.end-ask-btn { gap: 8px; background: transparent; border: 1px solid color-mix(in srgb, var(--other, #9b8ce0) 45%, var(--line)); color: var(--text); font-weight: 600; }
.end-ask-btn:hover { background: color-mix(in srgb, var(--other, #9b8ce0) 12%, transparent); border-color: var(--other, #9b8ce0); }
.end-ask-ico { color: var(--other, #9b8ce0); }

/* ---------- Herramientas de moderación (vistas/mod-historia.js) ---------- */
.story-id { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .78rem; color: var(--muted); letter-spacing: .02em; user-select: all; }
.mod-story { gap: 10px; padding: 14px; margin: 0; }
.mod-story-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; }
.mod-story-title { font-weight: 700; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.mod-story-title:hover { text-decoration: underline; }
.mod-story .meta { flex-wrap: wrap; gap: 6px 10px; }
.badge.mod-on { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.mod-actions { flex-wrap: wrap; gap: 8px; }
.mod-actions .btn { min-height: 40px; }
.mod-actions .btn[disabled] { opacity: .45; cursor: not-allowed; }
.mod-history summary { cursor: pointer; padding: 4px 0; }
.mod-history[open] summary { margin-bottom: 6px; }
.mod-pick { display: flex; flex-wrap: wrap; gap: 6px; }
.mod-pick button { min-height: 40px; padding: 8px 12px; border: 1px solid var(--line); background: var(--bg-3); color: var(--text); border-radius: 10px; cursor: pointer; font: inherit; font-size: .9rem; }
.mod-pick button.on { border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 700; }
.mod-dialog label { font-weight: 600; }
.modal .box.mod-box { max-width: 640px; width: 100%; }
.log-list { gap: 0; }
.log-row { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .88rem; overflow-wrap: anywhere; }
.log-row:last-child { border-bottom: 0; }
.log-when { font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 520px) {
  .log-row { grid-template-columns: 1fr; gap: 2px; }
  .mod-actions .btn { flex: 1 1 calc(50% - 8px); }
}

/* Géneros: el chip del género se distingue un poco de las etiquetas (#…). */
.chip.genre-chip { font-weight: 600; }
/* Flecha de los grupos de etiquetas (con display:flex el navegador no dibuja la suya). */
:is(.tag-group, .tag-admin-group) > summary { list-style: none; }
:is(.tag-group, .tag-admin-group) > summary::-webkit-details-marker { display: none; }
:is(.tag-group, .tag-admin-group) > summary::before { content: '▸'; display: inline-block; width: 1em; transition: transform .15s; }
:is(.tag-group, .tag-admin-group)[open] > summary::before { transform: rotate(90deg); }
