/* ============================================================
   .reader — Minimalist Glass Reader
   4 themes: t-1 warm · t-2 ocean · t-3 pastel · t-4 dark-amber
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,600;0,700;1,400&family=Lora:ital,wght@0,400;0,500;1,400&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  --dur: 0.28s;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  --spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --hdr-h: 60px;
  --r: 18px;
  --r-sm: 10px;
  --max-w: 800px;
}

/* ─── THEME 1: warm beige (light default) ─── */
body.t-1 {
  --bg: #ede0d4;
  --bg-grad:
    radial-gradient(ellipse 60% 50% at 20% 10%, rgba(255,200,170,0.6) 0%, transparent 70%),
    radial-gradient(ellipse 50% 60% at 80% 20%, rgba(200,170,230,0.35) 0%, transparent 70%),
    radial-gradient(ellipse 70% 50% at 50% 90%, rgba(255,180,150,0.4) 0%, transparent 70%),
    #ede0d4;
  --text: #1a1625;
  --muted: rgba(26,22,37,0.5);
  --glass: rgba(255,255,255,0.46);
  --glass-b: rgba(255,255,255,0.76);
  --shadow: 0 4px 20px rgba(0,0,0,0.06), 0 1px 3px rgba(0,0,0,0.04);
  --hdr: rgba(237,224,212,0.78);
  --hdr-b: rgba(255,255,255,0.65);
  --menu: rgba(248,240,234,0.94);
  --div: rgba(0,0,0,0.07);
  --hov: rgba(0,0,0,0.05);
  --btn: linear-gradient(135deg,#1a1625,#2e2940);
  --btn-t: #f0ece8;
  --sb: rgba(26,22,37,0.18);
}

/* ─── THEME 2: ocean (light) ─── */
body.t-2 {
  --bg: #cde8f5;
  --bg-grad:
    radial-gradient(ellipse 60% 50% at 15% 10%, rgba(100,190,255,0.5) 0%, transparent 70%),
    radial-gradient(ellipse 50% 55% at 85% 25%, rgba(60,210,200,0.3) 0%, transparent 70%),
    radial-gradient(ellipse 65% 45% at 50% 88%, rgba(80,160,240,0.38) 0%, transparent 70%),
    #cde8f5;
  --text: #0c2b3e;
  --muted: rgba(12,43,62,0.5);
  --glass: rgba(255,255,255,0.44);
  --glass-b: rgba(255,255,255,0.74);
  --shadow: 0 4px 20px rgba(0,40,80,0.07), 0 1px 3px rgba(0,40,80,0.04);
  --hdr: rgba(205,232,245,0.8);
  --hdr-b: rgba(255,255,255,0.65);
  --menu: rgba(224,242,255,0.95);
  --div: rgba(0,60,120,0.08);
  --hov: rgba(0,80,160,0.06);
  --btn: linear-gradient(135deg,#0d4a70,#1a8abf);
  --btn-t: #f0f8ff;
  --sb: rgba(0,80,160,0.2);
}

/* ─── THEME 3: pastel lilac (light) ─── */
body.t-3 {
  --bg: #f0e4f6;
  --bg-grad:
    radial-gradient(ellipse 60% 50% at 18% 12%, rgba(255,180,220,0.5) 0%, transparent 70%),
    radial-gradient(ellipse 50% 55% at 82% 22%, rgba(200,210,255,0.4) 0%, transparent 70%),
    radial-gradient(ellipse 65% 45% at 50% 88%, rgba(255,200,240,0.4) 0%, transparent 70%),
    #f0e4f6;
  --text: #2a1840;
  --muted: rgba(42,24,64,0.5);
  --glass: rgba(255,255,255,0.48);
  --glass-b: rgba(255,255,255,0.78);
  --shadow: 0 4px 20px rgba(80,0,100,0.06), 0 1px 3px rgba(80,0,100,0.03);
  --hdr: rgba(240,228,246,0.8);
  --hdr-b: rgba(255,255,255,0.7);
  --menu: rgba(250,238,252,0.95);
  --div: rgba(100,0,130,0.07);
  --hov: rgba(140,0,180,0.05);
  --btn: linear-gradient(135deg,#6b2d8b,#9b4dc8);
  --btn-t: #fff0ff;
  --sb: rgba(120,0,160,0.18);
}

/* ─── THEME 4: dark amber ─── */
body.t-4 {
  --bg: #0e0c08;
  --bg-grad:
    radial-gradient(ellipse 55% 45% at 15% 15%, rgba(255,180,0,0.14) 0%, transparent 70%),
    radial-gradient(ellipse 45% 55% at 85% 20%, rgba(200,100,0,0.11) 0%, transparent 70%),
    radial-gradient(ellipse 60% 50% at 50% 85%, rgba(255,140,0,0.09) 0%, transparent 70%),
    #0e0c08;
  --text: #f5ead2;
  --muted: rgba(245,234,210,0.48);
  --glass: rgba(255,200,50,0.04);
  --glass-b: rgba(255,200,50,0.1);
  --shadow: 0 4px 24px rgba(0,0,0,0.42), 0 1px 4px rgba(0,0,0,0.28);
  --hdr: rgba(14,12,8,0.82);
  --hdr-b: rgba(255,200,50,0.1);
  --menu: rgba(20,17,8,0.96);
  --div: rgba(255,200,50,0.08);
  --hov: rgba(255,180,0,0.07);
  --btn: linear-gradient(135deg,#b07000,#e09820);
  --btn-t: #0e0c08;
  --sb: rgba(230,160,30,0.25);
}

/* ============================================================
   BASE
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Lora', Georgia, serif;
  min-height: 100vh;
  padding-top: var(--hdr-h);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  transition: color var(--dur) var(--ease), background var(--dur) var(--ease);
  scrollbar-width: thin;
  scrollbar-color: var(--sb) transparent;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--bg-grad);
  transition: background var(--dur) var(--ease);
}

body::-webkit-scrollbar { width: 5px; }
body::-webkit-scrollbar-track { background: transparent; }
body::-webkit-scrollbar-thumb { background: var(--sb); border-radius: 6px; }

/* ============================================================
   HEADER
   ============================================================ */
header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--hdr-h);
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 24px;
  background: var(--hdr);
  border-bottom: 1px solid var(--hdr-b);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease);
}

.site-title {
  font-family: 'Playfair Display', serif;
  font-weight: 700;
  font-size: 20px;
  letter-spacing: 0.2px;
  cursor: default;
  user-select: none;
  color: var(--text);
  transition: opacity 0.15s;
}
.site-title:hover { opacity: 0.6; }

/* ============================================================
   MENU
   ============================================================ */
.menu-container { position: relative; display: flex; align-items: center; }

.hamburger {
  width: 26px; height: 26px;
  cursor: pointer; flex-shrink: 0;
  transition: transform 0.15s var(--spring), opacity 0.15s;
}
.hamburger:hover { opacity: 0.6; transform: scale(1.1); }
.hamburger:active { transform: scale(0.88); }

.menu-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 230px;
  border-radius: var(--r);
  padding: 5px 0;
  list-style: none;
  overflow-y: auto;
  max-height: calc(100vh - var(--hdr-h) - 20px);
  opacity: 0;
  transform: translateY(-8px) scale(0.96);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity var(--dur) var(--ease), transform var(--dur) var(--spring);
  z-index: 200;
  background: var(--menu);
  border: 1px solid var(--glass-b);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  box-shadow: var(--shadow);
  scrollbar-width: thin;
  scrollbar-color: var(--sb) transparent;
}

