/* ═══════════════════════════════════════════════════════════════════════
   AEJ 2026 — Glassmorphism · Black & Orange
   ═══════════════════════════════════════════════════════════════════════ */

/* ─── PRELOADER ───────────────────────────────────────────────────────────── */
.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: #080808;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2.5rem;
  overflow: hidden;
  transition: opacity .6s ease, visibility .6s ease;
}

.preloader.hide {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Ambient glows */
.preloader-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
}
.preloader-glow--left {
  width: 420px; height: 420px;
  background: rgba(249, 115, 22, 0.18);
  top: -80px; left: -100px;
  animation: glowPulse 3s ease-in-out infinite alternate;
}
.preloader-glow--right {
  width: 320px; height: 320px;
  background: rgba(249, 115, 22, 0.1);
  bottom: -60px; right: -80px;
  animation: glowPulse 3s ease-in-out 1.5s infinite alternate;
}
@keyframes glowPulse {
  from { opacity: .6; transform: scale(1); }
  to   { opacity: 1;  transform: scale(1.12); }
}

/* Logos wrapper */
.preloader-logos {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.5rem;
  position: relative;
  z-index: 1;
}

/* Main logo — grande y centrado */
.pre-logo--main {
  max-width: 280px;
  width: 70vw;
  opacity: 0;
  transform: translateY(20px);
  animation: logoFadeUp .7s ease .3s forwards;
}

/* Divider */
.preloader-divider {
  width: 1px;
  height: 36px;
  background: linear-gradient(to bottom, transparent, rgba(249,115,22,.4), transparent);
  opacity: 0;
  animation: logoFadeUp .5s ease .9s forwards;
}

/* Sub logos — más pequeños, en fila */
.preloader-sub-logos {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2rem;
  opacity: 0;
  transform: translateY(14px);
  animation: logoFadeUp .6s ease 1.1s forwards;
}

.pre-logo--sub {
  max-width: 120px;
  width: 28vw;
  opacity: .85;
}

@keyframes logoFadeUp {
  to { opacity: 1; transform: translateY(0); }
}

/* Progress bar */
.preloader-bar-wrap {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 3px;
  background: rgba(255,255,255,.05);
}

.preloader-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #f97316, #fb923c, #f97316);
  background-size: 200% 100%;
  border-radius: 0 2px 2px 0;
  animation:
    barFill   5s linear forwards,
    barShimmer 1.5s linear infinite;
}

@keyframes barFill {
  from { width: 0%; }
  to   { width: 100%; }
}
@keyframes barShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* Responsive */
@media (max-width: 480px) {
  .pre-logo--main  { max-width: 220px; }
  .pre-logo--sub   { max-width: 95px; }
  .preloader-sub-logos { gap: 1.25rem; }
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --header-h: 60px;
  --footer-h: 80px;
  --side-w: 310px;
  --accent: #f97316;
  --accent-dim: rgba(249, 115, 22, 0.12);
  --accent-glow: rgba(249, 115, 22, 0.28);
  --accent-border: rgba(249, 115, 22, 0.28);
  --glass-bg: rgba(255, 255, 255, 0.05);
  --glass-border: rgba(255, 255, 255, 0.08);
  --text: #f1f5f9;
  --muted: #d3d3d4;
  --border: rgba(255, 255, 255, 0.07);
}

html,
body {
  height: 100%;
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--text);
  overflow: hidden;
}

body {
  background-color: #080808;
  background-image:
    radial-gradient(ellipse 65% 55% at 12% 65%, rgba(249, 115, 22, 0.14) 0%, transparent 55%),
    radial-gradient(ellipse 50% 60% at 90% 20%, rgba(249, 115, 22, 0.07) 0%, transparent 50%);
  background-attachment: fixed;
}

/* ─── HEADER ──────────────────────────────────────────────────────────── */
.app-header {
  height: var(--header-h);
  background: rgba(5, 5, 5, 0.9);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-bottom: 1px solid rgba(249, 115, 22, 0.18);
  box-shadow: 0 1px 0 rgba(249, 115, 22, 0.08), 0 4px 24px rgba(0, 0, 0, 0.6);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.25rem;
  gap: 1rem;
  z-index: 100;
  position: relative;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: .75rem;
  min-width: 0;
}

.header-logo {
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  font-size: .85rem;
  padding: .35rem .6rem;
  border-radius: 6px;
  letter-spacing: .05em;
  white-space: nowrap;
  box-shadow: 0 0 18px rgba(249, 115, 22, 0.5), 0 2px 6px rgba(0, 0, 0, 0.4);
}

