/* Uthmanic Script Font */
@font-face {
  font-family: "KFGQPC Uthmanic Script HAFS";
  src:
    url("https://cdn.jsdelivr.net/gh/mustafa0x/quran-font@3.0.0/dist/v1/uthmanic/KFGQPC%20Uthmanic%20Script%20HAFS.woff2") format("woff2"),
    url("https://cdn.jsdelivr.net/gh/mustafa0x/quran-font@3.0.0/dist/v1/uthmanic/KFGQPC%20Uthmanic%20Script%20HAFS.woff") format("woff");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Scheherazade New";
  src: url("https://fonts.gstatic.com/s/scheherazadenew/v9/4iCp6KhlaNHb2oeD7Vamy7lsnA7gL1kzLad.woff2") format("woff2");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  overscroll-behavior: none;
}

/* Safe area support for notched devices and edge-to-edge (Android 15+) */
body {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* Prevent text selection on mobile for better UX */
button,
.ctrl-btn,
.speed-btn-simple,
.top-bar-btn {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* Prevent zoom on double tap for iOS */
input,
select,
textarea {
  font-size: 16px;
  /* Prevents iOS zoom on focus */
  -webkit-user-select: auto;
  -moz-user-select: auto;
  -ms-user-select: auto;
  user-select: auto;
}

:root {
  --bg-gradient-1: #08080c;
  --bg-gradient-2: #101015;
  --bg-card: rgba(20, 20, 26, 0.65);
  --bg-card-solid: #15151c;
  --bg-hover: rgba(35, 35, 45, 0.8);
  --text-primary: #fcfcf9;
  --text-secondary: #a8a8a8;
  --text-muted: #757575;
  --accent-1: #dfba42;
  --accent-2: #f2d788;
  --accent-glow: rgba(223, 186, 66, 0.35);
  --border: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(223, 186, 66, 0.4);
  --glass-blur: blur(24px);
  --surface-glass: rgba(255, 255, 255, 0.05);
  --surface-glass-border: rgba(255, 255, 255, 0.1);
  --overlay-dark: rgba(5, 5, 10, 0.75);
  --shadow-bento: 0 10px 30px rgba(0, 0, 0, 0.4), 0 2px 8px rgba(0, 0, 0, 0.2);
}

[data-theme="light"] {
  --bg-gradient-1: #fbf9f4;
  --bg-gradient-2: #f4f0e9;
  --bg-card: rgba(255, 255, 255, 0.75);
  --bg-card-solid: #ffffff;
  --bg-hover: rgba(245, 242, 238, 0.95);
  --text-primary: #151515;
  --text-secondary: #5a5a5a;
  --text-muted: #8c8c8c;
  --accent-1: #c69411;
  --accent-2: #dbaf34;
  --accent-glow: rgba(198, 148, 17, 0.25);
  --border: rgba(0, 0, 0, 0.06);
  --border-accent: rgba(198, 148, 17, 0.35);
  --surface-glass: rgba(0, 0, 0, 0.04);
  --surface-glass-border: rgba(0, 0, 0, 0.08);
  --overlay-dark: rgba(251, 249, 244, 0.85);
  --shadow-bento:
    0 10px 30px rgba(0, 0, 0, 0.08), 0 2px 8px rgba(0, 0, 0, 0.04);
}

body {
  font-family: "Inter", "Noto Naskh Arabic", sans-serif;
  background: linear-gradient(135deg,
      var(--bg-gradient-1) 0%,
      var(--bg-gradient-2) 100%);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  transition:
    background 0.4s ease,
    color 0.4s ease;
}

.ambient-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 101;
  overflow: hidden;
  opacity: 0.4;
}

@keyframes pulse-dot {

  0%,
  100% {
    box-shadow: 0 0 6px 2px rgba(55, 212, 165, 0.5);
  }

  50% {
    box-shadow: 0 0 12px 4px rgba(55, 212, 165, 0.8);
  }
}

.particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--accent-1);
  opacity: 0.3;
  animation: float 15s infinite ease-in-out;
}

.sajda-notif {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: rgba(6, 6, 14, 0.85);
  backdrop-filter: blur(20px);
  border: 1px solid var(--accent-1);
  border-radius: 30px;
  padding: 30px;
  z-index: 10000;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 15px;
  box-shadow:
    0 20px 60px rgba(0, 0, 0, 0.5),
    0 0 40px var(--accent-glow);
  transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  opacity: 0;
  text-align: center;
}

.sajda-notif.show {
  display: flex;
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.sajda-icon-container {
  width: 70px;
  height: 70px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--accent-glow);
  margin-bottom: 5px;
}

.sajda-icon-container svg {
  width: 40px;
  height: 40px;
  fill: #000;
}

@keyframes float {

  0%,
  100% {
    transform: translateY(0) translateX(0);
    opacity: 0.1;
  }

  50% {
    transform: translateY(-100px) translateX(50px);
    opacity: 0.4;
  }
}

.screen {
  display: none;
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  overflow: hidden;
}

.screen.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.5s ease;
  z-index: 2;
}

/* Ummah Screen */
.ummah-screen {
  background: var(--bg-gradient-1);
  overflow: hidden;
}

