:root {
  color-scheme: dark;
  --text: #ffffff;
  --text-secondary: #d8dff0;
  --muted: #a8b4cc;
  --blue: #93e4ff;
  --blue-strong: #3a8ef2;
  --blue-dim: rgba(147, 228, 255, 0.18);
  --blue-glow: rgba(147, 228, 255, 0.32);
  --border: rgba(255, 255, 255, 0.26);
  --border-strong: rgba(255, 255, 255, 0.40);
  --panel-border: rgba(255, 255, 255, 0.32);
  --ice-top: rgba(210, 238, 255, 0.22);
  --ice-mid: rgba(130, 200, 255, 0.26);
  --ice-bottom: rgba(18, 50, 100, 0.32);
  --ice-border: rgba(170, 222, 255, 0.55);
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
  --shadow-soft: 0 10px 32px rgba(0, 0, 0, 0.38);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --viewport-width: 100vw;
  --viewport-height: 100dvh;
  --ui-font: "Avenir Next", "SF Pro Display", "Segoe UI", "Helvetica Neue", sans-serif;
  --drawer-width: clamp(310px, 64vw, 530px);
  --key-radius: 18px;
  --key-height: 72px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: #000;
  color: var(--text);
  font-family: var(--ui-font);
  overscroll-behavior: none;
  overflow: hidden;
}

body {
  min-height: var(--viewport-height);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  opacity: 0.35;
}

.app-shell {
  position: relative;
  width: var(--viewport-width);
  min-height: var(--viewport-height);
  height: var(--viewport-height);
  overflow: hidden;
  background:
    radial-gradient(circle at 50% -8%, rgba(60, 130, 255, 0.22), transparent 30%),
    radial-gradient(circle at 15% 20%, rgba(255, 200, 100, 0.10), transparent 22%),
    radial-gradient(circle at 88% 22%, rgba(90, 170, 255, 0.10), transparent 22%),
    linear-gradient(180deg, #0d1322 0%, #060910 50%, #000 100%);
}

.viewer-shell {
  position: relative;
  display: grid;
  width: var(--viewport-width);
  min-height: var(--viewport-height);
  height: var(--viewport-height);
  padding:
    var(--safe-top)
    var(--safe-right)
    var(--safe-bottom)
    var(--safe-left);
  place-items: center;
  user-select: none;
  overflow: hidden;
}

#page-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: calc(var(--viewport-width) - var(--safe-left) - var(--safe-right));
  max-height: calc(var(--viewport-height) - var(--safe-top) - var(--safe-bottom));
  object-fit: contain;
  object-position: center center;
  background: #000;
  transition: opacity 160ms ease;
}

#page-image.is-loading {
  opacity: 0.65;
}

.loading {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0.9rem 1.4rem;
  border-radius: 999px;
  background: rgba(6, 10, 22, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.22);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 0.85rem;
  font-weight: 700;
  box-shadow: var(--shadow-soft);
  z-index: 30;
}

.loading.is-hidden,
.is-hidden {
  display: none !important;
}

.offline-gate {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(2, 6, 14, 0.86);
  backdrop-filter: blur(18px);
}

.offline-gate-card {
  width: min(560px, 92vw);
  padding: 28px 24px;
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(18, 30, 56, 0.94), rgba(7, 12, 24, 0.97)),
    rgba(8, 12, 20, 0.96);
  border: 1px solid rgba(170, 222, 255, 0.34);
  box-shadow: var(--shadow);
  text-align: center;
}

.offline-gate-eyebrow {
  margin: 0 0 10px;
  color: var(--blue);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 800;
}

.offline-gate-title {
  margin: 0 0 10px;
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  line-height: 1.05;
}

.offline-gate-body {
  margin: 0 0 18px;
  color: var(--text-secondary);
  font-size: 1rem;
  line-height: 1.45;
}

