/* Manuscrito — estilos. Papel, máquina de escribir y los acomodos de PiensAprende.
   Tokens en :root; el modo oscuro ("papel carbón") solo cambia los tokens. */
:root {
  --azul: #046cb3;
  --azul-2: #0a86d8;
  --azul-hondo: #034f84;
  --naranjo: #f49c4c;
  --tinta-naranja: #a85a14;
  --cinta: #b3352b;              /* rojo de cinta de máquina, para detalles chicos */
  --bg: #f1eadb;
  --bg-2: #e6dcc8;
  --papel: #fffaf0;
  --papel-2: #fbf4e4;
  --glass: rgba(255, 251, 242, .7);
  --glass-strong: rgba(255, 251, 243, .9);
  --solid: #fffcf5;
  --hair: rgba(255, 255, 255, .7);
  --line: rgba(60, 44, 20, .11);
  --line-2: rgba(60, 44, 20, .2);
  --text: #221c14;
  --text-2: #52483a;
  --text-3: #85796a;
  --accent-text: #035a96;
  --red: #b8392f;
  --amber: #a8691a;
  --green: #2c7d4f;
  --red-bg: rgba(184, 57, 47, .11);
  --amber-bg: rgba(214, 145, 50, .16);
  --green-bg: rgba(44, 125, 79, .13);
  --blue-bg: rgba(4, 108, 179, .09);
  --shadow: 0 1px 2px rgba(60, 40, 10, .06), 0 12px 30px -14px rgba(60, 40, 10, .28);
  --shadow-lg: 0 30px 80px -30px rgba(50, 32, 8, .5);
  --grain-opacity: .085;
  --grain-blend: multiply;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --r-xl: 28px;
  --side-w: 268px;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --type: "Special Elite", "Courier Prime", "Courier New", monospace;
  --mono: "Courier Prime", "Courier New", Courier, monospace;
  --libro: "Literata", Georgia, "Times New Roman", serif;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --escritura: var(--mono);
  --escritura-tam: 18px;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #16130e;
  --bg-2: #221d16;
  --papel: #211c15;
  --papel-2: #1c1812;
  --glass: rgba(40, 34, 26, .66);
  --glass-strong: rgba(36, 31, 24, .94);
  --solid: #26201a;
  --hair: rgba(255, 240, 210, .08);
  --line: rgba(255, 236, 200, .09);
  --line-2: rgba(255, 236, 200, .17);
  --text: #f1e8d6;
  --text-2: #c7bba6;
  --text-3: #958a77;
  --accent-text: #79bdf0;
  --tinta-naranja: #f4a560;
  --cinta: #ef7a6c;
  --red: #ef7a6c;
  --amber: #f0b45e;
  --green: #69c893;
  --red-bg: rgba(239, 122, 108, .14);
  --amber-bg: rgba(240, 180, 94, .14);
  --green-bg: rgba(105, 200, 147, .13);
  --blue-bg: rgba(121, 189, 240, .12);
  --shadow: 0 1px 2px rgba(0, 0, 0, .35), 0 14px 36px -16px rgba(0, 0, 0, .75);
  --shadow-lg: 0 30px 80px -30px rgba(0, 0, 0, .85);
  --grain-opacity: .1;
  --grain-blend: overlay;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 400 16px/1.6 var(--sans);
  color: var(--text);
  background:
    radial-gradient(1000px 680px at 6% -12%, rgba(4, 108, 179, .08), transparent 60%),
    radial-gradient(900px 620px at 108% 6%, rgba(244, 156, 76, .13), transparent 60%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "kern", "liga", "calt";
}
html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
  transition: background-color .55s var(--ease), color .55s var(--ease), border-color .55s var(--ease), fill .55s, stroke .55s, box-shadow .55s !important;
}

/* Grano de papel: una capa fija detrás de todo. No toca el texto. */
.grain {
  position: fixed; inset: -50%; z-index: 0; pointer-events: none;
  opacity: var(--grain-opacity); mix-blend-mode: var(--grain-blend);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .2 0 0 0 0 .14 0 0 0 0 .05 0 0 0 .6 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

a { color: var(--accent-text); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2.5px solid var(--azul-2); outline-offset: 2px; border-radius: 8px; }
.ic { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.ic.sm { width: 16px; height: 16px; }
.ic.lg { width: 28px; height: 28px; }
::selection { background: rgba(4, 108, 179, .2); }

/* ---------- Estructura ---------- */
.app { position: relative; z-index: 1; display: flex; min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side-w); z-index: 30;
  display: flex; flex-direction: column; gap: 4px; padding: 22px 16px 18px;
  background: var(--glass); backdrop-filter: blur(22px) saturate(1.4); -webkit-backdrop-filter: blur(22px) saturate(1.4);
  border-right: 1px solid var(--line); overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 10px 18px; text-decoration: none; color: var(--text); }
.brand b { display: block; font: 400 23px/1 var(--type); letter-spacing: -.01em; }
.brand small { display: block; margin-top: 5px; font: 400 12.5px var(--mono); color: var(--text-3); }
.nav-group { margin: 14px 0 4px; padding: 0 12px; font: 700 11px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--text-3); }
.nav-item {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 9px 12px; border: 0; border-radius: 12px; background: none;
  color: var(--text-2); font-size: 15px; font-weight: 500; text-align: left; text-decoration: none;
  transition: background .2s, color .2s;
}
.nav-item:hover { background: var(--blue-bg); color: var(--text); }
.nav-item.active { background: var(--solid); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.nav-item.active .ic { color: var(--azul); }
:root[data-theme="dark"] .nav-item.active .ic { color: var(--accent-text); }
.nav-item .count { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 99px; background: var(--blue-bg); color: var(--accent-text); font-size: 12px; font-weight: 600; text-align: center; font-variant-numeric: tabular-nums; }
.nav-item .lk { margin-left: auto; color: var(--text-3); width: 15px; height: 15px; }
.side-foot { margin-top: auto; padding-top: 18px; display: grid; gap: 14px; }
.credit { margin: 0; padding: 0 12px; font-size: 12.5px; line-height: 1.55; color: var(--text-3); }
.credit b { color: var(--text-2); font-weight: 600; }
.plan-box { display: grid; gap: 10px; padding: 14px; border-radius: var(--r); background: linear-gradient(135deg, rgba(244, 156, 76, .16), rgba(4, 108, 179, .09)); border: 1px solid var(--line); font-size: 13px; color: var(--text-2); }
.plan-box b { font: 700 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--tinta-naranja); }
.plan-box .progress { height: 6px; }
.plan-box.completo { background: var(--green-bg); }
.plan-box.completo b { display: flex; align-items: center; gap: 6px; color: var(--green); }