.ummah-scroll-content {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.ummah-globe-hero {
  position: relative;
  width: 100%;
  flex-shrink: 0;
}

.ummah-globe-container {
  width: 100%;
  height: min(380px, 45vh);
  overflow: hidden;
}

.ummah-globe-fade {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 120px;
  background: linear-gradient(to top,
      var(--bg-gradient-1) 0%,
      transparent 100%);
  pointer-events: none;
}

.ummah-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  padding-top: calc(14px + env(safe-area-inset-top));
  background: linear-gradient(to bottom,
      var(--overlay-dark) 0%,
      transparent 100%);
}

.ummah-top-bar-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.ummah-top-bar-title {
  font-size: 18px;
  font-weight: 900;
  color: var(--accent-1);
  letter-spacing: -0.3px;
}

.ummah-live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #37d4a5;
  box-shadow: 0 0 8px rgba(55, 212, 165, 0.7);
  animation: pulse-dot 2s infinite;
  flex-shrink: 0;
}

.ummah-live-label {
  font-size: 10px;
  color: #37d4a5;
  font-weight: 700;
  letter-spacing: 1px;
}

.ummah-close-btn {
  background: var(--surface-glass);
  backdrop-filter: blur(8px);
  border: 1px solid var(--surface-glass-border);
  color: var(--text-secondary);
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ummah-counter-wrap {
  position: absolute;
  bottom: 24px;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
}

.ummah-counter-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: var(--overlay-dark);
  backdrop-filter: blur(16px);
  border: 1px solid var(--surface-glass-border);
  border-radius: 28px;
  transition: all 0.4s ease;
}

.ummah-counter-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #37d4a5;
  flex-shrink: 0;
  box-shadow: 0 0 6px #37d4a5;
}

.ummah-reader-count {
  font-size: 22px;
  font-weight: 900;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.ummah-reading-now {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.ummah-content {
  padding: 0 16px 24px;
  flex: 1;
}

.ummah-mega-stat {
  text-align: center;
  padding: 18px 0 16px;
}

.ummah-mega-stat-value {
  font-size: 44px;
  font-weight: 900;
  color: var(--accent-1);
  line-height: 1;
  letter-spacing: -2px;
  font-variant-numeric: tabular-nums;
}

.ummah-mega-stat-label {
  font-size: 12px;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}

.ummah-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

@media (max-width: 359px) {
  .ummah-stats-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }
}

.ummah-stat-card {
  background: var(--surface-glass);
  backdrop-filter: blur(10px);
  border: 1px solid var(--surface-glass-border);
  border-radius: 20px;
  padding: 16px 8px;
  text-align: center;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
}

.ummah-stat-card-accent {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  opacity: 0.6;
}

.ummah-stat-icon {
  margin-bottom: 8px;
  display: flex;
  justify-content: center;
}

.ummah-stat-value {
  font-size: 32px;
  font-weight: 900;
  color: var(--text-primary);
  line-height: 1;
}

.ummah-stat-label {
  font-size: 14px;
  color: var(--text-muted);
  font-weight: 700;
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.ummah-feed-section {
  background: var(--surface-glass);
  border: 1px solid var(--surface-glass-border);
  border-radius: 18px;
  padding: 14px 16px;
  margin-bottom: 16px;
}

.ummah-feed-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.ummah-feed-header-left {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ummah-feed-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #37d4a5;
  box-shadow: 0 0 4px #37d4a5;
  animation: pulse-dot 2s infinite;
}

.ummah-feed-title {
  font-size: 10px;
  color: #37d4a5;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
}

.ummah-feed-time {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 600;
}

.ummah-feed-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.ummah-feed-empty {
  display: none;
  text-align: center;
  padding: 16px 0;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  opacity: 0.6;
}

.ummah-cta-bar {
  flex-shrink: 0;
  padding: 16px 20px;
  padding-bottom: calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(to top,
      var(--bg-gradient-1) 70%,
      transparent 100%);
}

.ummah-share-btn {
  margin: 0;
  width: 100%;
  box-shadow: 0 10px 30px rgba(184, 134, 11, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  height: 56px;
  border-radius: 28px;
}

.ummah-ref-popup {
  display: none;
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  padding: 10px 20px;
  background: rgba(74, 222, 128, 0.12);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(74, 222, 128, 0.35);
  border-radius: 24px;
  font-size: 13px;
  font-weight: 700;
  color: #4ade80;
  white-space: nowrap;
  animation: fadeIn 0.4s ease;
  pointer-events: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Intro Screen */
.intro-screen {
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.intro-icon {
  width: 120px;
  height: 120px;
  margin-bottom: 40px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 20px 60px var(--accent-glow);
  animation: pulse 3s infinite ease-in-out;
  flex-shrink: 0;
}

@keyframes pulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.05);
  }
}

.intro-icon svg {
  width: 60px;
  height: 60px;
  stroke: #0a0a0f;
  fill: none;
  stroke-width: 1.5;
}

.intro-title {
  font-family: "Amiri", serif;
  font-size: 2.8rem;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}

.intro-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 60px;
  max-width: 350px;
  line-height: 1.8;
}

.intro-btn {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #0a0a0f;
  border: none;
  padding: 18px 70px;
  font-size: 1.2rem;
  font-family: inherit;
  font-weight: 600;
  border-radius: 50px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 10px 40px var(--accent-glow);
}

.intro-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 15px 50px var(--accent-glow);
}