.offline-progress {
  overflow: hidden;
  width: 100%;
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.offline-progress-bar {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #7fe3ff 0%, #7fb1ff 48%, #ffe2a8 100%);
  box-shadow: 0 0 28px rgba(127, 177, 255, 0.4);
  transition: width 180ms ease;
}

.offline-progress-value {
  margin: 12px 0 0;
  color: var(--text);
  font-weight: 700;
}

.offline-admin-note {
  margin: 16px 0 0;
  color: #ffe2a8;
  font-size: 0.96rem;
  font-weight: 800;
}

.offline-ready-note {
  margin: 16px 0 0;
  color: #dfffe7;
  font-size: 1rem;
  font-weight: 700;
}

.offline-meta-note {
  margin: 10px 0 0;
  color: var(--text-secondary);
  font-size: 0.92rem;
  line-height: 1.4;
}

.offline-test-button,
.offline-continue-button,
.offline-retry-button {
  margin-top: 18px;
  min-width: 220px;
  padding: 14px 18px;
  border-radius: 16px;
  color: #07111f;
  background: linear-gradient(135deg, #9fe9ff, #ffe2a8);
  font-weight: 800;
  box-shadow: 0 18px 34px rgba(0, 0, 0, 0.26);
}

.offline-continue-button {
  background: linear-gradient(135deg, #c8ffcf, #9fe9ff);
}

.offline-test-button {
  background: linear-gradient(135deg, #ffe2a8, #ffd28c);
}

/* ── Overlay shell ───────────────────────────────────────────────────────────── */
.overlay-controls {
  position: fixed;
  inset: 0;
  width: var(--viewport-width);
  height: var(--viewport-height);
  z-index: 4;
  pointer-events: none;
  touch-action: pan-x pan-y pinch-zoom;
}

/* ── Drawer handle: left-edge pull-tab ───────────────────────────────────────── */
.drawer-handle {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 6;
  width: 24px;
  height: 64px;
  padding: 0;
  border: none;
  border-radius: 0 12px 12px 0;
  background: rgba(20, 28, 60, 0.92);
  border-right: 1px solid rgba(147, 228, 255, 0.40);
  border-top: 1px solid rgba(147, 228, 255, 0.25);
  border-bottom: 1px solid rgba(147, 228, 255, 0.25);
  box-shadow: none;
  pointer-events: auto;
  touch-action: manipulation;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: width 150ms ease, background 120ms;
}

.drawer-handle:active {
  width: 28px;
  background: rgba(40, 60, 110, 0.95);
}

/* Arrow chevron inside the tab */
.drawer-handle-lines {
  display: block;
  font-style: normal;
  font-size: 14px;
  line-height: 1;
  color: rgba(147, 228, 255, 0.80);
  pointer-events: none;
  user-select: none;
}

/* Hide tab while drawer is open */
.overlay-controls.drawer-open ~ .drawer-handle,
.app-shell.drawer-open .drawer-handle {
  opacity: 0;
  pointer-events: none;
}

/* ── Backdrop ───────────────────────────────────────────────────────────────── */
.drawer-backdrop {
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background 260ms ease;
  pointer-events: none;
  border: 0;
}

.overlay-controls.drawer-open .drawer-backdrop {
  background: rgba(0, 0, 0, 0.52);
  pointer-events: auto;
}

/* ── Navigation drawer (left side) ──────────────────────────────────────────── */
.navigation-drawer {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--drawer-width);
  padding-top: calc(var(--safe-top) + 4px);
  background: #07091a;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  flex-direction: column;
  /* Two-pane handles its own scroll; drawer clips overflow */
  overflow: hidden;
  transform: translateX(-100%);
  transition: transform 280ms cubic-bezier(0.22, 0.61, 0.36, 1);
  pointer-events: none;
  box-shadow: 12px 0 60px rgba(0, 0, 0, 0.70);
}

.overlay-controls.drawer-open .navigation-drawer {
  transform: translateX(0);
  pointer-events: auto;
}

.navigation-drawer.is-dragging {
  transition: none;
}

/* ── Drawer top bar + close button ─────────────────────────────────────────── */
.drawer-top-bar {
  flex-shrink: 0;
}
.drawer-close-btn {
  width: 100%;
  padding: 0.82rem 1.1rem;
  background: #0d1030;
  border: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.82);
  font-size: 1.08rem;
  font-weight: 700;
  text-align: left;
  letter-spacing: 0.01em;
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 130ms, color 130ms;
}

.drawer-close-btn:hover,
.drawer-close-btn:active {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
}

/* ── Drawer nav row: ← Canción Anterior | Song info | Siguiente Canción → ────── */
.drawer-nav-row {
  display: flex;
  align-items: stretch;
  min-height: 88px;
  flex-shrink: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.025);
}

.drawer-nav-btn {
  flex-shrink: 0;
  width: 84px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  background: transparent;
  border: 0;
  color: var(--text);
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 130ms;
}

.drawer-nav-btn:hover,
.drawer-nav-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

.drawer-nav-btn:disabled {
  opacity: 0.28;
}

.drawer-nav-arrow {
  font-size: 2.6rem;
  line-height: 1;
  font-weight: 700;
}

.nav-label {
  display: block;
  font-size: 0.64rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.65);
  line-height: 1.25;
  text-align: center;
}

.drawer-nav-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  padding: 0.6rem 0.4rem;
  min-width: 0;
}

.numberpad-status {
  margin: 0;
  text-align: center;
  font-size: 1.15rem;
  color: #ffffff;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
  letter-spacing: 0.01em;
}

