/* ================= LECTURA ULTRA RÁPIDA — estilos ================= */
:root {
  --bg: #0b0f17;
  --bg-elev: #131a26;
  --bg-elev2: #1b2435;
  --text: #e8edf6;
  --text-dim: #9aa7bd;
  --accent: #4f8cff;
  --accent-2: #7c5cff;
  --orp: #ff4d5e;
  --good: #2ec27e;
  --warn: #ffb020;
  --border: #243044;
  --radius: 16px;
  --shadow: 0 10px 30px rgba(0,0,0,.4);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}
[data-theme="light"] {
  --bg:#f4f6fb; --bg-elev:#fff; --bg-elev2:#eef2f9; --text:#16202e;
  --text-dim:#5a6679; --border:#dde4ef; --shadow:0 10px 30px rgba(0,0,0,.08);
}
[data-theme="sepia"] {
  --bg:#f1e7d3; --bg-elev:#f8f0df; --bg-elev2:#ece0c6; --text:#43381f;
  --text-dim:#7a6c4f; --border:#dccbab; --accent:#a6712f; --shadow:0 10px 30px rgba(120,90,40,.15);
}
[data-theme="amoled"] {
  --bg:#000; --bg-elev:#0a0a0a; --bg-elev2:#141414; --text:#f0f0f0;
  --text-dim:#888; --border:#222;
}
/* ---- temas oscuros ---- */
[data-theme="midnight"] {
  --bg:#0d1b2a; --bg-elev:#16263a; --bg-elev2:#1f3a52; --text:#e0e7f0;
  --text-dim:#8aa0b8; --border:#284058; --accent:#4cc9f0; --accent-2:#4361ee; --orp:#ff5d8f;
}
[data-theme="dracula"] {
  --bg:#282a36; --bg-elev:#343746; --bg-elev2:#424458; --text:#f8f8f2;
  --text-dim:#9aa0b4; --border:#44475a; --accent:#bd93f9; --accent-2:#ff79c6; --orp:#ff5555; --good:#50fa7b;
}
[data-theme="nord"] {
  --bg:#2e3440; --bg-elev:#3b4252; --bg-elev2:#434c5e; --text:#eceff4;
  --text-dim:#a6adbb; --border:#4c566a; --accent:#88c0d0; --accent-2:#5e81ac; --orp:#bf616a; --good:#a3be8c;
}
[data-theme="ocean"] {
  --bg:#0b2027; --bg-elev:#0f2e38; --bg-elev2:#163e4a; --text:#e0f2f5;
  --text-dim:#88b0b8; --border:#1e4d59; --accent:#2ec4b6; --accent-2:#20a4f3; --orp:#ff6b6b;
}
[data-theme="forest"] {
  --bg:#10231a; --bg-elev:#163024; --bg-elev2:#1d4030; --text:#e6f0e8;
  --text-dim:#95b3a0; --border:#265240; --accent:#4caf50; --accent-2:#2e8b57; --orp:#ff7043; --good:#9ccc65;
}
[data-theme="coffee"] {
  --bg:#1c140f; --bg-elev:#271c15; --bg-elev2:#34261c; --text:#efe3d7;
  --text-dim:#b09a86; --border:#43332a; --accent:#c08457; --accent-2:#8d5a3b; --orp:#e0a458;
}
[data-theme="sunset"] {
  --bg:#1a1020; --bg-elev:#271630; --bg-elev2:#3a1f42; --text:#ffeede;
  --text-dim:#c39ab0; --border:#4a2a4f; --accent:#ff7e5f; --accent-2:#feb47b; --orp:#ff3d77;
}
[data-theme="matrix"] {
  --bg:#000900; --bg-elev:#021202; --bg-elev2:#042004; --text:#b9ffb0;
  --text-dim:#4f8f4f; --border:#0c3a0c; --accent:#00ff66; --accent-2:#00cc55; --orp:#aaff00; --good:#00ff66;
}
[data-theme="contrast"] {
  --bg:#000; --bg-elev:#0d0d0d; --bg-elev2:#1a1a1a; --text:#fff;
  --text-dim:#cccccc; --border:#555; --accent:#ffd400; --accent-2:#00e5ff; --orp:#ff2d55;
}
/* ---- temas claros ---- */
[data-theme="solarized"] {
  --bg:#fdf6e3; --bg-elev:#fbf0d5; --bg-elev2:#eee8d5; --text:#073642;
  --text-dim:#657b83; --border:#e3dcc4; --accent:#268bd2; --accent-2:#6c71c4; --orp:#dc322f;
  --shadow:0 10px 30px rgba(120,110,70,.14);
}
[data-theme="rose"] {
  --bg:#fff1f5; --bg-elev:#ffffff; --bg-elev2:#ffe3ec; --text:#4a1d2e;
  --text-dim:#9b6b7d; --border:#ffd0de; --accent:#e5447d; --accent-2:#ff7eb6; --orp:#d6336c;
  --shadow:0 10px 30px rgba(200,80,120,.14);
}
[data-theme="lavender"] {
  --bg:#f5f3ff; --bg-elev:#ffffff; --bg-elev2:#ece8ff; --text:#2e2348;
  --text-dim:#7c6f9b; --border:#ddd6f3; --accent:#7c5cff; --accent-2:#a78bfa; --orp:#ec4899;
  --shadow:0 10px 30px rgba(120,90,200,.14);
}
[data-theme="mint"] {
  --bg:#f0fbf4; --bg-elev:#ffffff; --bg-elev2:#e1f5e8; --text:#16341f;
  --text-dim:#5f8a6e; --border:#cdebd6; --accent:#18a558; --accent-2:#34c759; --orp:#ff6b6b;
  --shadow:0 10px 30px rgba(40,160,90,.14);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  overscroll-behavior: none;
  transition: background .25s, color .25s;
}
#app { height: 100dvh; height: 100vh; }