/* Language Screen */
.lang-screen {
  align-items: center;
  justify-content: center;
  padding: 30px;
  text-align: center;
}

.lang-title {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 50px;
  font-weight: 500;
}

.lang-options {
  display: flex;
  flex-direction: column;
  gap: 20px;
  width: 100%;
  max-width: 320px;
}

.lang-btn {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 22px 35px;
  font-size: 1.3rem;
  font-family: inherit;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
}

.lang-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-accent);
  transform: translateY(-3px);
}

/* App Screen */
.app-screen {
  padding: 15px;
  padding-bottom: 30px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

.app-container {
  max-width: 500px;
  width: 100%;
  min-height: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  /* Allow natural top-down flow */
  padding: 0 16px;
  /* No gap here, we handle spacing via flex or margins */
  gap: 0;
  padding-bottom: 30px;
  /* Add some padding so the bottom isn't fully hugging the edge */
}

/* Mobile: Full width and height for reading area */
@media (max-width: 768px) {
  .app-screen {
    padding: 0 !important;
    padding-bottom: env(safe-area-inset-bottom) !important;
    /* Remove main screen padding to fix shift, keep bottom safe area */
  }

  .app-container {
    max-width: 100%;
    /* Reset padding to fix shift - children handle their own margins */
    padding: 0 !important;
  }

  .word-display {
    width: calc(100% - 32px) !important;
    /* Force spacing from edges */
    max-width: 500px !important;
    /* Cap width for larger mobile screens */
    height: 170px !important;
    /* Force rectangular landscape shape */
    min-height: 150px !important;
    max-height: 180px !important;
    /* Remove flex grow */
    flex: 0 0 auto;

    /* Keep rounded corners */
    border-radius: 24px !important;
    margin: 10px auto !important;
    /* Consistent inter-card spacing */

    /* display: flex is inherited or set in main class, but ensure here */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;

    /* Ensure background/border are visible */
    background: var(--bg-card);
    border: 1px solid var(--border);
  }

  .spritz-frame {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
  }

  .focus-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
  }

  /* Apply Card Styling to all main containers */
  .unified-info-block,
  .compact-time-row,
  .surah-row,
  .stats-grid,
  .playhead-card,
  .speed-presets-simple,
  .more-controls-btn,
  .control-card,
  .advanced-controls .control-card {
    width: calc(100% - 32px) !important;
    max-width: 500px !important;
    margin-left: auto !important;
    margin-right: auto !important;
    border-radius: 16px !important;
    position: relative;
    z-index: 2;
  }

  /* Playhead Card: unified progress + controls bento box */
  .playhead-card {
    background: var(--bg-card) !important;
    backdrop-filter: var(--glass-blur) !important;
    -webkit-backdrop-filter: var(--glass-blur) !important;
    border: 1px solid var(--border) !important;
    padding: 14px 16px 8px 16px !important;
    margin-top: 10px !important;
    margin-bottom: 10px !important;
    overflow: visible !important;
  }

  /* Children inside playhead card: full width, no borders, no extra margins */
  .playhead-card>.progress-track {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 0 6px 0 !important;
    padding: 4px 0 !important;
    border-radius: 0 !important;
    border: none !important;
    background: none !important;
  }

  .playhead-card>.playback-controls {
    width: 100% !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 6px 0 4px 0 !important;
    border-radius: 0 !important;
    border: none !important;
    background: none !important;
    border-top: 1px solid var(--border) !important;
  }

  /* Adjust Surah Row specific padding */
  .surah-row {
    padding: 0 !important;
    margin-bottom: 10px !important;
    justify-content: space-between;
    gap: 10px;
  }

  .current-word {
    width: 100%;
    max-width: 100%;
  }
}

/* Top Bar with Labels (mobile friendly) */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  margin: 8px 16px 10px 16px;
  border-radius: 40px;
  flex-shrink: 0;
  position: sticky;
  top: 12px;
  z-index: 100;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-bento);
}

.top-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.top-bar-btn {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.top-bar-btn:hover,
.top-bar-btn:active,
.top-bar-btn.active {
  background: var(--surface-glass);
  color: var(--text-primary);
}

.top-bar-item:hover .btn-label,
.top-bar-item:active .btn-label,
.top-bar-item.active .btn-label {
  color: var(--text-primary);
}

.top-bar-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.top-bar-center {
  display: flex;
  gap: 12px;
}

.btn-label {
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--text-muted);
  text-align: center;
  opacity: 0.8;
  max-width: 60px;
}

/* Surah Selector */
.surah-selector select {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 14px;
  cursor: pointer;
  text-align: center;
  -webkit-appearance: none;
  appearance: none;
  transition: all 0.3s ease;
}

.surah-selector select:focus {
  outline: none;
  border-color: var(--accent-1);
  box-shadow: 0 0 20px var(--accent-glow);
}

/* Unified Info Block */
.unified-info-block {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  border-radius: 20px;
  margin: 0 auto 12px auto;
  box-shadow: var(--shadow-bento);
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-evenly;
  width: 100%;
}

/* Compact Time Row */
.compact-time-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  background: transparent;
  gap: 15px;
  padding: 8px 16px;
  margin: 0 auto 12px auto;
  width: 100%;
}