.numberpad-intro {
  margin: 0;
  text-align: center;
  font-size: 0.78rem;
  color: var(--blue);
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.35;
  padding: 0 0.3rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.drawer-back-btn {
  display: flex;
  align-items: center;
  gap: 0.28rem;
  padding: 0.32rem 0.72rem;
  border-radius: 20px;
  border: 1px solid rgba(147, 228, 255, 0.45);
  background: rgba(147, 228, 255, 0.12);
  color: var(--blue);
  font-size: 0.85rem;
  font-weight: 700;
  touch-action: manipulation;
  pointer-events: auto;
  transition: background 130ms, border-color 130ms;
  white-space: nowrap;
}

.drawer-back-btn:hover {
  background: rgba(147, 228, 255, 0.22);
  border-color: rgba(147, 228, 255, 0.6);
}

/* ── Numpad section ──────────────────────────────────────────────────────────── */
.numpad-section {
  flex-shrink: 0;
  padding: 0.85rem 0.95rem 0.7rem;
}

/* search-focused kept for compat but numpad is hidden by mode switching now */
.navigation-drawer.search-focused .numpad-section {
  display: none;
}

/* Song number display — styled div, NOT a text input */
.numberpad-display-wrap {
  position: relative;
  margin: 0 0 0.75rem;
}

.numberpad-display {
  width: 100%;
  min-height: 4.2rem;
  padding: 0.95rem 3.2rem 0.95rem 1.2rem;
  border-radius: 20px;
  border: 2px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.07);
  color: #ffffff;
  font-size: clamp(1.7rem, 4.5vw, 2.3rem);
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: default;
  user-select: none;
  -webkit-user-select: none;
}

/* Placeholder when no digits entered */
.numberpad-display:empty::before {
  content: "No. de canción";
  color: rgba(255, 255, 255, 0.28);
  font-size: 0.52em;
  font-weight: 500;
  letter-spacing: 0.01em;
}

.display-clear-btn {
  position: absolute;
  right: 0.7rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.95rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: manipulation;
  padding: 0;
  transition: background 130ms;
}

.display-clear-btn:hover,
.display-clear-btn:active {
  background: rgba(255, 255, 255, 0.35);
}

/* ── Numpad grid ─────────────────────────────────────────────────────────────── */
.numberpad-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.6rem;
}

/* Base key style — used by numpad AND util row */
.numberpad-key {
  min-height: var(--key-height);
  border-radius: var(--key-radius);
  border: 1px solid var(--border);
  color: var(--text);
  pointer-events: auto;
  touch-action: manipulation;
  transition: transform 110ms ease, background 150ms ease, border-color 150ms ease;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.15), rgba(255, 255, 255, 0.09));
  font-size: 1.2rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Digit keys — bright blue-glass */
.numberpad-key[data-digit] {
  background:
    linear-gradient(
      180deg,
      var(--ice-top) 0%,
      var(--ice-mid) 30%,
      var(--ice-bottom) 100%
    );
  border-color: var(--ice-border);
  color: #ffffff;
  font-size: 2.1rem;
  font-weight: 800;
  text-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25),
    0 0 20px rgba(147, 228, 255, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 0 28px var(--blue-glow),
    var(--shadow-soft);
}

/* Muted keys — Borrar, ↩, ? */
.numberpad-key-muted {
  font-size: 1.08rem;
  font-weight: 700;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.10), rgba(255, 255, 255, 0.05));
  border-color: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.88);
}

/* Util row: bump icons/text 25% bigger than base muted key */
.numpad-util-row .numberpad-key-muted {
  font-size: 1.35rem;
}

/* Help key — blue tint */
.help-key {
  color: var(--blue);
  font-size: 1.875rem;
  font-weight: 900;
  border-color: rgba(147, 228, 255, 0.32);
  background: linear-gradient(180deg, rgba(147, 228, 255, 0.10), rgba(147, 228, 255, 0.05));
}