/* ---------- Desbloqueo (acceso.js) ---------- */
.acceso-caja { display: grid; gap: 18px; }
.link { background: none; border: 0; padding: 0; color: var(--accent-text); font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.acceso-pie { margin: 0; font-size: 14px; color: var(--text-3); text-align: center; }
.acceso-codigo { font-family: var(--mono); font-size: 26px !important; letter-spacing: .4em; text-align: center; }
.acceso-aviso { margin: 0; font-size: 14px; border-radius: 12px; }
.acceso-aviso:empty { display: none; }
.acceso-aviso.error { color: var(--red); background: var(--red-bg); padding: 10px 12px; }
.acceso-aviso.info { color: var(--text-2); background: var(--blue-bg); padding: 10px 12px; }
.acceso-spin { width: 16px; height: 16px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: accesoGiro .7s linear infinite; }
@keyframes accesoGiro { to { transform: rotate(360deg); } }

.shell { flex: 1; min-width: 0; margin-left: var(--side-w); display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px; margin: 14px 22px 0; padding: 10px 12px 10px 20px; border-radius: 18px; }
.glass {
  background: var(--glass); backdrop-filter: blur(20px) saturate(1.5); -webkit-backdrop-filter: blur(20px) saturate(1.5);
  border: 1px solid var(--hair); box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .4);
}
:root[data-theme="dark"] .glass { box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .04); }
.top-title { min-width: 0; font-size: 14px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-title b { color: var(--text); font-weight: 600; }
.save-state { font: 400 12.5px var(--mono); color: var(--text-3); display: inline-flex; align-items: center; gap: 6px; opacity: 0; transition: opacity .3s; white-space: nowrap; }
.save-state.on { opacity: 1; }
.save-state .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
.top-actions { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; flex: none;
  border: 1px solid var(--line); background: var(--solid); color: var(--text-2);
  transition: transform .15s, color .2s, background .2s, border-color .2s;
}
.icon-btn:hover { color: var(--text); }
.icon-btn:active { transform: scale(.94); }
.icon-btn.on { color: var(--accent-text); background: var(--blue-bg); border-color: rgba(4, 108, 179, .3); }
.icon-btn[disabled] { opacity: .4; pointer-events: none; }
.icon-btn.xs { width: 32px; height: 32px; border-radius: 10px; }
.pill-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--solid); color: var(--text-2); font-size: 14px; font-weight: 500;
  transition: color .2s, transform .15s;
}
.pill-btn:hover { color: var(--text); }
.pill-btn:active { transform: scale(.97); }
.pill-btn.unlock { border-color: rgba(244, 156, 76, .55); background: rgba(244, 156, 76, .14); color: var(--tinta-naranja); font-weight: 600; }
.only-mobile { display: none; }
.scrim { display: none; }

main { position: relative; padding: 48px 56px 96px; max-width: 1280px; width: 100%; outline: none; }

.view { animation: viewIn .45s var(--ease) both; }
.view.leaving { animation: viewOut .16s ease-in both; }
@keyframes viewIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes viewOut { to { opacity: 0; transform: translateY(-4px); } }

/* ---------- Tipografía ---------- */
.eyebrow { display: inline-flex; align-items: center; gap: 8px; margin: 0 0 14px; font: 700 12.5px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--accent-text); }
.eyebrow .ic { width: 16px; height: 16px; }
h1.title {
  margin: 0; font: 400 clamp(36px, 5.2vw, 64px)/1.06 var(--type); letter-spacing: -.01em; text-wrap: balance;
  text-shadow: 0 0 .6px currentColor;   /* tinta que se corre apenas */
}
h1.title em { font-style: normal; color: var(--azul); }
:root[data-theme="dark"] h1.title em { color: var(--accent-text); }
.lede { margin: 20px 0 0; max-width: 60ch; font-size: 18px; line-height: 1.65; color: var(--text-2); }
h2.section { display: flex; align-items: center; gap: 12px; margin: 0 0 6px; font: 400 27px/1.2 var(--type); }
h2.section .ic { color: var(--azul); width: 24px; height: 24px; }
:root[data-theme="dark"] h2.section .ic { color: var(--accent-text); }
.section-sub { margin: 0 0 24px; max-width: 64ch; color: var(--text-2); font-size: 15.5px; }
h3 { margin: 0; font-size: 18px; font-weight: 650; }
.muted { color: var(--text-3); }
.small { font-size: 13.5px; }
.mono { font-family: var(--mono); }
.tabnum { font-variant-numeric: tabular-nums; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: 28px; flex-wrap: wrap; margin-bottom: 52px; }
.head > div:first-child { min-width: 0; flex: 1 1 520px; }
.block { margin-top: 68px; }
.block:first-child { margin-top: 0; }

/* ---------- Tarjetas (hojas de papel) ---------- */
.card {
  position: relative; padding: 30px; border-radius: var(--r-lg);
  background: var(--glass); border: 1px solid var(--hair);
  backdrop-filter: blur(18px) saturate(1.4); -webkit-backdrop-filter: blur(18px) saturate(1.4);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .4);
}
:root[data-theme="dark"] .card { box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, .03); }
.card.flat { background: var(--solid); backdrop-filter: none; -webkit-backdrop-filter: none; }
.stack { display: grid; gap: 22px; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 22px; }

