/* Mushaf Al-Qalam — Design System & Responsive Mushaf Layout */
:root {
  --bg-app: #efe8d8;
  --bg-surface: #f7f2e6;
  --bg-mushaf: #fcf8ee;
  --bg-panel: #f9f5eb;
  --bg-elevated: #ffffff;
  --ink-primary: #1b1916;
  --ink-arabic: #141210;
  --ink-secondary: #595246;
  --ink-muted: #847a69;
  --accent: #154c42;
  --accent-hover: #0f3a32;
  --accent-soft: rgba(21, 76, 66, 0.1);
  --gold: #b58d3d;
  --gold-soft: rgba(181, 141, 61, 0.16);
  --border: rgba(94, 79, 53, 0.16);
  --border-strong: rgba(94, 79, 53, 0.28);
  --shadow-sm: 0 2px 8px rgba(38, 29, 14, 0.06);
  --shadow-md: 0 10px 30px rgba(38, 29, 14, 0.09);
  --shadow-lg: 0 18px 46px rgba(38, 29, 14, 0.14);
  --word-hover: rgba(181, 141, 61, 0.18);
  --word-active: rgba(21, 76, 66, 0.16);
  --ayah-playing: rgba(181, 141, 61, 0.2);
  --arabic-size: 2.15rem;
  --arabic-line: 2.55;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --font-ui: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-arabic: 'Amiri Quran', 'Amiri', 'Scheherazade New', 'Traditional Arabic', 'Geeza Pro', serif;
}

[data-theme="clean"] {
  --bg-app: #f3f4f2;
  --bg-surface: #ffffff;
  --bg-mushaf: #ffffff;
  --bg-panel: #fafafa;
  --bg-elevated: #ffffff;
  --ink-primary: #171918;
  --ink-arabic: #101211;
  --ink-secondary: #525955;
  --ink-muted: #7c847f;
  --accent: #155347;
  --accent-hover: #0e3d34;
  --accent-soft: rgba(21, 83, 71, 0.09);
  --gold: #a68034;
  --gold-soft: rgba(166, 128, 52, 0.14);
  --border: rgba(20, 30, 25, 0.1);
  --border-strong: rgba(20, 30, 25, 0.2);
}

[data-theme="night"] {
  --bg-app: #101312;
  --bg-surface: #171b19;
  --bg-mushaf: #1b201e;
  --bg-panel: #161a18;
  --bg-elevated: #222825;
  --ink-primary: #ede6d6;
  --ink-arabic: #f5efe0;
  --ink-secondary: #b4ac9b;
  --ink-muted: #847d70;
  --accent: #3ea38e;
  --accent-hover: #52b8a3;
  --accent-soft: rgba(62, 163, 142, 0.16);
  --gold: #d2ab5a;
  --gold-soft: rgba(210, 171, 90, 0.18);
  --border: rgba(235, 224, 198, 0.12);
  --border-strong: rgba(235, 224, 198, 0.22);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 12px 32px rgba(0, 0, 0, 0.36);
  --shadow-lg: 0 20px 52px rgba(0, 0, 0, 0.5);
  --word-hover: rgba(210, 171, 90, 0.2);
  --word-active: rgba(62, 163, 142, 0.25);
  --ayah-playing: rgba(210, 171, 90, 0.17);
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg-app);
  color: var(--ink-primary);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

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

button {
  cursor: pointer;
  border: none;
  background: transparent;
}

/* App Shell */
.app-shell {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  overflow: hidden;
}

/* Top Bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  z-index: 40;
  flex-shrink: 0;
}

.topbar-left, .topbar-center, .topbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.brand-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 8px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, border-color 0.15s ease;
  max-width: 280px;
}

.brand-btn:hover {
  border-color: var(--gold);
  transform: translateY(-1px);
}

.brand-emblem {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--accent);
  color: #f8f2e4;
  display: grid;
  place-items: center;
  font-family: var(--font-arabic);
  font-size: 1.2rem;
  flex-shrink: 0;
  border: 1px solid var(--gold);
}

.surah-picker-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  text-align: left;
}

.surah-picker-title {
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}

.surah-picker-sub {
  font-size: 0.72rem;
  color: var(--ink-muted);
  white-space: nowrap;
}

/* Segmented Controls */
.segmented {
  display: inline-flex;
  align-items: center;
  background: var(--bg-app);
  padding: 3px;
  border-radius: 11px;
  border: 1px solid var(--border);
  gap: 2px;
}

.seg-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--ink-secondary);
  transition: all 0.16s ease;
  white-space: nowrap;
}

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

.seg-btn.active {
  background: var(--bg-elevated);
  color: var(--accent);
  box-shadow: var(--shadow-sm);
}