/* ---------- Vistas ---------- */
.view {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  padding: var(--safe-top) 0 var(--safe-bottom);
  height: 100dvh;
}
.view.active { display: flex; }
.hidden { display: none !important; }

/* ---------- Topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px;
  background: var(--bg-elev);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.brand { display: flex; align-items: center; gap: 10px; flex: 1; }
.brand-mark { font-size: 26px; }
.brand h1 { font-size: 18px; font-weight: 800; letter-spacing: -.3px; }
.reader-title {
  flex: 1; text-align: center; font-weight: 700; font-size: 15px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px;
  background: var(--bg-elev2); border: 1px solid var(--border);
  color: var(--text); font-size: 18px; cursor: pointer; flex-shrink: 0;
  display: grid; place-items: center; transition: transform .12s, background .2s, border-color .2s;
}
.icon-btn:hover { border-color: var(--accent); }
.icon-btn:active { transform: scale(.9); background: var(--bg-elev); }

/* ---------- Botones ---------- */
.btn {
  border: none; border-radius: 12px; padding: 14px 18px;
  font-size: 15px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform .1s, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }
.btn-ghost { background: var(--bg-elev2); color: var(--text); border: 1px solid var(--border); }
.btn.full { width: 100%; margin-top: 10px; }

/* ================= BIBLIOTECA ================= */
#view-library { overflow-y: auto; }
.lib-stats {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
  padding: 16px;
}
.stat-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 12px; text-align: center;
}
.stat-card .num { font-size: 22px; font-weight: 800; line-height: 1; }
.stat-card .lbl { font-size: 11px; color: var(--text-dim); margin-top: 6px; }
.lib-actions { display: flex; gap: 10px; padding: 0 16px 16px; flex-wrap: wrap; }
.lib-actions .btn { flex: 1; min-width: 140px; }

