@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400..700;1,9..40,400..700&family=Playfair+Display:ital,wght@0,400..800;1,400..800&family=Noto+Nastaliq+Urdu:wght@400..700&family=Noto+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  --paper: #f7f6f2;
  --ink: #202124;
  --muted: #797b7d;
  --line: #e8e6e1;
  --blue: #2563eb;
  --pale-blue: #eff6ff;
  --sand-1: #49b6dc;
  --sand-2: #78c9df;
  --sand-3: #e6a43a;
  --sand-4: #d78a2a;
  
  --font-serif: 'Playfair Display', Georgia, serif;
  --font-sans: 'DM Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-urdu: 'Noto Nastaliq Urdu', 'Noto Sans Arabic', 'Segoe UI', Tahoma, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  cursor: pointer;
  outline: none;
}

button:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

/* Container Shell */
.shell {
  max-width: 1440px;
  margin: 0 auto;
  padding: 0 clamp(16px, 5.2vw, 75px);
}

/* Main Layout */
main {
  padding: clamp(32px, 5vw, 62px) 0 170px;
}

/* Intro Title */
.intro {
  margin-bottom: clamp(24px, 3.5vw, 38px);
}

.intro h1 {
  font-family: var(--font-serif);
  font-size: clamp(32px, 4.6vw, 56px);
  font-weight: 600;
  line-height: 1.08;
  letter-spacing: -0.04em;
  color: var(--ink);
}

/* Responsive Two-Column Layout */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(320px, 0.92fr);
  gap: clamp(28px, 5.5vw, 84px);
  align-items: start;
}

/* Cover Illustration (Flat, Clean, No Shadows) */
.cover {
  position: relative;
  min-height: 280px;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  overflow: hidden;
  background: linear-gradient(180deg, var(--sand-1) 0%, var(--sand-2) 58%, var(--sand-3) 59%, var(--sand-4) 100%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.sun {
  width: clamp(140px, 24vw, 300px);
  height: clamp(140px, 24vw, 300px);
  border-radius: 50%;
  background: #f7e3b5;
  position: absolute;
  top: 10%;
  left: 35%;
  opacity: 0.95;
}

.hill {
  position: absolute;
  left: -10%;
  right: -10%;
  height: 35%;
  bottom: -22%;
  border-radius: 50% 50% 0 0;
  background: #d58b32;
  transform: rotate(-5deg);
}

.hill.two {
  height: 28%;
  bottom: -22%;
  left: 32%;
  background: #bf722a;
  transform: rotate(8deg);
}

/* Now Playing Row */
.now {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 16px;
}

.now-text-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.now h2 {
  font-family: var(--font-serif);
  font-size: clamp(22px, 2.4vw, 28px);
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.now h2.urdu {
  font-family: var(--font-urdu);
  font-size: clamp(24px, 2.8vw, 32px);
  line-height: 2.2;
  padding: 4px 0;
  text-align: right;
  direction: rtl;
}

.active-meta {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.active-meta.urdu {
  font-family: var(--font-urdu);
  font-size: 15px;
  line-height: 2;
  text-align: right;
  direction: rtl;
}

/* Language Switcher Pill */
.lang {
  display: flex;
  background: #eeede9;
  border-radius: 30px;
  padding: 3px;
  gap: 2px;
  flex-shrink: 0;
}

.lang button {
  background: none;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 24px;
  transition: all 0.16s ease;
}

.lang button.active {
  background: #ffffff;
  color: var(--ink);
}

/* Transcript Area (Clean background box with max-height restored) */
.transcript {
  margin-top: 24px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 24px 28px;
  max-height: 520px;
  overflow-y: auto;
}

.transcript::-webkit-scrollbar {
  width: 4px;
}
.transcript::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

/* Text Verses & Paragraphs (No spoken highlight) */
.verse {
  font-size: 16px;
  line-height: 1.85;
  color: #4b4e52;
  margin-bottom: 16px;
  cursor: default;
}

.verse.urdu {
  font-family: var(--font-urdu);
  font-size: 20px;
  line-height: 2.4;
  padding: 4px 0;
  text-align: right;
  direction: rtl;
}

.verse-heading {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  margin: 22px 0 10px;
}

.verse-heading.urdu {
  font-family: var(--font-urdu);
  font-size: 22px;
  line-height: 2.2;
  padding: 4px 0;
  text-align: right;
  direction: rtl;
}

.verse-quote {
  font-style: italic;
  color: var(--ink);
  padding: 8px 16px;
  border-left: 2px solid var(--line);
  margin: 14px 0;
}

.verse-quote.urdu {
  font-family: var(--font-urdu);
  font-size: 20px;
  line-height: 2.3;
  padding: 4px 0;
  font-style: normal;
  direction: rtl;
  text-align: right;
  border-left: none;
  border-right: 2px solid var(--line);
}

/* Chapters Column */
.chapters-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 2px 0 14px;
  border-bottom: 1px solid var(--line);
}

.chapters-head h3 {
  font-size: 11px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--ink);
}

.chapter-list {
  display: flex;
  flex-direction: column;
  max-height: 520px;
  overflow-y: auto;
  padding-right: 4px;
}

.chapter-list::-webkit-scrollbar {
  width: 4px;
}
.chapter-list::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
}

/* Chapter Item (4 columns: number, title/meta, duration, play button) */
.chapter {
  display: grid;
  grid-template-columns: 28px 1fr auto auto;
  gap: 12px;
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border-radius: 8px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  transition: all 0.16s ease;
}

.chapter:hover {
  background: #f3f2ee;
}

.chapter.selected {
  background: #f0f5ff;
}

.chapter:hover .ch-title {
  color: var(--blue);
}

.chapter.selected .ch-num {
  color: var(--blue);
}

.chapter.selected .ch-title {
  color: var(--blue);
  font-weight: 600;
}

.ch-num {
  font-size: 11px;
  color: #a2a39d;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.ch-info {
  min-width: 0;
}

.ch-title {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.16s ease;
}

.ch-title.urdu {
  font-family: var(--font-urdu);
  font-size: 16.5px;
  line-height: 2.3;
  padding: 4px 0;
  text-align: right;
  direction: rtl;
  overflow: visible;
}

.ch-meta {
  font-size: 10.5px;
  color: #a2a39d;
  margin-top: 2px;
}

.ch-duration {
  font-size: 11px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.play-mini {
  width: 28px;
  height: 28px;
  background: #e8f0fe;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--blue);
  font-size: 14px;
  opacity: 1;
  transition: all 0.16s ease;
}

.chapter:hover .play-mini,
.chapter.selected .play-mini {
  background: var(--blue);
  color: #ffffff;
}

/* Fixed Bottom Player (Flat, Crisp, Minimal, No Box Shadows) */
.player {
  position: fixed;
  z-index: 100;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(251, 250, 247, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--line);
  padding: 12px clamp(16px, 5.2vw, 75px) 16px;
}

.player-inner {
  max-width: 1440px;
  margin: auto;
  display: grid;
  grid-template-columns: 1fr 1.35fr 1fr;
  gap: 24px;
  align-items: center;
}

/* Left Playing Track */
.playing {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.playing-text {
  min-width: 0;
}

.playing-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--ink);
}

.playing-title.urdu {
  font-family: var(--font-urdu);
  font-size: 16px;
  line-height: 2;
  padding: 2px 0;
}

.playing-sub {
  font-size: 10.5px;
  color: var(--muted);
  margin-top: 2px;
}

/* Center Controls */
.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
}