/* Go button — ↵ Ir */
.go-button {
  background: linear-gradient(180deg, rgba(147, 228, 255, 0.30), rgba(58, 142, 242, 0.35));
  border-color: rgba(147, 228, 255, 0.55);
  color: var(--blue);
  font-size: 1.45rem;
  font-weight: 900;
  letter-spacing: 0.02em;
  box-shadow:
    0 0 22px rgba(58, 142, 242, 0.28),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.go-button:hover {
  box-shadow: 0 0 34px rgba(58, 142, 242, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

/* Expand / fullscreen button */
.expand-button {
  border-color: rgba(255, 255, 255, 0.28);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.07));
}

.expand-icon {
  width: 1.94rem;
  height: 1.94rem;
  color: rgba(255, 255, 255, 0.85);
}

/* Press feedback */
.numberpad-key:active {
  transform: translateY(2px) scale(0.97);
  transition-duration: 60ms;
}

.numberpad-key:hover {
  border-color: rgba(255, 255, 255, 0.36);
}

.numberpad-key[data-digit]:hover {
  border-color: rgba(200, 238, 255, 0.7);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    0 0 36px var(--blue-glow),
    var(--shadow-soft);
}

/* ── Util row: same grid layout as numpad bottom row ────────────────────────── */
.numpad-util-row {
  display: grid;
  grid-template-columns: 1fr 1fr; /* 2 useful buttons: ← Volver + ? */
  gap: 0.6rem;
  margin-top: 0.6rem;
}

/* ── Numpad tip ──────────────────────────────────────────────────────────────── */
.numpad-tip-wrap {
  position: relative;
  margin: 0 0.95rem 0.3rem;
  padding: 0.75rem 2.6rem 0.75rem 0.9rem; /* right padding for dismiss button */
  background: rgba(147, 228, 255, 0.06);
  border: 1px solid rgba(147, 228, 255, 0.18);
  border-radius: 14px;
  flex-shrink: 0;
}

.numpad-tip {
  margin: 0;
  padding: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.65);
}

.numpad-tip strong {
  color: rgba(255, 255, 255, 0.9);
  font-weight: 700;
}

/* Inline × dismiss button on the tip banner itself */
.numpad-tip-dismiss {
  position: absolute;
  top: 0.45rem;
  right: 0.55rem;
  width: 1.8rem;
  height: 1.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 0;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.55);
  font-size: 0.9rem;
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 120ms, color 120ms;
}
.numpad-tip-dismiss:hover { background: rgba(255,255,255,0.18); color: #fff; }

/* Hide tip when dismissed */
.numpad-tip-wrap.is-hidden { display: none; }

/* ── Mode switcher: 🔢 Teclado ↔ 📚 Explorar ─────────────────────────────────── */
.drawer-mode-switch {
  display: flex;
  flex-shrink: 0;
  gap: 0.5rem;
  padding: 0.55rem 0.75rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(0, 0, 0, 0.15);
}

.drawer-mode-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.58rem 0.5rem;
  border-radius: 14px;
  border: 1.5px solid rgba(255, 255, 255, 0.10);
  background: transparent;
  color: rgba(255, 255, 255, 0.40);
  font-size: 0.86rem;
  font-weight: 700;
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 160ms, border-color 160ms, color 160ms;
  white-space: nowrap;
}
.mode-icon { font-size: 1.05rem; line-height: 1; }
.mode-label { font-size: 0.84rem; font-weight: 800; }

.drawer-mode-btn.is-active {
  background: rgba(147, 228, 255, 0.13);
  border-color: rgba(147, 228, 255, 0.45);
  color: var(--blue);
}
.drawer-mode-btn:hover:not(.is-active) {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.65);
}

/* ── Drawer panels ─────────────────────────────────────────────────────────────
   Each panel fills all remaining drawer height. Only one visible at a time.  */
.drawer-panel {
  flex: 1;
  min-height: 0;
  display: flex;
  overflow: hidden;
}

/* Numpad panel: single column */
.drawer-numpad-panel {
  flex-direction: column;
}

/* Browse panel: two-pane row (rail + content) */
.drawer-browse-panel {
  flex-direction: row;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Mode visibility — default is numpad */
.drawer-browse-panel { display: none; }
.navigation-drawer.mode-browse .drawer-numpad-panel { display: none; }
.navigation-drawer.mode-browse .drawer-browse-panel { display: flex; }

/* ── Two-pane (inside browse panel) ────────────────────────────────────────── */

/* Left tab rail */
.drawer-tab-rail {
  width: 76px;
  flex-shrink: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  scrollbar-width: none;
  border-right: 1px solid rgba(255, 255, 255, 0.10);
  display: flex;
  flex-direction: column;
  padding: 0.35rem 0;
  background: rgba(0, 0, 0, 0.18);
}
.drawer-tab-rail::-webkit-scrollbar { display: none; }

.rail-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.22rem;
  padding: 0.72rem 0.25rem;
  width: 100%;
  border: 0;
  border-right: 3px solid transparent;
  background: transparent;
  color: rgba(255, 255, 255, 0.42);
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 130ms, border-color 130ms, color 130ms;
  text-align: center;
  cursor: pointer;
}
.rail-icon {
  font-size: 1.3rem;
  line-height: 1;
}
.rail-label {
  font-size: 0.60rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: inherit;
}
.rail-tab:hover {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.72);
}
.rail-tab.is-active {
  background: rgba(147, 228, 255, 0.10);
  border-right-color: var(--blue);
  color: var(--blue);
}