.library-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 14px; padding: 0 16px 90px;
}
.book-card {
  background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column; transition: transform .12s, border-color .2s;
  position: relative;
}
.book-card:active { transform: scale(.97); }
.book-cover {
  aspect-ratio: 3/4.2; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #fff; font-weight: 800; font-size: 15px; text-align: center;
  padding: 14px; position: relative; overflow: hidden;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.book-info { padding: 10px 12px 12px; }
.book-info .title { font-size: 13px; font-weight: 700; line-height: 1.25;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.book-info .author { font-size: 11px; color: var(--text-dim); margin-top: 3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.book-progress { height: 4px; background: var(--bg-elev2); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.book-progress > i { display: block; height: 100%; background: var(--good); border-radius: 4px; }
.book-pct { font-size: 10px; color: var(--text-dim); margin-top: 4px; }
.book-del {
  position: absolute; top: 8px; right: 8px; width: 28px; height: 28px;
  border-radius: 8px; background: rgba(0,0,0,.55); color: #fff; border: none;
  font-size: 14px; cursor: pointer; display: grid; place-items: center; backdrop-filter: blur(4px);
}

.empty-state { text-align: center; padding: 60px 30px; color: var(--text-dim); }
.empty-state .empty-icon { font-size: 60px; }
.empty-state h2 { color: var(--text); margin: 16px 0 8px; font-size: 20px; }

/* ================= LECTOR RSVP ================= */
#view-reader { background: var(--bg); }
.reader-topbar { background: transparent; border-bottom: 1px solid var(--border); }
.rsvp-stage {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  position: relative; padding: 16px; min-height: 0; cursor: pointer;
}
.rsvp-guides {
  position: relative; width: 100%; max-width: 720px;
  padding: 28px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.guide-tick { position: absolute; left: 50%; transform: translateX(-50%); width: 2px; background: var(--orp); }
.guide-tick.top { height: 14px; top: 0; }
.guide-tick.bottom { height: 14px; bottom: 0; }
.rsvp-word {
  font-size: 64px; font-weight: 700; text-align: center; letter-spacing: -.5px;
  font-variant-numeric: tabular-nums; line-height: 1.1;
  display: flex; justify-content: center; align-items: baseline;
  user-select: none; white-space: nowrap; overflow: hidden; width: 100%;
}
.rsvp-word > span { flex: 0 0 auto; } /* no encoger: permite medir el ancho real */
.rsvp-word .w-orp { color: var(--orp); }
.rsvp-word.no-orp .w-orp { color: inherit; }
.rsvp-context {
  margin-top: 32px; max-width: 680px; text-align: center;
  color: var(--text-dim); font-size: 15px; line-height: 1.7; min-height: 48px;
}
.rsvp-context .cur { color: var(--text); font-weight: 700; background: var(--bg-elev2);
  border-radius: 5px; padding: 1px 5px; }

/* ---------- Progreso ---------- */
.progress-wrap { padding: 6px 20px 2px; flex-shrink: 0; max-width: 720px; width: 100%; margin: 0 auto; }
.progress-bar { width: 100%; }
input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 6px;
  background: var(--bg-elev2); border-radius: 6px; outline: none; cursor: pointer;
}
input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 18px; height: 18px; border-radius: 50%;
  background: var(--accent); border: 3px solid var(--bg); box-shadow: 0 0 0 1px var(--accent);
  transition: transform .1s;
}
input[type=range]::-webkit-slider-thumb:active { transform: scale(1.25); }
input[type=range]::-moz-range-thumb {
  width: 16px; height: 16px; border-radius: 50%; background: var(--accent); border: 3px solid var(--bg);
}
.progress-meta { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--text-dim); margin-top: 6px; font-variant-numeric: tabular-nums; }

/* ---------- Controles ---------- */
.controls { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 16px; flex-shrink: 0; }
.ctrl-btn {
  width: 50px; height: 50px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--bg-elev); color: var(--text); font-size: 18px; cursor: pointer;
  display: grid; place-items: center; transition: transform .12s, background .2s, border-color .2s;
}
.ctrl-btn:hover { border-color: var(--accent); }
.ctrl-btn:active { transform: scale(.88); background: var(--bg-elev2); }
.ctrl-btn.play {
  width: 68px; height: 68px; font-size: 26px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border: none;
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 45%, transparent);
}
.ctrl-btn.play:hover { border: none; }

/* ---------- Velocidad ---------- */
.speed-wrap { padding: 2px 20px 8px; flex-shrink: 0; text-align: center; max-width: 720px; width: 100%; margin: 0 auto; }
.speed-display { font-weight: 800; margin-bottom: 6px; }
.speed-display #wpm-value { font-size: 26px; font-variant-numeric: tabular-nums; }
.speed-display small { color: var(--text-dim); font-size: 12px; margin-left: 4px; letter-spacing: .5px; }
.wpm-slider { margin: 2px 0 10px; }
.speed-presets { display: flex; gap: 6px; justify-content: center; flex-wrap: nowrap; }
.preset {
  flex: 1 1 0; min-width: 0; max-width: 70px;
  background: var(--bg-elev2); border: 1px solid var(--border); color: var(--text-dim);
  border-radius: 18px; padding: 7px 4px; font-size: 13px; font-weight: 700; cursor: pointer;
  font-variant-numeric: tabular-nums; transition: background .18s, color .18s, border-color .18s;
}
.preset:active { transform: scale(.94); }
.preset.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* ---------- Capítulos (barra inferior) ---------- */
.chapter-bar { display: flex; gap: 8px; padding: 0 16px 14px; align-items: center; flex-shrink: 0;
  max-width: 720px; width: 100%; margin: 0 auto; }