.seg-btn.mode-draw.active {
  background: var(--accent);
  color: #fffdf7;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink-secondary);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.icon-btn:hover {
  background: var(--accent-soft);
  color: var(--accent);
}

.icon-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--border-strong);
}

.icon-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

/* Drawing Toolbar (Contextual, sleek strip) */
.draw-toolbar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 16px;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  z-index: 35;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.draw-toolbar.collapsed {
  display: none;
}

.tool-group {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding-right: 10px;
  border-right: 1px solid var(--border);
}

.tool-group:last-child {
  border-right: none;
  padding-right: 0;
}

.tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-secondary);
  border: 1px solid transparent;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.tool-btn:hover {
  background: var(--bg-app);
  color: var(--ink-primary);
}

.tool-btn.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(21, 76, 66, 0.28);
}

.swatch {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.18);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.swatch:hover {
  transform: scale(1.12);
}

.swatch.active {
  transform: scale(1.16);
  border-color: var(--bg-elevated);
  box-shadow: 0 0 0 2px var(--accent);
}

.size-slider-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.75rem;
  color: var(--ink-secondary);
}

.size-slider-wrap input[type="range"] {
  width: 78px;
  accent-color: var(--accent);
}

.size-dot-preview {
  width: 18px;
  height: 18px;
  display: grid;
  place-items: center;
}

.size-dot-preview span {
  display: block;
  border-radius: 999px;
  background: var(--ink-primary);
}

.pencil-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  color: var(--ink-secondary);
  background: var(--bg-surface);
  transition: all 0.15s ease;
}

.pencil-pill.active {
  background: var(--accent);
  color: #fffdf8;
  border-color: var(--accent);
}

/* Main Workspace */
.workspace {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

/* Mushaf Viewport */
.mushaf-viewport {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 20px 44px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.mushaf-viewport.lock-scroll {
  overflow-y: hidden;
  touch-action: none;
}

/* Authentic Parchment Mushaf Sheet */
.mushaf-sheet {
  position: relative;
  max-width: 820px;
  margin: 0 auto;
  background: var(--bg-mushaf);
  border-radius: 16px;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-md);
  padding: 26px;
  background-image:
    radial-gradient(ellipse at 20% 0%, rgba(181, 141, 61, 0.06), transparent 55%),
    radial-gradient(ellipse at 85% 100%, rgba(21, 76, 66, 0.04), transparent 50%);
}

.mushaf-inner-frame {
  position: relative;
  border: 1.5px solid rgba(181, 141, 61, 0.42);
  border-radius: 10px;
  padding: 28px 32px 36px;
  min-height: 540px;
}

.mushaf-inner-frame::before {
  content: '';
  position: absolute;
  inset: 4px;
  border: 1px solid rgba(181, 141, 61, 0.22);
  border-radius: 7px;
  pointer-events: none;
}

/* Surah Ornamental Header */
.surah-banner {
  position: relative;
  text-align: center;
  padding: 16px 22px;
  margin-bottom: 22px;
  border-radius: 12px;
  border: 1.5px solid rgba(181, 141, 61, 0.5);
  background: linear-gradient(180deg, var(--gold-soft), rgba(181, 141, 61, 0.04));
}

.surah-banner-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--ink-secondary);
  margin-bottom: 4px;
  letter-spacing: 0.02em;
}

.surah-banner-ar {
  font-family: var(--font-arabic);
  font-size: 2.1rem;
  line-height: 1.35;
  color: var(--accent);
  margin: 0;
  font-weight: 700;
}

.surah-banner-id {
  font-size: 0.84rem;
  color: var(--ink-secondary);
  margin-top: 2px;
}

.bismillah-row {
  text-align: center;
  font-family: var(--font-arabic);
  font-size: calc(var(--arabic-size) * 0.92);
  line-height: 2;
  color: var(--ink-arabic);
  margin: 4px 0 20px;
  user-select: none;
}

/* Mushaf Content Container & Canvas Overlay */
.mushaf-stage {
  position: relative;
  min-height: 420px;
}

.mushaf-content {
  position: relative;
  z-index: 1;
}

.annotation-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 10;
  pointer-events: none;
  touch-action: auto;
  transition: opacity 0.2s ease;
}

.annotation-canvas.drawing-active {
  pointer-events: auto;
  touch-action: none;
  cursor: crosshair;
}

.annotation-canvas.pencil-only {
  pointer-events: none;
  touch-action: pan-y;
}

.annotation-canvas.hidden-strokes {
  opacity: 0;
}

/* Mode 1: Continuous Classic Mushaf */
.mushaf-flow {
  direction: rtl;
  text-align: justify;
  text-align-last: center;
  font-family: var(--font-arabic);
  font-size: var(--arabic-size);
  line-height: var(--arabic-line);
  color: var(--ink-arabic);
  word-spacing: 0.14em;
}