/* ---------- Botones ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; overflow: hidden;
  height: 46px; padding: 0 20px; border-radius: 14px; border: 1px solid var(--line-2);
  background: var(--solid); color: var(--text); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap;
  transition: transform .15s var(--ease), box-shadow .25s, background .2s, border-color .2s;
}
@media (hover: hover) { .btn:hover { border-color: var(--text-3); transform: translateY(-1px); } }
.btn:active { transform: scale(.97); }
.btn.sm { height: 38px; padding: 0 14px; font-size: 14px; border-radius: 12px; gap: 8px; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn.ghost:hover { background: var(--blue-bg); color: var(--text); }
.btn.danger { color: var(--red); }
.btn.danger:hover { border-color: var(--red); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn.primary {
  height: 52px; padding: 0 26px; border: 0; border-radius: 16px; isolation: isolate;
  color: #fff; font-size: 16px;
  background: linear-gradient(135deg, var(--azul-2) 0%, var(--azul) 45%, var(--azul-hondo) 100%);
  box-shadow: 0 14px 30px -12px rgba(4, 108, 179, .65), 0 2px 6px -1px rgba(4, 108, 179, .35), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn.primary::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(135deg, transparent 55%, rgba(244, 156, 76, .55) 130%); }
.btn.primary::after {
  content: ""; position: absolute; top: 0; bottom: 0; left: -60%; width: 45%; z-index: -1;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, .38), transparent);
  transform: skewX(-18deg); transition: left .8s var(--ease);
}
.btn.primary:hover::after { left: 120%; }
.btn.primary.sm { height: 42px; padding: 0 18px; font-size: 14.5px; border-radius: 13px; }
.btn.naranja { border: 0; color: #fff; isolation: isolate; background: linear-gradient(135deg, #f7b06c, #ee8a35 55%, #c96a1b); box-shadow: 0 14px 30px -12px rgba(214, 120, 40, .7), inset 0 1px 0 rgba(255, 255, 255, .3); }
.onda { position: absolute; border-radius: 50%; pointer-events: none; background: currentColor; opacity: .22; transform: scale(0); animation: onda .6s var(--ease) forwards; }
.btn.primary .onda, .btn.naranja .onda { background: #fff; opacity: .35; }
@keyframes onda { to { transform: scale(1); opacity: 0; } }

/* ---------- Formularios ---------- */
label.field { display: grid; gap: 8px; font-size: 13.5px; font-weight: 600; color: var(--text-2); }
label.field small { font-weight: 400; color: var(--text-3); }
.input, textarea.input, select.input {
  width: 100%; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--solid); color: var(--text); font-size: 15.5px; font-weight: 400; line-height: 1.55;
  transition: border-color .2s, box-shadow .2s;
}
.input:focus { outline: none; border-color: var(--azul-2); box-shadow: 0 0 0 4px rgba(10, 134, 216, .16); }
textarea.input { resize: vertical; min-height: 92px; }
textarea.input.corto { min-height: 64px; }
select.input { appearance: none; padding-right: 38px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%2385796a' stroke-width='1.8' stroke-linecap='round'%3E%3Cpath d='m1 1.5 5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.input.num { width: 120px; text-align: center; font-variant-numeric: tabular-nums; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.tight { gap: 8px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px; }
.check { display: flex; gap: 10px; align-items: center; font-size: 14.5px; color: var(--text-2); }
.check input { width: 18px; height: 18px; accent-color: var(--azul); }

.seg { display: inline-flex; padding: 4px; gap: 2px; border-radius: 13px; background: var(--bg-2); border: 1px solid var(--line); flex-wrap: wrap; }
.seg button { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 13px; border: 0; border-radius: 10px; background: none; color: var(--text-2); font-size: 13.5px; font-weight: 500; white-space: nowrap; }
.seg button.on { background: var(--solid); color: var(--text); font-weight: 600; box-shadow: 0 1px 3px rgba(40, 24, 8, .14); }
.seg.full { display: flex; }
.seg.full button { flex: 1; justify-content: center; padding: 0 6px; }

.tag { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 99px; font-size: 12.5px; font-weight: 600; white-space: nowrap; background: var(--bg-2); color: var(--text-2); }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .9; }
.tag.red { background: var(--red-bg); color: var(--red); }
.tag.amber { background: var(--amber-bg); color: var(--amber); }
.tag.green { background: var(--green-bg); color: var(--green); }
.tag.blue { background: var(--blue-bg); color: var(--accent-text); }
.tag.plain::before { display: none; }
.tag.lock { background: rgba(244, 156, 76, .16); color: var(--tinta-naranja); }
.tag.lock::before { display: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; min-height: 34px; padding: 0 13px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--solid); color: var(--text-2); font-size: 13.5px; font-weight: 500; }
.chip.on { border-color: var(--azul); color: var(--accent-text); background: var(--blue-bg); }
/* Etiqueta tipo "cinta rotulada" (estampada a máquina) */
.cinta { display: inline-block; padding: 3px 10px 2px; font: 400 12.5px var(--type); letter-spacing: .06em; text-transform: uppercase; color: var(--papel); background: var(--text); border-radius: 3px; transform: rotate(-1.2deg); }

.progress { height: 8px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
.progress > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--azul), var(--azul-2) 70%, var(--naranjo)); transition: width .6s var(--ease); }
.local-note { display: flex; gap: 14px; align-items: flex-start; padding: 18px 20px; border-radius: var(--r); background: var(--blue-bg); color: var(--text-2); font-size: 14.5px; line-height: 1.55; }
.local-note .ic { color: var(--accent-text); margin-top: 1px; }
.site-foot { margin-top: 96px; padding-top: 28px; border-top: 1px dashed var(--line-2); display: flex; justify-content: space-between; gap: 18px; flex-wrap: wrap; font-size: 13.5px; color: var(--text-3); }

/* ---------- Inicio ---------- */
.trial-banner { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding: 18px 22px; border-radius: var(--r-lg); margin-bottom: 40px;
  background: linear-gradient(120deg, rgba(244, 156, 76, .18), rgba(4, 108, 179, .08)); border: 1px solid rgba(244, 156, 76, .35); }
.trial-banner .t { flex: 1 1 320px; display: grid; gap: 4px; font-size: 14.5px; color: var(--text-2); }
.trial-banner .t b { font: 700 13px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--tinta-naranja); }
.novel-card { display: grid; gap: 16px; cursor: pointer; transition: transform .25s var(--ease), box-shadow .25s; background: var(--papel); }
.novel-card:hover { transform: translateY(-3px) rotate(-.25deg); }
.novel-card h3 { font: 400 26px/1.15 var(--type); }
.novel-card .premisa { margin: 0; color: var(--text-2); font-size: 14.5px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; font-family: var(--libro); font-style: italic; }
.novel-card .meta { display: flex; gap: 8px; flex-wrap: wrap; }
.novel-card .nums { display: flex; justify-content: space-between; font: 400 13px var(--mono); color: var(--text-3); }
.novel-card::after { content: ""; position: absolute; top: -9px; left: 50%; width: 74px; height: 20px; transform: translateX(-50%) rotate(-2deg); background: rgba(244, 222, 170, .75); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); border-radius: 2px; }
:root[data-theme="dark"] .novel-card::after { background: rgba(170, 150, 110, .35); }
.new-card { display: grid; place-items: center; text-align: center; gap: 10px; min-height: 230px; border: 2px dashed var(--line-2); border-radius: var(--r-lg); background: transparent; color: var(--text-2); transition: border-color .2s, background .2s; }
.new-card:hover { border-color: var(--azul); background: var(--blue-bg); }
.new-card .ic { width: 30px; height: 30px; color: var(--azul); }
.new-card b { font: 400 21px var(--type); color: var(--text); }
.stat-row { display: flex; gap: 14px; flex-wrap: wrap; }
.stat { display: grid; gap: 2px; padding: 14px 18px; border-radius: var(--r); background: var(--solid); border: 1px solid var(--line); min-width: 130px; }
.stat b { font: 700 28px/1 var(--mono); font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--text-3); }
.stat.fuego b { color: var(--tinta-naranja); }

