.icon-btn {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  color: var(--text);
  background: var(--surface-alt);
  border-radius: 12px;
}

.icon-btn.small {
  width: 34px;
  height: 34px;
  border-radius: 10px;
}

.icon-btn.glass {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.16);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.btn-primary {
  color: var(--on-primary);
  background: var(--primary);
}

.btn-outline {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

.btn-danger {
  color: #ffffff;
  background: var(--danger);
}

[data-theme="dark"] .btn-danger {
  color: #1c0a07;
}

.btn-block {
  width: 100%;
}

.text-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.text-btn.danger {
  color: var(--danger);
}

.card {
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.surah-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.surah-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px;
  cursor: pointer;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: transform 0.15s, border-color 0.15s;
}

.surah-card:hover {
  border-color: var(--primary);
}

.surah-card:active {
  transform: scale(0.99);
}

.surah-number {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  font-weight: 700;
  color: var(--on-primary);
  background: var(--primary);
  border-radius: 12px;
}

.surah-number.madani {
  background: var(--primary-strong);
}

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

.surah-latin {
  font-size: 16px;
  font-weight: 600;
}

.surah-meaning {
  font-size: 13px;
  color: var(--text-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 9px;
  font-size: 11px;
  font-weight: 500;
  border-radius: 8px;
}

.chip-makki,
.chip-madani {
  color: var(--primary);
  background: var(--primary-soft);
}

.chip-muted {
  color: var(--text-soft);
  background: var(--surface-alt);
}

.surah-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.surah-arabic {
  font-family: var(--font-arabic);
  font-size: 22px;
  font-weight: 700;
  line-height: 1.4;
  color: var(--primary);
}

.fav-btn {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--text-faint);
  border-radius: 10px;
  transition: color 0.2s, background 0.2s;
}

.fav-btn.active {
  color: #e8a600;
}

.fav-btn.icon-btn.glass {
  width: 44px;
  height: 44px;
  color: #ffffff;
  border-radius: 12px;
}

.fav-btn.icon-btn.glass.active {
  color: #ffd54a;
}

.skeleton {
  height: 96px;
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-alt) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  border-radius: var(--radius-lg);
  animation: shimmer 1.4s infinite linear;
}

@keyframes shimmer {
  from {
    background-position: 200% 0;
  }
  to {
    background-position: -200% 0;
  }
}

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 48px 20px;
  text-align: center;
}

.empty-state.compact {
  padding: 24px 12px;
}

.empty-state h3 {
  font-size: 18px;
}

.empty-state p {
  max-width: 320px;
  font-size: 14px;
  color: var(--text-soft);
}

.empty-state .btn {
  margin-top: 8px;
}

.empty-icon {
  display: grid;
  place-items: center;
  width: 96px;
  height: 96px;
  margin-bottom: 6px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 50%;
}

.empty-inline {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 28px 16px;
  font-size: 14px;
  color: var(--text-faint);
  background: var(--surface);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}

.loading-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 80px 0;
  color: var(--text-soft);
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--primary-soft);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 12px;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 12px;
}

.ayah {
  margin-bottom: 22px;
  scroll-margin-top: 84px;
}

.ayah-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.ayah-badge {
  display: grid;
  place-items: center;
  min-width: 36px;
  height: 36px;
  padding: 0 6px;
  font-size: 14px;
  font-weight: 700;
  color: var(--on-primary);
  background: var(--primary);
  border-radius: 10px;
}

.ayah-rule {
  flex: 1;
  height: 1px;
  background: var(--border);
}

.ayah-box {
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  transition: border-color 0.2s, background 0.2s;
}

.ayah.playing .ayah-box {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.ayah-arabic {
  font-family: var(--font-arabic);
  font-size: var(--arabic-size);
  line-height: 1.9;
  text-align: right;
}

.ayah-translation {
  padding-top: 14px;
  margin-top: 16px;
  font-size: var(--translation-size);
  line-height: 1.65;
  color: var(--text-soft);
  border-top: 1px solid var(--border);
}

body.hide-translation .ayah-translation {
  display: none;
}

.play-main {
  position: relative;
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  color: var(--on-primary);
  background: var(--primary);
  border-radius: 50%;
}

.play-main.loading::after {
  content: '';
  position: absolute;
  inset: -4px;
  border: 3px solid transparent;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 8px;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 12px;
}

.stat-value {
  font-size: 22px;
  line-height: 1.2;
}

.stat-label {
  font-size: 12px;
  color: var(--text-soft);
}

.resume-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
}

.resume-label {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
}

.resume-card h3 {
  font-size: 20px;
}

.resume-arabic {
  margin-left: 6px;
  font-family: var(--font-arabic);
  color: var(--primary);
}

.resume-card .btn {
  margin-top: 10px;
}

.progress-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 14px;
}

.progress-head span {
  font-weight: 600;
  color: var(--primary);
}

.progress {
  height: 10px;
  margin-bottom: 8px;
  overflow: hidden;
  background: var(--surface-alt);
  border-radius: 999px;
}