.menu-list.show {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.menu-list li a {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 15px;
  font-family: 'Lora', serif;
  font-size: 13px;
  color: var(--text);
  transition: background 0.15s, padding-left 0.15s;
}
.menu-list li a::before { content: '§'; font-size: 9px; opacity: 0.3; flex-shrink: 0; }
.menu-list li a:hover { background: var(--hov); padding-left: 20px; }
.menu-list li a:hover::before { opacity: 0.6; }

.menu-list li:last-child {
  padding: 6px 10px;
  margin-top: 2px;
  border-top: 1px solid var(--div);
}

.theme-button {
  width: 100%;
  padding: 8px 12px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  border-radius: var(--r-sm);
  background: var(--btn);
  color: var(--btn-t);
  transition: opacity 0.15s, transform 0.15s var(--spring);
  letter-spacing: 0.1px;
}
.theme-button:hover  { opacity: 0.85; transform: translateY(-1px); }
.theme-button:active { transform: scale(0.96); opacity: 1; }

/* ============================================================
   BOOK INFO
   ============================================================ */
.book-info {
  display: flex;
  align-items: flex-start;
  padding: 32px 24px 20px;
  gap: 22px;
  max-width: var(--max-w);
  margin: 0 auto;
}

.cover {
  width: 115px;
  aspect-ratio: 2/3;
  object-fit: cover;
  border-radius: 10px;
  flex-shrink: 0;
  box-shadow: var(--shadow);
  transition: transform var(--dur) var(--spring);
}
.cover:hover { transform: translateY(-4px) scale(1.02); }

.description { padding-top: 2px; }
.description h2 {
  font-family: 'Playfair Display', serif;
  font-size: 22px; font-weight: 700;
  margin-bottom: 10px; line-height: 1.3;
  color: var(--text);
}
.description p {
  margin: 4px 0;
  font-size: 13px;
  color: var(--muted);
  font-style: italic;
}

/* ============================================================
   CHAPTER CARDS
   ============================================================ */
.chapters-container {
  padding: 0 24px 60px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: var(--max-w);
  margin: 0 auto;
}

.chapter-card {
  border-radius: var(--r);
  padding: 22px 26px;
  background: var(--glass);
  border: 1px solid var(--glass-b);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
  transition:
    transform var(--dur) var(--spring),
    box-shadow var(--dur) var(--ease),
    background var(--dur) var(--ease),
    border-color var(--dur) var(--ease);
}
.chapter-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 30px rgba(0,0,0,0.11), 0 2px 6px rgba(0,0,0,0.06);
}
body.t-4 .chapter-card:hover {
  box-shadow: 0 10px 30px rgba(0,0,0,0.48), 0 2px 6px rgba(0,0,0,0.3);
}