.chip {
  background: var(--bg-elev2); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 10px 12px; font-size: 13px; font-weight: 700; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; transition: background .18s, border-color .18s;
}
.chip:active { transform: scale(.95); background: var(--bg-elev); }
.chip:hover { border-color: var(--accent); }
.chapter-select {
  flex: 1 1 auto; min-width: 0; background: var(--bg-elev2); border: 1px solid var(--border); color: var(--text);
  border-radius: 12px; padding: 10px 12px; font-size: 13px;
  text-overflow: ellipsis; appearance: none;
}

/* ================= ESTADÍSTICAS ================= */
#view-stats { overflow-y: auto; }
.stats-content { padding: 16px 16px 60px; }
.big-stat-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 12px; margin-bottom: 20px; }
.big-stat { background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.big-stat .num { font-size: 30px; font-weight: 800; line-height: 1; }
.big-stat .lbl { font-size: 12px; color: var(--text-dim); margin-top: 8px; }
.big-stat .sub { font-size: 11px; color: var(--accent); margin-top: 4px; }
.section-title { font-size: 14px; font-weight: 800; color: var(--text-dim); text-transform: uppercase;
  letter-spacing: .5px; margin: 24px 0 12px; }
.chart {
  display: flex; align-items: flex-end; gap: 4px; height: 140px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
}
.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; }
.bar-col .bar { width: 100%; max-width: 26px; background: linear-gradient(180deg, var(--accent), var(--accent-2));
  border-radius: 6px 6px 0 0; min-height: 3px; transition: height .4s; }
.bar-col .day { font-size: 10px; color: var(--text-dim); }
.achievements { display: flex; flex-direction: column; gap: 10px; }
.ach { display: flex; align-items: center; gap: 12px; background: var(--bg-elev); border: 1px solid var(--border);
  border-radius: 12px; padding: 12px 14px; }
.ach.locked { opacity: .45; }
.ach .emoji { font-size: 26px; }
.ach .a-title { font-weight: 700; font-size: 14px; }
.ach .a-desc { font-size: 12px; color: var(--text-dim); }

/* ================= SELECTOR DE MODO ================= */
.mode-switch {
  display: flex; gap: 4px; margin: 8px auto 2px; padding: 3px;
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: 11px;
  width: max-content; max-width: calc(100% - 32px); flex-shrink: 0;
}
.mode-opt {
  border: none; background: transparent; color: var(--text-dim);
  font-size: 12.5px; font-weight: 700; padding: 6px 14px; border-radius: 8px;
  cursor: pointer; transition: background .18s, color .18s;
}
.mode-opt.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; }

/* icono de ayuda compacto */
.icon-btn.sm { width: 34px; height: 34px; font-size: 15px; font-weight: 800; flex-shrink: 0; }