.header-title {
  display: flex;
  flex-direction: column;
}

.header-main {
  font-size: 1rem;
  font-weight: 700;
  white-space: nowrap;
  color: #f9fafb;
}

.header-sub {
  font-size: .72rem;
  color: #4b5563;
  white-space: nowrap;
}

.header-plan-logo {
  height: 36px;
  width: auto;
  object-fit: contain;
  opacity: .9;
  margin-left: .5rem;
  flex-shrink: 0;
}

.header-controls {
  display: flex;
  align-items: center;
  gap: .75rem;
}

.page-nav-inline {
  display: flex;
  align-items: center;
  gap: .5rem;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: .25rem .5rem;
}

.page-display {
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}

.page-display input {
  width: 44px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  border-radius: 5px;
  text-align: center;
  padding: .2rem;
  font-size: .85rem;
  font-family: inherit;
}

.page-display input:focus {
  outline: none;
  border-color: var(--accent-border);
  box-shadow: 0 0 0 2px var(--accent-dim);
}

.page-total {
  color: #d9dce0;
}

.nav-btn {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #9ca3af;
  padding: .3rem .65rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  transition: .15s;
}

.nav-btn:hover:not(:disabled) {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

.nav-btn:disabled {
  opacity: .25;
  cursor: not-allowed;
}


/* ─── LAYOUT GRID ─────────────────────────────────────────────────────── */
.app-layout {
  display: grid;
  grid-template-columns: 1fr var(--side-w);
  height: calc(100vh - var(--header-h) - var(--footer-h));
  overflow: hidden;
}

/* ─── TOC PANEL (oculto) ──────────────────────────────────────────────── */
.toc-panel {
  display: none;
}

.toc-header {
  padding: .85rem 1rem;
  font-size: .78rem;
  font-weight: 700;
  color: #d9dce0;
  text-transform: uppercase;
  letter-spacing: .08em;
  display: flex;
  align-items: center;
  gap: .5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.toc-nav {
  overflow-y: auto;
  flex: 1;
  padding: .4rem 0;
}

.toc-nav::-webkit-scrollbar {
  width: 4px;
}

.toc-nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
}

.toc-item {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .55rem .9rem;
  text-decoration: none;
  color: #6b7280;
  font-size: .82rem;
  border-left: 3px solid transparent;
  transition: .15s;
}

.toc-item:hover {
  background: rgba(255, 255, 255, 0.04);
  color: #d1d5db;
  border-left-color: rgba(249, 115, 22, 0.4);
}

.toc-item.active {
  background: var(--accent-dim);
  color: #fff;
  border-left-color: var(--accent);
}

.toc-item-icon {
  display: flex;
  flex-shrink: 0;
}

.toc-item-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.toc-item-title {
  font-weight: 500;
  line-height: 1.3;
}

.toc-item-pages {
  font-size: .72rem;
  color: #d9dce0;
}

.toc-header svg,
.toc-item-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

/* ─── BOOK PANEL ──────────────────────────────────────────────────────── */
.book-panel {
  display: flex;
  flex-direction: column;
  background: transparent;
  overflow: hidden;
  position: relative;
}

/* ─── ZOOM TOOLBAR ────────────────────────────────────────────────────── */
.book-toolbar {
  display: flex;
  align-items: center;
  gap: .35rem;
  padding: .3rem .75rem;
  background: rgba(6, 6, 6, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: .2rem;
}

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 .25rem;
  flex-shrink: 0;
}

.tool-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  color: #d9dce0;
  transition: background .12s, border-color .12s, color .12s, box-shadow .12s;
  flex-shrink: 0;
}

.tool-btn svg {
  width: 15px;
  height: 15px;
  stroke-width: 2;
}

.tool-btn:hover:not(:disabled) {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
}

.tool-btn.active {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}

.tool-btn:disabled {
  opacity: .2;
  cursor: not-allowed;
}

.zoom-display {
  font-size: .78rem;
  font-weight: 600;
  color: #4b5563;
  min-width: 42px;
  text-align: center;
  user-select: none;
  font-variant-numeric: tabular-nums;
}

/* ─── BOOK WRAPPER + CANVAS ───────────────────────────────────────────── */
.book-wrapper {
  flex: 1;
  overflow-y: auto;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1rem;
  position: relative;
  background-color: #353535;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 28px 28px;
}