/* ---------- Estructura ---------- */
.struct-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.struct-opt { position: relative; text-align: left; padding: 20px; border-radius: var(--r); border: 1.5px solid var(--line); background: var(--solid); transition: border-color .2s, transform .2s var(--ease), box-shadow .2s; }
.struct-opt:hover { transform: translateY(-2px); }
.struct-opt.on { border-color: var(--azul); box-shadow: 0 0 0 4px rgba(4, 108, 179, .12); }
.struct-opt.locked { opacity: .78; }
.struct-opt b { display: block; font: 700 17px/1.25 var(--mono); }
.struct-opt span { display: block; margin-top: 6px; font-size: 13.5px; color: var(--text-3); line-height: 1.45; }
.struct-opt .tag { margin-bottom: 10px; }
.regla { position: relative; height: 54px; margin: 8px 0 30px; border-radius: 10px; background: var(--solid); border: 1px solid var(--line); }
.regla .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 10px 0 0 10px; background: linear-gradient(90deg, rgba(4, 108, 179, .14), rgba(244, 156, 76, .2)); }
.regla .mk { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--azul); transform: translateX(-1px); }
.regla .mk span { position: absolute; top: 100%; margin-top: 6px; left: 50%; transform: translateX(-50%); font: 400 11px var(--mono); color: var(--text-3); white-space: nowrap; }
.regla .yo { position: absolute; top: -8px; bottom: -8px; width: 3px; border-radius: 2px; background: var(--naranjo); }
.beat { display: grid; grid-template-columns: 74px 1fr; gap: 20px; padding: 22px 24px; }
.beat-pct { font: 700 22px/1 var(--mono); color: var(--accent-text); padding-top: 4px; font-variant-numeric: tabular-nums; }
.beat-pct small { display: block; margin-top: 6px; font: 400 11.5px var(--mono); color: var(--text-3); }
.beat h3 { font: 700 18px var(--mono); }
.beat p { margin: 6px 0 0; color: var(--text-2); font-size: 14.5px; max-width: 64ch; }
.beat-scenes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- Corcho ---------- */
.corcho { display: grid; gap: 30px; }
.cap-col { padding: 20px; border-radius: var(--r-lg); background: rgba(150, 110, 60, .08); border: 1px solid var(--line); }
:root[data-theme="dark"] .cap-col { background: rgba(255, 230, 190, .04); }
.cap-col-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.cap-col-head input { flex: 1 1 220px; min-width: 0; border: 0; background: transparent; font: 400 21px var(--type); color: var(--text); padding: 4px 6px; border-radius: 8px; }
.cap-col-head input:focus { outline: none; background: var(--solid); box-shadow: 0 0 0 3px rgba(10, 134, 216, .14); }
.cap-col-head .n { font: 400 13px var(--mono); color: var(--text-3); white-space: nowrap; }
.tarjetas { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; min-height: 60px; }
.tarjeta { position: relative; display: grid; gap: 8px; align-content: start; padding: 18px 16px 14px; min-height: 160px; border-radius: 6px; background: var(--papel);
  border: 1px solid var(--line); box-shadow: 0 8px 18px -12px rgba(60, 40, 10, .45); cursor: grab; transition: transform .2s var(--ease), box-shadow .2s;
  background-image: linear-gradient(transparent 33px, rgba(179, 53, 43, .35) 33px, rgba(179, 53, 43, .35) 34px, transparent 34px), repeating-linear-gradient(transparent 0 25px, rgba(4, 108, 179, .08) 25px 26px); background-position: 0 0, 0 34px; }
