/* ==========================================================================
   HindiQuran Sharif - Design System & Stylesheet (v1.0)
   Layers: Tokens -> Base -> Layout -> Components -> Reader -> Print
   ========================================================================== */

/* 1. Design Tokens (CSS Custom Properties) */
:root {
    /* Color Palette - Light (Paper / Editorial) */
    --bg-page: #fdfbf7;
    --bg-card: #ffffff;
    --bg-card-subtle: #f8f6f0;
    --bg-accent: #eef5f2;
    --border-subtle: #eae6dc;
    --border-strong: #d2cbbe;

    --text-primary: #1f2421;
    --text-secondary: #525a55;
    --text-muted: #7d8580;
    --text-arabic: #111412;

    --brand-primary: #1b6b54;
    --brand-primary-hover: #145240;
    --brand-accent: #2c9778;
    --brand-surface: #e8f4f0;

    --badge-bg: #e2ede8;
    --badge-text: #175a46;
    --highlight-bg: #fef08a;

    --link-color: #1b6b54;
    --link-hover: #104233;

    /* Typography */
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --font-devanagari: "Noto Sans Devanagari", "Mukta", "Mangal", var(--font-sans);
    --font-arabic: "Amiri Quran", "Amiri", "Noto Naskh Arabic", "Traditional Arabic", serif;

    --font-size-base: 1rem;
    --line-height-base: 1.6;
    --line-height-hi: 1.8;
    --line-height-ar: 2.2;

    /* Spacing & Radii */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-12: 3rem;

    --radius-sm: 6px;
    --radius-md: 10px;
    --radius-lg: 16px;
    --radius-full: 9999px;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.07), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.08), 0 4px 6px -2px rgba(0, 0, 0, 0.04);

    --header-height: 64px;
    --toolbar-height: 52px;
}

/* Dark Mode Tokens */
html[data-theme="dark"] {
    --bg-page: #13171b;
    --bg-card: #1c2227;
    --bg-card-subtle: #232a31;
    --bg-accent: #1e2c26;
    --border-subtle: #2c353d;
    --border-strong: #3e4b56;

    --text-primary: #f0f3f1;
    --text-secondary: #b5c0b9;
    --text-muted: #828f87;
    --text-arabic: #ffffff;

    --brand-primary: #38a181;
    --brand-primary-hover: #48bb97;
    --brand-accent: #52c7a3;
    --brand-surface: #1e332b;

    --badge-bg: #223c32;
    --badge-text: #6de2be;
    --highlight-bg: #854d0e;

    --link-color: #52c7a3;
    --link-hover: #7ce8c7;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.45);
}

/* Layer Visibility Controls via data- attributes */
html[data-show-ar="0"] ._arbi { display: none !important; }
html[data-show-tr="0"] ._transli { display: none !important; }
html[data-show-hi="0"] ._tarjuma { display: none !important; }

/* 2. Base & Reset */
*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-text-size-adjust: 100%;
}

body {
    background-color: var(--bg-page);
    color: var(--text-primary);
    font-family: var(--font-devanagari);
    line-height: var(--line-height-base);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    text-rendering: optimizeLegibility;
}

