/* Misma identidad que eljuegodelpsicopata.com: fondo negro, Geist, acentos en Source Serif cursiva, rojo del rey. */
:root {
  --bg: #000;
  --surface: #0e0e10;
  --surface-2: #1b1b1e;
  --text: #f5f5f7;
  --muted: #8e8e93;
  --hair: rgba(255, 255, 255, .09);
  --red: #e5232c;
  --red-text: #ff5a60;
  --yellow: #ffd60a;
  --sans: "Geist", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  --gl: max(16px, env(safe-area-inset-left, 0px));
  --gr: max(16px, env(safe-area-inset-right, 0px));
  --sb: env(safe-area-inset-bottom, 0px);
  --st: env(safe-area-inset-top, 0px);
  --tabbar-h: 58px;
  /* Lector */
  --hl-yellow: rgba(255, 214, 10, .42);
  --hl-green: rgba(90, 200, 120, .4);
  --hl-pink: rgba(255, 90, 150, .38);
  --tts: rgba(229, 35, 44, .16);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg); color: var(--text);
  font-family: var(--sans); font-size: 16px; line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column; overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--yellow); outline-offset: 3px; border-radius: 6px; }
h1, h2, h3, p { margin: 0; }
h1, h2 { text-wrap: balance; }
em { font-family: var(--serif); font-style: italic; font-weight: 400; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.red { color: var(--red); }

/* ---------- Barra superior (igual al sitio) ---------- */
.appbar {
  flex: none; display: flex; align-items: center; gap: 12px;
  height: calc(52px + var(--st)); padding: var(--st) var(--gr) 0 var(--gl);
  background: rgba(0, 0, 0, .85);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--hair); z-index: 5;
}
body.on-sitio .appbar { display: none; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; white-space: nowrap; min-width: 0; }
.brand-mark { width: 18px; height: 24px; flex: none; fill: var(--red); filter: drop-shadow(0 0 8px rgba(229, 35, 44, .45)); }
.brand-text {
  display: flex; align-items: baseline; gap: .38em; white-space: nowrap; overflow: hidden;
  padding-left: 10px; border-left: 1px solid rgba(255,255,255,.18);
  font-size: 13px; font-weight: 700; line-height: 1.2; letter-spacing: .08em; text-transform: uppercase;
}
.brand-text .red { font-weight: 800; }
.exit {
  margin-left: auto; flex: none; display: inline-flex; align-items: center; gap: 6px;
  background: var(--yellow); color: #000; border: 0; border-radius: 999px;
  padding: 7px 14px 7px 11px; font-weight: 700; font-size: 14px; letter-spacing: .01em;
}
.exit svg { width: 14px; height: 14px; }
.exit:active { transform: scale(.97); }

/* ---------- Vistas ---------- */
main { flex: 1; position: relative; min-height: 0; }
.view { position: absolute; inset: 0; display: none; }
.view.active { display: block; }
.view.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 40px var(--gr) calc(var(--tabbar-h) + var(--sb) + 48px) var(--gl); }
.eyebrow { font-size: 12px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--red-text); margin-bottom: 10px; }
h1 { font-size: clamp(2rem, 6vw, 3rem); line-height: 1.08; font-weight: 700; letter-spacing: -.02em; }
h1 em { color: var(--red-text); }
.lead { color: var(--muted); font-size: 1.05rem; max-width: 56ch; margin: 14px 0 28px; }