/* Word Display */
.word-display {
  width: 100%;
  min-height: 180px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  border-radius: 32px;
  padding: 20px;
  position: relative;
  overflow: hidden;
  height: 200px;
  max-height: 200px;
  flex-shrink: 0;
  box-shadow: var(--shadow-bento);
}

.word-display::before {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 300px;
  height: 300px;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
  pointer-events: none;
  opacity: 0.5;
}

/* Spritz-style Focus Container */
.focus-container {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  z-index: 1;
  /* Keep the whole (word + yellow guide lines) block centered in the reading box */
  padding: 15px 0;
  margin-top: 0;
}

.spritz-frame {
  position: relative;
  width: 90%;
  max-width: 450px;
  min-height: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Symmetric padding so the guide lines + word sit visually centered */
  padding: 15px;
  box-sizing: border-box;
}

/* Lines are in background, behind the word */
.spritz-line {
  position: absolute;
  left: 10%;
  right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--accent-1), transparent);
  opacity: 0.6;
  z-index: 0;
}

.spritz-line-top {
  top: 20px;
}

.spritz-line-bottom {
  bottom: 20px;
}

/* Wedges to Elegant Markers */
.spritz-wedge {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-1);
  box-shadow: 0 0 10px var(--accent-glow);
  z-index: 2;
}

.spritz-wedge-top {
  top: 17px;
}

.spritz-wedge-bottom {
  bottom: 17px;
}

.focus-lines-hidden .spritz-line,
.focus-lines-hidden .spritz-wedge {
  display: none;
}

/* Current Word - Fixed ORP with Uthmanic Script */
.current-word {
  font-family:
    "KFGQPC Uthmanic Script HAFS", "Amiri Quran", "Scheherazade New", "Amiri",
    "Noto Naskh Arabic", serif;
  font-size: 4rem;
  font-weight: normal;
  color: var(--text-primary);
  text-align: center;
  line-height: 1.4;
  min-height: 100px;
  display: flex;
  align-items: center;
  justify-content: center;
  direction: rtl;
  unicode-bidi: bidi-override;
  z-index: 1;
  position: relative;
  padding: 15px 20px;
  box-sizing: border-box;
  max-width: 100%;
  width: 100%;
  word-wrap: break-word;
  overflow-wrap: break-word;
  /* Uthmanic font features */
  font-feature-settings:
    "liga" 1,
    "kern" 1,
    "calt" 1;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* Adjust vertical position to be equidistant from both lines */
  margin-top: -15px;
}

.current-word .orp-letter {
  color: var(--accent-1);
  text-shadow: 0 0 30px var(--accent-glow);
}

.current-word .dim-letter {
  opacity: 0.4;
}

.current-word.size-small {
  font-size: 3rem;
  padding: 12px 18px;
}

.current-word.size-medium {
  font-size: 4rem;
  padding: 15px 20px;
}

.current-word.size-large {
  font-size: 4.5rem;
  padding: 18px 22px;
}

.current-word.size-xlarge {
  font-size: 5rem;
  padding: 20px 25px;
}

/* Info Bar - Improved */
.info-bar {
  display: flex;
  justify-content: center;
  gap: 20px;
  padding: 12px 16px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  border-radius: 28px;
  box-shadow: var(--shadow-bento);
}

.info-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.info-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.info-value {
  font-size: 1.1rem;
  color: var(--accent-1);
  font-weight: 600;
}

/* Playhead Card: unified progress + playback controls */
.playhead-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  border-radius: 32px;
  padding: 16px 20px 12px 20px;
  margin: 12px auto;
  overflow: visible;
  box-shadow: var(--shadow-bento);
}

.playhead-card>.progress-track {
  width: 100%;
  margin: 0 0 6px 0;
  padding: 4px 0;
  border: none;
  background: none;
  border-radius: 0;
}

.playhead-card>.playback-controls {
  width: 100%;
  margin: 0;
  padding: 6px 0 4px 0;
  border: none;
  background: none;
  border-radius: 0;
  border-top: 1px solid var(--border);
}

/* Progress Track - RTL Support */
.progress-track {
  width: 100%;
  padding: 8px 0;
}

.progress-container {
  width: 100%;
  height: 8px;
  background: var(--bg-card-solid);
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  touch-action: none;
  border: 1px solid var(--border);
}

[dir="rtl"] .progress-bar {
  margin-left: auto;
  margin-right: 0;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-1), var(--accent-2));
  width: 0%;
  border-radius: 4px;
  transition: width 0.15s ease;
  box-shadow: 0 0 10px var(--accent-glow);
}

.progress-thumb {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #0a0a0f;
  border-radius: 50%;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 700;
  box-shadow: 0 4px 15px var(--accent-glow);
  user-select: none;
  transition:
    left 0.15s ease,
    transform 0.15s ease;
}

.progress-thumb:active {
  cursor: grabbing;
  transform: translateY(-50%) scale(1.15);
}

/* Time Estimates - Improved */
.time-estimates {
  display: flex;
  justify-content: space-around;
  gap: 20px;
  padding: 16px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: 28px;
  border: 1px solid var(--surface-glass-border);
  box-shadow: var(--shadow-bento);
}

.time-item {
  text-align: center;
  flex: 1;
}

.time-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.time-value {
  color: var(--accent-1);
  font-size: 1.1rem;
  font-weight: 600;
}

