﻿:root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color-scheme: dark;
  --berry: #94194f;
  --berry-glow: #b82666;
  --gold: #ffdb99;
  --glass-bg: rgba(20, 2, 11, 0.82);
  --glass-border: rgba(255, 255, 255, 0.12);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100vh;
  height: 100dvh;
  min-width: 320px;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 50%, #4d0b2b 0%, #280415 50%, #14010a 100%);
  color: #ffffff;
  display: flex;
  flex-direction: column;
}
button, input, a { -webkit-tap-highlight-color: transparent; font: inherit; outline-offset: 3px; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
button:focus-visible, a:focus-visible, input:focus-visible { outline: 2px solid #ffdb99; }
button:disabled { opacity: .25; cursor: default; }
[hidden] { display: none !important; }
svg {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

/* Top Header */
.header {
  height: 48px;
  min-height: 48px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--glass-border);
  z-index: 20;
  flex: none;
}
.header-left {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.brand {
  font-size: 24px;
  letter-spacing: -1px;
  font-weight: 900;
  line-height: 1;
  color: #ffffff;
  display: flex;
  align-items: baseline;
  gap: 3px;
  flex-shrink: 0;
}
.brand span {
  font-size: 13px;
  color: var(--gold);
}
.brand small { display: none; }
.header-caption { display: none; }
.header-campaign-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.top-campaign-title {
  color: rgba(255, 255, 255, 0.9);
  font-size: 12px;
  letter-spacing: 0.5px;
}
.top-page-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gold);
}
.contact-links {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.contact-links a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 700;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
}
.contact-links a:hover {
  transform: translateY(-1px);
  opacity: 0.95;
}
.contact-links .apply {
  background: linear-gradient(135deg, #ffe08a, #f5b942);
  color: #3b2200;
  box-shadow: 0 2px 8px rgba(245, 185, 66, 0.3);
}
.contact-links .instagram {
  background: linear-gradient(135deg, #773aca, #d32783 55%, #f59646);
  color: #fff;
  box-shadow: 0 2px 8px rgba(211, 39, 131, 0.3);
}
.contact-links .whatsapp {
  background: linear-gradient(135deg, #16a34a, #15803d);
  color: #fff;
  box-shadow: 0 2px 8px rgba(22, 163, 74, 0.3);
}
.contact-links svg { width: 15px; height: 15px; }
.contact-links small, .online-dot { display: none; }

/* Main Stage */
main#reader {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  background: transparent;
}
.campaign, .reader-meta, .reading-hint, main > footer {
  display: none;
}
.reader-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 0;
}
.stage {
  flex: 1;
  min-height: 0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}
.stage:after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 10%;
  right: 10%;
  height: 36px;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 50%, rgba(0, 0, 0, 0.75) 0%, rgba(0,0,0,0) 70%);
  filter: blur(14px);
  z-index: 1;
  pointer-events: none;
}
#book-position {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  z-index: 2;
  filter: drop-shadow(0 22px 45px rgba(0, 0, 0, 0.75)) drop-shadow(0 4px 12px rgba(0, 0, 0, 0.5));
}
#book-host {
  position: relative;
  transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1);
}
#book {
  position: relative;
}
.book-page {
  background: #ffffff;
  overflow: hidden;
  position: relative;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,0.08);
}
.page-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #ffffff;
  user-select: none;
  -webkit-user-drag: none;
}
.page-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  color: #ad8d9c;
  font-size: 12px;
  gap: 12px;
  text-align: center;
  background: #fdfafc;
}
.page-placeholder .spinner { margin: auto; width: 24px; height: 24px; }
.page-image:not([src]) { visibility: hidden; }
.page-image[src] + .page-placeholder { display: none; }

/* 3D Realistic Page Spine Shadows */
.book-page:after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.book-page.--right:after {
  background: linear-gradient(to right, rgba(0,0,0,0.22) 0%, rgba(0,0,0,0.06) 4%, rgba(0,0,0,0) 12%);
}
.book-page.--left:after {
  background: linear-gradient(to left, rgba(0,0,0,0.22) 0%, rgba(0,0,0,0.06) 4%, rgba(0,0,0,0) 12%);
}

/* Floating Navigation Arrows */
.side-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #ffffff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, color 0.2s, opacity 0.2s;
}
.side-arrow:hover:not(:disabled) {
  background: var(--berry);
  color: #ffffff;
  transform: translateY(-50%) scale(1.08);
}
.side-arrow:disabled {
  opacity: 0.15;
  cursor: default;
  pointer-events: none;
}
.side-arrow.left { left: 16px; }
.side-arrow.right { right: 16px; }
.side-arrow svg { width: 24px; height: 24px; }

/* Bottom Toolbar */
.bottom-controls {
  flex: none;
  height: 52px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 20;
  padding: 0 12px 6px;
}
.toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--glass-bg);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  box-shadow: var(--glass-shadow);
}
.toolbar button, .toolbar .tool {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 8px;
  background: none;
  color: rgba(255, 255, 255, 0.85);
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.toolbar button:hover:not(:disabled), .toolbar .tool:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}
.toolbar button:disabled {
  opacity: 0.28;
  cursor: default;
}
.toolbar svg { width: 18px; height: 18px; }
.tool-label { font-size: 11px; font-weight: 600; }
.divider {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 4px;
}
.pagination, .zoom-tools {
  display: flex;
  align-items: center;
  gap: 2px;
}
#page-form {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  white-space: nowrap;
}
#page-number {
  width: 34px;
  height: 28px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  border-radius: 6px;
  text-align: center;
  font-size: 12px;
  font-weight: 700;
  appearance: textfield;
  -moz-appearance: textfield;
}
#page-number::-webkit-inner-spin-button { appearance: none; }
#zoom-reset {
  font-size: 10px;
  font-weight: 600;
  min-width: 42px;
}
.progress-track {
  position: absolute;
  bottom: 1px;
  left: 50%;
  transform: translateX(-50%);
  width: 140px;
  height: 2px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  overflow: hidden;
}
#reading-progress {
  height: 100%;
  display: block;
  width: 0;
  background: linear-gradient(90deg, var(--berry), var(--gold));
  transition: width 0.35s ease;
}