.tarjeta:nth-child(3n+1) { transform: rotate(-.6deg); }
.tarjeta:nth-child(3n+2) { transform: rotate(.5deg); }
.tarjeta:hover { transform: translateY(-3px) rotate(0); box-shadow: 0 16px 28px -14px rgba(60, 40, 10, .5); }
.tarjeta.arrastrando { opacity: .4; }
.tarjeta.sobre { outline: 2px dashed var(--azul); outline-offset: 3px; }
.tarjeta::before { content: ""; position: absolute; top: -6px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff9d8f, var(--cinta) 60%, #7a1c14); box-shadow: 0 2px 3px rgba(0, 0, 0, .3); }
.tarjeta b { font: 700 15px/1.3 var(--mono); padding-right: 18px; }
.tarjeta p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.tarjeta .pie-t { display: flex; justify-content: space-between; align-items: center; gap: 6px; margin-top: auto; padding-top: 6px; font: 400 12px var(--mono); color: var(--text-3); }
.tarjeta .estado { position: absolute; top: 12px; right: 12px; width: 11px; height: 11px; border-radius: 50%; }
.tarjeta .mover { display: flex; gap: 4px; }
.tarjeta .mover button { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--solid); color: var(--text-3); padding: 0; }
.tarjeta .mover .ic { width: 14px; height: 14px; }
.drop-fin { display: grid; place-items: center; min-height: 160px; border: 2px dashed var(--line-2); border-radius: 8px; color: var(--text-3); font-size: 13.5px; background: transparent; }
.drop-fin.sobre { border-color: var(--azul); background: var(--blue-bg); }
.est-idea { background: #b9ab95; } .est-borrador { background: var(--amber); } .est-revision { background: var(--azul-2); } .est-final { background: var(--green); }

/* ---------- Escritorio ---------- */
.desk { display: grid; grid-template-columns: 250px minmax(0, 1fr) 300px; gap: 26px; align-items: start; }
.desk.sin-panel { grid-template-columns: 250px minmax(0, 1fr); }
.desk.sin-panel .scene-panel { display: none; }
main.ancho { max-width: 1480px; }
.arbol { position: sticky; top: 92px; display: grid; gap: 4px; max-height: calc(100vh - 110px); overflow-y: auto; padding: 14px 10px; }
.arbol .cap { margin-top: 10px; display: flex; align-items: center; gap: 6px; padding: 4px 8px; font: 700 12px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }
.arbol .cap:first-child { margin-top: 0; }
.arbol .cap span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arbol a { display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 10px; font-size: 14px; color: var(--text-2); text-decoration: none; }
.arbol a span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.arbol a small { font: 400 11.5px var(--mono); color: var(--text-3); }
.arbol a:hover { background: var(--blue-bg); color: var(--text); }
.arbol a.on { background: var(--solid); color: var(--text); font-weight: 600; box-shadow: var(--shadow); }
.arbol .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.arbol .add { margin-top: 2px; font-size: 13px; color: var(--accent-text); }
.hoja-wrap { display: grid; gap: 14px; min-width: 0; width: 100%; max-width: 880px; justify-self: center; }
.herramientas { position: sticky; top: 86px; z-index: 5; display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 8px; border-radius: 16px; }
.herramientas .sep { width: 1px; height: 24px; background: var(--line-2); margin: 0 4px; }
.herramientas .sp { flex: 1; }
.hoja {
  position: relative; padding: 64px 72px 80px; border-radius: 4px; background: var(--papel); border: 1px solid var(--line);
  box-shadow: 0 1px 1px rgba(60, 40, 10, .05), 0 22px 50px -26px rgba(60, 40, 10, .5), 0 0 0 6px rgba(255, 255, 255, .0);
}
.hoja::before { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; background: radial-gradient(120% 60% at 50% 0%, rgba(255, 255, 255, .5), transparent 60%); }
:root[data-theme="dark"] .hoja::before { display: none; }
.hoja .titulo-escena { width: 100%; border: 0; background: transparent; padding: 0; font: 400 26px/1.25 var(--type); color: var(--text); outline: none; }
.hoja .titulo-escena::placeholder, .hoja textarea::placeholder { color: var(--text-3); opacity: .7; }
.hoja .cap-label { display: block; margin-bottom: 6px; font: 700 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--cinta); }
.hoja textarea.texto {
  display: block; width: 100%; min-height: 60vh; margin-top: 26px; padding: 0; border: 0; background: transparent; resize: none; outline: none;
  font-family: var(--escritura); font-size: var(--escritura-tam); line-height: 1.85; color: var(--text); caret-color: var(--azul);
  overflow: hidden; tab-size: 4;
}
.estado-barra { display: flex; gap: 8px 18px; flex-wrap: wrap; align-items: center; justify-content: space-between; padding: 12px 18px; border-radius: 14px; font: 400 13px var(--mono); color: var(--text-3); }
.estado-barra b { color: var(--text); font-weight: 700; }
.estado-barra .meta-hoy { display: inline-flex; align-items: center; gap: 8px; }
.mini-anillo { width: 22px; height: 22px; transform: rotate(-90deg); }
.mini-anillo circle { fill: none; stroke-width: 4; }
.scene-panel { position: sticky; top: 92px; display: grid; gap: 16px; max-height: calc(100vh - 110px); overflow-y: auto; padding: 20px; }
.scene-panel h3 { font: 700 13px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--text-3); }
.scene-panel .input { font-size: 14.5px; padding: 10px 12px; }
.scene-panel textarea.input { min-height: 64px; }
.scene-panel label.field { font-size: 12.5px; }
.aparece { display: flex; flex-wrap: wrap; gap: 6px; }
.limite-aviso { display: flex; gap: 12px; align-items: center; padding: 12px 16px; border-radius: 14px; background: var(--amber-bg); color: var(--text-2); font-size: 14px; }
.limite-aviso .ic { color: var(--amber); }
.limite-aviso.tope { background: rgba(244, 156, 76, .2); }
.vacio-escritorio { max-width: 560px; margin: 40px auto; }

/* Modo foco: solo la hoja, como frente a la máquina. */
body.foco .sidebar, body.foco .topbar, body.foco .arbol, body.foco .scene-panel, body.foco .estado-barra.normal, body.foco .site-foot, body.foco .limite-aviso { display: none !important; }
body.foco .shell { margin-left: 0; }
body.foco main { max-width: none; padding: 0; }
body.foco .desk, body.foco .desk.sin-panel { display: block; }
body.foco .hoja-wrap { max-width: 820px; margin: 0 auto; padding: 22px 16px 0; }
body.foco .herramientas { top: 10px; opacity: .25; transition: opacity .3s; }
body.foco .herramientas:hover, body.foco .herramientas:focus-within { opacity: 1; }
body.foco .hoja { min-height: calc(100vh - 90px); border-radius: 4px 4px 0 0; }
body.foco .hoja textarea.texto { padding-bottom: 45vh; }
.foco-pie { display: none; }
body.foco .foco-pie { display: flex; position: fixed; left: 50%; bottom: 14px; transform: translateX(-50%); z-index: 40; gap: 14px; align-items: center; padding: 8px 16px; border-radius: 99px; font: 400 13px var(--mono); color: var(--text-3); opacity: .5; transition: opacity .3s; }
body.foco .foco-pie:hover { opacity: 1; }