a {
    color: var(--link-color);
    text-decoration: none;
    transition: color 0.15s ease;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

h1, h2, h3, h4, h5, h6 {
    color: var(--text-primary);
    font-weight: 700;
    line-height: 1.3;
}

p {
    margin-bottom: var(--space-3);
}

ul, ol {
    margin-left: var(--space-6);
    margin-bottom: var(--space-4);
}

button, input, select, textarea {
    font: inherit;
    color: inherit;
}

/* Accessibility Skip-Link */
.skip-to-content {
    position: absolute;
    top: -100px;
    left: var(--space-4);
    background: var(--brand-primary);
    color: #ffffff;
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-sm);
    z-index: 10000;
    font-weight: 600;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-to-content:focus {
    top: var(--space-4);
}

.hidden {
    display: none !important;
}

/* Layout Utilities */
.container {
    width: 100%;
    max-width: 1140px;
    margin-left: auto;
    margin-right: auto;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

.main-content {
    flex: 1 0 auto;
    padding-bottom: var(--space-12);
}

/* 3. Site Header */
.site-header {
    background-color: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    position: sticky;
    top: 0;
    z-index: 100;
    height: var(--header-height);
    box-shadow: var(--shadow-sm);
}

.header-inner {
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.header-left {
    display: flex;
    align-items: center;
    gap: var(--space-3);
}

.brand-link {
    display: flex;
    flex-direction: column;
    text-decoration: none !important;
}

.brand-arabic {
    font-family: var(--font-arabic);
    font-size: 1.15rem;
    color: var(--brand-primary);
    line-height: 1.1;
    direction: rtl;
}

.brand-title {
    font-size: 1.05rem;
    font-weight: 800;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.header-nav .nav-links {
    display: none;
    list-style: none;
    margin: 0;
    padding: 0;
    gap: var(--space-6);
}

.nav-link {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-secondary);
}

.nav-link:hover {
    color: var(--brand-primary);
    text-decoration: none;
}

.header-right {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.btn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-secondary);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.btn-icon:hover {
    background: var(--bg-card-subtle);
    color: var(--text-primary);
    border-color: var(--border-strong);
}

.theme-toggle .sun-icon { display: none; }
.theme-toggle .moon-icon { display: block; }
html[data-theme="dark"] .theme-toggle .sun-icon { display: block; }
html[data-theme="dark"] .theme-toggle .moon-icon { display: none; }

/* 4. Home Hero & Quick Links */
.home-hero {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-page) 100%);
    border-bottom: 1px solid var(--border-subtle);
    padding: var(--space-8) 0 var(--space-6);
    text-align: center;
}

.hero-title {
    font-size: 2.25rem;
    color: var(--brand-primary);
    margin-bottom: var(--space-2);
}

.hero-tagline {
    font-size: 1.1rem;
    color: var(--text-secondary);
    max-width: 650px;
    margin: 0 auto var(--space-6);
}

.quick-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

.quick-link-chip {
    display: inline-block;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    color: var(--text-primary);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
    font-weight: 600;
    box-shadow: var(--shadow-sm);
    transition: all 0.15s ease;
}

.quick-link-chip:hover {
    background: var(--brand-surface);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
    text-decoration: none;
    transform: translateY(-1px);
}

.resume-reading-box {
    margin-top: var(--space-4);
}

.resume-inner {
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    background: var(--bg-accent);
    border: 1px solid var(--border-strong);
    padding: var(--space-2) var(--space-4);
    border-radius: var(--radius-full);
    font-size: 0.9rem;
}

.resume-link {
    font-weight: 700;
    color: var(--brand-primary);
}

/* 5. Surahs Grid (114) */
.surahs-section {
    padding-top: var(--space-8);
}

.surahs-section-header {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    margin-bottom: var(--space-6);
}

.section-title {
    font-size: 1.5rem;
}

.surah-filter-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.surah-filter-wrap .filter-icon {
    position: absolute;
    left: var(--space-4);
    color: var(--text-muted);
}

.surah-filter-wrap input {
    width: 100%;
    padding: var(--space-3) var(--space-4) var(--space-3) 2.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    color: var(--text-primary);
    font-size: 1rem;
}

.surah-filter-wrap input:focus {
    outline: 2px solid var(--brand-primary);
    border-color: transparent;
}

.surah-count-badge {
    position: absolute;
    right: var(--space-3);
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.surahs-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

.surah-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    padding: var(--space-4);
    display: flex;
    align-items: center;
    gap: var(--space-4);
    box-shadow: var(--shadow-sm);
    text-decoration: none !important;
    transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s;
}

.surah-card:hover {
    border-color: var(--brand-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.card-num-wrap {
    flex-shrink: 0;
    width: 44px;
    height: 44px;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    color: var(--brand-primary);
    font-size: 1.1rem;
}

.card-details {
    flex: 1 1 auto;
    min-width: 0;
}

.surah-title-hi {
    font-size: 1.15rem;
    margin-bottom: 2px;
}

.surah-title-en {
    font-size: 0.85rem;
    color: var(--text-secondary);
    display: block;
}

.surah-meta {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.card-arabic {
    flex-shrink: 0;
    font-family: var(--font-arabic);
    font-size: 1.4rem;
    color: var(--brand-primary);
    direction: rtl;
}

/* 6. Surah Detail & Ayah Reader */
.breadcrumb {
    padding: var(--space-4) 0 var(--space-2);
    font-size: 0.9rem;
    color: var(--text-muted);
}

.breadcrumb-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.surah-header {
    margin-bottom: var(--space-6);
}

.surah-h1 {
    font-size: 1.85rem;
    margin-bottom: var(--space-2);
}

.surah-subheading {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-3);
    font-size: 1rem;
    color: var(--text-secondary);
}

.surah-subheading .ar-name {
    font-family: var(--font-arabic);
    font-size: 1.3rem;
    color: var(--brand-primary);
}

.surah-intro-card {
    margin-top: var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.surah-intro-summary {
    padding: var(--space-3) var(--space-4);
    font-weight: 700;
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card-subtle);
    user-select: none;
}

.surah-intro-body {
    padding: var(--space-4);
    line-height: var(--line-height-hi);
    border-top: 1px solid var(--border-subtle);
}

/* Reader Toolbar */
.reader-toolbar-wrapper {
    position: sticky;
    top: var(--header-height);
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-subtle);
    z-index: 90;
    box-shadow: var(--shadow-sm);
    padding: var(--space-2) 0;
}

.reader-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}

.toolbar-group {
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.toggle-switch {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.toggle-switch input {
    cursor: pointer;
}

.btn-tool, .select-tool {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: var(--space-1) var(--space-3);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-tool:hover, .select-tool:hover {
    border-color: var(--border-strong);
}

/* Ayah Card & Content Layers */
.surah-content {
    margin-top: var(--space-6);
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.bismillah-card, .ayah-card {
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-sm);
    transition: background-color 0.2s, border-color 0.2s;
}

.ayah-card.current-verse {
    background-color: var(--brand-surface) !important;
    border-color: var(--brand-primary) !important;
}

.bismillah-card {
    text-align: center;
    background: var(--bg-card-subtle);
    border-color: var(--border-strong);
}

.ayah-top-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.ayah-badge {
    background: var(--brand-primary);
    color: #ffffff !important;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    font-weight: 700;
    font-size: 0.9rem;
    text-decoration: none !important;
}

.ayah-layer {
    margin-bottom: var(--space-4);
}

.layer-label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 700;
    color: var(--brand-primary);
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

/* Arabic Text */
.arabic-text {
    font-family: var(--font-arabic);
    font-size: calc(1.75rem * var(--font-scale, 1.0));
    line-height: var(--line-height-ar);
    color: var(--text-arabic);
    direction: rtl;
    text-align: right;
    word-spacing: 0.1em;
}

.ar-symbol {
    color: var(--brand-primary);
    font-size: 1.35rem;
    margin-right: 4px;
}

/* Transliteration */
.translit-text {
    font-size: calc(1.05rem * var(--font-scale, 1.0));
    font-weight: 600;
    color: var(--text-secondary);
    line-height: var(--line-height-hi);
}

/* Translation */
.translation-text {
    font-size: calc(1.1rem * var(--font-scale, 1.0));
    line-height: var(--line-height-hi);
    color: var(--text-primary);
}

.fn-sup {
    font-size: 0.75em;
    vertical-align: super;
}

.fn-link {
    color: var(--brand-primary);
    font-weight: 700;
    text-decoration: none;
    padding: 0 2px;
}

.fn-link:hover {
    text-decoration: underline;
}

/* Footnotes Block */
.ayah-footnotes {
    margin-top: var(--space-4);
    padding-top: var(--space-3);
    border-top: 1px dashed var(--border-strong);
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.footnotes-heading {
    display: block;
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-2);
}

.footnotes-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footnote-item {
    margin-bottom: var(--space-2);
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
}

.fn-num {
    font-weight: 700;
    color: var(--brand-primary);
    flex-shrink: 0;
}

/* Action Bar */
.ayah-action-bar, .bismillah-actions {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    padding-top: var(--space-3);
    border-top: 1px solid var(--border-subtle);
}

.btn-verse-play, .btn-verse-tool {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    padding: 6px 12px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.15s ease;
}

.btn-verse-play {
    background: var(--brand-surface);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.btn-verse-play:hover {
    background: var(--brand-primary);
    color: #ffffff;
}

.btn-verse-tool:hover {
    background: var(--bg-card);
    border-color: var(--border-strong);
    color: var(--text-primary);
}

/* Prev / Next Surah Nav */
.surah-footer-nav {
    display: flex;
    justify-content: space-between;
    gap: var(--space-4);
    margin-top: var(--space-12);
    padding-top: var(--space-6);
    border-top: 1px solid var(--border-subtle);
}

.btn-adjacent {
    display: flex;
    flex-direction: column;
    padding: var(--space-4);
    background: var(--bg-card);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    text-decoration: none !important;
    min-width: 200px;
    box-shadow: var(--shadow-sm);
}

.btn-adjacent:hover {
    border-color: var(--brand-primary);
    box-shadow: var(--shadow-md);
}

.nav-dir {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.nav-title {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-top: 2px;
}

/* 7. Sticky Mini Audio Player */
.sticky-audio-player {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 2px solid var(--brand-primary);
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12);
    z-index: 999;
    padding: 0;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
}

.sticky-audio-player.hidden {
    display: none !important;
}

/* Timeline Wrapper (full width progress line above controls) */
.player-timeline-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 6px var(--space-4) 4px;
    background: var(--bg-card-subtle);
    border-bottom: 1px solid var(--border-subtle);
}

.player-time-badge {
    font-size: 0.75rem;
    font-family: var(--font-mono, monospace);
    color: var(--text-muted);
    font-weight: 600;
    min-width: 36px;
    text-align: center;
    user-select: none;
}

.player-seek-container {
    position: relative;
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    height: 14px;
    cursor: pointer;
}

.player-seek-container input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: var(--border-subtle);
    border-radius: var(--radius-full);
    outline: none;
    cursor: pointer;
    position: relative;
    z-index: 2;
    margin: 0;
}

.player-seek-container input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 14px;
    height: 14px;
    background: var(--brand-primary);
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
    transition: transform 0.1s ease;
}

.player-seek-container input[type="range"]:hover::-webkit-slider-thumb {
    transform: scale(1.2);
}

.player-seek-container input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 14px;
    background: var(--brand-primary);
    border: 2px solid #ffffff;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.player-seek-progress {
    position: absolute;
    left: 0;
    top: 4px;
    height: 6px;
    background: var(--brand-primary);
    border-radius: var(--radius-full);
    pointer-events: none;
    z-index: 1;
    width: 0%;
    transition: width 0.05s linear;
}

/* Main Controls Row */
.player-container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
    padding: var(--space-2) var(--space-4) var(--space-3);
}

