@font-face {
  font-family: "KFGQPC Uthmanic Hafs";
  src: url("/fonts/UthmanicHafs1Ver18.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Amiri Quran Local";
  src: url("/fonts/AmiriQuran.woff2") format("woff2");
  font-display: swap;
}

@font-face {
  font-family: "Scheherazade New Local";
  src: url("/fonts/ScheherazadeNew.woff2") format("woff2");
  font-display: swap;
}

:root {
  --mushaf-font: "KFGQPC Uthmanic Hafs", "Amiri Quran Local", "Amiri Quran", serif;
  --bg: #0b1412;
  --surface: #12201c;
  --surface-2: #182b25;
  --border: #254037;
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.16);
  --emerald: #10b981;
  --emerald-soft: rgba(16, 185, 129, 0.16);
  --text: #f3f6f4;
  --text-muted: #9eb3aa;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Cairo", system-ui, -apple-system, sans-serif;
  background: radial-gradient(circle at top right, #132922 0%, var(--bg) 55%);
  color: var(--text);
  min-height: 100vh;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  padding: 14px 24px;
  background: rgba(12, 22, 19, 0.92);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--gold), #8f6b14);
  color: #09110e;
  display: grid;
  place-items: center;
  font-size: 24px;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--gold);
}

.subtitle {
  margin: 2px 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.db-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--emerald-soft);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  font-size: 0.82rem;
  font-weight: 600;
}

.layout {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 20px;
  padding: 20px 24px;
  max-width: 1600px;
  margin: 0 auto;
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.panel h2 {
  margin: 0 0 12px;
  font-size: 0.98rem;
  color: var(--gold);
  border-bottom: 1px solid rgba(212, 175, 55, 0.2);
  padding-bottom: 8px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 10px;
}

.field label {
  font-size: 0.82rem;
  color: var(--text-muted);
}

select,
input[type="number"],
input[type="text"] {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
}

select:focus,
input:focus {
  outline: none;
  border-color: var(--gold);
}

.row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.hidden {
  display: none !important;
}

.btn {
  border: none;
  border-radius: 9px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.1s ease, opacity 0.15s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

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

.btn:hover:not(:disabled) {
  opacity: 0.92;
}

.btn-primary {
  background: #1f4f3f;
  color: #fff;
  border: 1px solid #2e755e;
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), #b88b1e);
  color: #0b1412;
}

.btn-emerald {
  background: var(--emerald);
  color: #062118;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}

.w-full {
  width: 100%;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 3px;
}

.seg-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 7px;
  border-radius: 7px;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
}

.seg-btn.active {
  background: var(--gold);
  color: #0b1412;
}

.qiraah-card {
  background: var(--surface-2);
  border: 1px solid rgba(212, 175, 55, 0.25);
  border-radius: 9px;
  padding: 10px;
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.55;
  margin-bottom: 10px;
}

.qiraah-card strong {
  color: var(--gold);
}

.toggles {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  cursor: pointer;
}

.search-row {
  display: flex;
  gap: 8px;
}

.search-results {
  margin-top: 10px;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.search-item {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
  font-size: 0.82rem;
}

.search-item:hover {
  border-color: var(--gold);
}

.workspace {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.player-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  background: rgba(18, 32, 28, 0.96);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 12px 16px;
  position: sticky;
  top: 76px;
  z-index: 15;
  backdrop-filter: blur(8px);
}

.player-controls,
.montage-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-banner {
  background: var(--gold-soft);
  border: 1px solid rgba(212, 175, 55, 0.3);
  color: #f6e29c;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
}

.tajweed-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.tj-badge {
  font-size: 0.78rem;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--c);
  color: var(--text);
}

.mushaf-container {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.surah-banner {
  text-align: center;
  padding: 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.14), rgba(16, 185, 129, 0.08));
  border: 1px solid rgba(212, 175, 55, 0.35);
}

.surah-banner h2 {
  margin: 0;
  font-family: "Amiri Quran", "Scheherazade New", serif;
  font-size: 2rem;
  color: var(--gold);
}

.surah-banner p {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.86rem;
}

.ayah-card {
  background: rgba(24, 43, 37, 0.55);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  transition: border-color 0.2s ease, background 0.2s ease;
}

.ayah-card.active-ayah {
  border-color: var(--gold);
  background: rgba(212, 175, 55, 0.07);
}

.ayah-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

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

.ayah-actions {
  display: flex;
  gap: 6px;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 0.78rem;
  border-radius: 7px;
}

.uthmani-line {
  font-family: var(--mushaf-font);
  font-size: 2.1rem;
  line-height: 2.45;
  direction: rtl;
  text-align: right;
  color: #fffef7;
  margin-bottom: 12px;
}

.uthmani-word {
  display: inline-block;
  padding: 0 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease, transform 0.12s ease;
}

.uthmani-word:hover {
  background: rgba(255, 255, 255, 0.08);
}

.uthmani-word.active-word {
  background: var(--gold);
  color: #0b1412 !important;
  transform: scale(1.04);
}

.ayah-num-ornament {
  font-family: "Cairo", sans-serif;
  font-size: 0.95rem;
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 999px;
  padding: 2px 9px;
  margin-right: 6px;
  vertical-align: middle;
}

.translation-box {
  direction: ltr;
  text-align: left;
  font-size: 0.94rem;
  color: #cfe0d8;
  background: rgba(0, 0, 0, 0.22);
  border-left: 3px solid var(--emerald);
  padding: 10px 14px;
  border-radius: 8px;
  margin-top: 8px;
}

.tafsir-box {
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.24);
  border-right: 3px solid var(--gold);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.75;
  color: #e6ece9;
}

.tafsir-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  color: var(--gold);
  font-size: 0.82rem;
  font-weight: 700;
}

.eval-box {
  margin-top: 10px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 0.86rem;
  line-height: 1.7;
}

.eval-score {
  color: #6ee7b7;
  font-weight: 800;
}

.video-studio {
  background: var(--surface);
  border: 1px solid var(--gold);
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.video-studio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rec-indicator {
  color: var(--danger);
  font-weight: 700;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

#videoCanvas {
  width: 100%;
  max-width: 960px;
  border-radius: 12px;
  border: 1px solid var(--border);
  align-self: center;
}

.video-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