.chapter-title {
  font-family: 'Playfair Display', serif;
  font-weight: 600;
  font-size: 16px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  color: var(--text);
  border-bottom: 1px solid var(--div);
  transition: border-color var(--dur) var(--ease);
}

.chapter-text {
  font-family: 'Lora', Georgia, serif;
  line-height: 1.85;
  font-size: 15.5px;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text);
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 600px) {
  header { padding: 0 16px; }
  .book-info { flex-direction: column; align-items: center; text-align: center; padding: 20px 16px 14px; gap: 14px; }
  .cover { width: 120px; }
  .chapters-container { padding: 0 12px 44px; gap: 10px; }
  .chapter-card { padding: 18px 18px; border-radius: 14px; }
  .description h2 { font-size: 20px; }
  .chapter-text { font-size: 15px; }
  .menu-list { width: 210px; }
}


/* Контейнер всей конструкции слева */
.left-progress-container {
    position: fixed;
    left: 12px; /* Чуть сдвинули от края для видимости свечения */
    top: 50%;
    transform: translateY(-50%);
    height: 50vh; /* Сделали чуть длиннее для лучшего перелива цвета */
    display: flex;
    flex-direction: column;
    align-items: center;
    z-index: 99;
    pointer-events: none;
}

/* Задняя подложка (тусклая серая линия-направляющая) */
.progress-line-bg {
    width: 3px; /* Сделали чуть толще (3px вместо 2px), чтобы неоновый градиент лучше читался */
    height: 100%;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 4px;
    position: relative;
}

/* Активная заполняющаяся линия с неоновым градиентом */
.progress-line-fill {
    width: 100%;
    height: 0%; /* Стартует с нуля, управляется через JS */
    border-radius: 4px;
    transition: height 0.1s ease-out;
    position: absolute;
    top: 0;
    left: 0;

    /* Жесткий кислотный градиент: Красный -> Желтый -> Зеленый */
    background: linear-gradient(to bottom, 
        #ff3b30 0%, 
        #ff9500 35%,
        #ffcc00 60%, 
        #4cd964 100%
    );

    /* Многослойное неоновое свечение (размытие разного радиуса) */
    box-shadow: 
        0 0 4px rgba(255, 60, 50, 0.6),
        0 0 10px rgba(255, 200, 0, 0.4),
        0 0 15px rgba(75, 215, 100, 0.5);
}

/* Текст с процентами под линией */
.progress-text {
    font-family: 'Courier New', Courier, monospace;
    font-size: 11px;
    font-weight: bold;
    margin-top: 10px;
    opacity: 0.2;
    color: #fff;
    transition: opacity 0.3s, color 0.3s;
    text-shadow: 0 0 5px currentColor; /* Текст тоже слегка подсвечивается */
}
/* Всплывающая микро-кнопка над текстом */
.quote-tooltip {
    position: absolute;
    z-index: 1000;
    background: #000;
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    padding: 6px 12px;
    font-size: 12px;
    font-family: monospace;
    border-radius: 4px;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    animation: fadeIn 0.2s ease-out;
}

/* Оверлей модального окна (размывает весь задний фон сайта) */
.quote-modal {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    z-index: 10000;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.quote-modal-content {
    width: 100%;
    max-width: 360px;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* Сама генерируемая карточка для скриншота */
.quote-card-preview {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 30px 25px;
    border-radius: 12px;
    position: relative;
    box-shadow: 0 20px 40px rgba(0,0,0,0.4);
    text-align: center;
}

.quote-card-book {
    font-size: 10px;
    font-family: monospace;
    letter-spacing: 2px;
    opacity: 0.4;
    text-transform: uppercase;
    margin-bottom: 20px;
}

.quote-card-text {
    font-size: 16px;
    line-height: 1.6;
    font-style: italic;
    color: #fff;
    font-family: Georgia, serif;
}

.quote-card-watermark {
    font-size: 9px;
    font-family: monospace;
    opacity: 0.2;
    margin-top: 25px;
    letter-spacing: 1px;
}

/* Кнопки управления */
.quote-modal-actions {
    display: flex;
    gap: 10px;
}

.quote-modal-actions button {
    flex: 1;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #fff;
    padding: 10px;
    border-radius: 6px;
    font-family: monospace;
    cursor: pointer;
    transition: 0.2s;
}

.quote-modal-actions button:hover {
    background: rgba(255, 255, 255, 0.2);
}

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