/* ═══════════════════════════════════════════════════════════════════════════════
   SEHAJ PAATH READER — ULTRA-SMOOTH READING EXPERIENCE
   Zero Flicker • GPU Optimized • 2 Themes (Dark + Light)
   ═══════════════════════════════════════════════════════════════════════════════ */

/* ═══════════════════════════════════════════════════════════════════════════════
   DESIGN TOKENS
   ═══════════════════════════════════════════════════════════════════════════════ */

:root {
    /* Dark Theme (Default) */
    --bg-primary: #0a0a0c;
    --bg-secondary: #1c1c1e;
    --bg-gradient: linear-gradient(180deg, #0a0a0c 0%, #111118 50%, #0f0f15 100%);

    --glass-bg: rgba(255, 255, 255, 0.07);
    --glass-bg-hover: rgba(255, 255, 255, 0.11);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-glow: rgba(212, 175, 55, 0.12);

    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.70);
    --text-tertiary: rgba(255, 255, 255, 0.45);

    --text-gurmukhi: #FFE4B5;
    --text-gurmukhi-glow: rgba(255, 228, 181, 0.25);
    --translation-color: rgba(176, 196, 222, 0.90);
    --transliteration-color: rgba(200, 180, 255, 0.85);

    --sehaj-gold: #D4AF37;
    --sehaj-gold-light: #F5E6C4;
    --sehaj-saffron: #FF9500;

    --font-primary: 'Inter', -apple-system, sans-serif;
    --font-gurmukhi: 'Noto Sans Gurmukhi', 'Mukta Mahee', sans-serif;
    --gurmukhi-size: 24px;
    --line-height: 2.2;

    --safe-top: env(safe-area-inset-top, 20px);
    --safe-bottom: env(safe-area-inset-bottom, 34px);
    --header-height: 70px;
    --footer-height: 80px;

    --ease-out-expo: cubic-bezier(0.19, 1, 0.22, 1);
    --ease-spring: cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   THEMES — Only Dark + Light
   ═══════════════════════════════════════════════════════════════════════════════ */

/* 🌙 Dark Theme */
[data-theme="dark"],
[data-theme="gradient"],
[data-theme="oled"],
[data-theme="rainbow"] {
    --bg-primary: #0a0a0c;
    --bg-secondary: #1c1c1e;
    --bg-gradient: linear-gradient(180deg, #0a0a0c 0%, #111118 50%, #0f0f15 100%);
    --glass-bg: rgba(255, 255, 255, 0.07);
    --glass-bg-hover: rgba(255, 255, 255, 0.11);
    --glass-border: rgba(255, 255, 255, 0.10);
    --glass-glow: rgba(212, 175, 55, 0.12);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.70);
    --text-tertiary: rgba(255, 255, 255, 0.45);
    --text-gurmukhi: #FFE4B5;
    --text-gurmukhi-glow: rgba(255, 228, 181, 0.25);
    --translation-color: rgba(176, 196, 222, 0.90);
    --transliteration-color: rgba(200, 180, 255, 0.85);
    --sehaj-gold: #D4AF37;
}

/* ☀️ Light Theme */
[data-theme="light"],
[data-theme="sepia"],
[data-theme="auto"] {
    --bg-primary: #F5F3EE;
    --bg-secondary: #ffffff;
    --bg-gradient: linear-gradient(180deg, #ffffff 0%, #F8F5F0 50%, #f0ebe3 100%);
    --glass-bg: rgba(255, 255, 255, 0.92);
    --glass-bg-hover: rgba(255, 255, 255, 0.98);
    --glass-border: rgba(0, 0, 0, 0.08);
    --glass-glow: rgba(212, 175, 55, 0.08);
    --text-primary: #1a1a1a;
    --text-secondary: rgba(0, 0, 0, 0.60);
    --text-tertiary: rgba(0, 0, 0, 0.40);
    --text-gurmukhi: #1E3A5F;
    --text-gurmukhi-glow: rgba(30, 58, 95, 0.10);
    --translation-color: #4A5568;
    --transliteration-color: #6B46C1;
    --sehaj-gold: #B8860B;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BASE RESET — NO FLICKER
   ═══════════════════════════════════════════════════════════════════════════════ */

*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
}

body {
    font-family: var(--font-primary);
    background: var(--bg-gradient);
    color: var(--text-primary);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Subtle ambient glow — STATIC, no animation to prevent repaints */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background:
        radial-gradient(ellipse at 20% 20%, var(--glass-glow) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(139, 92, 246, 0.06) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
    opacity: 0.6;
    /* NO animation — prevents full-viewport repaints */
}

/* ═══════════════════════════════════════════════════════════════════════════════
   BACKGROUND BLUR ORBS - iOS INSPIRED
   ═══════════════════════════════════════════════════════════════════════════════ */

.bg-orbs {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}

.orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: float 25s ease-in-out infinite;
    transition: background 1.5s ease, transform 0.5s ease-out, opacity 0.5s ease;
}

/* Dark theme orbs */
[data-theme="dark"] .orb-1 {
    width: 400px;
    height: 400px;
    background: conic-gradient(from 0deg, #D4AF37, #FF8C00, #FFD700, #D4AF37);
    top: -150px;
    right: -100px;
}

[data-theme="dark"] .orb-2 {
    width: 300px;
    height: 300px;
    background: conic-gradient(from 180deg, #AF52DE, #5856D6, #007AFF, #AF52DE);
    bottom: 20%;
    left: -120px;
    animation-delay: -12s;
}

[data-theme="dark"] .orb-3 {
    width: 250px;
    height: 250px;
    background: conic-gradient(from 90deg, #30D158, #34C759, #32D74B, #30D158);
    bottom: -80px;
    right: 20%;
    animation-delay: -18s;
}

/* Light theme orbs - Minimal iOS inspired */
[data-theme="light"] .orb-1 {
    width: 300px;
    height: 300px;
    background: conic-gradient(from 0deg, #007AFF, #5AC8FA, #34C759, #007AFF);
    top: -120px;
    right: -80px;
    opacity: 0.1;
}

[data-theme="light"] .orb-2 {
    width: 250px;
    height: 250px;
    background: conic-gradient(from 180deg, #FF2D55, #FF375F, #FF9500, #FF2D55);
    bottom: 15%;
    left: -100px;
    animation-delay: -12s;
    opacity: 0.08;
}

[data-theme="light"] .orb-3 {
    width: 200px;
    height: 200px;
    background: conic-gradient(from 90deg, #AF52DE, #BF5AF2, #007AFF, #AF52DE);
    bottom: -60px;
    right: 10%;
    opacity: 0.08;
}

@keyframes float {
    0%, 100% { transform: translate(0, 0) rotate(0deg); }
    33% { transform: translate(30px, -30px) rotate(120deg); }
    66% { transform: translate(-20px, 20px) rotate(240deg); }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   LOADING OVERLAY
   ═══════════════════════════════════════════════════════════════════════════════ */

.loading-overlay {
    position: fixed;
    inset: 0;
    background: var(--bg-gradient);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s ease, visibility 0.5s;
}

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

.loading-content {
    text-align: center;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    margin: 0 auto 24px;
    position: relative;
}

.loading-spinner::before {
    content: '☬';
    font-size: 48px;
    color: var(--sehaj-gold);
    animation: sacredSpin 2s linear infinite;
    filter: drop-shadow(0 0 15px var(--sehaj-gold));
}

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

.loading-text {
    font-family: var(--font-gurmukhi);
    color: var(--text-gurmukhi);
    font-size: 18px;
    opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   READER CONTAINER — STABLE LAYOUT (NO PADDING TRANSITIONS)
   Content uses FIXED top/bottom padding — never changes.
   Header/Footer slide in/out via transform without affecting content.
   ═══════════════════════════════════════════════════════════════════════════════ */

.reader-container {
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    z-index: 1;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   READING PROGRESS BAR (Top)
   ═══════════════════════════════════════════════════════════════════════════════ */

.reading-progress-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: rgba(139, 92, 246, 0.15);
    z-index: 2000;
    overflow: hidden;
}

.reading-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #667eea 0%, #764ba2 50%, #EC4899 100%);
    transition: width 0.3s ease-out;
    box-shadow: 0 0 8px rgba(139, 92, 246, 0.4);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   HEADER — GLASS, GPU-COMPOSITED HIDE/SHOW
   Uses transform only — no layout reflow
   ═══════════════════════════════════════════════════════════════════════════════ */

.reader-header {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding-top: var(--safe-top);
    transform: translateY(0);
    transition: transform 0.35s var(--ease-out-expo), opacity 0.35s;
    will-change: transform;
}

.reader-header.hidden {
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
}

.header-blur {
    position: absolute;
    inset: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-bottom: 1px solid var(--glass-border);
}

.header-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    height: var(--header-height);
}

.header-btn {
    width: 44px;
    height: 44px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.header-btn:active {
    transform: scale(0.92);
}

.header-btn svg {
    width: 22px;
    height: 22px;
}

.header-btn.bookmarked svg {
    fill: var(--sehaj-gold);
    stroke: var(--sehaj-gold);
    filter: drop-shadow(0 0 6px var(--sehaj-gold));
}

.header-center {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ang-label {
    font-family: var(--font-gurmukhi);
    font-size: 12px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.ang-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--sehaj-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.header-actions {
    display: flex;
    gap: 10px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SEEK BAR
   ═══════════════════════════════════════════════════════════════════════════════ */

.seek-bar-container {
    position: relative;
    padding: 0 16px 12px;
}

.seek-bar {
    width: 100%;
    height: 6px;
    background: var(--glass-border);
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
    cursor: pointer;
}

.seek-bar::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: linear-gradient(135deg, var(--sehaj-gold) 0%, var(--sehaj-saffron) 100%);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(212, 175, 55, 0.5);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   MAIN CONTENT — STABLE HEIGHT, NEVER CHANGES PADDING
   The padding is always present regardless of header/footer visibility.
   This is THE KEY to preventing flicker.
   ═══════════════════════════════════════════════════════════════════════════════ */

.gurbani-content {
    flex: 1;
    overflow: hidden;
    /* FIXED padding — NEVER changes in normal mode. Header/footer overlay on top. */
    padding-top: calc(var(--header-height) + var(--safe-top) + 10px);
    padding-bottom: calc(var(--footer-height) + var(--safe-bottom) + 10px);
    /* Smooth padding transition for continuous mode fullscreen */
    transition: padding 0.35s var(--ease-out-expo);
}

/* ═══ FULL SCREEN in Continuous Mode when UI is hidden ═══ */
.reader-container.fullscreen-reading .gurbani-content {
    padding-top: 10px;
    padding-bottom: 10px;
}

.gurbani-scroll {
    height: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 20px 16px;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    /* Single GPU layer for the scroll container */
    transform: translateZ(0);
    contain: layout style;
}

/* Custom Scrollbar */
.gurbani-scroll::-webkit-scrollbar {
    width: 4px;
}
.gurbani-scroll::-webkit-scrollbar-track {
    background: transparent;
}
.gurbani-scroll::-webkit-scrollbar-thumb {
    background: var(--glass-border);
    border-radius: 4px;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SECTION HEADER — RAAG NAME
   ═══════════════════════════════════════════════════════════════════════════════ */

.section-header {
    text-align: center;
    margin-bottom: 32px;
    padding: 16px;
    background: var(--glass-bg);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
}

.raag-name {
    font-family: var(--font-gurmukhi);
    font-size: 17px;
    color: var(--sehaj-gold);
    letter-spacing: 0.05em;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   GURBANI LINES — CLEAN MINIMAL DESIGN (NITNEM-STYLE)
   Simple lines with subtle dividers, no boxy cards
   ═══════════════════════════════════════════════════════════════════════════════ */

.gurbani-lines {
    max-width: 800px;
    margin: 0 auto;
    contain: content;
}

.gurbani-line {
    margin-bottom: 0;
    padding: 20px 20px;
    border-radius: 0;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--glass-border);
    position: relative;
    overflow: hidden;
    /* Simple fade-in */
    animation: lineAppear 0.4s ease-out backwards;
    contain: layout style paint;
}

.gurbani-line:nth-child(1) { animation-delay: 0.05s; }
.gurbani-line:nth-child(2) { animation-delay: 0.08s; }
.gurbani-line:nth-child(3) { animation-delay: 0.11s; }
.gurbani-line:nth-child(4) { animation-delay: 0.14s; }
.gurbani-line:nth-child(5) { animation-delay: 0.17s; }
.gurbani-line:nth-child(n+6) { animation-delay: 0.20s; }

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

/* Remove the corner glow decoration */
.gurbani-line::after {
    display: none;
}

/* Content visibility for off-screen verses */
.gurbani-line {
    content-visibility: auto;
    contain-intrinsic-size: 0 120px;
}

/* GURMUKHI TEXT */
.gurmukhi-text {
    font-family: var(--font-gurmukhi);
    font-size: var(--gurmukhi-size);
    line-height: var(--line-height);
    color: var(--text-gurmukhi);
    margin-bottom: 10px;
    word-wrap: break-word;
    text-align: center;
    text-shadow: none;
    letter-spacing: 0.02em;
    font-weight: 400;
}

.gurmukhi-text.larivaar {
    word-spacing: 0;
    letter-spacing: 0.02em;
}

/* TRANSLATION TEXT */
.translation-text {
    font-size: 14px;
    line-height: 1.6;
    color: var(--translation-color);
    font-style: italic;
    text-align: center;
    padding: 8px 8px 0;
    border-top: none;
    margin-top: 8px;
    opacity: 0.85;
}

.translation-text::before {
    display: none;
}

/* TRANSLITERATION TEXT */
.transliteration-text {
    font-size: 13px;
    line-height: 1.5;
    color: var(--transliteration-color);
    text-align: center;
    font-family: 'Georgia', serif;
    letter-spacing: 0.03em;
    padding: 0 8px;
    margin-top: 4px;
    opacity: 0.8;
}

/* LINE NUMBER */
.line-number {
    position: absolute;
    top: 8px;
    left: 10px;
    font-size: 10px;
    color: var(--text-tertiary);
    font-weight: 500;
    opacity: 0.4;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   CONTINUOUS READING MODE — TRULY FULL SCREEN
   Content fills entire screen. Header/footer hidden by default.
   Lines flow one after another with zero gap.
   ═══════════════════════════════════════════════════════════════════════════════ */

.gurbani-lines.continuous-mode {
    display: block;
}

.gurbani-lines.continuous-mode .gurbani-line {
    display: block;
    margin-bottom: 0;
    padding: 6px 20px;
    background: transparent;
    border: none;
    border-radius: 0;
    animation: none;
    contain: layout style;
}

.gurbani-lines.continuous-mode .gurbani-line::after {
    display: none;
}

.gurbani-lines.continuous-mode .gurmukhi-text {
    margin-bottom: 0;
    text-align: left;
    display: block;
    line-height: 2.2;
    text-shadow: none;
}

.gurbani-lines.continuous-mode .translation-text,
.gurbani-lines.continuous-mode .transliteration-text {
    display: none !important;
}

.gurbani-lines.continuous-mode .line-number {
    display: none !important;
}

/* Light theme continuous mode border fix */
[data-theme="light"] .gurbani-lines.continuous-mode .gurbani-line,
[data-theme="sepia"] .gurbani-lines.continuous-mode .gurbani-line,
[data-theme="auto"] .gurbani-lines.continuous-mode .gurbani-line {
    border-bottom-color: rgba(0, 0, 0, 0.03);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PARAGRAPH MODE — Tight grouping, minimal spacing
   All Gurbani flows closely together like a paragraph
   ═══════════════════════════════════════════════════════════════════════════════ */

.gurbani-lines.paragraph-mode .gurbani-line {
    margin-bottom: 2px;
    padding: 6px 16px;
    background: transparent;
    border: none;
    border-radius: 0;
    animation: none;
}

.gurbani-lines.paragraph-mode .gurbani-line::after {
    display: none;
}

.gurbani-lines.paragraph-mode .gurmukhi-text {
    margin-bottom: 0;
    text-align: left;
    line-height: 2.0;
    text-shadow: none;
}

.gurbani-lines.paragraph-mode .translation-text {
    margin-top: 2px;
    padding-top: 2px;
    border-top: none;
    font-size: 13px;
    text-align: left;
}

.gurbani-lines.paragraph-mode .translation-text::before {
    display: none;
}

.gurbani-lines.paragraph-mode .transliteration-text {
    text-align: left;
    font-size: 13px;
}

.gurbani-lines.paragraph-mode .line-number {
    display: none !important;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   LARIVAAR MODE
   ═══════════════════════════════════════════════════════════════════════════════ */

body.larivaar-mode .gurmukhi-text {
    word-spacing: -0.25em;
    letter-spacing: 0.02em;
    word-break: break-word;
    overflow-wrap: break-word;
}

body.larivaar-assist .gurmukhi-text .word-alt {
    color: var(--sehaj-gold);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   ANG INFO / COMPLETION
   ═══════════════════════════════════════════════════════════════════════════════ */

.ang-info {
    text-align: center;
    padding: 32px 20px;
    margin-top: 24px;
    background: var(--glass-bg);
    border-radius: 20px;
    border: 1px solid var(--glass-border);
}

.ang-info::before {
    content: '☬';
    display: block;
    font-size: 28px;
    color: var(--sehaj-gold);
    margin-bottom: 12px;
    filter: drop-shadow(0 0 10px var(--sehaj-gold));
}

.ang-info-text {
    font-size: 14px;
    color: var(--text-secondary);
    font-family: var(--font-gurmukhi);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FOOTER — GPU-COMPOSITED, NO LAYOUT REFLOW
   ═══════════════════════════════════════════════════════════════════════════════ */

.reader-footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 100;
    padding-bottom: var(--safe-bottom);
    transform: translateY(0);
    transition: transform 0.35s var(--ease-out-expo), opacity 0.35s;
    will-change: transform;
}

.reader-footer.hidden {
    transform: translateY(100%);
    opacity: 0;
    pointer-events: none;
}

.footer-blur {
    position: absolute;
    inset: 0;
    background: var(--glass-bg);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    border-top: 1px solid var(--glass-border);
}

.footer-content {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    height: var(--footer-height);
}

.nav-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 18px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s;
}

.nav-btn:active {
    transform: scale(0.93);
}

.nav-btn:disabled {
    opacity: 0.3;
    pointer-events: none;
}

.nav-btn svg {
    width: 18px;
    height: 18px;
}

.footer-center {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}

.reading-stats {
    display: flex;
    gap: 16px;
}

.stat {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 13px;
    color: var(--text-secondary);
}

.stat-icon { font-size: 14px; }

.progress-mini {
    display: flex;
    align-items: center;
    gap: 8px;
}

.progress-bar-mini {
    width: 80px;
    height: 5px;
    background: var(--glass-border);
    border-radius: 3px;
    overflow: hidden;
}

.progress-fill-mini {
    height: 100%;
    background: linear-gradient(90deg, var(--sehaj-gold) 0%, var(--sehaj-saffron) 100%);
    border-radius: 3px;
    transition: width 0.4s ease-out;
}

.progress-text-mini {
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 36px;
    font-weight: 600;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   QUICK ACTIONS OVERLAY
   ═══════════════════════════════════════════════════════════════════════════════ */

.quick-actions-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.quick-actions-overlay.active {
    opacity: 1;
    visibility: visible;
}

.quick-actions-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(15px);
}

.quick-actions-panel {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 24px;
    max-width: 340px;
    width: 90%;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s var(--ease-spring);
}

.quick-actions-overlay.active .quick-actions-panel {
    transform: scale(1);
    opacity: 1;
}

.actions-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 14px;
}

.action-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 14px 10px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    color: var(--text-primary);
    cursor: pointer;
    transition: transform 0.2s;
}

.action-btn:active { transform: scale(0.93); }
.action-icon { font-size: 26px; }
.action-btn span { font-size: 11px; color: var(--text-secondary); font-weight: 500; }

.divider {
    height: 1px;
    background: var(--glass-border);
    margin: 16px 0;
}

.close-actions-btn {
    position: absolute;
    bottom: -60px;
    left: 50%;
    transform: translateX(-50%);
    width: 46px;
    height: 46px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 22px;
    cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SETTINGS PANEL
   ═══════════════════════════════════════════════════════════════════════════════ */

.settings-panel {
    position: fixed;
    inset: 0;
    z-index: 300;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.settings-panel.active {
    opacity: 1;
    visibility: visible;
}

.settings-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(4px);
}

.settings-content {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 90%;
    max-width: 400px;
    background: var(--bg-secondary);
    transform: translateX(100%);
    transition: transform 0.35s var(--ease-out-expo);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: -8px 0 40px rgba(0, 0, 0, 0.3);
}

.settings-panel.active .settings-content {
    transform: translateX(0);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid var(--glass-border);
    padding-top: calc(20px + var(--safe-top));
    background: var(--glass-bg);
}

.settings-header h2 {
    font-size: 20px;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, var(--text-primary) 0%, var(--sehaj-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.close-settings-btn {
    width: 36px;
    height: 36px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    color: var(--text-primary);
    font-size: 20px;
    cursor: pointer;
}

.settings-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
    padding-bottom: calc(20px + var(--safe-bottom));
}

.settings-section {
    margin-bottom: 28px;
}

.settings-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: var(--sehaj-gold);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.setting-item { margin-bottom: 20px; }

.setting-item label {
    display: block;
    font-size: 15px;
    margin-bottom: 10px;
    color: var(--text-primary);
    font-weight: 500;
}

.toggle-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    margin-bottom: 10px;
}

.toggle-item label { margin-bottom: 0; }

/* Toggle Switch — iOS Style */
.toggle {
    position: relative;
    width: 51px;
    height: 31px;
    cursor: pointer;
}

.toggle input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle .toggle-slider {
    position: absolute;
    inset: 0;
    background: var(--glass-border);
    border-radius: 31px;
    transition: background 0.25s ease;
}

.toggle .toggle-slider::before {
    content: '';
    position: absolute;
    width: 27px;
    height: 27px;
    left: 2px;
    top: 2px;
    background: white;
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

.toggle input:checked + .toggle-slider {
    background: linear-gradient(135deg, #34C759 0%, #30D158 100%);
}

.toggle input:checked + .toggle-slider::before {
    transform: translateX(20px);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   THEME SELECTOR — 2 THEMES ONLY (Dark + Light)
   ═══════════════════════════════════════════════════════════════════════════════ */

.theme-selector-modern {
    display: flex;
    gap: 8px;
    padding: 5px;
    background: var(--glass-bg);
    border-radius: 16px;
    border: 1px solid var(--glass-border);
    margin-bottom: 12px;
}

.theme-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-radius: 12px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.theme-pill.active {
    background: linear-gradient(135deg, var(--sehaj-gold) 0%, var(--sehaj-saffron) 100%);
    color: #000;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.35);
    font-weight: 700;
}

.theme-emoji { font-size: 16px; }
.theme-name { font-weight: inherit; }

/* Hide extended theme options */
.theme-options-extended { display: none !important; }

/* ═══════════════════════════════════════════════════════════════════════════════
   DISPLAY MODE PILLS
   ═══════════════════════════════════════════════════════════════════════════════ */

.display-mode-pills {
    display: flex;
    gap: 8px;
    padding: 5px;
    background: var(--glass-bg);
    border-radius: 12px;
    border: 1px solid var(--glass-border);
}

.mode-pill {
    flex: 1;
    padding: 12px 18px;
    background: transparent;
    border: none;
    border-radius: 10px;
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.25s ease;
}

.mode-pill.active {
    background: linear-gradient(135deg, var(--sehaj-gold) 0%, var(--sehaj-saffron) 100%);
    color: #1a1a1a;
    box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FONT SIZE CONTROL
   ═══════════════════════════════════════════════════════════════════════════════ */

.font-size-control-modern {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
}

.font-size-control-modern .font-small { font-size: 12px; color: var(--text-tertiary); font-weight: 600; }
.font-size-control-modern .font-large { font-size: 20px; color: var(--text-secondary); font-weight: 600; }

.font-size-control-modern input[type="range"],
.line-spacing-control input[type="range"] {
    flex: 1;
    height: 5px;
    background: var(--glass-border);
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
}

.font-size-control-modern input::-webkit-slider-thumb,
.line-spacing-control input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    background: linear-gradient(135deg, var(--sehaj-gold) 0%, var(--sehaj-saffron) 100%);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(212, 175, 55, 0.4);
    cursor: pointer;
}

.font-size-value,
.line-spacing-value {
    font-size: 12px;
    color: var(--text-tertiary);
    font-weight: 600;
    min-width: 36px;
    text-align: center;
    background: var(--glass-bg-hover);
    padding: 4px 8px;
    border-radius: 8px;
}

/* LINE SPACING CONTROL */
.line-spacing-control {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
}

/* MODERN SELECT */
.modern-select {
    width: 100%;
    padding: 12px 14px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
}

.modern-select:focus {
    outline: none;
    border-color: var(--sehaj-gold);
    box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.15);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   TOAST
   ═══════════════════════════════════════════════════════════════════════════════ */

.toast-container {
    position: fixed;
    bottom: calc(var(--footer-height) + var(--safe-bottom) + 16px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
}

.toast {
    background: var(--glass-bg);
    backdrop-filter: blur(15px);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    padding: 14px 22px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    animation: toastIn 0.3s ease-out;
}

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

/* ═══════════════════════════════════════════════════════════════════════════════
   KHANDA WATERMARK
   ═══════════════════════════════════════════════════════════════════════════════ */

.khanda-watermark-reader {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 250px;
    color: var(--sehaj-gold);
    opacity: 0.025;
    pointer-events: none;
    z-index: 0;
    user-select: none;
    /* NO animation — static watermark prevents full-screen repaints */
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SETTINGS BUTTON ANIMATION
   ═══════════════════════════════════════════════════════════════════════════════ */

.settings-btn-animated svg {
    transition: transform 0.3s ease;
}

.settings-btn-animated:active svg {
    transform: rotate(90deg);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   SEARCHED LINE HIGHLIGHT
   ═══════════════════════════════════════════════════════════════════════════════ */

.gurbani-line.searched-highlight {
    background: linear-gradient(135deg,
            rgba(139, 92, 246, 0.12) 0%,
            rgba(102, 126, 234, 0.12) 100%) !important;
    border-left: 4px solid #8B5CF6 !important;
    animation: searchedPulse 1.5s ease-out !important;
}

.gurbani-line.searched-highlight::before {
    content: '🔍';
    position: absolute;
    top: -8px;
    left: 10px;
    font-size: 18px;
}

@keyframes searchedPulse {
    0% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0.4); }
    50% { box-shadow: 0 0 20px 4px rgba(139, 92, 246, 0.2); }
    100% { box-shadow: 0 0 0 0 rgba(139, 92, 246, 0); }
}

.gurbani-scroll.smooth-scroll-to-search {
    scroll-behavior: smooth;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   FLOATING ACTIONS BAR
   ═══════════════════════════════════════════════════════════════════════════════ */

.floating-actions-bar {
    position: fixed;
    bottom: calc(var(--footer-height) + var(--safe-bottom) + 70px);
    left: 50%;
    transform: translateX(-50%);
    z-index: 150;
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    background: var(--glass-bg);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border: 1px solid var(--glass-border);
    border-radius: 100px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.floating-actions-bar.visible {
    opacity: 1;
    visibility: visible;
}

.fab-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 8px 14px;
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    border-radius: 12px;
    transition: background 0.2s;
}

.fab-btn:active { background: rgba(139, 92, 246, 0.12); }
.fab-icon { font-size: 20px; }
.fab-label { font-size: 10px; font-weight: 600; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.5px; }

/* ═══════════════════════════════════════════════════════════════════════════════
   SEARCH MODAL
   ═══════════════════════════════════════════════════════════════════════════════ */

.search-modal {
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.search-modal.active {
    opacity: 1;
    visibility: visible;
}

.search-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
}

.search-modal-content {
    position: relative;
    background: var(--bg-secondary);
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    padding: 22px;
    width: min(90%, 360px);
    transform: scale(0.92);
    transition: transform 0.3s ease;
}

.search-modal.active .search-modal-content {
    transform: scale(1);
}

.search-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.search-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.close-search-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-secondary);
}

.search-modal-body {
    display: flex;
    gap: 10px;
}

.ang-input {
    flex: 1;
    padding: 14px 16px;
    font-size: 18px;
    border: 2px solid var(--glass-border);
    border-radius: 14px;
    background: var(--bg-primary);
    color: var(--text-primary);
    outline: none;
    transition: border-color 0.2s;
}

.ang-input:focus { border-color: var(--sehaj-gold); }
.ang-input::placeholder { color: var(--text-tertiary); }

.go-btn {
    padding: 14px 22px;
    font-size: 16px;
    font-weight: 600;
    background: var(--sehaj-gold);
    color: #000;
    border: none;
    border-radius: 14px;
    cursor: pointer;
}

.search-modal-footer {
    margin-top: 14px;
    text-align: center;
}

.advanced-search-link {
    color: var(--sehaj-gold);
    text-decoration: none;
    font-size: 14px;
    opacity: 0.8;
}

/* ═══════════════════════════════════════════════════════════════════════════════
   DOWNLOAD MODAL
   ═══════════════════════════════════════════════════════════════════════════════ */

.download-modal {
    position: fixed;
    inset: 0;
    z-index: 250;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.download-modal.active {
    opacity: 1;
    visibility: visible;
}

.download-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.download-modal-content {
    position: relative;
    background: var(--glass-bg);
    backdrop-filter: blur(30px) saturate(200%);
    border: 1px solid var(--glass-border);
    border-radius: 20px;
    padding: 24px;
    max-width: 320px;
    width: 90%;
    transform: scale(0.9);
    opacity: 0;
    transition: all 0.3s var(--ease-spring);
}

.download-modal.active .download-modal-content {
    transform: scale(1);
    opacity: 1;
}

.download-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
}

.download-modal-header h3 {
    margin: 0;
    font-size: 18px;
    color: var(--text-primary);
}

.close-download-btn {
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    border-radius: 50%;
    width: 32px;
    height: 32px;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-secondary);
}

.download-modal-body {
    margin-bottom: 16px;
}

.download-info {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 16px;
    text-align: center;
}

.download-progress-container {
    margin-bottom: 16px;
}

.download-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--glass-border);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 8px;
}

.download-progress-fill {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, var(--sehaj-gold) 0%, var(--sehaj-saffron) 100%);
    border-radius: 4px;
    transition: width 0.3s ease;
}

.download-progress-text {
    font-size: 13px;
    color: var(--text-secondary);
    display: block;
    text-align: center;
}

.download-status {
    font-size: 13px;
    color: var(--sehaj-gold);
    text-align: center;
    margin-bottom: 12px;
    min-height: 18px;
}

.download-start-btn {
    width: 100%;
    padding: 14px 20px;
    font-size: 15px;
    font-weight: 600;
    background: var(--sehaj-gold);
    color: #000;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: transform 0.2s, opacity 0.2s;
}

.download-start-btn:hover {
    opacity: 0.9;
}

.download-start-btn:active {
    transform: scale(0.98);
}

.download-start-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.download-modal-footer {
    text-align: center;
    padding-top: 12px;
    border-top: 1px solid var(--glass-border);
}

.cached-count {
    font-size: 13px;
    color: var(--text-tertiary);
}

/* ═══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (min-width: 768px) {
    :root { --gurmukhi-size: 28px; }
    .gurbani-line { padding: 32px 36px; margin-bottom: 36px; }
    .translation-text { font-size: 16px; }
}

@media (min-width: 1024px) {
    :root { --gurmukhi-size: 32px; }
    .gurbani-lines { max-width: 900px; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   PRINT
   ═══════════════════════════════════════════════════════════════════════════════ */

@media print {
    body { background: white !important; color: black !important; }
    .reader-header, .reader-footer, .settings-panel, .quick-actions-overlay { display: none !important; }
    .gurmukhi-text { color: #1a1a1a !important; text-shadow: none !important; }
}

/* ═══════════════════════════════════════════════════════════════════════════════
   REDUCED MOTION
   ═══════════════════════════════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}