/* Right content pane — this is the only scrollable element */
.drawer-pane-content {
  flex: 1;
  min-width: 0;
  overflow-y: scroll;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 0.75rem 0.8rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ── Full-screen search mode ────────────────────────────────────────────────────
   When Buscar tab is active, the rail slides away and search owns the full
   drawer width. The pane-content fills edge-to-edge.                        */
.navigation-drawer.search-fullscreen .drawer-tab-rail {
  /* Animate out left */
  width: 0;
  padding: 0;
  border-right: none;
  overflow: hidden;
  transition: width 200ms cubic-bezier(0.4, 0, 0.2, 1),
              padding 200ms cubic-bezier(0.4, 0, 0.2, 1);
}
.navigation-drawer.search-fullscreen .drawer-pane-content {
  padding: 0.85rem 1rem 1rem;
}

/* ── Back button: shown inside search fullscreen ────────────────────────────── */
.search-back-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 0 0.85rem;
  height: 2.6rem;
  border-radius: 22px;
  border: 1.5px solid rgba(147, 228, 255, 0.35);
  background: rgba(147, 228, 255, 0.10);
  color: var(--blue);
  font-size: 0.88rem;
  font-weight: 800;
  pointer-events: auto;
  touch-action: manipulation;
  white-space: nowrap;
  transition: background 130ms, border-color 130ms;
}
.search-back-btn:hover,
.search-back-btn:active {
  background: rgba(147, 228, 255, 0.20);
  border-color: rgba(147, 228, 255, 0.6);
}
.search-back-arrow { font-size: 1rem; line-height: 1; }
.search-back-label { font-size: 0.86rem; font-weight: 800; }

/* Also rail: smooth re-entry when leaving search */
.drawer-tab-rail {
  transition: width 200ms cubic-bezier(0.4, 0, 0.2, 1),
              padding 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Search row (inside pane, only shown in Buscar tab) */
.search-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-shrink: 0;
  margin-bottom: 0.55rem;
}
.search-row.is-hidden { display: none; }

.search-input-wrap {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
}

.search-clear-btn {
  position: absolute;
  right: 0.6rem;
  top: 50%;
  transform: translateY(-50%);
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, 0.22);
  color: rgba(255, 255, 255, 0.85);
  font-size: 0.9rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: manipulation;
  padding: 0;
  transition: background 130ms;
}

.search-clear-btn:hover,
.search-clear-btn:active {
  background: rgba(255, 255, 255, 0.35);
}

.search-input {
  width: 100%;
  padding: 0.95rem 3rem 0.95rem 1.05rem;
  border-radius: 18px;
  border: 2px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
  font-size: 1.12rem;
  font-weight: 600;
  outline: none;
  transition: border-color 150ms;
}

.search-input:focus {
  border-color: rgba(147, 228, 255, 0.55);
}

.search-input::placeholder {
  color: rgba(255, 255, 255, 0.38);
  font-weight: 400;
}

.search-col-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.1rem 0.8rem 0;
  flex-shrink: 0;
}

.search-col-no {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.40);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  min-width: 2.4rem;
}

.search-col-title {
  font-size: 0.7rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.40);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.search-index-btn {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 3.4rem;
  padding: 0;
  border-radius: 16px;
  border: 2px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.88);
  font-size: 2.1rem;
  line-height: 1;
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 140ms, border-color 140ms, color 140ms;
}

.search-index-btn:hover {
  background: rgba(255, 255, 255, 0.18);
}

.search-index-btn.is-active {
  background: rgba(147, 228, 255, 0.2);
  border-color: rgba(147, 228, 255, 0.52);
  color: var(--blue);
}

/* ── Search cancel button — appears when search is focused ─────────────────── */
.search-cancel-btn {
  flex-shrink: 0;
  padding: 0.52rem 0.8rem;
  border-radius: 14px;
  border: 0;
  background: transparent;
  color: var(--blue);
  font-size: 0.98rem;
  font-weight: 700;
  white-space: nowrap;
  pointer-events: auto;
  touch-action: manipulation;
  transition: color 120ms, background 120ms;
}

.search-cancel-btn:hover,
.search-cancel-btn:active {
  background: rgba(147, 228, 255, 0.12);
}

/* Show cancel button when search is focused */
.navigation-drawer.search-focused .search-cancel-btn {
  display: flex !important;
}

/* ── Search tab bar ──────────────────────────────────────────────────────────── */
/* search-tabs / search-tab styles removed — replaced by .rail-tab in drawer-tab-rail */

/* ── Browse group headers (used in Misa, Temporada, Tono tabs) ──────────────── */
/* ── Group color palette: gc-0 … gc-7 ────────────────────────────────────────
   Each group gets one color. The SAME color tints the header AND the number
   badge so the visual grouping is instant without reading text.           */