/* ---------- Biblia: personajes y lugares ---------- */
.ficha-card { display: grid; grid-template-columns: 92px 1fr; gap: 18px; align-items: start; cursor: pointer; transition: transform .25s var(--ease); background: var(--papel); }
.ficha-card:hover { transform: translateY(-3px); }
.ficha-card h3 { font: 400 21px/1.2 var(--type); }
.ficha-card p { margin: 6px 0 0; font-size: 14px; color: var(--text-2); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.ficha-card .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.polaroid { width: 92px; aspect-ratio: 4 / 5; padding: 6px 6px 16px; background: #fff; box-shadow: 0 6px 14px -8px rgba(0, 0, 0, .45); transform: rotate(-2deg); display: grid; }
.polaroid > div { display: grid; place-items: center; overflow: hidden; background: #ece4d4; color: #a3967f; }
.polaroid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.polaroid.lg { width: 150px; justify-self: start; }
.preguntas { display: grid; gap: 16px; }
.pregunta label { font-family: var(--libro); font-style: italic; font-weight: 400; font-size: 15px; color: var(--text); }
.pregunta.locked { opacity: .55; }

/* ---------- Hábito ---------- */
.habit-top { display: grid; grid-template-columns: auto 1fr; gap: 34px; align-items: center; }
.anillo { width: 150px; height: 150px; transform: rotate(-90deg); flex: none; }
.anillo circle { fill: none; stroke-width: 12; }
.anillo-fondo { stroke: var(--bg-2); }
.anillo-valor { stroke: var(--azul); stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.anillo-wrap { position: relative; width: 150px; height: 150px; }
.anillo-wrap .centro { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; }
.anillo-wrap .centro b { font: 700 30px/1 var(--mono); font-variant-numeric: tabular-nums; }
.anillo-wrap .centro span { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.calor { display: grid; grid-auto-flow: column; grid-template-rows: repeat(7, 1fr); gap: 4px; overflow-x: auto; padding-bottom: 6px; }
.calor i { width: 15px; height: 15px; border-radius: 4px; background: var(--bg-2); }
.calor i.n1 { background: rgba(4, 108, 179, .25); } .calor i.n2 { background: rgba(4, 108, 179, .5); } .calor i.n3 { background: var(--azul); } .calor i.n4 { background: var(--naranjo); }
.calor i.hoy { outline: 2px solid var(--text-3); outline-offset: 1px; }
.leyenda { display: flex; gap: 6px; align-items: center; font-size: 12px; color: var(--text-3); margin-top: 10px; }
.leyenda i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- Avance ---------- */
.hitos { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.hito { display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center; padding: 16px 20px; border-radius: var(--r); background: var(--glass); border: 1px solid var(--hair); box-shadow: var(--shadow); }
.hito-check { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line-2); color: var(--text-3); font: 700 13px var(--mono); }
.hito.ok .hito-check { border-color: transparent; background: var(--green); color: #fff; }
.hito-txt { display: grid; gap: 4px; min-width: 0; }
.hito-txt b { font-size: 15.5px; font-weight: 600; }
.hito.ok .hito-txt b { color: var(--text-2); }
.hito-bar { display: block; height: 5px; width: min(260px, 100%); border-radius: 99px; background: var(--bg-2); overflow: hidden; margin-top: 4px; }
.hito-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--azul), var(--azul-2)); }
.pendiente { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center; padding: 14px 18px; }
.pendiente .ic { color: var(--cinta); }
.pendiente q { font-family: var(--libro); font-style: italic; quotes: "«" "»"; }

/* ---------- Exportar ---------- */
.export-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 30px; align-items: start; }
.muestra { aspect-ratio: 210 / 297; padding: 11% 12%; background: #fff; color: #111; box-shadow: var(--shadow-lg); border-radius: 2px; font: 9px/1.5 "Times New Roman", Times, serif; overflow: hidden; display: flex; flex-direction: column; }
.muestra .mh { display: flex; justify-content: space-between; font-size: 7px; color: #555; margin-bottom: 12%; }
.muestra .mt { text-align: center; font-size: 11px; font-weight: bold; margin: 18% 0 10%; text-transform: uppercase; }
.muestra p { margin: 0; text-indent: 1.6em; }
.muestra p.ni { text-indent: 0; }
.muestra .sep { text-align: center; margin: 6% 0; }

/* ---------- Lo que viene ---------- */
.viene { display: grid; gap: 10px; background: var(--papel); }
.viene h3 { font: 700 17px var(--mono); }
.viene p { margin: 0; color: var(--text-2); font-size: 14.5px; }

/* ---------- Estado vacío ---------- */
.empty { display: grid; justify-items: center; text-align: center; gap: 14px; padding: 60px 28px; }
.empty .art { display: grid; place-items: center; width: 92px; height: 92px; border-radius: 28px; background: linear-gradient(135deg, rgba(4, 108, 179, .12), rgba(244, 156, 76, .18)); color: var(--azul); margin-bottom: 6px; }
:root[data-theme="dark"] .empty .art { color: var(--accent-text); }
.empty .art .ic { width: 40px; height: 40px; stroke-width: 1.5; }
.empty h3 { font: 400 25px/1.25 var(--type); }
.empty p { margin: 0; max-width: 48ch; color: var(--text-2); }
.empty .btn { margin-top: 10px; }

/* ---------- Cajón lateral ---------- */
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(20, 14, 6, .38); opacity: 0; pointer-events: none; transition: opacity .3s; backdrop-filter: blur(2px); }
.overlay.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 12px; right: 12px; bottom: 12px; z-index: 70; width: min(560px, calc(100vw - 24px));
  display: flex; flex-direction: column; border-radius: var(--r-xl);
  background: var(--glass-strong); backdrop-filter: blur(28px) saturate(1.5); -webkit-backdrop-filter: blur(28px) saturate(1.5);
  border: 1px solid var(--hair); box-shadow: var(--shadow-lg);
  transform: translateX(calc(100% + 24px)); transition: transform .45s var(--ease); visibility: hidden;
}
.drawer.on { transform: none; visibility: visible; }
.drawer-head { display: flex; align-items: center; gap: 12px; padding: 22px 22px 12px; }
.drawer-head h2 { margin: 0; flex: 1; min-width: 0; font: 400 25px var(--type); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-body { flex: 1; overflow-y: auto; padding: 8px 24px 28px; display: grid; gap: 18px; align-content: start; }
.drawer-sub { font: 700 12px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-text); margin: 14px 0 -4px; }

/* ---------- Modal ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 95; display: grid; place-items: center; padding: 20px; background: rgba(20, 14, 6, .45); backdrop-filter: blur(4px); animation: fade .25s both; }
.modal { width: min(580px, 100%); max-height: calc(100vh - 40px); overflow-y: auto; padding: 32px; border-radius: var(--r-xl); background: var(--glass-strong); backdrop-filter: blur(28px) saturate(1.5); -webkit-backdrop-filter: blur(28px) saturate(1.5); border: 1px solid var(--hair); box-shadow: var(--shadow-lg); animation: pop .35s var(--ease) both; display: grid; gap: 20px; }
.modal h2 { margin: 0; font: 400 28px/1.2 var(--type); }
.modal p { margin: 0; color: var(--text-2); }
.modal .actions { display: flex; gap: 12px; justify-content: flex-end; flex-wrap: wrap; margin-top: 4px; }
.modal.ancho { width: min(760px, 100%); }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(14px) scale(.98); } }
.mejorar-lista { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.mejorar-lista li { display: flex; gap: 10px; align-items: flex-start; color: var(--text-2); font-size: 15px; }
.mejorar-lista .ic { color: var(--green); margin-top: 3px; }
.precio { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; padding: 14px 18px; border-radius: var(--r); background: var(--blue-bg); }
.precio b { font: 700 30px var(--mono); color: var(--accent-text); }
.precio span { color: var(--text-2); font-size: 14.5px; }

/* ---------- Avisos ---------- */
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 210; display: grid; gap: 12px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: start;
  padding: 16px 16px 16px 18px; border-radius: 18px; background: var(--glass-strong);
  backdrop-filter: blur(24px) saturate(1.5); -webkit-backdrop-filter: blur(24px) saturate(1.5);
  border: 1px solid var(--hair); box-shadow: var(--shadow-lg); font-size: 14.5px; line-height: 1.5;
  animation: toastIn .45s var(--ease) both; overflow: hidden; position: relative;
}
.toast.out { animation: toastOut .3s ease-in both; }
.toast .t-ic { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; }
.toast.success .t-ic { background: var(--green-bg); color: var(--green); }
.toast.warn .t-ic { background: var(--amber-bg); color: var(--amber); }
.toast.error .t-ic { background: var(--red-bg); color: var(--red); }
.toast.info .t-ic { background: var(--blue-bg); color: var(--accent-text); }
.toast b { display: block; font-weight: 650; }
.toast span { color: var(--text-2); }
.toast .x { border: 0; background: none; color: var(--text-3); padding: 4px; border-radius: 8px; }
.toast .life { position: absolute; left: 0; bottom: 0; height: 3px; background: currentColor; opacity: .35; animation: life linear both; }
.toast.success .life { color: var(--green); } .toast.warn .life { color: var(--amber); } .toast.error .life { color: var(--red); } .toast.info .life { color: var(--azul); }
@keyframes toastIn { from { opacity: 0; transform: translateX(30px) scale(.97); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(30px); } }
@keyframes life { from { width: 100%; } to { width: 0; } }

/* ---------- Detalle sorpresa: tira de papel escrita a máquina ---------- */
.tira { position: fixed; left: 50%; top: 22%; z-index: 120; pointer-events: none; transform: translateX(-50%); animation: tiraIn 3.6s var(--ease) both; }
.tira-papel { position: relative; padding: 22px 34px 24px; background: #fffaf0; color: #221c14; box-shadow: 0 30px 60px -24px rgba(0, 0, 0, .5); border-radius: 2px; min-width: min(420px, 86vw); text-align: center;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 96% 97%, 92% 100%, 88% 97%, 84% 100%, 80% 97%, 76% 100%, 72% 97%, 68% 100%, 64% 97%, 60% 100%, 56% 97%, 52% 100%, 48% 97%, 44% 100%, 40% 97%, 36% 100%, 32% 97%, 28% 100%, 24% 97%, 20% 100%, 16% 97%, 12% 100%, 8% 97%, 4% 100%, 0 97%); }
.tira-papel small { display: block; font: 700 11px "Courier Prime", monospace; letter-spacing: .2em; text-transform: uppercase; color: #b3352b; margin-bottom: 8px; }
.tira-papel b { display: block; font: 400 26px/1.2 "Special Elite", monospace; min-height: 1.2em; }
.tira-papel b::after { content: "▌"; margin-left: 2px; color: #046cb3; animation: parpadeo .7s steps(2) infinite; }
.tira-papel span { display: block; margin-top: 8px; font: 400 14px "Courier Prime", monospace; color: #6b5f4f; }
@keyframes tiraIn { 0% { opacity: 0; transform: translate(-50%, -30px); } 10% { opacity: 1; transform: translate(-50%, 0); } 86% { opacity: 1; transform: translate(-50%, 0); } 100% { opacity: 0; transform: translate(-50%, 20px); } }
@keyframes parpadeo { to { visibility: hidden; } }

/* ---------- Tutorial con voz ---------- */
.tut {
  position: fixed; z-index: 85; left: calc(var(--side-w) + 22px); bottom: 20px; width: min(410px, calc(100vw - var(--side-w) - 44px));
  display: grid; gap: 16px; padding: 22px; border-radius: var(--r-xl);
  background: var(--glass-strong); backdrop-filter: blur(28px) saturate(1.5); -webkit-backdrop-filter: blur(28px) saturate(1.5);
  border: 1px solid var(--hair); box-shadow: var(--shadow-lg); animation: tutIn .45s var(--ease) both;
  max-height: calc(100vh - 40px); overflow-y: auto;
}
.tut.out { animation: tutOut .28s ease-in both; }
@keyframes tutIn { from { opacity: 0; transform: translateY(24px) scale(.97); } }
@keyframes tutOut { to { opacity: 0; transform: translateY(16px); } }
.tut .ic.sm { width: 17px; height: 17px; }
.tut-play .ic { fill: currentColor; stroke: none; }
.tut-head { display: flex; align-items: center; gap: 12px; }
.tut-head > div { flex: 1; min-width: 0; }
.tut-head b { display: block; font-size: 15px; }
.tut-head small { display: block; font-size: 12.5px; color: var(--text-3); }
.tut-head .icon-btn, .tut.min .icon-btn { width: 36px; height: 36px; border-radius: 11px; }
.tut-avatar { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 50%; flex: none; color: #fff; font: 400 20px var(--type); background: linear-gradient(135deg, var(--naranjo), #e0873a 40%, var(--azul)); box-shadow: 0 6px 16px -6px rgba(244, 156, 76, .7); }
.tut-title { font: 400 23px/1.2 var(--type); }
.tut-text { margin: 0; max-height: 132px; overflow-y: auto; font-size: 14.5px; line-height: 1.65; color: var(--text-2); padding-right: 4px; }
.tut-progress { height: 8px; border-radius: 99px; background: var(--bg-2); cursor: pointer; overflow: hidden; }
.tut-progress i, .tut-bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--azul), var(--azul-2) 70%, var(--naranjo)); }
.tut-controls { display: flex; align-items: center; justify-content: center; gap: 22px; }
.tut-play { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; border: 0; color: #fff; flex: none; background: linear-gradient(135deg, var(--azul-2), var(--azul) 50%, var(--azul-hondo)); box-shadow: 0 12px 26px -10px rgba(4, 108, 179, .75), inset 0 1px 0 rgba(255, 255, 255, .25); transition: transform .15s; }
.tut-play:active { transform: scale(.94); }
.tut-play .ic { width: 24px; height: 24px; }
.tut-caps { display: flex; flex-wrap: wrap; gap: 6px; }
.tut-caps button { border: 1px solid var(--line-2); background: var(--solid); color: var(--text-2); border-radius: 99px; padding: 4px 11px; font-size: 12.5px; }
.tut-caps button.on { border-color: var(--azul); background: var(--blue-bg); color: var(--accent-text); font-weight: 600; }
.tut-done { display: flex; gap: 10px; align-items: flex-start; margin: 0; padding: 12px 14px; border-radius: 14px; background: var(--green-bg); color: var(--green); font-size: 14px; }
.tut-done span { color: var(--text-2); }
.tut.min { grid-template-columns: auto 1fr auto auto; align-items: center; gap: 10px; width: min(370px, calc(100vw - var(--side-w) - 44px)); padding: 10px 12px 10px 10px; border-radius: 22px; }
.tut.min .tut-play { width: 44px; height: 44px; }
.tut.min .tut-play .ic { width: 18px; height: 18px; }
.tut-min-info { display: grid; gap: 7px; min-width: 0; border: 0; background: none; padding: 0; text-align: left; }
.tut-min-info b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tut-bar { display: block; height: 5px; border-radius: 99px; background: var(--bg-2); overflow: hidden; }
body.foco .tut { display: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ---------- Responsive ---------- */
@media (max-width: 1600px) {
  .desk, .desk.sin-panel { grid-template-columns: 220px minmax(0, 1fr); }
  .desk .scene-panel { display: none; }
  .desk.panel-flota .scene-panel { display: grid; align-content: start; position: fixed; top: 12px; right: 12px; bottom: 12px; z-index: 70; width: min(380px, calc(100vw - 24px)); max-height: none; background: var(--glass-strong); box-shadow: var(--shadow-lg); animation: pop .3s var(--ease); }
  main.ancho { padding-left: 32px; padding-right: 32px; }
}
@media (max-width: 1280px) {
  .export-grid { grid-template-columns: 1fr; }
  .export-grid .muestra { max-width: 340px; }
}
@media (max-width: 1100px) {
  main { padding: 40px 32px 88px; }
  .hoja { padding: 48px 44px 64px; }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-102%); transition: transform .4s var(--ease); box-shadow: var(--shadow-lg); background: var(--glass-strong); }
  .sidebar.open { transform: none; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 25; background: rgba(20, 14, 6, .35); opacity: 0; pointer-events: none; transition: opacity .3s; }
  .scrim.on { opacity: 1; pointer-events: auto; }
  .shell { margin-left: 0; }
  .only-mobile { display: inline-grid; }
  .topbar { margin: 10px 12px 0; padding: 8px 8px 8px 10px; gap: 8px; }
  .pill-btn span { display: none; }
  .pill-btn { width: 40px; padding: 0; justify-content: center; }
  .save-state { display: none; }
  main { padding: 30px 16px 80px; }
  .head { margin-bottom: 36px; }
  .block { margin-top: 54px; }
  .card { padding: 22px; }
  .grid-2 { grid-template-columns: 1fr; }
  .desk, .desk.sin-panel { grid-template-columns: 1fr; }
  .arbol { display: none; }
  .desk.arbol-flota .arbol { display: grid; position: fixed; top: 12px; left: 12px; bottom: 12px; z-index: 70; width: min(320px, calc(100vw - 24px)); max-height: none; background: var(--glass-strong); box-shadow: var(--shadow-lg); animation: pop .3s var(--ease); align-content: start; }
  .hoja { padding: 34px 22px 50px; }
  .hoja .titulo-escena { font-size: 22px; }
  .herramientas { top: 72px; flex-wrap: nowrap; }
  .herramientas #tipoInfo, .herramientas .sep { display: none; }
  .habit-top { grid-template-columns: 1fr; justify-items: start; }
  .beat { grid-template-columns: 1fr; gap: 6px; padding: 18px; }
  .tut, .tut.min { left: 12px; right: 12px; bottom: 12px; width: auto; }
  .tut { padding: 18px; gap: 14px; background: var(--solid); max-height: 70vh; }
  .tut .tut-caps, .tut > p.small.muted { display: none; }
  .tut-text { max-height: 84px; }
  .ficha-card { grid-template-columns: 76px 1fr; }
  .polaroid { width: 76px; }
}
@media (min-width: 901px) {
  .solo-movil { display: none !important; }
}
@media (max-width: 520px) {
  .head .btn.primary { width: 100%; }
  .stat { min-width: 0; flex: 1 1 40%; }
  .modal { padding: 24px 20px; }
  .tarjetas { grid-template-columns: 1fr; }
}

/* ---------- Impresión: manuscrito en formato editorial ---------- */
#print { display: none; }
@media print {
  @page { size: A4; margin: 2.5cm 2.5cm 2.5cm 3cm; }
  body { background: #fff !important; color: #000; }
  body.printing .app, body.printing .grain, body.printing .drawer, body.printing .overlay, body.printing .toasts, body.printing .modal-wrap, body.printing .tut, body.printing .tira { display: none !important; }
  body.printing #print { display: block; }
  .ms { font: 12pt/1.5 "Times New Roman", Times, serif; color: #000; }
  .ms.doble { line-height: 2; }
  .ms.just p { text-align: justify; }
  .ms .portada { height: 24.5cm; display: flex; flex-direction: column; page-break-after: always; }
  .ms .portada .datos { display: flex; justify-content: space-between; font-size: 12pt; line-height: 1.4; }
  .ms .portada .centro { margin: auto 0; text-align: center; }
  .ms .portada h1 { font: 700 20pt/1.2 "Times New Roman", Times, serif; text-transform: uppercase; margin: 0 0 18pt; }
  .ms .portada .por { font-size: 13pt; }
  .ms .portada .prueba { margin-top: 30pt; font-size: 10pt; color: #555; font-style: italic; }
  .ms .capitulo { page-break-before: always; }
  .ms .capitulo:first-of-type { page-break-before: auto; }
  .ms .capitulo h2 { font: 700 14pt "Times New Roman", Times, serif; text-align: center; text-transform: uppercase; margin: 6cm 0 1.2cm; }
  .ms p { margin: 0; text-indent: 1.25cm; orphans: 2; widows: 2; }
  .ms p.ni { text-indent: 0; }
  .ms .sep { text-align: center; margin: 12pt 0; text-indent: 0; }
  .ms .fin { text-align: center; margin-top: 24pt; text-indent: 0; }
}