/* ---------- Barra de pestañas: abajo como app; flotante en computadora ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 6;
  display: flex; justify-content: space-around;
  padding: 6px var(--gr) calc(6px + var(--sb)) var(--gl);
  background: rgba(14, 14, 16, .88);
  -webkit-backdrop-filter: saturate(180%) blur(20px); backdrop-filter: saturate(180%) blur(20px);
  border-top: 1px solid var(--hair);
}
.tabbar a {
  flex: 1; max-width: 140px; display: flex; flex-direction: column; align-items: center; gap: 2px;
  text-decoration: none; color: var(--muted); font-size: 11px; font-weight: 500; padding: 4px 0; border-radius: 10px;
}
.tabbar svg { width: 25px; height: 25px; }
.tabbar a.active { color: var(--text); }
.tabbar a.active svg { color: var(--red); }
@media (min-width: 820px) {
  .tabbar {
    left: 50%; right: auto; bottom: calc(18px + var(--sb)); transform: translateX(-50%);
    gap: 4px; padding: 5px; border: 1px solid var(--hair); border-radius: 999px;
    box-shadow: 0 12px 40px rgba(0,0,0,.6);
  }
  .tabbar a { flex-direction: row; gap: 8px; padding: 9px 18px; font-size: 14px; max-width: none; border-radius: 999px; }
  .tabbar svg { width: 19px; height: 19px; }
  .tabbar a.active { background: var(--surface-2); }
}

/* ---------- Sitio ---------- */
#site-frame { width: 100%; height: 100%; border: 0; display: block; background: var(--bg); }
@media (max-width: 819px) { #site-frame { height: calc(100% - var(--tabbar-h) - var(--sb)); } }

/* ---------- Herramientas: cálidas y con vida. Cada ejercicio tiene su degradado (--g1, --g2) y su color de texto (--ink). ---------- */
#view-herramientas { overflow-x: hidden; }
.tools-hero { position: relative; padding: 8px 0 6px; isolation: isolate; }
.aurora { position: absolute; z-index: -1; inset: -90px calc(-1 * var(--gr)) -40px calc(-1 * var(--gl)); pointer-events: none; filter: blur(46px); opacity: .75; overflow: hidden; }
.aurora i { position: absolute; width: 46%; aspect-ratio: 1; border-radius: 50%; animation: drift 18s ease-in-out infinite alternate; }
.aurora i:nth-child(1) { left: 2%; top: 4%; background: #ff3d6e; }
.aurora i:nth-child(2) { left: 38%; top: -10%; background: #ff9a3d; animation-duration: 22s; animation-delay: -6s; }
.aurora i:nth-child(3) { left: 62%; top: 20%; background: #6d5bff; animation-duration: 26s; animation-delay: -12s; }
@keyframes drift { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(8%, 10%) scale(1.15); } 100% { transform: translate(-6%, 4%) scale(.9); } }
.tools-hero .eyebrow { color: #ffd0c2; }
.tools-hero h1 em { color: #ffb38a; }
.tools-hero .lead { color: #d8d4dc; }

.mood { margin: 18px 0 34px; }
.mood-q { font-family: var(--serif); font-style: italic; font-size: 1.35rem; color: #f2eef5; margin-bottom: 12px; }
.mood-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  border: 1px solid color-mix(in srgb, var(--c, #fff) 45%, transparent); background: color-mix(in srgb, var(--c, #fff) 10%, #0b0b0e);
  color: var(--text); border-radius: 999px; padding: 9px 15px; font-size: .92rem; font-weight: 550;
  transition: background .2s, transform .15s;
}
.chip i { width: 9px; height: 9px; border-radius: 50%; background: var(--c, #fff); box-shadow: 0 0 10px var(--c, #fff); }
.chip:hover { background: color-mix(in srgb, var(--c, #fff) 22%, #0b0b0e); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"] { background: var(--c, #fff); color: #120a10; border-color: var(--c, #fff); }
.chip[aria-pressed="true"] i { background: #120a10; box-shadow: none; }

.tool-group { margin-bottom: 34px; scroll-margin-top: 12px; transition: opacity .3s; }
.tg-head { margin-bottom: 14px; }
.tg-head h2 { font-size: clamp(1.45rem, 5vw, 1.8rem); font-weight: 750; letter-spacing: -.02em; }
.tg-head h2 em { color: var(--accent); font-size: 1.08em; }
.tg-head p { color: #a9a6b0; font-size: .95rem; margin-top: 2px; }

/* Fila deslizable en el celular; cuadrícula en computadora */
.tiles {
  display: grid; grid-auto-flow: column; grid-auto-columns: min(78%, 300px); gap: 12px;
  overflow-x: auto; scroll-snap-type: x mandatory; overscroll-behavior-x: contain; scrollbar-width: none;
  margin: 0 calc(-1 * var(--gr)) 0 calc(-1 * var(--gl)); padding: 6px var(--gr) 18px var(--gl); scroll-padding-left: var(--gl);
}
.tiles::-webkit-scrollbar { display: none; }
@media (min-width: 820px) {
  .tiles { grid-auto-flow: row; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); overflow: visible; margin: 0; padding: 6px 0 4px; }
}
.tile {
  --g1: #ff8a5c; --g2: #ff3d6e; --ink: #fff;
  position: relative; overflow: hidden; isolation: isolate; scroll-snap-align: start;
  min-height: 210px; padding: 86px 18px 18px; border: 0; border-radius: 26px; text-align: left; color: var(--ink);
  display: flex; flex-direction: column; justify-content: flex-start; gap: 6px;
  background: linear-gradient(150deg, var(--g1) 0%, var(--g2) 100%);
  box-shadow: 0 18px 40px -18px var(--g2), inset 0 1px 0 rgba(255,255,255,.25);
  transition: transform .25s cubic-bezier(.3,.7,.3,1), box-shadow .25s, opacity .3s, filter .3s;
}
.tile:hover { transform: translateY(-4px) rotate(-.4deg); box-shadow: 0 26px 50px -18px var(--g2), inset 0 1px 0 rgba(255,255,255,.3); }
.tile:active { transform: scale(.98); }
.tile .blob {
  position: absolute; z-index: -1; width: 170px; height: 170px; right: -46px; top: -52px;
  background: rgba(255,255,255,.24); border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%;
  animation: blob 16s ease-in-out infinite; animation-delay: var(--d, 0s);
}
.tile .blob.b2 { width: 96px; height: 96px; right: 70px; top: 40px; background: rgba(255,255,255,.13); animation-duration: 21s; animation-direction: reverse; }
@keyframes blob {
  0%, 100% { border-radius: 42% 58% 63% 37% / 41% 44% 56% 59%; transform: translate(0, 0) rotate(0deg); }
  33% { border-radius: 63% 37% 45% 55% / 56% 38% 62% 44%; transform: translate(-14px, 12px) rotate(30deg); }
  66% { border-radius: 38% 62% 52% 48% / 44% 60% 40% 56%; transform: translate(8px, 18px) rotate(-20deg); }
}
.tile-ic {
  position: absolute; top: 18px; left: 18px; width: 52px; height: 52px; border-radius: 18px; display: grid; place-items: center;
  background: rgba(255,255,255,.24); box-shadow: inset 0 0 0 1px rgba(255,255,255,.3);
}
.tile-ic svg { width: 28px; height: 28px; }
.tile strong { font-size: 1.22rem; font-weight: 750; letter-spacing: -.015em; line-height: 1.15; text-wrap: balance; }
.tile .d { font-size: .92rem; line-height: 1.38; opacity: .92; margin-bottom: 10px; }
.tile .t { margin-top: auto; align-self: flex-start; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; padding: 5px 10px; border-radius: 999px; background: rgba(0,0,0,.2); }
#tool-groups { transition: opacity .35s, filter .35s; }
#tool-groups.dimmed { opacity: .32; filter: saturate(.45); }
#tool-groups.dimmed:hover { opacity: .5; }
.chip-all { --c: #ffffff; }

.focus-area {
  --mood: #ff9a4d; position: relative; margin: -6px 0 34px; padding: 18px 16px 6px; border-radius: 28px; scroll-margin-top: 12px;
  background: radial-gradient(120% 90% at 0% 0%, color-mix(in srgb, var(--mood) 26%, transparent), transparent 70%), color-mix(in srgb, var(--mood) 8%, #0b0b0e);
  border: 1px solid color-mix(in srgb, var(--mood) 40%, transparent); box-shadow: 0 30px 80px -40px var(--mood);
  animation: focusIn .45s ease both;
}
.focus-area[hidden] { display: none; }
@keyframes focusIn { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.focus-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.focus-head .eyebrow { color: var(--mood); margin-bottom: 4px; }
.focus-head h2 { font-size: clamp(1.35rem, 5vw, 1.8rem); font-weight: 750; letter-spacing: -.02em; text-wrap: balance; }
.focus-head h2 em { color: var(--mood); }
.focus-all { flex: none; background: rgba(255,255,255,.08); color: var(--text); border: 1px solid rgba(255,255,255,.18); border-radius: 999px; padding: 7px 13px; font-size: .85rem; font-weight: 550; }
.focus-area .tiles {
  grid-auto-flow: row; grid-template-columns: repeat(auto-fill, minmax(min(100%, 150px), 1fr)); overflow: visible;
  margin: 0; padding: 4px 0 14px;
}
/* ---------- Celular: lista vertical compacta, sin deslizar de lado ---------- */
@media (max-width: 819px) {
  .tools-hero h1 { font-size: 2rem; }
  .tools-hero .lead { font-size: .98rem; margin: 10px 0 0; }
  .mood { margin: 20px 0 26px; }
  .mood-q { font-size: 1.15rem; margin-bottom: 10px; }
  .mood-chips { gap: 6px; }
  .chip { padding: 7px 12px; font-size: .85rem; gap: 7px; }
  .chip i { width: 8px; height: 8px; }

  .tool-group { margin-bottom: 26px; }
  .tg-head { margin-bottom: 10px; }
  .tg-head h2 { font-size: 1.35rem; }
  .tg-head p { font-size: .86rem; }

  .tiles, .focus-area .tiles {
    display: flex; flex-direction: column; gap: 8px; overflow: visible;
    margin: 0; padding: 0; scroll-snap-type: none;
  }
  .tile {
    min-height: 0; padding: 12px 36px 12px 12px; border-radius: 18px; color: var(--text);
    display: grid; grid-template-columns: 50px 1fr auto; grid-template-areas: "ic title time" "ic desc desc";
    column-gap: 12px; row-gap: 2px; align-items: center;
    background: linear-gradient(100deg, color-mix(in srgb, var(--g1) 20%, #111114) 0%, #111114 75%);
    border: 1px solid color-mix(in srgb, var(--g1) 28%, transparent);
    box-shadow: none;
  }
  .tile:hover { transform: none; box-shadow: none; }
  .tile:active { transform: scale(.985); }
  .tile .blob { display: none; }
  .tile-ic {
    position: static; grid-area: ic; width: 50px; height: 50px; border-radius: 15px; color: var(--ink);
    background: linear-gradient(150deg, var(--g1), var(--g2)); box-shadow: 0 6px 16px -6px var(--g2), inset 0 1px 0 rgba(255,255,255,.3);
  }
  .tile-ic svg { width: 26px; height: 26px; }
  .tile strong { grid-area: title; font-size: 1rem; line-height: 1.2; text-wrap: pretty; }
  .tile .d { grid-area: desc; font-size: .83rem; line-height: 1.35; color: #a9a6b0; opacity: 1; margin: 0;
    display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .tile .t { grid-area: time; margin: 0; align-self: start; background: none; padding: 2px 0 0; font-size: 10px; letter-spacing: .06em; color: var(--g1); white-space: nowrap; }
  .tile::after { content: ""; position: absolute; right: 14px; top: 50%; width: 8px; height: 8px; margin-top: -4px;
    border-right: 2px solid rgba(255,255,255,.35); border-bottom: 2px solid rgba(255,255,255,.35); transform: rotate(-45deg); }
  #tool-groups.dimmed .tile { pointer-events: auto; }
  .focus-area { padding: 16px 12px 12px; border-radius: 22px; }
  .focus-head { margin-bottom: 10px; }
}
@media (min-width: 820px) { .focus-area { padding: 24px 24px 10px; } .focus-area .tiles { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); } }

/* ---------- Ejercicio abierto ---------- */
.tool-full { --tone: var(--g1, #ff7a6b); --tone-bg: color-mix(in srgb, var(--g1, #ff7a6b) 18%, transparent); --tone-glow: color-mix(in srgb, var(--g1, #ff7a6b) 42%, transparent); }
.tool-stage { position: absolute; inset: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; isolation: isolate;
  background: radial-gradient(90% 55% at 15% 0%, color-mix(in srgb, var(--g1) 42%, transparent), transparent 70%),
              radial-gradient(80% 50% at 100% 25%, color-mix(in srgb, var(--g2) 38%, transparent), transparent 70%),
              radial-gradient(70% 40% at 50% 110%, color-mix(in srgb, var(--g2) 22%, transparent), transparent 70%), #07070a; }
.tool-stage[hidden] { display: none; }
.ex { max-width: 560px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column;
  padding: calc(84px + var(--st)) var(--gr) calc(40px + var(--sb)) var(--gl); text-align: center; }
.ex-ic { width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 20px; display: grid; place-items: center; color: var(--ink);
  background: linear-gradient(150deg, var(--g1), var(--g2)); box-shadow: 0 12px 30px -10px var(--g2); }
.ex-ic svg { width: 30px; height: 30px; }
.ex-head .eyebrow { color: var(--tone); }
.ex-head h2 { font-size: clamp(1.7rem, 6.5vw, 2.4rem); font-weight: 750; letter-spacing: -.02em; text-wrap: balance; }
.ex-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; padding-top: 18px; }
.ex-sub { color: #e2dee6; font-variant-numeric: tabular-nums; min-height: 1.5em; }
.ex-lead { color: #e2dee6; font-size: 1.05rem; max-width: 46ch; }
.ex-lead strong { color: #fff; }
.ex-lead em { color: var(--tone); }
.ex-note { color: #9d99a5; font-size: .85rem; max-width: 46ch; margin-top: 8px; }
.ex-note em { font-style: italic; font-family: inherit; }
.ex-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.ex-choices { display: flex; gap: 8px; justify-content: center; }
.ex-choices.wrap-ok { flex-wrap: wrap; }
.ex-choices[hidden] { display: none; }
.ex-choices .chip { --c: var(--g1); }
.ex-dots { display: flex; justify-content: center; gap: 6px; }
.ex-dots i { width: 8px; height: 8px; border-radius: 50%; background: rgba(255,255,255,.14); transition: background .3s, transform .3s; }
.ex-dots i.on { background: var(--tone); transform: scale(1.15); }
.tool-full .primary { background: linear-gradient(150deg, var(--g1), var(--g2)); color: var(--ink); box-shadow: 0 10px 30px -8px var(--g2); }
.tool-full .primary:disabled { opacity: .5; }
.ghost { color: var(--text); }
.ghost:disabled { opacity: .35; }

.orb-wrap { position: relative; width: min(64vw, 260px); aspect-ratio: 1; display: grid; place-items: center; margin: 8px 0; }
.orb-ring { position: absolute; inset: 0; border-radius: 50%; border: 1px solid rgba(255,255,255,.14); }
.orb {
  width: 100%; height: 100%; border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle at 38% 30%, color-mix(in srgb, var(--g1) 55%, #fff), var(--g1) 40%, var(--g2) 100%);
  box-shadow: 0 0 90px var(--tone-glow); transform: scale(.5); transition: transform 1.2s ease-in-out;
}
.orb-label { font-weight: 700; font-size: 15px; color: var(--ink); transform: scale(1.4); text-align: center; max-width: 9em; line-height: 1.2; }

.pmr { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pmr-part { font-size: 1.6rem; font-weight: 750; }
.pmr-do { font-family: var(--serif); font-size: 1.25rem; color: #ece8f0; max-width: 30ch; min-height: 3em; }
.pmr-count { position: relative; width: 140px; height: 140px; display: grid; place-items: center; margin: 6px auto 8px; border-radius: 50%; }
.pmr-count svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.pmr-count circle { fill: none; stroke-width: 5; }
.pmr-count .trk { stroke: rgba(255,255,255,.1); }
.pmr-count .arc { stroke: var(--tone); stroke-linecap: round; transition: stroke-dashoffset 1s linear; }
.pmr[data-phase="release"] .arc { stroke: #7ee08a; }
.pmr-count span { font-size: 2.8rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.pmr-count.pulse { animation: pulse .55s ease-in-out infinite alternate; box-shadow: 0 0 60px var(--tone-glow); }
@keyframes pulse { to { transform: scale(1.06); } }

.guide { min-height: 13em; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.guide-big { font-size: 4.8rem; font-weight: 800; line-height: 1; background: linear-gradient(150deg, var(--g1), color-mix(in srgb, var(--g2) 70%, #fff)); -webkit-background-clip: text; background-clip: text; color: transparent; filter: drop-shadow(0 0 30px var(--tone-glow)); }
.guide-big.word { font-size: clamp(2.6rem, 12vw, 3.6rem); letter-spacing: -.02em; }
.guide-big[hidden] { display: none; }
.guide-text { font-family: var(--serif); font-size: clamp(1.35rem, 5vw, 1.75rem); line-height: 1.35; max-width: 24ch; }
.guide-text.in { animation: fadeUp .6s ease both; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.tr { width: 100%; display: flex; flex-direction: column; gap: 14px; text-align: left; }
.tr label { display: flex; flex-direction: column; gap: 6px; }
.tr label > span { font-weight: 600; font-size: .95rem; display: flex; justify-content: space-between; }
.tr output { color: var(--tone); font-variant-numeric: tabular-nums; }
.tr textarea, .tr input[type=text], .burn textarea {
  font: inherit; font-size: 1rem; color: var(--text); background: rgba(10,10,14,.7); border: 1px solid rgba(255,255,255,.16);
  border-radius: 14px; padding: 11px 13px; resize: vertical; width: 100%;
}
.tr textarea:focus, .tr input[type=text]:focus, .burn textarea:focus { outline: none; border-color: var(--tone); box-shadow: 0 0 0 3px var(--tone-bg); }
.tr textarea::placeholder, .tr input::placeholder, .burn textarea::placeholder { color: #77737e; }
.tr input[type=range] { accent-color: var(--tone); width: 100%; }
.tr .ex-actions { justify-content: flex-start; margin-top: 4px; }
.tr-result { font-family: var(--serif); font-size: 1.2rem; color: var(--tone); max-width: 34ch; }

.step-card { width: 100%; border-radius: 24px; padding: 30px 20px; color: var(--ink); background: linear-gradient(150deg, var(--g1), var(--g2)); box-shadow: 0 20px 50px -18px var(--g2); }
.step-k { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; margin-bottom: 8px; opacity: .85; }
.step-t { font-family: var(--serif); font-size: 1.55rem; line-height: 1.3; }
.step-done { font-family: var(--serif); font-size: 1.15rem; color: #ece8f0; max-width: 34ch; }

.cold-steps { text-align: left; margin: 0; padding: 0; list-style: none; counter-reset: s; display: flex; flex-direction: column; gap: 12px; max-width: 42ch; }
.cold-steps li { counter-increment: s; display: grid; grid-template-columns: 32px 1fr; gap: 12px; align-items: start; font-size: 1.02rem; color: #ece8f0; }
.cold-steps li::before { content: counter(s); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; color: var(--ink); background: linear-gradient(150deg, var(--g1), var(--g2)); }

.burn { position: relative; width: 100%; }
.burn textarea { min-height: 12em; transition: opacity .4s; }
.burn textarea.gone { opacity: 0; }
.burn-fx { position: absolute; inset: 0; padding: 12px 14px; pointer-events: none; text-align: left; overflow: hidden; font-size: 1rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.burn-fx span { display: inline-block; min-width: .25em; color: #ffd3a8; text-shadow: 0 0 8px #ff7a2e; }
.burn-fx.on span { animation: ash 1.6s ease-in forwards; }
@keyframes ash {
  0% { opacity: 1; transform: none; color: #fff2d8; }
  35% { color: #ff9a3d; text-shadow: 0 0 14px #ff4d1a; }
  100% { opacity: 0; transform: translate(var(--x), -140px) rotate(var(--r)) scale(.4); color: #444; filter: blur(2px); }
}

.hints { text-align: left; color: #d6d2dc; margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 4px; max-width: 44ch; }
.hints li::marker { color: var(--tone); }
.letter { margin: 0; width: 100%; text-align: left; white-space: pre-wrap; font-family: var(--serif); font-size: 1.2rem; line-height: 1.55; color: #2b1a2e;
  background: linear-gradient(170deg, #fff8f2, #ffeef8); border-radius: 18px; padding: 24px 22px; box-shadow: 0 24px 60px -24px var(--g2); animation: fadeUp .6s ease both; }

.three fieldset { border: 0; margin: 0; padding: 14px; border-radius: 18px; background: rgba(255,255,255,.04); display: grid; grid-template-columns: 36px 1fr; gap: 6px 12px; }
.three legend { float: left; grid-row: span 2; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: var(--ink); background: linear-gradient(150deg, var(--g1), var(--g2)); padding: 0; }
.three label { grid-column: 2; }
.glow-list { width: 100%; display: flex; flex-direction: column; gap: 10px; }
.glow { text-align: left; border-radius: 18px; padding: 16px 18px; color: var(--ink); background: linear-gradient(150deg, var(--g1), var(--g2)); box-shadow: 0 16px 40px -16px var(--g2); animation: fadeUp .6s ease both; display: flex; flex-direction: column; gap: 2px; }
.glow strong { font-size: 1.1rem; }
.glow span { opacity: .85; font-family: var(--serif); font-style: italic; }

@media (prefers-reduced-motion: reduce) {
  .aurora i, .tile .blob, .pmr-count.pulse, .focus-area { animation: none; }
  .orb, .pmr-count .arc, .tile, .chip { transition: none; }
  .guide-text.in, .letter, .glow { animation: none; }
  .burn-fx.on span { animation-duration: .01s; }
}

.help { margin-top: 40px; background: var(--surface); border: 1px solid var(--hair); border-radius: 16px; padding: 22px var(--gr) 24px var(--gl); }
.help h2 { font-size: 1.15rem; margin-bottom: 6px; }
.help > p { color: var(--muted); }
.help strong { color: var(--text); }
.help-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 8px 28px; margin-top: 16px; }
.help dl { margin: 0; }
.help dt { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding-bottom: 6px; }
.help dl div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-top: 1px solid var(--hair); }
.help dd { margin: 0; }
.help dd small { color: var(--muted); }
.help .num { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; user-select: all; }

/* ---------- Libro ---------- */
.book-home { display: grid; grid-template-columns: minmax(200px, 320px) 1fr; gap: 24px 48px; align-items: center; }
.cover-wrap { perspective: 1200px; }
#book-cover {
  width: 100%; height: auto; display: block; border-radius: 3px 8px 8px 3px;
  transform: rotateY(-14deg); transform-origin: left center;
  box-shadow: 18px 24px 50px rgba(0,0,0,.75), 0 0 80px rgba(229, 35, 44, .12), inset 4px 0 8px rgba(255,255,255,.08);
}
.book-title { font-size: clamp(1.8rem, 5vw, 2.8rem); text-transform: uppercase; letter-spacing: .01em; font-weight: 800; line-height: 1.02; }
.book-title span { display: block; }
.book-sub { font-family: var(--serif); font-style: italic; color: #c9c9ce; font-size: 1.15rem; margin: 14px 0 26px; max-width: 34ch; }
.progress-row { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; }
.progress { flex: 1; max-width: 260px; height: 4px; background: var(--surface-2); border-radius: 2px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: var(--red); }
.primary {
  background: var(--red); color: #fff; border: 0; border-radius: 999px; padding: 13px 26px;
  font-weight: 650; font-size: 1rem; box-shadow: 0 8px 24px rgba(229, 35, 44, .3);
}
.primary:active { transform: scale(.98); }
.ghost { background: none; border: 1px solid rgba(255,255,255,.2); border-radius: 999px; padding: 12px 20px; }
.book-toc { grid-column: 1 / -1; margin-top: 28px; }
.book-toc h2 { font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 8px; }
.toc-part { display: grid; grid-template-columns: 64px 1fr; gap: 16px; padding: 16px 0; border-top: 1px solid var(--hair); }
.toc-part img { width: 64px; height: 80px; object-fit: cover; border-radius: 6px; filter: grayscale(.2); }
.toc-part .ph { width: 64px; height: 64px; }
.toc-part h3 { font-size: 13px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; margin: 4px 0 4px; }
.toc-part h3 .red { margin-right: .4em; }
.toc-part ol { list-style: none; padding: 0; margin: 0; }
.toc-part li button, .toc li button {
  width: 100%; text-align: left; background: none; border: 0; padding: 7px 0; color: #d6d6db; font-size: .98rem;
  display: flex; gap: 10px; align-items: baseline;
}
.toc-part li button:hover { color: #fff; }
.toc-part .n { color: var(--muted); font-variant-numeric: tabular-nums; min-width: 1.6em; font-size: .85rem; }
.toc-part li.current button { color: var(--red-text); }
@media (max-width: 700px) {
  .book-home { grid-template-columns: 1fr; text-align: center; padding-top: 28px; }
  .cover-wrap { width: 58%; max-width: 240px; margin: 0 auto; }
  #book-cover { transform: rotateY(-10deg); }
  .book-sub { margin-left: auto; margin-right: auto; }
  .progress-row { justify-content: center; }
  .book-info .primary { width: 100%; max-width: 360px; }
  .book-toc { text-align: left; }
}

/* ===================== Lector ===================== */
.reader {
  position: fixed; inset: 0; z-index: 10; background: var(--r-bg); color: var(--r-text);
  display: flex; flex-direction: column;
  --r-bg: #0b0b0d; --r-text: #dcdad5; --r-muted: #85858b; --r-line: rgba(255,255,255,.08);
  --r-font: var(--serif); --r-size: 19px; --r-lh: 1.6;
}
.reader[hidden] { display: none; }
.reader[data-theme="light"] { --r-bg: #fbfaf7; --r-text: #1d1b18; --r-muted: #7a746a; --r-line: rgba(0,0,0,.08); color-scheme: light;
  --hl-yellow: rgba(255, 214, 10, .45); --hl-green: rgba(120, 210, 120, .42); --hl-pink: rgba(255, 120, 170, .38); }
.reader[data-theme="sepia"] { --r-bg: #f3ead6; --r-text: #4a3b28; --r-muted: #8a7558; --r-line: rgba(74,59,40,.12); color-scheme: light;
  --hl-yellow: rgba(255, 200, 0, .4); --hl-green: rgba(110, 190, 100, .38); --hl-pink: rgba(240, 110, 160, .34); }
.reader[data-font="sans"] { --r-font: var(--sans); }

.r-bar { display: flex; align-items: center; gap: 2px; flex: none; color: var(--r-muted); z-index: 3; }
.r-top { padding: calc(6px + var(--st)) var(--gr) 6px var(--gl); border-bottom: 1px solid var(--r-line); }
.r-bottom { justify-content: space-between; font-size: .78rem; padding: 4px var(--gr) calc(6px + var(--sb)) var(--gl); font-variant-numeric: tabular-nums; }
.r-title { flex: 1; min-width: 0; text-align: center; font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding: 0 6px; }
.icon { background: none; border: 0; width: 40px; height: 40px; border-radius: 10px; color: var(--r-text); display: grid; place-items: center; flex: none; }
.icon svg { width: 22px; height: 22px; }
.icon:hover { background: var(--r-line); }
.icon.on { color: var(--red); }
#r-bookmark svg { fill: none; }
#r-bookmark.on svg { fill: var(--red); color: var(--red); }
#r-close svg { width: 16px; height: 16px; }
.exit-sm { margin-left: 4px; padding: 6px 12px; font-size: 13px; }
@media (max-width: 380px) { .exit-sm { padding: 6px 9px; } .icon { width: 36px; } }

.r-viewport { touch-action: none; flex: 1; min-height: 0; overflow: hidden; position: relative; padding: 24px 0; }
.r-content {
  height: 100%; column-fill: auto;
  font-family: var(--r-font); font-size: var(--r-size); line-height: var(--r-lh);
  -webkit-user-select: text; user-select: text; -webkit-touch-callout: none;
  hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word;
}
.r-content h1 { font-family: var(--sans); font-size: 1.35em; text-align: center; margin: .8em 0 1.4em; line-height: 1.2; font-weight: 700; letter-spacing: -.01em; }
.r-content h1 .label { display: block; font-size: .5em; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; color: var(--red); margin-bottom: .7em; }
.r-content h1.parte { margin-top: 8%; letter-spacing: .1em; text-transform: uppercase; }
.r-content section.parte img { max-height: calc(var(--page-h, 70vh) * .62); border-radius: 6px; }
.r-content h2 { font-family: var(--sans); font-size: 1em; font-weight: 700; margin: 1.5em 0 .5em; break-after: avoid; }
.r-content p { margin: 0; text-indent: 1.2em; text-align: justify; }
.r-content h1 + p, .r-content h2 + p, .r-content div.img + p, .r-content blockquote p { text-indent: 0; }
.r-content blockquote { margin: 1em 1.2em; font-style: italic; }
.r-content ul, .r-content ol { padding-left: 1.4em; }
.r-content div.img { text-align: center; margin: 1em 0; break-inside: avoid; }
.r-content img { max-width: 100%; max-height: calc(var(--page-h, 70vh) - 2em); height: auto; object-fit: contain; }
.r-content mark { color: inherit; border-radius: 2px; cursor: pointer; }
.r-content mark.yellow { background: var(--hl-yellow); }
.r-content mark.green { background: var(--hl-green); }
.r-content mark.pink { background: var(--hl-pink); }
.r-content .tts-on { background: var(--tts); border-radius: 3px; box-shadow: 0 0 0 3px var(--tts); }

/* Vuelta de página con doblez */
.curl { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.curl-top { position: absolute; inset: 0; padding: 24px 0; background: var(--r-bg); overflow: hidden; will-change: clip-path; }
.curl-shade, .curl-flap { position: absolute; inset: 0; overflow: hidden; }
.curl-shade i, .curl-flap i { position: absolute; left: 0; top: 0; transform-origin: center; }
/* Sombra que la hoja levantada proyecta sobre la página que se destapa */
.curl-shade i { background: linear-gradient(90deg, transparent 50%, rgba(0,0,0,.45) 50%, rgba(0,0,0,.14) calc(50% + var(--sw, 40px) * .45), transparent calc(50% + var(--sw, 40px))); }
/* La vuelta del papel: más clara junto al doblez, más oscura hacia la orilla */
.curl-flap i {
  --paper: color-mix(in srgb, var(--r-bg) 92%, #fff);
  background: linear-gradient(90deg,
    color-mix(in srgb, var(--paper) 78%, #000) calc(50% - var(--fw, 80px) * 2),
    var(--paper) calc(50% - var(--fw, 80px)),
    color-mix(in srgb, var(--paper) 88%, #fff) calc(50% - 8px),
    color-mix(in srgb, var(--paper) 80%, #000) calc(50% - 1px), transparent 50%);
}
.reader[data-theme="dark"] .curl-flap i { --paper: #26262b; }
.r-zone { touch-action: none; position: absolute; top: 60px; bottom: 44px; width: 14%; background: none; border: 0; z-index: 2; -webkit-tap-highlight-color: transparent; }
.r-prev { left: 0; } .r-next { right: 0; }
@media (min-width: 900px) { .r-zone { width: 10%; } }

.sel-menu {
  position: absolute; z-index: 6; display: flex; gap: 6px; align-items: center; padding: 6px;
  background: #1b1b1e; color: #f5f5f7; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.sel-menu[hidden] { display: none; }
.sel-menu button { background: none; border: 0; color: inherit; padding: 6px 10px; border-radius: 8px; font-size: .9rem; font-family: var(--sans); }
.sel-menu .sw { width: 28px; height: 28px; padding: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,.85); }
.sw.yellow { background: #ffd60a; } .sw.green { background: #5ac878; } .sw.pink { background: #ff5a96; }

.sheet {
  position: absolute; z-index: 7; left: 50%; transform: translateX(-50%); bottom: 0; width: min(520px, 100%);
  background: var(--r-bg); color: var(--r-text); border: 1px solid var(--r-line); border-bottom: 0;
  border-radius: 18px 18px 0 0; padding: 18px var(--gr) calc(22px + var(--sb)) var(--gl); box-shadow: 0 -12px 40px rgba(0,0,0,.4);
  font-family: var(--sans);
}
.sheet[hidden] { display: none; }
.sheet.tall { max-height: 75%; overflow-y: auto; }
.sheet h3 { margin: 4px 0 12px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--r-muted); }
.sheet .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; }
.sheet .row.center { justify-content: center; }
.sheet select { max-width: 62%; font: inherit; padding: 6px 8px; border-radius: 8px; background: var(--r-bg); color: var(--r-text); border: 1px solid var(--r-line); }
.sheet input[type=range] { flex: 1; accent-color: var(--red); }
.seg { display: flex; align-items: center; gap: 4px; }
.seg button { border: 1px solid var(--r-line); background: none; border-radius: 999px; padding: 6px 14px; color: var(--r-text); }
.seg button.on { background: var(--red); color: #fff; border-color: var(--red); }
#fs-val { min-width: 2.2em; text-align: center; font-variant-numeric: tabular-nums; }
.sheet .primary { padding: 10px 20px; box-shadow: none; }
.sheet .ghost { color: var(--r-text); border-color: var(--r-line); padding: 10px 18px; }
.sheet .toc li { border-bottom: 1px solid var(--r-line); }
.sheet .toc li button { color: var(--r-text); padding: 10px 2px; }
.sheet .toc li.parte button { font-weight: 700; letter-spacing: .06em; text-transform: uppercase; font-size: .85rem; padding-top: 18px; color: var(--r-muted); }
.sheet .toc li.current button { color: var(--red); font-weight: 600; }
.toc { list-style: none; padding: 0; margin: 0; }
.notes { list-style: none; margin: 0 0 18px; padding: 0; }
.notes li { display: flex; gap: 8px; align-items: flex-start; border-bottom: 1px solid var(--r-line); }
.notes li > button:first-child { flex: 1; text-align: left; background: none; border: 0; padding: 10px 0; color: var(--r-text); font-family: var(--serif); }
.notes small { display: block; color: var(--r-muted); font-family: var(--sans); margin-bottom: 2px; }
.notes .del { background: none; border: 0; color: var(--r-muted); padding: 10px 6px; }
.notes .empty { color: var(--r-muted); padding: 6px 0; border: 0; font-size: .9rem; }
.notes .swatch { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

/* ---------- Herramienta a pantalla completa ---------- */
.tool-full { position: fixed; inset: 0; z-index: 9; background: #000; }
.tool-full[hidden] { display: none; }
.tool-full-frame, .tool-full-frame iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.tool-full-bar {
  position: absolute; z-index: 2; display: flex; gap: 8px; align-items: center;
  top: calc(14px + var(--st)); left: var(--gl);
}
.tool-back {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px 7px 11px; border-radius: 999px;
  background: rgba(20, 20, 24, .6); color: #e9e9ed; border: 1px solid rgba(255,255,255,.18);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px); font-size: 13px; font-weight: 500;
}
.tool-back svg { width: 12px; height: 12px; }
.tool-full-bar .exit { margin-left: 0; }
body.tool-open .tabbar { display: none; }

@media print { body * { display: none !important; } body::after { content: "La impresión no está disponible."; display: block; } }

@media (max-width: 480px) {
  .appbar { gap: 8px; }
  .brand { gap: 8px; }
  .brand-mark { width: 15px; height: 20px; }
  .brand-text { font-size: 11px; letter-spacing: .05em; padding-left: 8px; gap: .32em; }
  .exit { padding: 6px 11px 6px 9px; font-size: 13px; }
  .exit svg { width: 12px; height: 12px; }
}

/* Franja detrás de Volver/Salir para que el texto no pase por debajo al desplazarse */
.tool-stage:not([hidden]) ~ .tool-full-bar::before {
  content: ""; position: fixed; z-index: -1; left: 0; right: 0; top: 0; height: calc(78px + var(--st));
  background: linear-gradient(#07070a 55%, rgba(7, 7, 10, 0)); pointer-events: none;
}

/* ---------- Cuenta, compra y muro de pago ---------- */
.lock { width: 13px; height: 13px; flex: none; margin-left: 8px; opacity: .55; vertical-align: -1px; }
.book-access { margin-top: 16px; display: grid; gap: 10px; max-width: 420px; }
.book-access p { margin: 0; }
.access-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.access-actions .primary { flex: 1 1 auto; }
.access-links { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.link { background: none; border: 0; padding: 4px 0; color: inherit; font: inherit; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; opacity: .85; }
.paywall { break-inside: avoid; font-family: var(--sans); text-align: center; max-width: 440px; margin: 8vh auto 0; padding: 28px 22px; border: 1px solid var(--r-line); border-radius: 22px; }
.paywall .eyebrow { color: var(--red-text); font-size: 13px; letter-spacing: .06em; text-transform: uppercase; margin: 0 0 8px; text-indent: 0; }
.paywall h2 { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 1.5em; margin: 0 0 12px; }
.paywall p { text-indent: 0; margin: 0 0 10px; }
.paywall .small { font-size: .8em; color: var(--r-muted); }
.pw-actions { display: grid; gap: 10px; margin-top: 18px; }
.pw-actions .ghost { color: inherit; border-color: var(--r-line); }
.reader.is-locked .r-content { user-select: none; -webkit-user-select: none; }
.r-wm { position: absolute; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; display: flex; flex-wrap: wrap; align-content: space-around; justify-content: space-around; gap: 90px 60px; padding: 40px; transform: rotate(-24deg) scale(1.4); opacity: .045; font: 12px var(--sans); color: var(--r-text); user-select: none; }
dialog.acct { width: min(440px, calc(100% - 32px)); max-height: calc(100% - 32px); border: 1px solid var(--hair); border-radius: 22px; padding: 0; background: var(--surface); color: var(--text); }
dialog.acct::backdrop { background: rgba(0,0,0,.72); backdrop-filter: blur(6px); }
.acct-top { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px 0; }
.acct-top .exit { position: static; }
.acct-body { padding: 4px 22px 24px; outline: none; }
.acct-body h2 { font-family: var(--serif); font-style: italic; font-weight: 500; font-size: 26px; margin: 0 0 10px; }
.acct-body p { margin: 0 0 12px; line-height: 1.5; }
.acct-body form { display: grid; gap: 12px; }
.acct-body label { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.acct-body input { font: 18px var(--sans); padding: 12px 14px; border-radius: 12px; border: 1px solid var(--hair); background: var(--surface-2); color: var(--text); }
.acct-body input[name="code"] { letter-spacing: .12em; }
.acct-body .primary { width: 100%; }
.acct-body .err { color: var(--red-text); font-size: 14px; margin: 0; }
.gift-code { font: 600 26px var(--sans); letter-spacing: .08em; text-align: center; padding: 14px; border: 1px dashed rgba(255,255,255,.3); border-radius: 14px; user-select: all; }
.acct-body .or { text-align: center; color: var(--muted); margin: 14px 0; }
.acct-body .key { font-size: 21px; letter-spacing: .04em; }
.acct-body .check { display: flex; flex-direction: row; align-items: center; gap: 10px; color: var(--text); font-size: 16px; margin: 6px 0 12px; }
.acct-body .check input { width: 20px; height: 20px; }
.acct-body .ghost { width: 100%; margin-bottom: 12px; }