.book-wrapper::-webkit-scrollbar {
  width: 6px;
}

.book-wrapper::-webkit-scrollbar-track {
  background: transparent;
}

.book-wrapper::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.07);
  border-radius: 3px;
}

#pdf-canvas {
  /* JS sets style.width (logical px). height:auto lets the browser
     scale height proportionally when max-width constrains the width —
     prevents stretch distortion on narrow screens. */
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 2px;
  transition: opacity .25s;
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.05),
    0 8px 40px rgba(0, 0, 0, 0.8),
    0 24px 80px rgba(0, 0, 0, 0.5),
    0 0 80px rgba(249, 115, 22, 0.05);
}

#pdf-canvas.loading {
  opacity: .15;
}

/* Loading overlay */
.book-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(5, 5, 5, 0.94);
  z-index: 10;
  gap: .75rem;
  color: #4b5563;
  font-size: .9rem;
  transition: opacity .3s;
}

.book-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .75s linear infinite;
  box-shadow: 0 0 16px var(--accent-glow);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* Bottom navigation */
.book-bottom-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem 1rem;
  background: rgba(4, 4, 4, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  flex-shrink: 0;
}

.nav-btn-lg {
  background: var(--accent-dim);
  border: 1px solid var(--accent-border);
  color: var(--accent);
  padding: .45rem 1.1rem;
  border-radius: 7px;
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}

.nav-btn-lg:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 20px var(--accent-glow);
}

.nav-btn-lg:disabled {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(255, 255, 255, 0.04);
  color: #d9dce0;
  cursor: not-allowed;
}

.section-label-bottom {
  font-size: .82rem;
  font-weight: 500;
  color: #d9dce0;
  text-align: center;
  flex: 1;
  padding: 0 .5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
}

.section-label-bottom svg {
  width: 13px;
  height: 13px;
  stroke-width: 2;
  opacity: .5;
}

/* ─── SIDEBAR PANEL ───────────────────────────────────────────────────── */
.sidebar-panel {
  display: flex;
  flex-direction: column;
  background: rgba(8, 8, 8, 0.72);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border-left: 1px solid rgba(255, 255, 255, 0.06);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar-panel::-webkit-scrollbar {
  width: 4px;
}

.sidebar-panel::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 2px;
}

/* Section badge */
.section-badge {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .85rem 1rem;
  background: linear-gradient(135deg, rgba(249, 115, 22, 0.18) 0%, rgba(249, 115, 22, 0.05) 100%);
  border-bottom: 1px solid rgba(249, 115, 22, 0.18);
  color: #fff;
  font-weight: 600;
  font-size: .9rem;
  position: sticky;
  top: 0;
  z-index: 10;
  flex-shrink: 0;
}

.section-badge svg {
  color: var(--accent);
  width: 17px;
  height: 17px;
}

#badge-icon {
  display: flex;
}

#badge-title {
  flex: 1;
}