/* Playback Controls - LTR ORDER with labels */
.playback-controls {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 0;
  direction: ltr;
}

.ctrl-btn-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ctrl-btn-label {
  font-size: 0.8rem;
  color: var(--text-primary);
  text-align: center;
  max-width: 60px;
  transition: color 0.3s ease;
}

/* Dim labels during playback for reduced distraction */
.playback-playing .ctrl-btn-label {
  color: var(--text-muted);
}

.ctrl-btn {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  color: var(--text-primary);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ctrl-btn:hover {
  background: var(--bg-hover);
  border-color: var(--border-accent);
  transform: scale(1.08);
}

.ctrl-btn svg {
  fill: currentColor;
}

.ctrl-btn-sm {
  width: 48px;
  height: 48px;
}

.ctrl-btn-sm svg {
  width: 20px;
  height: 20px;
}

.ctrl-btn-md {
  width: 52px;
  height: 52px;
}

.ctrl-btn-md svg {
  width: 22px;
  height: 22px;
}

.ctrl-btn-play {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #0a0a0f;
  border: none;
  box-shadow: 0 8px 30px var(--accent-glow);
  transition:
    background 0.4s ease,
    box-shadow 0.4s ease,
    transform 0.2s ease;
}

.ctrl-btn-play:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px var(--accent-glow);
}

/* Surah completion: green pulse animation */
.ctrl-btn-play.play-btn-complete {
  background: linear-gradient(135deg, #22c55e, #4ade80) !important;
  box-shadow: 0 8px 30px rgba(34, 197, 94, 0.45) !important;
  animation: playBtnFlash 1.6s ease-in-out infinite;
}

@keyframes playBtnFlash {

  0%,
  100% {
    transform: scale(1);
    box-shadow: 0 8px 30px rgba(34, 197, 94, 0.45);
  }

  50% {
    transform: scale(1.08);
    box-shadow: 0 12px 45px rgba(34, 197, 94, 0.7);
  }
}

.ctrl-btn-play svg {
  width: 26px;
  height: 26px;
}

/* Control Cards */
.control-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  padding: 20px;
  border-radius: 28px;
  gap: 12px;
  margin-top: auto;
  flex-shrink: 0;
  box-shadow: var(--shadow-bento);
  /* Don't shrink */
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.control-value {
  color: var(--accent-1);
  font-weight: 600;
  font-size: 1rem;
}

/* Enhanced Toggle */
.enhanced-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.enhanced-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.enhanced-title {
  color: var(--text-primary);
  font-size: 0.9rem;
}

.enhanced-desc {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  width: 50px;
  height: 26px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 26px;
  transition: 0.3s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 2px;
  bottom: 2px;
  background: var(--text-muted);
  border-radius: 50%;
  transition: 0.3s;
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--accent-1);
  border-color: var(--accent-1);
}

.toggle-switch input:checked+.toggle-slider:before {
  transform: translateX(24px);
  background: #0a0a0f;
}

/* Slider */
.speed-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  border-radius: 4px;
  outline: none;
}

.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--accent-glow);
}

.speed-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.speed-presets {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.preset-btn {
  padding: 8px 14px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  font-family: inherit;
  transition: all 0.3s ease;
}

.preset-btn:hover,
.preset-btn.active {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #0a0a0f;
  border-color: var(--accent-1);
}

/* Simplified Speed Buttons */
.speed-presets-simple {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: nowrap;
  margin-top: 6px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  border-radius: 28px;
  padding: 10px 12px;
  box-shadow: var(--shadow-bento);
}

.speed-btn-simple {
  padding: 8px 12px;
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.3s ease;
  min-width: auto;
  flex: 1;
}

.speed-btn-simple:hover {
  background: var(--bg-card);
  border-color: var(--accent-1);
  color: var(--accent-1);
}

.speed-btn-simple.active {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #0a0a0f;
  border-color: var(--accent-1);
  font-weight: 600;
}

/* More Controls Button */
.more-controls-btn {
  width: 100%;
  padding: 14px 20px;
  margin-top: 6px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  color: var(--text-primary);
  border-radius: 28px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 500;
  font-family: inherit;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--shadow-bento);
}

.more-controls-btn:hover {
  background: var(--bg-card);
  border-color: var(--accent-1);
  color: var(--accent-1);
}

.more-controls-btn.expanded #moreControlsIcon {
  transform: rotate(180deg);
}

/* Advanced Controls Section */
.advanced-controls {
  margin-top: 16px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Loop Control - Improved with Range Slider */
.loop-control {
  margin-top: 14px;
}

.loop-range-display {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 0.9rem;
  color: var(--text-secondary);
}

.loop-range-value {
  color: var(--accent-1);
  font-weight: 600;
}

.loop-slider-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.loop-slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.loop-slider-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  min-width: 50px;
}

.loop-input {
  width: 50px;
  padding: 8px;
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--bg-card-solid);
  color: var(--text-primary);
  border: 1px solid var(--border);
  border-radius: 8px;
  text-align: center;
  -moz-appearance: textfield;
  appearance: textfield;
}

.loop-input::-webkit-outer-spin-button,
.loop-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.loop-input:focus {
  outline: none;
  border-color: var(--accent-1);
  background-color: var(--bg-hover);
}

.loop-slider {
  flex: 1;
}