.control {
  background: none;
  color: #7f837c;
  font-size: 17px;
  padding: 4px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  transition: color 0.16s ease;
}

.control:hover {
  color: var(--ink);
}

.main-play {
  width: 38px;
  height: 38px;
  background: var(--blue);
  border-radius: 50%;
  color: #ffffff;
  display: grid;
  place-items: center;
  font-size: 18px;
  transition: transform 0.16s ease;
}

.main-play:hover {
  transform: scale(1.04);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  max-width: 480px;
  color: var(--muted);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
}

.progress {
  height: 3px;
  background: #e3e2db;
  flex: 1;
  position: relative;
  cursor: pointer;
  border-radius: 4px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--blue);
  border-radius: 4px;
  pointer-events: none;
}

/* Right Tools */
.right-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}

.speed-btn {
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  background: #eeede9;
  padding: 4px 9px;
  border-radius: 14px;
  transition: color 0.16s ease;
}

.speed-btn:hover {
  color: var(--ink);
}

.volume-box {
  display: flex;
  align-items: center;
  gap: 6px;
}

.volume-slider {
  width: 70px;
  height: 3px;
  -webkit-appearance: none;
  appearance: none;
  background: #e3e2db;
  border-radius: 2px;
  outline: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--blue);
  cursor: pointer;
}

/* Toast */
.toast-msg {
  position: fixed;
  bottom: 85px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: #20241f;
  color: #ffffff;
  padding: 8px 18px;
  border-radius: 24px;
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 200;
}