.progress-bar {
  height: 100%;
  min-width: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
  border-radius: 999px;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.section-title {
  font-size: 17px;
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.history-number {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 10px;
}

.history-text {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

.history-text small {
  font-size: 12px;
  color: var(--text-soft);
}

.history-arabic {
  font-family: var(--font-arabic);
  font-size: 20px;
  color: var(--primary);
}

.dev-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 28px 20px;
  text-align: center;
}

.avatar {
  display: grid;
  place-items: center;
  width: 104px;
  height: 104px;
  margin-bottom: 14px;
  font-size: 52px;
  font-weight: 700;
  color: #ffffff;
  background: linear-gradient(145deg, var(--hero-from), var(--hero-to));
  border: 4px solid var(--primary-soft);
  border-radius: 50%;
  box-shadow: var(--shadow);
}

.dev-name {
  font-size: 24px;
  letter-spacing: 0.06em;
}

.dev-role {
  margin-bottom: 14px;
  font-size: 13px;
  font-weight: 600;
  color: var(--primary);
}

.dev-text {
  max-width: 440px;
  font-size: 14px;
  line-height: 1.7;
  color: var(--text-soft);
}

.link-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.link-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--radius-lg);
  transition: transform 0.15s;
}

.link-btn:active {
  transform: scale(0.99);
}

.link-btn-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 12px;
}

.link-btn-label {
  flex: 1;
  letter-spacing: 0.04em;
}

.link-primary {
  color: var(--on-primary);
  background: var(--primary);
}

.link-outline {
  color: var(--primary);
  background: var(--surface);
  border-color: var(--primary);
}

.link-outline .link-btn-icon,
.link-soft .link-btn-icon {
  background: var(--primary-soft);
}

.link-soft {
  color: var(--text);
  background: var(--primary-soft);
}

.version-text {
  padding: 8px 0;
  font-size: 12px;
  text-align: center;
  color: var(--text-faint);
}

.section-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  color: var(--primary);
}

.section-title-row h2 {
  font-size: 17px;
  color: var(--text);
}

.field-label {
  margin: 14px 0 8px;
  font-size: 13px;
  color: var(--text-soft);
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.seg-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-soft);
  background: var(--surface-alt);
  border: 2px solid transparent;
  border-radius: var(--radius-md);
}

.seg-btn.active {
  font-weight: 600;
  color: var(--primary);
  background: var(--primary-soft);
  border-color: var(--primary);
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 0;
  cursor: pointer;
}

.setting-text {
  display: flex;
  flex-direction: column;
}

.setting-text small {
  font-size: 12px;
  color: var(--text-soft);
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.switch-track {
  position: absolute;
  inset: 0;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 999px;
  transition: background 0.2s;
}

.switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  background: var(--text-faint);
  border-radius: 50%;
  transition: transform 0.2s, background 0.2s;
}

.switch input:checked + .switch-track {
  background: var(--primary);
  border-color: var(--primary);
}

.switch input:checked + .switch-track::after {
  background: #ffffff;
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

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

.range {
  flex: 1;
  width: 100%;
  accent-color: var(--primary);
}

.font-preview {
  padding: 16px;
  margin-top: 6px;
  font-family: var(--font-arabic);
  font-size: var(--arabic-size);
  line-height: 1.9;
  text-align: center;
  background: var(--surface-alt);
  border-radius: var(--radius-md);
}

.select {
  width: 100%;
  padding: 12px 14px;
  margin-bottom: 8px;
  color: var(--text);
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.button-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.sheet-backdrop,
.dialog-backdrop {
  position: absolute;
  inset: 0;
  background: var(--overlay);
}

.sheet-panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--max-width);
  height: 85vh;
  background: var(--bg);
  border-radius: 28px 28px 0 0;
  animation: slide-up 0.28s ease-out;
}

@keyframes slide-up {
  from {
    transform: translateY(100%);
  }
  to {
    transform: translateY(0);
  }
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 20px;
  border-bottom: 1px solid var(--border);
}

.sheet-header h2 {
  font-size: 20px;
}

.sheet-header p {
  font-size: 12px;
  color: var(--text-soft);
}

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

.guide-list {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.guide-item {
  display: flex;
  gap: 14px;
}

.guide-icon {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: var(--primary);
  background: var(--primary-soft);
  border-radius: 12px;
}

.guide-item h3 {
  margin-bottom: 2px;
  font-size: 15px;
}

.guide-item p {
  font-size: 14px;
  line-height: 1.65;
  color: var(--text-soft);
}

.tafsir-item {
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.tafsir-ayah {
  display: inline-block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--primary);
}

.tafsir-item p {
  font-size: 14px;
  line-height: 1.75;
  white-space: pre-line;
  color: var(--text-soft);
}

.dialog {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 20px;
}

.dialog-box {
  position: relative;
  width: 100%;
  max-width: 360px;
  padding: 22px;
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}

.dialog-box p {
  margin-bottom: 18px;
  line-height: 1.6;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-height) + var(--safe-bottom) + 24px);
  z-index: 80;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  font-size: 13px;
  color: #ffffff;
  text-align: center;
  background: #12261a;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 0.25s, transform 0.25s;
}

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

body.nav-hidden .toast {
  bottom: calc(120px + var(--safe-bottom));
}

@media (min-width: 720px) {
  .surah-card:hover {
    transform: translateY(-1px);
  }
}