/* Track Meta Block */
.player-meta-block {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    flex: 1 1 240px;
    min-width: 0;
}

/* Equalizer Bars */
.player-wave {
    display: inline-flex;
    align-items: flex-end;
    gap: 3px;
    height: 20px;
    width: 18px;
    padding-bottom: 2px;
}

.wave-bar {
    width: 3px;
    background: var(--brand-primary);
    border-radius: 1px;
    height: 4px;
    transition: height 0.2s ease;
}

.player-wave.playing .bar-1 {
    animation: waveBounce 0.8s ease-in-out infinite alternate;
}
.player-wave.playing .bar-2 {
    animation: waveBounce 1.1s ease-in-out 0.2s infinite alternate;
}
.player-wave.playing .bar-3 {
    animation: waveBounce 0.9s ease-in-out 0.4s infinite alternate;
}
.player-wave.playing .bar-4 {
    animation: waveBounce 1.2s ease-in-out 0.1s infinite alternate;
}

@keyframes waveBounce {
    0% { height: 4px; }
    100% { height: 18px; }
}

.player-text-block {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.player-heading-row {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    min-width: 0;
}

.player-now-playing {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: color 0.15s ease;
}

.player-now-playing:hover {
    color: var(--brand-primary);
}

.player-ayah-pill {
    display: inline-block;
    padding: 1px 8px;
    background: var(--brand-surface);
    color: var(--brand-primary);
    border: 1px solid var(--brand-primary);
    border-radius: var(--radius-full);
    font-size: 0.75rem;
    font-weight: 700;
    white-space: nowrap;
}

.player-sublabel {
    font-size: 0.8rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Center Controls */
.player-controls-group {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    flex: 1 1 auto;
}

.btn-ctrl {
    background: transparent;
    border: none;
    color: var(--text-primary);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    transition: background 0.15s, color 0.15s, transform 0.1s;
}

.btn-ctrl:hover {
    background: var(--bg-card-subtle);
    color: var(--brand-primary);
}

.btn-ctrl:active {
    transform: scale(0.95);
}

.btn-skip {
    position: relative;
}

.skip-label {
    position: absolute;
    font-size: 0.55rem;
    font-weight: 800;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    pointer-events: none;
}

.btn-play-pause {
    width: 44px;
    height: 44px;
    background: var(--brand-primary);
    color: #ffffff !important;
    box-shadow: 0 2px 8px rgba(27, 107, 84, 0.35);
}

.btn-play-pause:hover {
    background: var(--brand-dark);
    transform: scale(1.05);
}

.btn-play-pause:active {
    transform: scale(0.95);
}

/* Extra Tools */
.player-tools-group {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-1);
    flex: 1 1 200px;
}

.btn-tool {
    position: relative;
    background: transparent;
    border: 1px solid transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: var(--radius-sm);
    transition: background 0.15s, color 0.15s, border-color 0.15s;
    font-size: 0.85rem;
    font-weight: 700;
}

.btn-tool:hover {
    background: var(--bg-card-subtle);
    color: var(--text-primary);
    border-color: var(--border-subtle);
}

.btn-tool.active {
    color: var(--brand-primary);
    background: var(--brand-surface);
    border-color: var(--brand-primary);
}

.repeat-badge {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 0.65rem;
    font-weight: 800;
    color: var(--brand-primary);
    line-height: 1;
}

.btn-speed {
    min-width: 42px;
    font-family: var(--font-mono, monospace);
}

.btn-close:hover {
    color: #e53e3e;
    background: rgba(229, 62, 62, 0.1);
    border-color: rgba(229, 62, 62, 0.2);
}

/* Playing Ayah Card & Button Sync */
.btn-verse-play.is-playing,
.a_verse.is-playing {
    background: var(--brand-primary) !important;
    color: #ffffff !important;
    border-color: var(--brand-primary) !important;
    box-shadow: 0 2px 8px rgba(27, 107, 84, 0.3) !important;
}

.audio-surah-card.is-active-surah {
    border-color: var(--brand-primary) !important;
    background: var(--brand-surface) !important;
    box-shadow: 0 4px 16px rgba(27, 107, 84, 0.15) !important;
}

/* Mobile Layout for Player */
@media (max-width: 768px) {
    .player-container {
        flex-wrap: wrap;
        padding: var(--space-2) var(--space-3);
        gap: var(--space-2);
    }
    .player-meta-block {
        flex: 1 1 100%;
        order: 1;
    }
    .player-controls-group {
        order: 2;
        flex: 1 1 auto;
        justify-content: flex-start;
    }
    .player-tools-group {
        order: 3;
        flex: 0 0 auto;
    }
}

/* 8. Surah Drawer */
.drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
}