/* Paneles de modo */
.mode-pane { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.mode-pane.hidden { display: none !important; }

/* ================= MODO CLÁSICO (lector paginado) ================= */
.book-chapter-bar { display: flex; gap: 8px; padding: 10px 16px; align-items: center; flex-shrink: 0; }
.book-chapter-bar .chapter-select { flex: 1; }

.book-viewport {
  position: relative; flex: 1; overflow: hidden; min-height: 0;
  max-width: 820px; width: 100%; margin: 0 auto;
}
.book-pages {
  height: 100%;
  column-fill: auto;
  font-size: 19px; line-height: 1.75;
  transition: transform .28s cubic-bezier(.4,0,.2,1);
  will-change: transform;
  -webkit-hyphens: auto; hyphens: auto;
  text-align: justify;
}
.book-pages .ch-title {
  font-size: 1.35em; font-weight: 800; line-height: 1.25;
  margin: 0 0 .8em; break-after: avoid; text-align: left;
}
.book-pages p { margin: 0 0 .9em; text-indent: 1.2em; }
.book-pages p:first-of-type { text-indent: 0; }
.book-pages .word { cursor: pointer; border-radius: 4px; }
.book-pages .word.sel { background: var(--accent); color: #fff; }
.book-pages .word.reading { background: var(--orp); color: #fff; }

.tap-zone {
  position: absolute; top: 0; bottom: 0; background: transparent;
  border: none; cursor: pointer; padding: 0; z-index: 2;
  -webkit-tap-highlight-color: transparent;
}
.tap-zone.left { left: 0; width: 18%; }
.tap-zone.right { right: 0; width: 18%; }
.tap-zone:active { background: rgba(127,127,127,.07); }

.cl-continue {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  z-index: 3; border: none; border-radius: 22px; padding: 12px 20px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  font-size: 14px; font-weight: 800; cursor: pointer; box-shadow: var(--shadow);
  animation: slideUp .2s;
}

.book-footer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 14px calc(12px + var(--safe-bottom)); flex-shrink: 0;
  max-width: 820px; width: 100%; margin: 0 auto;
}
.book-footer .chip { flex-shrink: 0; }
.page-ind {
  flex: 1 1 auto; min-width: 0; text-align: center;
  font-size: 12px; color: var(--text-dim); font-weight: 700;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}
.book-text p { margin-bottom: 1.1em; }
.book-text .word { cursor: pointer; border-radius: 4px; padding: 0 1px; transition: background .12s; }
.book-text .word:active { background: var(--accent); color: #fff; }
@media (hover: hover) { .book-text .word:hover { background: var(--bg-elev2); } }
.book-text .word.current {
  background: var(--orp); color: #fff; font-weight: 700;
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--orp) 35%, transparent);
}

/* ================= SHEET (ajustes) ================= */
.sheet { position: fixed; inset: 0; z-index: 50; display: none; }
.sheet.open { display: block; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.5); animation: fade .2s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  background: var(--bg-elev); border-radius: 22px 22px 0 0; padding: 12px 20px calc(24px + var(--safe-bottom));
  box-shadow: var(--shadow); animation: slideUp .25s ease; max-height: 85vh; overflow-y: auto;
}
.sheet-handle { width: 40px; height: 4px; background: var(--border); border-radius: 4px; margin: 0 auto 14px; }
.sheet-panel h3, .modal-panel h3 { margin-bottom: 16px; font-size: 18px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.setting-row span { font-size: 14px; font-weight: 600; }
.setting-row input[type=range] { width: 150px; }
.setting-row select { background: var(--bg-elev2); border: 1px solid var(--border); color: var(--text); border-radius: 8px; padding: 8px 10px; }
.toggle input[type=checkbox] { width: 50px; height: 28px; appearance: none; background: var(--bg-elev2);
  border: 1px solid var(--border); border-radius: 20px; position: relative; cursor: pointer; transition: background .2s; }
.toggle input[type=checkbox]::after { content: ""; position: absolute; top: 2px; left: 2px; width: 22px; height: 22px;
  border-radius: 50%; background: var(--text-dim); transition: transform .2s, background .2s; }
.toggle input[type=checkbox]:checked { background: var(--accent); }
.toggle input[type=checkbox]:checked::after { transform: translateX(22px); background: #fff; }

/* ================= MODAL ================= */
.modal { position: fixed; inset: 0; z-index: 60; display: none; }
.modal.open { display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.55); }
.modal-panel { position: relative; background: var(--bg-elev); border-radius: var(--radius); padding: 22px;
  width: 100%; max-width: 480px; box-shadow: var(--shadow); animation: slideUp .25s; }
.text-input, .text-area {
  width: 100%; background: var(--bg-elev2); border: 1px solid var(--border); color: var(--text);
  border-radius: 10px; padding: 12px 14px; font-size: 15px; margin-bottom: 12px; font-family: inherit;
}
.text-area { min-height: 200px; resize: vertical; line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ================= TOAST / LOADER ================= */
.toast {
  position: fixed; bottom: calc(28px + var(--safe-bottom)); left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--bg-elev2); color: var(--text); border: 1px solid var(--border);
  padding: 12px 20px; border-radius: 12px; font-size: 14px; font-weight: 600; box-shadow: var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 100; max-width: 90vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loader { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center;
  background: rgba(0,0,0,.6); backdrop-filter: blur(4px); flex-direction: column; }
.loader p { margin-top: 16px; color: #fff; font-weight: 600; }
.spinner { width: 48px; height: 48px; border: 4px solid rgba(255,255,255,.2); border-top-color: var(--accent);
  border-radius: 50%; animation: spin 1s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade { from { opacity: 0; } }
@keyframes slideUp { from { transform: translateY(40px); opacity: 0; } }

/* ================= RESPONSIVE ================= */
@media (min-width: 700px) {
  .lib-stats { max-width: 700px; margin: 0 auto; }
}
@media (max-width: 380px) {
  .controls { gap: 9px; }
  .ctrl-btn { width: 46px; height: 46px; font-size: 17px; }
  .ctrl-btn.play { width: 60px; height: 60px; font-size: 23px; }
  .chip { padding: 9px 10px; font-size: 12px; }
  .preset { font-size: 12px; padding: 7px 2px; }
}
@media (orientation: landscape) and (max-height: 520px) {
  .rsvp-context { display: none; }
  .speed-presets { display: none; }
  .rsvp-guides { padding: 16px 0; }
}