:root {
  --gc0: #93e4ff;   /* sky blue    */
  --gc1: #7ef5c2;   /* mint        */
  --gc2: #ffd66a;   /* amber gold  */
  --gc3: #ff9e7a;   /* coral       */
  --gc4: #c5adff;   /* lavender    */
  --gc5: #60e8f5;   /* teal        */
  --gc6: #ffbc72;   /* warm orange */
  --gc7: #f5a8d4;   /* blush pink  */
}

/* ── Section group headers ──────────────────────────────────────────────────── */
.browse-group-header {
  margin: 1.1rem 0 0.45rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  border-radius: 10px;
  border-left: 4px solid;
  flex-shrink: 0;
  /* default (ungrouped/fallback = sky blue) */
  color: var(--gc0);
  border-left-color: var(--gc0);
  background: color-mix(in srgb, var(--gc0) 11%, transparent);
}
.browse-group-header:first-child { margin-top: 0.1rem; }

/* Color overrides per group */
.browse-group-header.gc-0 { color: var(--gc0); border-left-color: var(--gc0); background: color-mix(in srgb, var(--gc0) 11%, transparent); }
.browse-group-header.gc-1 { color: var(--gc1); border-left-color: var(--gc1); background: color-mix(in srgb, var(--gc1) 11%, transparent); }
.browse-group-header.gc-2 { color: var(--gc2); border-left-color: var(--gc2); background: color-mix(in srgb, var(--gc2) 11%, transparent); }
.browse-group-header.gc-3 { color: var(--gc3); border-left-color: var(--gc3); background: color-mix(in srgb, var(--gc3) 11%, transparent); }
.browse-group-header.gc-4 { color: var(--gc4); border-left-color: var(--gc4); background: color-mix(in srgb, var(--gc4) 11%, transparent); }
.browse-group-header.gc-5 { color: var(--gc5); border-left-color: var(--gc5); background: color-mix(in srgb, var(--gc5) 11%, transparent); }
.browse-group-header.gc-6 { color: var(--gc6); border-left-color: var(--gc6); background: color-mix(in srgb, var(--gc6) 11%, transparent); }
.browse-group-header.gc-7 { color: var(--gc7); border-left-color: var(--gc7); background: color-mix(in srgb, var(--gc7) 11%, transparent); }

/* Number badge: inherits group color from .search-result-item.gc-N */
.search-result-item.gc-0 .search-result-num { background: var(--gc0); }
.search-result-item.gc-1 .search-result-num { background: var(--gc1); }
.search-result-item.gc-2 .search-result-num { background: var(--gc2); }
.search-result-item.gc-3 .search-result-num { background: var(--gc3); }
.search-result-item.gc-4 .search-result-num { background: var(--gc4); }
.search-result-item.gc-5 .search-result-num { background: var(--gc5); }
.search-result-item.gc-6 .search-result-num { background: var(--gc6); }
.search-result-item.gc-7 .search-result-num { background: var(--gc7); }

/* ── A-Z letter divider (Todas tab) — plain rule, not a group header ─────────── */
.browse-letter-header {
  /* Reset group-header look entirely */
  background: none;
  border-left: none;
  border-radius: 0;
  color: rgba(255, 255, 255, 0.30);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  padding: 0 0.15rem 0.2rem;
  margin: 0.9rem 0 0.3rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
}

/* Empty-state message inside browse tabs */
.browse-empty {
  padding: 1.2rem 0.5rem;
  text-align: center;
  color: var(--muted);
  font-size: 0.95rem;
}

/* ── Search results ──────────────────────────────────────────────────────────── */
.search-results {
  display: block;
  /* Content flows naturally; parent .navigation-drawer is the scroll container */
}

.navigation-drawer.index-visible .search-results {
  gap: 0;
  padding-bottom: 0;
}

.search-theme-header {
  margin: 0 0 0.2rem;
  padding: 0 0.2rem;
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--blue);
  text-transform: uppercase;
  letter-spacing: 0.09em;
  flex-shrink: 0;
}

.search-result-item {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  width: 100%;
  text-align: left;
  padding: 0.65rem 0.75rem;
  border-radius: 12px;
  /* Quieter card so the coloured group headers truly stand out */
  border: 1px solid rgba(255, 255, 255, 0.10);
  background: rgba(255, 255, 255, 0.055);
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 130ms ease, border-color 130ms ease;
  flex-shrink: 0;
  margin-bottom: 0.32rem;
}

.search-result-item:hover,
.search-result-item:focus,
.search-result-item:active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.24);
  outline: none;
}

.search-result-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  min-width: 0;
}

.search-result-num {
  flex-shrink: 0;
  font-size: 0.78rem;
  font-weight: 900;
  /* Very dark text on the bright badge for max contrast */
  color: #03060e;
  background: var(--gc0); /* fallback; overridden by .gc-N on parent */
  border-radius: 7px;
  padding: 0.1rem 0.46rem;
  letter-spacing: 0.01em;
  line-height: 1.55;
  min-width: 2ch;
  text-align: center;
}