.surah-drawer {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 320px;
    max-width: 85vw;
    background: var(--bg-card);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.surah-drawer.open {
    transform: translateX(0);
}

.drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.drawer-search {
    padding: var(--space-3);
    border-bottom: 1px solid var(--border-subtle);
}

.drawer-search input {
    width: 100%;
    padding: var(--space-2) var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    background: var(--bg-card-subtle);
}

.drawer-nav {
    flex: 1 1 auto;
    overflow-y: auto;
}

.drawer-surah-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.drawer-surah-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
    text-decoration: none !important;
}

.drawer-surah-link:hover {
    background: var(--brand-surface);
}

.d-num {
    font-weight: 700;
    color: var(--brand-primary);
    width: 24px;
}

.d-names {
    flex: 1 1 auto;
}

.d-names strong {
    display: block;
    color: var(--text-primary);
    font-size: 0.95rem;
}

.d-names small {
    color: var(--text-muted);
}

.d-ar {
    font-family: var(--font-arabic);
    color: var(--text-secondary);
}

/* 9. Search Modal & Lightbox */
.search-modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    justify-content: center;
    padding-top: 10vh;
}

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

.search-modal-container {
    position: relative;
    width: 100%;
    max-width: 680px;
    padding: 0 var(--space-4);
}