.ayah-span {
  display: inline;
  border-radius: 8px;
  padding: 2px 0;
  transition: background-color 0.2s ease;
}

.ayah-span.playing {
  background: var(--ayah-playing);
}

.ayah-span.selected-ayah {
  background: var(--accent-soft);
}

.q-word {
  display: inline;
  padding: 2px 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background-color 0.14s ease, color 0.14s ease;
}

.q-word:hover {
  background: var(--word-hover);
}

.q-word.active-word {
  background: var(--word-active);
  color: var(--accent);
}

.ayah-medallion {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.45em;
  height: 1.45em;
  padding: 0 0.22em;
  margin: 0 0.2em 0 0.3em;
  font-family: var(--font-arabic);
  font-size: 0.54em;
  line-height: 1;
  color: var(--accent);
  border: 1.5px solid var(--gold);
  border-radius: 999px;
  background: var(--gold-soft);
  vertical-align: middle;
  cursor: pointer;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.ayah-medallion:hover {
  transform: scale(1.1);
  background: var(--accent);
  color: #fffdf8;
  border-color: var(--accent);
}

/* Mode 2: Interlinear Per-Kata + Makna Kalimat */
.interlinear-list {
  display: flex;
  flex-direction: column;
  gap: 22px;
}

.ayah-card {
  padding: 18px 18px 16px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.22);
  transition: border-color 0.2s ease, background-color 0.2s ease;
}

[data-theme="night"] .ayah-card {
  background: rgba(255, 255, 255, 0.02);
}

.ayah-card.playing {
  border-color: var(--gold);
  background: var(--ayah-playing);
}

.ayah-card.selected-ayah {
  border-color: var(--accent);
}

.ayah-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.ayah-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}

.ayah-card-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.word-grid-rtl {
  display: flex;
  flex-wrap: wrap;
  direction: rtl;
  gap: 10px 12px;
  margin-bottom: 14px;
}

.word-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px 11px 7px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-mushaf);
  cursor: pointer;
  transition: all 0.15s ease;
  min-width: 72px;
}

.word-tile:hover {
  border-color: var(--gold);
  background: var(--word-hover);
}

.word-tile.active-word {
  border-color: var(--accent);
  background: var(--word-active);
}

.word-tile-ar {
  font-family: var(--font-arabic);
  font-size: calc(var(--arabic-size) * 0.82);
  line-height: 1.85;
  color: var(--ink-arabic);
}

.word-tile-tr {
  direction: ltr;
  font-size: 0.68rem;
  color: var(--ink-muted);
  font-style: italic;
  margin-top: -2px;
}

.word-tile-id {
  direction: ltr;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent);
  text-align: center;
  margin-top: 2px;
}

.ayah-arabic-block {
  direction: rtl;
  text-align: right;
  font-family: var(--font-arabic);
  font-size: var(--arabic-size);
  line-height: 2.3;
  color: var(--ink-arabic);
  margin-bottom: 12px;
}

.ayah-translation-box {
  font-size: 0.94rem;
  line-height: 1.65;
  color: var(--ink-secondary);
  padding-top: 10px;
  border-top: 1px dashed var(--border-strong);
}

.ayah-translation-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  display: block;
  margin-bottom: 3px;
}

/* Makna Kalimat Side Panel */
.meaning-panel {
  width: 360px;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.25s ease, width 0.25s ease;
  z-index: 30;
}

.meaning-panel.collapsed {
  width: 0;
  border-left: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.panel-title {
  font-size: 0.92rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.word-spotlight {
  padding: 18px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.word-spotlight-ar {
  font-family: var(--font-arabic);
  font-size: 2.6rem;
  line-height: 1.7;
  color: var(--accent);
  direction: rtl;
}

.word-spotlight-tr {
  font-size: 0.85rem;
  color: var(--ink-muted);
  font-style: italic;
}

.word-spotlight-meaning {
  font-size: 1.08rem;
  font-weight: 700;
  color: var(--ink-primary);
  margin-top: 6px;
}

.word-spotlight-actions {
  display: flex;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.btn-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: var(--accent);
  color: #fffdf7;
  transition: background 0.15s ease, transform 0.15s ease;
}

.btn-pill:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
}

.btn-pill.secondary {
  background: var(--bg-app);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
}

.btn-pill.secondary:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.section-card {
  padding: 15px 16px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
}

.section-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--gold);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.sentence-meaning-text {
  font-size: 0.94rem;
  line-height: 1.68;
  color: var(--ink-primary);
  margin: 0;
}

.word-breakdown-chips {
  display: flex;
  flex-wrap: wrap;
  direction: rtl;
  gap: 7px;
}

.mini-word-chip {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  padding: 5px 9px;
  border-radius: 9px;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  cursor: pointer;
  transition: all 0.14s ease;
}

.mini-word-chip:hover {
  border-color: var(--gold);
}

.mini-word-chip.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.mini-word-chip .ar {
  font-family: var(--font-arabic);
  font-size: 1.15rem;
  line-height: 1.5;
  color: var(--ink-arabic);
}

.mini-word-chip .id {
  direction: ltr;
  font-size: 0.68rem;
  color: var(--ink-secondary);
}

.tadabbur-textarea {
  width: 100%;
  min-height: 82px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  font-size: 0.84rem;
  line-height: 1.5;
  resize: vertical;
}

.tadabbur-textarea:focus {
  outline: none;
  border-color: var(--accent);
}

/* Bottom Audio Player */
.audio-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 20px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border);
  z-index: 40;
  flex-shrink: 0;
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}