/* Sidebar blocks */
.sidebar-block {
  padding: 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.sidebar-block-header {
  display: flex;
  align-items: center;
  gap: .4rem;
  margin-bottom: .75rem;
}

.sidebar-block-icon {
  display: flex;
  color: var(--accent);
}

.sidebar-block-icon svg {
  width: 14px;
  height: 14px;
  stroke-width: 2;
}

.sidebar-block-header h3 {
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #d9dce0;
}

.sidebar-empty {
  font-size: .82rem;
  color: #d9dce0;
  text-align: center;
  padding: .75rem 0;
}

/* ─── STATS GRID ──────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .45rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-left: 3px solid var(--section-color, var(--accent));
  border-radius: 8px;
  padding: .6rem .7rem;
  display: flex;
  flex-direction: column;
  gap: .15rem;
  transition: background .15s, box-shadow .15s;
}

.stat-card:hover {
  background: rgba(255, 255, 255, 0.055);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.stat-value {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
  line-height: 1;
  display: flex;
  align-items: center;
  gap: .2rem;
}

.stat-unit {
  font-size: .67rem;
  color: #d9dce0;
}

.stat-label {
  font-size: .71rem;
  color: #4b5563;
  line-height: 1.3;
  margin-top: .1rem;
}

.trend-up {
  color: #22c55e;
  font-size: .7rem;
}

.trend-down {
  color: #ef4444;
  font-size: .7rem;
}

.trend-neutral {
  color: #d9dce0;
  font-size: .7rem;
}

/* ─── SURVEY CARD ─────────────────────────────────────────────────────── */
.survey-card {
  padding: .25rem 0;
}

.survey-title {
  font-size: .82rem;
  font-weight: 700;
  margin-bottom: .3rem;
  color: #e5e7eb;
}

.survey-question {
  font-size: .84rem;
  color: #6b7280;
  margin-bottom: .75rem;
  line-height: 1.45;
}

.survey-options {
  display: flex;
  flex-direction: column;
  gap: .4rem;
}

.survey-opt-btn {
  text-align: left;
  padding: .6rem .85rem;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  cursor: pointer;
  font-size: .82rem;
  font-family: inherit;
  color: #9ca3af;
  transition: .15s;
}

.survey-opt-btn::before {
  content: '';
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1.5px solid rgba(255, 255, 255, 0.14);
  border-radius: 50%;
  margin-right: .5rem;
  vertical-align: middle;
  transition: border-color .15s;
}

.survey-opt-btn:hover {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
  box-shadow: 0 0 14px rgba(249, 115, 22, 0.1);
}

.survey-opt-btn:hover::before {
  border-color: var(--accent);
}

/* Results */
.survey-results {
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.result-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .8rem;
}

.result-row.voted .result-label {
  font-weight: 700;
  color: #e5e7eb;
}

.result-label {
  flex: 1;
  min-width: 0;
  color: #6b7280;
}

.result-bar-wrap {
  width: 70px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 99px;
  height: 7px;
  overflow: hidden;
}

.result-bar {
  height: 100%;
  border-radius: 99px;
  transition: width .65s cubic-bezier(.4, 0, .2, 1);
}

.result-pct {
  width: 30px;
  text-align: right;
  font-weight: 600;
  font-size: .78rem;
  color: #9ca3af;
}

.voted-check {
  color: #22c55e;
  font-weight: 700;
}

.total-votes-label {
  font-size: .72rem;
  color: #d9dce0;
  margin-top: .35rem;
  text-align: right;
}

/* ─── FOOTER ──────────────────────────────────────────────────────────── */
.app-footer {
  height: var(--footer-h);
  background: rgba(3, 3, 3, 0.96);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid rgba(249, 115, 22, 0.14);
  overflow: hidden;
}

.footer-inner {
  height: 100%;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 0 1.25rem;
  overflow-x: auto;
}

.footer-inner::-webkit-scrollbar {
  height: 3px;
}

.footer-inner::-webkit-scrollbar-thumb {
  background: rgba(249, 115, 22, 0.2);
  border-radius: 2px;
}

.footer-brand {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  color: #d9dce0;
  font-size: .75rem;
  line-height: 1.4;
  padding-right: 1.25rem;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.footer-brand strong {
  font-size: .9rem;
  font-weight: 700;
  color: #d9dce0;
}

.footer-nav {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}

.footer-link {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: .15rem;
  padding: .35rem .5rem;
  border-radius: 7px;
  text-decoration: none;
  color: #d9dce0;
  font-size: .67rem;
  min-width: 50px;
  text-align: center;
  border: 1px solid transparent;
  transition: .15s;
}

.footer-link:hover,
.footer-link.active {
  background: var(--accent-dim);
  border-color: var(--accent-border);
  color: var(--accent);
  box-shadow: 0 0 16px rgba(249, 115, 22, 0.12);
}

.footer-link-icon {
  display: flex;
  align-items: center;
  justify-content: center;
}

.footer-link-icon svg {
  width: 17px;
  height: 17px;
  stroke-width: 1.75;
}

.footer-link-text {
  line-height: 1.25;
  word-break: break-word;
  max-width: 58px;
}

/* ─── ANIMATIONS ──────────────────────────────────────────────────────── */
@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stat-card {
  animation: fadeSlideIn .22s ease both;
}

.survey-card {
  animation: fadeSlideIn .28s ease both;
}

/* ─── RESPONSIVE ──────────────────────────────────────────────────────── */

/* ── Tablet: 1024px ─────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  :root {
    --side-w: 260px;
    --footer-h: 68px;
  }

  .header-sub    { display: none; }
  .header-main   { font-size: .9rem; }

  .footer-link-text  { display: none; }
  .footer-link       { min-width: 36px; padding: .35rem .4rem; }
  .footer-link-icon svg { width: 18px; height: 18px; }
}

/* ── Small tablet / large phone: 860px ──────────────────────────────── */
@media (max-width: 860px) {
  :root {
    --side-w: 230px;
  }


  .page-display    { font-size: .8rem; }
  .page-display input { width: 38px; }
}

/* ── Mobile: 768px ──────────────────────────────────────────────────── */
@media (max-width: 768px) {
  :root {
    --header-h: 52px;
    --footer-h: 56px;
  }

  /* Body becomes scrollable */
  html, body { overflow: auto; height: auto; }

  /* ── Header ── */
  .app-header   { padding: 0 .75rem; gap: .5rem; }
  .header-logo  { font-size: .78rem; padding: .28rem .5rem; }
  .header-main  { font-size: .82rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
  .header-sub   { display: none; }

  /* Hide plan logo on mobile */
  .header-plan-logo { display: none; }

  .page-nav-inline { padding: .2rem .4rem; gap: .3rem; }
  .page-display    { font-size: .78rem; gap: .25rem; }
  .page-display input { width: 34px; font-size: .78rem; }
  .page-total      { font-size: .75rem; }
  .nav-btn         { padding: .25rem .5rem; font-size: .9rem; }

  /* ── Layout: single column ── */
  .app-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  /* ── Book panel: fixed viewport height ── */
  .book-panel {
    height: calc(100vh  - var(--header-h) - var(--footer-h) - 36px); /* fallback */
    height: calc(100svh - var(--header-h) - var(--footer-h) - 36px); /* svh = excludes browser chrome */
    min-height: 320px;
    flex-shrink: 0;
  }

  /* ── Bottom nav buttons: compact ── */
  .nav-btn-lg {
    padding: .38rem .75rem;
    font-size: .78rem;
  }

  .section-label-bottom {
    font-size: .75rem;
    padding: 0 .25rem;
  }

  /* ── Sidebar: below book, scrollable ── */
  .sidebar-panel {
    border-left: none;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
    max-height: 380px;
    overflow-y: auto;
    flex-shrink: 0;
  }

  .stats-grid {
    grid-template-columns: 1fr 1fr;
    gap: .4rem;
  }

  /* ── Footer: compact, horizontally scrollable ── */
  .app-footer   { height: var(--footer-h); }
  .footer-inner { gap: .6rem; padding: 0 .75rem; }
  .footer-brand { padding-right: .75rem; font-size: .7rem; }
  .footer-brand strong { font-size: .8rem; }
  .footer-link  { min-width: 32px; padding: .3rem .35rem; }
  .footer-link-text  { display: none; }
  .footer-link-icon svg { width: 16px; height: 16px; }
}

/* ── Small phones: 480px ────────────────────────────────────────────── */
@media (max-width: 480px) {
  :root {
    --header-h: 48px;
    --footer-h: 48px;
  }

  /* ── Header: minimal ── */
  .header-brand { gap: .4rem; }
  .header-logo  { font-size: .72rem; padding: .25rem .45rem; }
  .header-main  { font-size: .76rem; max-width: 110px; }

  .page-nav-inline { gap: .2rem; padding: .15rem .3rem; }
  .page-display input { width: 28px; }
  .header-controls { gap: .35rem; }

  /* ── Book panel ── */
  .book-panel {
    height: calc(100vh  - var(--header-h) - var(--footer-h) - 32px);
    height: calc(100svh - var(--header-h) - var(--footer-h) - 32px);
    min-height: 280px;
  }

  .book-wrapper { padding: .75rem .5rem; }

  /* ── Toolbar: compact ── */
  .book-toolbar  { padding: .2rem .5rem; }
  .tool-btn      { width: 26px; height: 26px; }
  .zoom-display  { font-size: .72rem; min-width: 36px; }

  /* ── Nav buttons ── */
  .book-bottom-nav { padding: .4rem .6rem; }
  .nav-btn-lg { padding: .32rem .6rem; font-size: .74rem; }

  /* ── Sidebar ── */
  .sidebar-panel { max-height: 320px; }
  .stats-grid    { grid-template-columns: 1fr; }
  .stat-card     { flex-direction: row; align-items: center; gap: .5rem; }
  .stat-value    { font-size: .95rem; }

  /* ── Footer ── */
  .footer-brand  { display: none; } /* hide brand on tiny screens */
  .footer-link   { min-width: 30px; padding: .25rem .3rem; }
}

/* ── Very small phones: 360px ──────────────────────────────────────── */
@media (max-width: 360px) {
  .page-display span.page-total { display: none; }
  .header-logo  { display: none; }
  .header-main  { font-size: .78rem; }
}

/* ─── ZOOM BANNER (mobile ribbon) ────────────────────────────────────────── */
.zoom-banner {
  display: none;                    /* shown via JS only on mobile */
  align-items: center;
  gap: .6rem;
  padding: .55rem 1rem;
  background: linear-gradient(90deg, rgba(249,115,22,0.18) 0%, rgba(249,115,22,0.08) 100%);
  border-bottom: 1px solid rgba(249,115,22,0.3);
  font-size: .8rem;
  color: #fdba74;
  position: relative;
  z-index: 90;
  animation: bannerSlideDown .3s cubic-bezier(.34,1.4,.64,1) both;
}

@keyframes bannerSlideDown {
  from { transform: translateY(-100%); opacity: 0; }
  to   { transform: translateY(0);     opacity: 1; }
}

.zoom-banner.visible { display: flex; }

.zoom-banner > i[data-lucide] { flex-shrink: 0; color: var(--accent); }
.zoom-banner > i[data-lucide] svg { width: 15px; height: 15px; stroke-width: 2.5; }

.zoom-banner > span {
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.zoom-banner-btn {
  flex-shrink: 0;
  padding: .3rem .75rem;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: .78rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 2px 12px rgba(249,115,22,0.4);
  transition: box-shadow .15s, transform .1s;
  white-space: nowrap;
}
.zoom-banner-btn:active { transform: scale(.96); }

.zoom-banner-close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: rgba(249,115,22,0.6);
  cursor: pointer;
  border-radius: 4px;
  padding: 0;
  transition: color .15s, background .15s;
}
.zoom-banner-close:hover { color: var(--accent); background: rgba(249,115,22,0.12); }
.zoom-banner-close svg { width: 14px; height: 14px; stroke-width: 2.5; }

/* ─── ZOOM HINT MODAL ─────────────────────────────────────────────────────── */
.zoom-hint-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  align-items: flex-end;       /* sheet slides from bottom on mobile */
  justify-content: center;
  padding: 1rem;
  animation: zhFadeIn .22s ease both;
}

.zoom-hint-backdrop.open {
  display: flex;
}

@keyframes zhFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.zoom-hint-card {
  background: rgba(14, 14, 14, 0.97);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  border: 1px solid rgba(249, 115, 22, 0.22);
  border-radius: 20px;
  padding: 1.75rem 1.5rem 1.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 -4px 60px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(249, 115, 22, 0.08);
  animation: zhSlideUp .28s cubic-bezier(.34, 1.4, .64, 1) both;
  text-align: center;
}

@keyframes zhSlideUp {
  from { transform: translateY(40px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

.zoom-hint-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  background: rgba(249, 115, 22, 0.14);
  border: 1px solid rgba(249, 115, 22, 0.28);
  border-radius: 50%;
  margin: 0 auto .9rem;
  color: var(--accent);
}

.zoom-hint-icon svg {
  width: 24px;
  height: 24px;
  stroke-width: 2;
}

.zoom-hint-card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  color: #f1f5f9;
  margin-bottom: .5rem;
}

.zoom-hint-card p {
  font-size: .875rem;
  color: #9ca3af;
  line-height: 1.55;
  margin-bottom: 1.25rem;
}

.zoom-hint-actions {
  display: flex;
  flex-direction: column;
  gap: .6rem;
  margin-bottom: 1rem;
}

.zoom-hint-btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .45rem;
  padding: .75rem 1rem;
  background: linear-gradient(135deg, #f97316, #ea580c);
  color: #fff;
  border: none;
  border-radius: 11px;
  font-size: .9rem;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(249, 115, 22, 0.4);
  transition: box-shadow .2s, transform .15s;
}

.zoom-hint-btn-primary:active {
  transform: scale(.97);
}

.zoom-hint-btn-primary svg {
  width: 16px;
  height: 16px;
  stroke-width: 2.5;
}

.zoom-hint-btn-ghost {
  padding: .6rem 1rem;
  background: transparent;
  color: #6b7280;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 11px;
  font-size: .85rem;
  font-family: inherit;
  cursor: pointer;
  transition: color .15s, background .15s;
}

.zoom-hint-btn-ghost:hover {
  color: #d1d5db;
  background: rgba(255, 255, 255, 0.05);
}

.zoom-hint-remember {
  display: inline-flex;
  align-items: center;
  gap: .45rem;
  font-size: .78rem;
  color: #4b5563;
  cursor: pointer;
  user-select: none;
}

.zoom-hint-remember input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
  cursor: pointer;
}