.search-modal-box {
    background: var(--bg-card);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    overflow: hidden;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.search-form {
    display: flex;
    align-items: center;
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--border-subtle);
}

.search-input-wrap {
    display: flex;
    align-items: center;
    flex: 1 1 auto;
    gap: var(--space-3);
}

.search-input-wrap input {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font-size: 1.15rem;
    color: var(--text-primary);
}

.search-modal-results {
    overflow-y: auto;
    padding: var(--space-4);
}

.search-chips, .search-shortcuts {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

.btn-chip {
    background: var(--bg-card-subtle);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-full);
    padding: 4px 12px;
    font-size: 0.85rem;
    cursor: pointer;
}

.btn-chip:hover {
    background: var(--brand-surface);
    color: var(--brand-primary);
    border-color: var(--brand-primary);
}

.search-highlight {
    background-color: var(--highlight-bg);
    color: inherit;
    padding: 0 2px;
    border-radius: 2px;
}

/* 10. Footer */
.site-footer {
    background: var(--bg-card);
    border-top: 1px solid var(--border-subtle);
    margin-top: auto;
}

.footer-top {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-8);
    padding-top: var(--space-12);
    padding-bottom: var(--space-8);
}

.footer-brand-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--brand-primary);
    display: block;
    margin-bottom: var(--space-2);
}