.play-main-btn {
  width: 42px;
  height: 42px;
  border-radius: 999px;
  background: var(--accent);
  color: #fffdf7;
  display: grid;
  place-items: center;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, background 0.15s ease;
}

.play-main-btn:hover {
  background: var(--accent-hover);
  transform: scale(1.05);
}

.audio-progress-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
  max-width: 480px;
}

.audio-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.76rem;
  color: var(--ink-secondary);
}

.audio-track {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: var(--border-strong);
  overflow: hidden;
  cursor: pointer;
}

.audio-track-fill {
  height: 100%;
  width: 0%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.12s linear;
}

.audio-options {
  display: flex;
  align-items: center;
  gap: 8px;
}

.compact-select {
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--ink-primary);
  max-width: 175px;
}

.chip-toggle {
  padding: 6px 10px;
  border-radius: 9px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--ink-secondary);
  white-space: nowrap;
}

.chip-toggle.active {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: var(--accent);
}

/* Surah Modal Drawer */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 16, 0.45);
  backdrop-filter: blur(3px);
  z-index: 80;
  display: none;
}

.drawer-backdrop.open {
  display: block;
}

.surah-drawer {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(370px, 90vw);
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  z-index: 90;
  display: flex;
  flex-direction: column;
  transform: translateX(-105%);
  transition: transform 0.24s ease;
}

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

.drawer-search-wrap {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.drawer-search {
  width: 100%;
  padding: 10px 13px;
  border-radius: 10px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  font-size: 0.86rem;
}

.drawer-search:focus {
  outline: none;
  border-color: var(--accent);
}

.surah-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.surah-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 11px;
  text-align: left;
  border: 1px solid transparent;
  transition: all 0.14s ease;
}

.surah-item:hover {
  background: var(--bg-elevated);
  border-color: var(--border);
}

.surah-item.active {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.surah-num-badge {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--gold-soft);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.surah-item-info {
  flex: 1;
  min-width: 0;
}

.surah-item-name {
  font-size: 0.88rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
}

.offline-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--accent);
  display: inline-block;
}

.surah-item-sub {
  font-size: 0.73rem;
  color: var(--ink-muted);
}

.surah-item-ar {
  font-family: var(--font-arabic);
  font-size: 1.25rem;
  color: var(--accent);
}

/* Status Toast */
.toast {
  position: fixed;
  bottom: 84px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--ink-primary);
  color: var(--bg-mushaf);
  padding: 9px 16px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 100;
  white-space: nowrap;
}

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

/* Pencil Status Badge inside Mushaf */
.mushaf-status-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
  font-size: 0.74rem;
  color: var(--ink-muted);
}

.status-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  font-weight: 600;
  color: var(--ink-secondary);
}

.status-chip.pen-live {
  background: var(--accent-soft);
  color: var(--accent);
  border-color: rgba(21, 76, 66, 0.3);
}

.loading-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--ink-secondary);
  font-size: 0.92rem;
}

/* Responsive Breakpoints */
@media (max-width: 1024px) {
  .meaning-panel {
    position: fixed;
    right: 0;
    top: 57px;
    bottom: 63px;
    width: min(380px, 92vw);
    box-shadow: var(--shadow-lg);
    transform: translateX(0);
  }

  .meaning-panel.collapsed {
    width: min(380px, 92vw);
    transform: translateX(105%);
  }
}

@media (max-width: 720px) {
  .topbar {
    padding: 8px 10px;
    flex-wrap: wrap;
  }

  .topbar-center {
    order: 3;
    width: 100%;
    justify-content: center;
    flex-wrap: wrap;
  }

  .mushaf-viewport {
    padding: 12px 10px 30px;
  }

  .mushaf-sheet {
    padding: 12px;
  }

  .mushaf-inner-frame {
    padding: 16px 14px 24px;
  }

  .audio-bar {
    flex-wrap: wrap;
    padding: 8px 12px;
    gap: 8px;
  }

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

  .compact-select {
    max-width: 155px;
  }

  .hide-sm {
    display: none;
  }
}