.toast-msg.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Fluid Responsive Breakpoints */
@media (max-width: 850px) {
  /* On mobile, Queue, Lyrics, and Language only live inside the Spotify drawer */
  .desktop-transcript,
  .chapters-col,
  .desktop-lang {
    display: none !important;
  }

  .layout {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .stage-col {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    width: 100%;
  }

  .intro {
    text-align: center;
    margin-bottom: 22px;
  }

  .intro h1 {
    font-size: clamp(28px, 6vw, 36px);
  }

  .cover {
    width: 100%;
    max-width: 420px;
    height: 280px;
    margin: 0 auto;
    border-radius: 14px;
  }

  .now {
    margin-top: 22px;
    justify-content: center;
    text-align: center;
    width: 100%;
  }

  .now-text-wrap {
    align-items: center;
    text-align: center;
    max-width: 440px;
  }

  .active-meta {
    font-size: 13.5px;
    color: var(--muted);
    margin-top: 4px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .player-inner {
    grid-template-columns: 1fr 1fr;
    gap: 14px;
  }

  .right-tools {
    display: none;
  }

  .playing {
    grid-column: 1;
  }

  .center {
    grid-column: 2;
    grid-row: 1;
  }

  main {
    padding-top: 28px;
    padding-bottom: 150px;
  }
}

@media (max-width: 540px) {
  .intro h1 {
    font-size: 26px;
  }

  .cover {
    max-width: 320px;
    height: 230px;
  }

  .now {
    margin-top: 16px;
  }

  .now h2 {
    font-size: 20px;
  }

  .active-meta {
    font-size: 12.5px;
  }

  .player {
    padding: 10px 16px 14px;
  }

  .player-inner {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .playing {
    width: 100%;
    justify-content: space-between;
  }

  .center {
    width: 100%;
  }

  .controls {
    gap: 14px;
  }
}

/* ==========================================================================
   Mobile Spotify-style Slide-Up Sheet (Queue, Lyrics, Language)
   ========================================================================== */

/* Hidden on desktop */
.player-pull-handle,
.sheet-backdrop,
.mobile-sheet {
  display: none;
}

@media (max-width: 850px) {
  /* Pull Handle on Mobile Player */
  .player-pull-handle {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    padding: 2px 0 8px;
    cursor: pointer;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .pull-bar {
    width: 36px;
    height: 4px;
    background: #dcdad2;
    border-radius: 999px;
    transition: background 0.2s ease, width 0.2s ease;
  }

  .player-pull-handle:hover .pull-bar,
  .player-pull-handle:active .pull-bar {
    background: var(--blue);
    width: 44px;
  }

  .pull-hint {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--muted);
    text-transform: uppercase;
  }

  .pull-hint iconify-icon {
    font-size: 12px;
    animation: bounceUp 1.8s infinite ease-in-out;
  }

  @keyframes bounceUp {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-3px); }
  }

  /* Sheet Backdrop */
  .sheet-backdrop {
    display: block;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(18, 20, 16, 0.45);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 150;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .sheet-backdrop.open {
    opacity: 1;
    pointer-events: auto;
  }

  /* Mobile Slide-up Sheet Modal */
  .mobile-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 84vh;
    max-height: 740px;
    background: #fbfaf7;
    border-top: 1px solid var(--line);
    border-radius: 22px 22px 0 0;
    z-index: 160;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.32, 1, 0.23, 1);
    overflow: hidden;
  }

  .mobile-sheet.open {
    transform: translateY(0);
  }

  body.sheet-open {
    overflow: hidden;
  }

  /* Sheet Handle Bar */
  .sheet-handle-bar {
    padding: 12px 0 8px;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: grab;
    touch-action: none;
  }

  .sheet-handle {
    width: 42px;
    height: 4.5px;
    border-radius: 999px;
    background: #cfcdc5;
  }

  /* Sheet Header: Tabs + Actions */
  .sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 18px 12px;
    border-bottom: 1px solid var(--line);
    gap: 12px;
  }

  .sheet-tabs {
    display: flex;
    align-items: center;
    background: #eeede9;
    padding: 3px;
    border-radius: 999px;
    gap: 2px;
  }

  .sheet-tab {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    border-radius: 999px;
    background: transparent;
    transition: all 0.16s ease;
  }

  .sheet-tab iconify-icon {
    font-size: 14px;
  }

  .sheet-tab.active {
    background: #ffffff;
    color: var(--ink);
  }

  .sheet-actions {
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .sheet-lang {
    display: flex;
    background: #eeede9;
    padding: 2px;
    border-radius: 999px;
  }

  .sheet-lang button {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 999px;
    color: var(--muted);
    background: transparent;
  }

  .sheet-lang button.active {
    background: #ffffff;
    color: var(--ink);
  }

  .sheet-close-btn {
    background: transparent;
    color: var(--muted);
    font-size: 22px;
    display: grid;
    place-items: center;
    padding: 4px;
    border-radius: 50%;
    transition: color 0.16s ease;
  }

  .sheet-close-btn:hover {
    color: var(--ink);
  }

  /* Sheet Content Panes */
  .sheet-content {
    flex: 1;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 14px 16px 36px;
  }

  .sheet-pane {
    display: none;
  }

  .sheet-pane.active {
    display: block;
  }

  .sheet-transcript {
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
  }
}