.search-result-title {
  font-size: 0.97rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.92);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  line-height: 1.25;
  min-width: 0;
  flex: 1;
}

.search-result-key {
  flex-shrink: 0;
  font-size: 0.68rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  padding: 0.06rem 0.36rem;
  letter-spacing: 0.04em;
  line-height: 1.5;
  margin-left: auto;
}

.search-result-snippet {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.60);
  line-height: 1.38;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  padding-left: calc(0.85rem + 0.55rem);
}

.search-result-snippet mark {
  background: transparent;
  color: rgba(255, 255, 255, 0.95);
  font-weight: 800;
}

.search-no-results {
  margin: 0;
  padding: 1rem;
  text-align: center;
  color: var(--muted);
  font-size: 1rem;
  flex-shrink: 0;
}

/* ── Index panel ─────────────────────────────────────────────────────────────── */
.index-layout {
  display: flex;
  flex-direction: row;
  flex: 1;
  min-height: 0;
  gap: 0.5rem;
  overflow: hidden;
}

.index-sidebar {
  flex-shrink: 0;
  width: 72px;
  display: flex;
  flex-direction: column;
  gap: 0.32rem;
  overflow-y: auto;
  scrollbar-width: none;
  padding-right: 0.28rem;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
}

.index-sidebar::-webkit-scrollbar {
  display: none;
}

.index-content {
  flex: 1;
  min-width: 0;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  gap: 0.38rem;
  padding-bottom: 0.75rem;
}

.index-tab-btn {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.24rem;
  width: 100%;
  padding: 0.6rem 0.2rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.55);
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 120ms, border-color 120ms, color 120ms;
}

.index-tab-btn.is-active {
  background: rgba(147, 228, 255, 0.18);
  border-color: rgba(147, 228, 255, 0.42);
  color: var(--blue);
}

.index-tab-emoji {
  font-size: 1.2rem;
  line-height: 1;
}

.index-tab-label {
  font-size: 0.62rem;
  font-weight: 800;
  text-align: center;
  line-height: 1.15;
  letter-spacing: 0.02em;
  word-break: break-word;
  hyphens: auto;
}

/* Sort tabs */
.index-sort-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  flex-shrink: 0;
}

.index-sort-tab {
  flex: 1 0 calc(50% - 0.25rem);
  min-width: 0;
  padding: 0.52rem 0.55rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.86rem;
  font-weight: 700;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 120ms, border-color 120ms, color 120ms;
}

.index-sort-tab.is-active {
  background: rgba(147, 228, 255, 0.2);
  border-color: rgba(147, 228, 255, 0.48);
  color: var(--blue);
}

.index-sort-tab:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

/* Group headers */
.index-group-header {
  margin: 0.55rem 0 0.2rem;
  padding: 0 0.1rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.50);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  flex-shrink: 0;
}

.index-group-header:first-child {
  margin-top: 0;
}

.index-group-header--sticky {
  position: sticky;
  top: 0;
  z-index: 2;
  margin: 0;
  padding: 0.42rem 0.45rem;
  background: rgba(7, 9, 26, 0.98);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.60);
  letter-spacing: 0.08em;
  font-size: 0.78rem;
}

/* Themes */
.index-themes-grid {
  display: flex;
  flex-direction: column;
  gap: 0.34rem;
}

.index-theme-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.76rem 0.7rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.08);
  text-align: left;
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 130ms, border-color 130ms;
}

.index-theme-chip:hover,
.index-theme-chip:active {
  background: rgba(147, 228, 255, 0.14);
  border-color: rgba(147, 228, 255, 0.40);
}

.index-chip-emoji {
  font-size: 1.38rem;
  line-height: 1;
  flex-shrink: 0;
}

.index-chip-label {
  flex: 1;
  font-size: 0.92rem;
  font-weight: 700;
  color: #ffffff;
  overflow: hidden;
  min-width: 0;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  white-space: normal;
  line-height: 1.25;
}

.index-chip-months {
  display: block;
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--blue);
  opacity: 0.85;
  line-height: 1;
}

.index-chip-badge {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 900;
  color: rgba(5, 10, 22, 0.95);
  background: var(--blue);
  border-radius: 4px;
  padding: 0.06rem 0.34rem;
  letter-spacing: 0.04em;
  line-height: 1.6;
  text-transform: uppercase;
}

.index-chip-count {
  flex-shrink: 0;
  font-size: 0.75rem;
  font-weight: 900;
  color: rgba(5, 10, 22, 0.95);
  background: var(--blue);
  border-radius: 5px;
  padding: 0.06rem 0.38rem;
  line-height: 1.5;
}