/* Font Size Control */
.font-size-control {
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border: 1px solid var(--surface-glass-border);
  border-radius: 28px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-bento);
}

.font-size-label {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  text-align: center;
}

.font-size-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.font-btn {
  background: var(--bg-card-solid);
  border: 1px solid var(--border);
  color: var(--text-muted);
  width: 44px;
  height: 44px;
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.font-btn:hover {
  background: var(--bg-hover);
  border-color: var(--accent-1);
  color: var(--accent-1);
  transform: translateY(-2px);
}

.font-btn.active {
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #0a0a0f;
  border-color: var(--accent-1);
  box-shadow: 0 4px 12px rgba(212, 175, 55, 0.3);
}

/* Stats with Visitor Counter */
.stats-row {
  display: flex;
  justify-content: space-around;
  padding: 14px;
  margin-top: 14px;
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  -webkit-backdrop-filter: var(--glass-blur);
  border-radius: 28px;
  border: 1px solid var(--surface-glass-border);
  box-shadow: var(--shadow-bento);
}

.stat-item {
  text-align: center;
}

.stat-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.stat-value {
  color: var(--accent-1);
  font-weight: 600;
  font-size: 1rem;
}

/* Fullscreen Exit Button */
.focus-exit {
  position: fixed;
  top: max(20px, calc(env(safe-area-inset-top) + 8px));
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border);
  color: var(--text-primary);
  padding: 10px 20px;
  border-radius: 25px;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.85rem;
  z-index: 1000;
  display: none;
  transition: all 0.3s ease;
}

.focus-exit:hover {
  background: var(--bg-hover);
  border-color: var(--accent-1);
}

.focus-mode .focus-exit {
  display: flex;
  align-items: center;
  gap: 8px;
}

.focus-exit svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Focus Mode — dims everything except word display and play/pause controls */
.focus-mode .top-bar,
.focus-mode .surah-selector,
.focus-mode .time-estimates,
.focus-mode .control-card,
.focus-mode .stats-row,
.focus-mode .font-size-control,
.focus-mode .enhanced-toggle,
.focus-mode .info-bar,
.focus-mode .speed-presets-simple,
.focus-mode .stats-grid {
  opacity: 0.1;
  pointer-events: none;
  transition: opacity 0.4s ease;
  filter: blur(3px);
}

.focus-mode .word-display {
  min-height: 45vh;
  transition: min-height 0.4s ease;
  opacity: 1 !important;
  filter: none !important;
}

.focus-mode .playback-controls,
.focus-mode .playhead-card {
  transition: opacity 0.4s ease;
  opacity: 1 !important;
  filter: none !important;
  pointer-events: auto !important;
}

.loading-text {
  color: var(--text-muted);
  font-size: 1.2rem;
}

/* Loading dots animation */
.loading-dots {
  display: inline-block;
  font-size: 2rem;
  letter-spacing: 0.3em;
}

.loading-dots span {
  display: inline-block;
  animation: dotPulse 1.4s infinite;
}

.loading-dots span:nth-child(1) {
  animation-delay: 0s;
}

.loading-dots span:nth-child(2) {
  animation-delay: 0.2s;
}

.loading-dots span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes dotPulse {

  0%,
  60%,
  100% {
    opacity: 0.3;
    transform: scale(1);
  }

  30% {
    opacity: 1;
    transform: scale(1.2);
  }
}

/* Responsive - Mobile Optimizations */
@media (max-width: 768px) {
  .app-screen {
    padding: 0;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .top-bar {
    padding: 6px 12px;
    gap: 8px;
    margin: 8px 12px;
  }

  .top-bar-btn {
    min-width: 44px;
    min-height: 44px;
    padding: 10px;
  }

  .surah-row {
    padding: 0 16px;
    flex-wrap: wrap;
    gap: 8px;
  }

  .surah-row .page-display {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.9rem;
    color: var(--text-secondary);
    min-width: fit-content;
  }

  .surah-row .page-display #pageLabel {
    font-size: 0.85rem;
  }

  .surah-row .page-display #pageNum {
    font-weight: 600;
    color: var(--accent-1);
    font-size: 0.95rem;
  }

  .surah-selector select {
    font-size: 0.95rem;
    padding: 12px 16px;
    background-color: var(--bg-card);
    color: var(--text-primary);
    border: 1px solid var(--border);
  }

  .surah-selector select option {
    background-color: var(--bg-card-solid);
    color: var(--text-primary);
  }

  .app-container {
    max-width: 100%;
    padding: 0;
    gap: 0;
  }

  .word-display {
    width: calc(100% - 32px);
    max-width: 500px;
    height: 170px;
    min-height: 150px;
    max-height: 180px;
    padding: 0;
    margin: 10px auto;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
  }

  .spritz-frame {
    width: 100%;
    max-width: 100%;
    min-height: auto;
    padding: 20px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    flex: 1;
  }

  .focus-container {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 0;
  }

  .current-word {
    width: 100%;
    max-width: 100%;
  }

  .playback-controls {
    gap: 8px;
    padding: 12px 8px;
    flex-wrap: wrap;
  }

  .ctrl-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .ctrl-btn-play {
    width: 56px;
    height: 56px;
  }

  .ctrl-btn-sm {
    width: 40px;
    height: 40px;
  }

  .ctrl-btn-md {
    width: 44px;
    height: 44px;
  }

  .speed-presets-simple {
    gap: 4px;
    flex-wrap: nowrap;
  }

  .speed-btn-simple {
    min-width: auto;
    min-height: 40px;
    padding: 8px 10px;
    font-size: 0.82rem;
    flex: 1;
  }

  .info-bar {
    gap: 12px;
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .time-estimates {
    gap: 12px;
    padding: 10px 12px;
  }

  .control-card {
    padding: 12px;
  }

  .more-controls-btn {
    min-height: 44px;
    padding: 12px 16px;
  }
}