.footer-tagline {
    font-size: 0.95rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-4);
}

.footer-heading {
    font-size: 1rem;
    margin-bottom: var(--space-4);
    color: var(--text-primary);
}

.footer-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}

.footer-menu li {
    margin-bottom: var(--space-2);
}

.footer-menu a {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.footer-menu a:hover {
    color: var(--brand-primary);
}

.footer-social {
    display: flex;
    gap: var(--space-3);
    margin-top: var(--space-4);
}

.footer-bottom {
    border-top: 1px solid var(--border-subtle);
    padding: var(--space-4) 0;
    font-size: 0.85rem;
    color: var(--text-muted);
}

.footer-bottom-inner {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    align-items: center;
    text-align: center;
}

.legal-links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: var(--space-4);
}

/* 11. Responsive Breakpoints */
@media (min-width: 640px) {
    .header-nav .nav-links {
        display: flex;
    }
    .surahs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-top {
        grid-template-columns: repeat(2, 1fr);
    }
    .footer-bottom-inner {
        flex-direction: row;
        justify-content: space-between;
        text-align: left;
    }
    .audio-surahs-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (min-width: 1024px) {
    .surahs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .footer-top {
        grid-template-columns: 2fr 1fr 1fr 1fr;
    }
    .audio-surahs-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

/* 12. Print Stylesheet */
@media print {
    .site-header, .reader-toolbar-wrapper, .site-footer, .sticky-audio-player,
    .surah-drawer, .search-modal, .ayah-action-bar, .surah-footer-nav {
        display: none !important;
    }
    body {
        background: #ffffff !important;
        color: #000000 !important;
    }
    .ayah-card {
        border: none !important;
        box-shadow: none !important;
        page-break-inside: avoid;
    }
}
