:root {
  --bg: #0c0c0b;
  --surface: #141412;
  --border: #2a2a26;
  --text: #e8e3d8;
  --muted: #7a7668;
  --accent: #c8893a;
  --accent-dim: rgba(200,137,58,0.12);
  --popup-bg: #18180f;
}

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

html { scroll-behavior: smooth; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-weight: 300;
  line-height: 1.6;
}

header {
  padding: 20px 24px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
}

.timer-badge {
  position: absolute;
  top: 14px;
  right: 18px;
  font-family: 'DM Sans', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 4px 10px;
  letter-spacing: 0.03em;
  user-select: none;
  transition: color 0.2s;
}

.timer-badge:hover { color: var(--accent); }

h1 {
  font-family: 'Lora', serif;
  font-size: clamp(22px, 5vw, 32px);
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.04em;
}

.search-bar {
  display: flex;
  gap: 8px;
  width: 100%;
  max-width: 420px;
}

.search-bar input {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 300;
  padding: 9px 14px;
  border-radius: 6px;
  outline: none;
  transition: border-color 0.2s;
}

.search-bar input:focus { border-color: var(--accent); }
.search-bar input::placeholder { color: var(--muted); }

.search-bar button {
  background: var(--accent);
  color: #0c0c0b;
  border: none;
  font-family: 'DM Sans', sans-serif;
  font-size: 14px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 6px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.search-bar button:hover { opacity: 0.85; }

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 28px 24px 80px;
}

.surah {
  margin-bottom: 48px;
}

.surah-title {
  font-family: 'DM Sans', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--accent);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}

.ayah {
  display: block;
  font-family: 'Lora', serif;
  font-size: 16.5px;
  line-height: 2.1;
  color: var(--text);
}

.ayah-num {
  font-family: 'DM Sans', sans-serif;
  font-size: 10px;
  color: var(--muted);
  vertical-align: super;
  margin: 0 2px 0 5px;
  user-select: none;
  opacity: 0.7;
}

.word {
  cursor: pointer;
  padding: 1px 2px;
  border-radius: 3px;
  transition: background 0.12s, color 0.12s;
}

.word:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.word.hard {
  border-bottom: 1px dotted var(--accent);
  color: #d9a96a;
}

.word.hard:hover {
  background: var(--accent-dim);
  color: var(--accent);
}

.word.name {
  border-bottom: 1px solid #6ab0d9;
  color: #8ecae6;
}

.word.name:hover {
  background: rgba(106,176,217,0.12);
  color: #6ab0d9;
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 100;
  padding: 0;
  backdrop-filter: blur(3px);
}

.overlay.hidden { display: none; }

.popup {
  background: var(--popup-bg);
  border: 1px solid var(--border);
  border-radius: 16px 16px 0 0;
  width: 100%;
  max-width: 600px;
  padding: 28px 24px 40px;
  position: relative;
  animation: slideUp 0.22s ease;
  max-height: 65vh;
  overflow-y: auto;
}

@media (min-width: 600px) {
  .overlay { align-items: center; padding: 20px; }
  .popup {
    border-radius: 12px;
    max-width: 480px;
    max-height: 70vh;
  }
}

@keyframes slideUp {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

#closeBtn {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  padding: 4px;
  transition: color 0.15s;
}

#closeBtn:hover { color: var(--text); }

#popupWord {
  font-family: 'Lora', serif;
  font-size: 22px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 16px;
  padding-right: 30px;
}

.meaning-block { margin-bottom: 16px; }

.pos {
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.def-item {
  font-size: 15px;
  color: var(--text);
  line-height: 1.65;
  padding-left: 14px;
  border-left: 2px solid var(--border);
  margin-bottom: 8px;
}

.example {
  font-family: 'Lora', serif;
  font-style: italic;
  font-size: 13px;
  color: var(--muted);
  margin-top: 4px;
}

.no-def {
  font-size: 15px;
  color: var(--muted);
}

.loading {
  font-size: 15px;
  color: var(--muted);
}