@media (max-width: 500px) {
  .intro-title {
    font-size: 2.2rem;
  }

  .current-word {
    font-size: 3.5rem;
    padding: 12px 15px;
    /* Keep Uthmanic font in responsive */
    font-family:
      "KFGQPC Uthmanic Script HAFS", "Amiri Quran", "Scheherazade New", "Amiri",
      "Noto Naskh Arabic", serif;
  }

  .current-word.size-small {
    font-size: 2.5rem;
    padding: 10px 12px;
  }

  .current-word.size-medium {
    font-size: 3.5rem;
    padding: 12px 15px;
  }

  .current-word.size-large {
    font-size: 4rem;
    padding: 14px 18px;
  }

  .current-word.size-xlarge {
    font-size: 4.5rem;
    padding: 16px 20px;
  }

  .word-display {
    width: calc(100% - 32px);
    max-width: 500px;
    height: 170px;
    min-height: 150px;
    max-height: 180px;
    padding: 0;
    margin: 10px auto;
    border-radius: 24px;
    background: var(--bg-card);
    border: 1px solid var(--border);
  }

  .spritz-frame {
    width: 100%;
    max-width: 100%;
    padding: 15px;
    min-height: auto;
  }

  .ctrl-btn-play {
    width: 58px;
    height: 58px;
  }

  .info-bar {
    gap: 15px;
    padding: 10px 12px;
  }

  .playback-controls {
    gap: 6px;
  }

  .speed-presets-simple {
    gap: 3px;
    padding: 8px 10px;
  }

  .speed-btn-simple {
    min-width: auto;
    padding: 7px 8px;
    font-size: 0.78rem;
    flex: 1;
  }
}

@media (max-width: 360px) {
  .current-word.size-small {
    font-size: 2.2rem;
    padding: 8px 10px;
  }

  .current-word.size-medium {
    font-size: 3rem;
    padding: 10px 12px;
  }

  .current-word.size-large {
    font-size: 3.5rem;
    padding: 12px 14px;
  }

  .current-word.size-xlarge {
    font-size: 4rem;
    padding: 14px 16px;
  }

  .speed-btn-simple {
    min-width: auto;
    padding: 6px 6px;
    font-size: 0.72rem;
    flex: 1;
  }

  .ctrl-btn-label {
    font-size: 0.6rem;
  }
}

/* Safe area insets for notched devices */
@supports (padding: max(0px)) {
  .app-screen {
    padding-left: max(16px, env(safe-area-inset-left));
    padding-right: max(16px, env(safe-area-inset-right));
    padding-top: max(0px, env(safe-area-inset-top));
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }

  .top-bar {
    padding-top: max(12px, env(safe-area-inset-top)) !important;
  }
}

.adjust-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  color: var(--text-primary);
  padding: 2px 10px;
  border-radius: 12px;
  cursor: pointer;
  margin: 0 8px;
  font-size: 0.85rem;
  transition: all 0.2s;
}

.adjust-btn:hover {
  background: var(--accent-1);
  color: #000;
}

.speed-adjuster {
  display: flex;
  align-items: center;
}

/* New Gaze UI */
.gaze-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  /* background: var(--bg-card); */
  /* border: 1px solid var(--border); */
  border-radius: 8px;
  padding: 5px 10px;
  margin: 10px auto;
  max-width: 800px;
  height: 40px;
  gap: 15px;
}

.gaze-canvas {
  width: 120px;
  height: 30px;
  /* background: rgba(0,0,0,0.2); */
  border-radius: 15px;
  /* border: 1px solid var(--border-accent); */
}

.gaze-toggle-mini {
  transform: scale(0.8);
}

.gaze-video-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

/* Pause Overlay */
.pause-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 10, 15, 0.85);
  /* Deep dark tint */
  backdrop-filter: blur(12px);
  z-index: 2000;
  display: none;
  /* Flex when active */
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-primary);
  text-align: center;
  transition: opacity 0.3s ease;
}

.overlay-content {
  display: flex;
  flex-direction: column;
  gap: 20px;
  transform: translateY(-20px);
  animation: slideUp 0.4s ease forwards;
}

.overlay-ayah {
  font-size: 2rem;
  color: var(--accent-1);
  font-weight: bold;
}

.overlay-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 10px;
}

.o-stat-item {
  background: rgba(255, 255, 255, 0.05);
  padding: 15px;
  border-radius: 10px;
  min-width: 120px;
}

.o-stat-val {
  font-size: 1.5rem;
  font-weight: bold;
  display: block;
}

.o-stat-lbl {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.resume-hint {
  margin-top: 30px;
  font-size: 1.1rem;
  color: var(--text-secondary);
  opacity: 0.8;
}

.focus-progress-bar {
  width: 200px;
  height: 4px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  margin: 15px auto 0;
  overflow: hidden;
}

.focus-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-1);
  transition: width 0.1s linear;
}