/* Keywords */
.index-keywords-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.index-keyword-chip {
  padding: 0.46rem 0.88rem;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.20);
  background: rgba(255, 255, 255, 0.09);
  color: rgba(255, 255, 255, 0.88);
  font-size: 0.96rem;
  font-weight: 600;
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 120ms, border-color 120ms, color 120ms;
}

.index-keyword-chip:hover,
.index-keyword-chip:active {
  background: rgba(147, 228, 255, 0.16);
  border-color: rgba(147, 228, 255, 0.38);
  color: var(--blue);
}

/* ── Help panel ──────────────────────────────────────────────────────────────── */
.help-panel {
  position: absolute;
  inset: 0;
  z-index: 10;
  background: #07091a;
  overflow-y: auto;
  padding: 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.help-close-btn {
  position: absolute;
  top: 0.8rem;
  right: 0.8rem;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.12);
  color: rgba(255, 255, 255, 0.85);
  font-size: 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  touch-action: manipulation;
  transition: background 130ms;
}

.help-close-btn:hover {
  background: rgba(255, 255, 255, 0.22);
}

.help-title {
  margin: 0 2.8rem 0.2rem 0;
  font-size: 1.1rem;
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.help-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.help-item {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

.help-item-icon {
  flex-shrink: 0;
  width: 2.8rem;
  height: 2.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(147, 228, 255, 0.12);
  border: 1px solid rgba(147, 228, 255, 0.25);
  font-size: 0.92rem;
  font-weight: 900;
  color: var(--blue);
  text-align: center;
  line-height: 1;
}

.help-item strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.14rem;
}

.help-item p {
  margin: 0;
  font-size: 0.84rem;
  color: rgba(255, 255, 255, 0.58);
  line-height: 1.38;
}

/* ── Help: settings section ─────────────────────────────────────────────────── */
.help-settings-label {
  margin: 0.4rem 0 0.1rem;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.38);
}

.help-setting-row {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.4rem 0;
}

.help-setting-body {
  flex: 1;
  min-width: 0;
}

.help-setting-body strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 0.1rem;
}

.help-setting-body p {
  margin: 0;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.55);
  line-height: 1.35;
}

/* iOS-style toggle switch */
.haptic-toggle {
  flex-shrink: 0;
  width: 52px;
  height: 30px;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  touch-action: manipulation;
  pointer-events: auto;
}

.haptic-toggle-track {
  display: block;
  width: 52px;
  height: 30px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.15);
  border: 1.5px solid rgba(255, 255, 255, 0.22);
  position: relative;
  transition: background 200ms, border-color 200ms;
}

.haptic-toggle[aria-pressed="true"] .haptic-toggle-track {
  background: #34c759;
  border-color: #34c759;
}

.haptic-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 22px;
  height: 22px;
  border-radius: 11px;
  background: #ffffff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.45);
  transition: transform 200ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.haptic-toggle[aria-pressed="true"] .haptic-toggle-thumb {
  transform: translateX(22px);
}

/* ── Page slide transition ───────────────────────────────────────────────────── */
@keyframes slide-from-right {
  from { transform: translateX(8%); opacity: 0.55; }
  to   { transform: translateX(0);  opacity: 1; }
}

@keyframes slide-from-left {
  from { transform: translateX(-8%); opacity: 0.55; }
  to   { transform: translateX(0);   opacity: 1; }
}

#page-image.slide-from-right {
  animation: slide-from-right 200ms ease-out forwards;
}

#page-image.slide-from-left {
  animation: slide-from-left 200ms ease-out forwards;
}

/* ── Small screens ───────────────────────────────────────────────────────────── */
@media (max-width: 400px) {
  :root {
    --key-height: 62px;
  }

  #page-image {
    object-position: top center;
  }

  .numberpad-display {
    font-size: 1.4rem;
    padding: 0.78rem 2.8rem 0.78rem 1rem;
  }

  .numberpad-key[data-digit] {
    font-size: 1.75rem;
  }

  .numberpad-key-muted {
    font-size: 0.92rem;
  }

  .numberpad-grid {
    gap: 0.45rem;
  }

  .numpad-util-row {
    gap: 0.45rem;
  }

  .drawer-nav-btn {
    width: 72px;
  }

  .drawer-nav-arrow {
    font-size: 2.1rem;
  }
}

@media (orientation: landscape) {
  :root {
    --drawer-width: clamp(280px, 36vw, 440px);
  }

  .viewer-shell {
    align-items: center;
    justify-items: center;
  }

  #page-image {
    max-width: min(
      calc(var(--viewport-width) - var(--safe-left) - var(--safe-right)),
      calc((var(--viewport-height) - var(--safe-top) - var(--safe-bottom)) * 1.7)
    );
  }
}