/* Loading & Error States */
.state {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  text-align: center;
  padding: 24px;
  z-index: 5;
  background: radial-gradient(ellipse at 50% 50%, rgba(35, 4, 19, 0.95), rgba(18, 1, 9, 0.98));
}
.state h2 { font-size: 20px; color: #ffffff; margin: 20px 0 10px; }
.state p { max-width: 360px; font-size: 12px; line-height: 1.6; color: rgba(255, 255, 255, 0.7); margin: 0; }
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255, 255, 255, 0.15);
  border-top-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
.error-book { width: 44px; height: 44px; color: var(--gold); }
.error-actions { display: flex; gap: 12px; align-items: center; margin-top: 20px; font-size: 12px; }
.error-actions button {
  background: var(--berry);
  border: 0;
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 700;
}
.error-actions a { padding: 10px; color: var(--gold); }
.toast {
  position: fixed;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(18, 1, 9, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  max-width: 90vw;
  padding: 11px 20px;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  font-size: 12px;
  z-index: 40;
}

/* Thumbnails */
.thumbnails {
  position: absolute;
  left: 20px;
  right: 20px;
  bottom: 64px;
  background: rgba(20, 2, 11, 0.96);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 -8px 40px rgba(0, 0, 0, 0.7);
  border-radius: 14px;
  z-index: 30;
  padding: 12px 16px;
}
.thumb-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
}
.thumb-heading button {
  background: none;
  border: 0;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
}
.thumb-heading button:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
#thumbnail-list {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 10px 0 4px;
  max-height: 160px;
}
.thumbnail {
  flex: 0 0 76px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid transparent;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.7);
  font-size: 10px;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}
.thumbnail:hover, .thumbnail[aria-current="true"] {
  border-color: var(--berry-glow);
  background: rgba(184, 38, 102, 0.18);
  color: #ffffff;
}
.thumbnail img {
  width: 64px;
  height: 90px;
  object-fit: contain;
  display: block;
  margin-bottom: 4px;
  background: #ffffff;
  border-radius: 3px;
}

/* Zoom Viewport */
#zoom-viewport {
  position: absolute;
  inset: 0;
  z-index: 15;
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-x pan-y;
  background: rgba(14, 1, 8, 0.96);
  cursor: grab;
}
#zoom-viewport.dragging { cursor: grabbing; }
#zoom-pages {
  display: flex;
  gap: 4px;
  width: max-content;
  min-width: 100%;
  min-height: 100%;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
#zoom-pages img {
  display: block;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6);
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.stage.zoomed .side-arrow { display: none; }

/* Utilities */
.skip {
  position: fixed;
  top: 8px;
  left: 8px;
  transform: translateY(-160%);
  padding: 12px;
  background: #ffffff;
  color: #861044;
  z-index: 50;
}
.skip:focus { transform: none; }
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  min-width: 0 !important;
  padding: 0 !important;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0 !important;
}
.noscript { position: fixed; inset: 45% 10% auto; text-align: center; background: white; color: #333; padding: 20px; z-index: 50; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Fullscreen mode */
main:fullscreen { height: 100dvh; background: radial-gradient(ellipse at 50% 50%, #4d0b2b 0%, #280415 50%, #14010a 100%); }

/* Responsive Adjustments */
@media (max-width: 767px) {
  .header {
    height: 44px;
    min-height: 44px;
    padding: 0 8px;
    gap: 8px;
  }
  .brand {
    font-size: 20px;
  }
  .brand span {
    font-size: 11px;
  }
  .top-campaign-title {
    display: none;
  }
  .contact-links {
    gap: 6px;
  }
  .contact-links a {
    height: 28px;
    padding: 0 8px;
    font-size: 10px;
    gap: 4px;
  }
  .contact-links .apply {
    display: none;
  }
  .side-arrow {
    display: none;
  }
  .bottom-controls {
    height: 46px;
    padding: 0 6px 3px;
  }
  .toolbar {
    padding: 2px 6px;
    max-width: 100%;
    gap: 1px;
  }
  .toolbar button, .toolbar .tool {
    min-width: 32px;
    height: 32px;
    padding: 0 4px;
  }
  .tool-label, .divider.extra, .download {
    display: none !important;
  }
  #page-number {
    width: 28px;
    height: 26px;
    font-size: 11px;
  }
  .thumbnails {
    left: 8px;
    right: 8px;
    bottom: 52px;
  }
}

@media (max-width: 360px) {
  .header {
    padding: 0 4px;
    gap: 4px;
  }
  .brand {
    font-size: 17px;
  }
  .contact-links {
    gap: 4px;
  }
  .contact-links a {
    padding: 0 6px;
  }
  .contact-links a span {
    display: none;
  }
  #fullscreen {
    display: none;
  }
}

@media (max-height: 560px) and (min-width: 701px) {
  .header {
    height: 40px;
    min-height: 40px;
  }
  .bottom-controls {
    height: 42px;
  }
  .toolbar {
    padding: 2px 8px;
  }
  .toolbar button, .toolbar .tool {
    height: 30px;
  }
}