@keyframes slideUp {
  to {
    transform: translateY(0);
  }
}

/* Generic Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  z-index: 3000;
  display: none;
  align-items: center;
  justify-content: center;
}

.modal-content {
  background: var(--bg-card);
  padding: 25px;
  border-radius: 16px;
  border: 1px solid var(--border-accent);
  max-width: 400px;
  width: 90%;
  text-align: center;
  color: var(--text-primary);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}

.modal-content h3 {
  color: var(--accent-1);
  margin-bottom: 15px;
  font-size: 1.2rem;
}

.modal-content p {
  color: var(--text-secondary);
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 20px;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 20px;
}

.modal-actions.column {
  flex-direction: column;
  gap: 12px;
}

.modal-btn {
  padding: 12px 20px;
  border-radius: 8px;
  border: 1px solid var(--border);
  cursor: pointer;
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  transition: all 0.2s;
  font-size: 1rem;
}

.modal-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.modal-btn.primary {
  background: var(--accent-1);
  color: #000;
  font-weight: bold;
  border: none;
}

.modal-btn.primary:hover {
  opacity: 0.9;
}

/* Tightening Overrides */
.gaze-bar {
  margin: 5px auto !important;
  height: 36px !important;
  padding: 0 10px !important;
}

.word-display {
  padding: 8px 0 !important;
  min-height: 140px !important;
  max-height: 180px !important;
  height: 170px !important;
}

.playhead-card>.playback-controls {
  margin: 0 !important;
  padding: 6px 0 4px 0 !important;
  direction: rtl !important;
}

.info-bar {
  margin: 0 !important;
  padding: 8px 5px !important;
  gap: 8px !important;
  height: 100%;
  justify-content: space-around;
}

.intro-title {
  font-size: 1.6rem !important;
  margin-bottom: 4px !important;
}

.intro-subtitle {
  display: none !important;
}

.top-bar {
  padding-left: 15px !important;
  padding-right: 15px !important;
  padding-bottom: 8px !important;
  margin-bottom: 10px !important;
}

/* Bento Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 8px;
  margin: 6px 0;
}

.time-estimates {
  margin: 0 !important;
  padding: 8px 5px !important;
  display: flex;
  justify-content: space-around;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  height: 100%;
}

.time-item {
  text-align: center;
}

.speed-presets-simple {
  margin-top: 10px !important;
  margin-bottom: 10px !important;
}

/* Interaction Overlay */
.touch-zone.center {
  width: 40%;
  margin: 0 auto;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.touch-zone.side {
  width: 30%;
  position: absolute;
  top: 0;
  bottom: 0;
  cursor: pointer;
  height: 100%;
}

.touch-zone.left {
  left: 0;
}

.touch-zone.right {
  right: 0;
}

.pause-overlay-icon {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s;
  z-index: 30;
}

.focus-ring-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 140px;
  height: 140px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.focus-active .focus-label {
  opacity: 1;
}

/* Variable Speed Toast */
.toast-notify {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translate(-50%, 20px);
  background: var(--accent-1);
  color: #000;
  padding: 8px 16px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
  z-index: 2000;
  opacity: 0;
  transition: all 0.3s;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
  text-align: center;
}

.toast-notify.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.focus-ring-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.focus-ring-bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 3;
}

.focus-ring-fill {
  fill: none;
  stroke: var(--accent-1);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-dasharray: 377;
  /* 2 * PI * 60 */
  stroke-dashoffset: 377;
  transition: stroke-dashoffset 0.1s linear;
}

.focus-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 0.85rem;
  color: var(--text-primary);
  font-weight: 500;
  text-align: center;
  width: 100%;
  opacity: 0.6;
  letter-spacing: 0.5px;
}

.overlay-icon-side {
  width: 40px;
  height: 40px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(2px);
  margin: auto;
  fill: white;
  animation: fadeIn 0.2s;
}

.overlay-icon-side svg {
  width: 24px;
  height: 24px;
}

/* Tools Grid */
.tools-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 8px 0;
}

.tool-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  height: 70px;
}

.tool-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

.tool-title {
  font-size: 0.8rem;
  color: var(--text-primary);
  font-weight: 600;
}

.tool-desc {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.toggle-wrapper {
  transform: scale(0.7);
  transform-origin: left center;
}

.gaze-ui-compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.gaze-canvas-micro {
  width: 60px;
  height: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
}

/* Improved Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-card-solid);
  border: 2px solid var(--border-accent);
  border-radius: 34px;
  transition: 0.4s;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: 0.4s;
  border-radius: 50%;
}

input:checked+.toggle-slider {
  background-color: var(--accent-1);
  border-color: var(--accent-1);
}

input:checked+.toggle-slider:before {
  transform: translateX(20px);
  background-color: #000;
}

/* Onboarding Features */
.onb-feature {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  text-align: right;
}

[dir="rtl"] .onb-feature {
  text-align: right;
}

.onb-icon {
  font-size: 1.4rem;
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(212, 175, 55, 0.1);
  border-radius: 10px;
}

.onb-text {
  flex: 1;
}

.onb-feat-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--accent-1);
  margin-bottom: 3px;
}

.onb-feat-desc {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.5;
}