/* ========================================================
   Umzu ALNQ 106-111 — Design System & Components
   Islamic Modern Premium Theme
   ======================================================== */

/* ---- CSS Custom Properties ---- */
:root {
  --emerald: #1B6B4A;
  --emerald-light: #2A9D6F;
  --gold: #D4A843;
  --gold-light: #E8C97A;
  --navy: #1B365D;
  --navy-light: #2A5298;
  --cream: #FBF8F1;
  --soft-gray: #F2F4F7;
  --card-bg: #FFFFFF;
  --text-primary: #1B365D;
  --text-secondary: #5A6B7F;
  --text-muted: #8E99A4;
  --border: #E2E8F0;
  --success: #22C55E;
  --danger: #EF4444;
  --warning: #F59E0B;
  --shadow-sm: 0 1px 3px rgba(27,54,93,0.08);
  --shadow-md: 0 4px 12px rgba(27,54,93,0.12);
  --shadow-lg: 0 8px 30px rgba(27,54,93,0.16);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --font-ui: 'Inter', system-ui, sans-serif;
  --font-arabic: 'Amiri', 'Traditional Arabic', serif;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --cream: #0F172A;
  --soft-gray: #1E293B;
  --card-bg: #1E293B;
  --text-primary: #E2E8F0;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border: #334155;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg: 0 8px 30px rgba(0,0,0,0.5);
}

/* ---- Reset & Base ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-tap-highlight-color: transparent; }
body {
  font-family: var(--font-ui);
  background: var(--cream);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- App Container (9:16 mobile, centered on desktop) ---- */
#app-wrapper {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--cream);
  overflow: hidden;
}

/* Islamic pattern on desktop side panels */
@media (min-width: 480px) {
  body {
    background-color: var(--navy);
    background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M30 5L35 15L45 15L37 22L40 32L30 26L20 32L23 22L15 15L25 15Z' fill='none' stroke='%23D4A84320' stroke-width='1'/%3E%3C/svg%3E");
  }
  #app-wrapper {
    box-shadow: 0 0 60px rgba(0,0,0,0.4);
    border-left: 1px solid rgba(212,168,67,0.2);
    border-right: 1px solid rgba(212,168,67,0.2);
  }
}

/* ---- Screen System ---- */
.screen {
  display: none;
  position: absolute;
  top: 0; left: 0; right: 0;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
.screen.active {
  display: flex;
  flex-direction: column;
  position: relative;
  opacity: 1;
  transform: translateY(0);
}

/* ---- Typography ---- */
h1, h2, h3, h4 { font-weight: 700; line-height: 1.3; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.1rem; }
.arabic { font-family: var(--font-arabic); direction: rtl; text-align: right; font-size: 1.4rem; line-height: 2.2; }
.arabic-large { font-size: 1.8rem; line-height: 2.4; }
.arabic-xl { font-size: 2.2rem; line-height: 2.6; }
.text-gold { color: var(--gold); }
.text-emerald { color: var(--emerald); }
.text-muted { color: var(--text-muted); }
.text-center { text-align: center; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 14px 24px; border: none; border-radius: var(--radius-md);
  font-family: var(--font-ui); font-size: 0.95rem; font-weight: 600;
  cursor: pointer; min-height: 48px; min-width: 48px;
  transition: all var(--transition); text-decoration: none;
  -webkit-user-select: none; user-select: none;
}
.btn:active { transform: scale(0.96); }
.btn-primary { background: var(--emerald); color: #fff; }
.btn-primary:hover { background: var(--emerald-light); }
.btn-gold { background: linear-gradient(135deg, var(--gold), var(--gold-light)); color: var(--navy); }
.btn-gold:hover { filter: brightness(1.1); }
.btn-navy { background: var(--navy); color: #fff; }
.btn-outline { background: transparent; border: 2px solid var(--border); color: var(--text-primary); }
.btn-outline:hover { border-color: var(--emerald); color: var(--emerald); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 0.85rem; min-height: 40px; }
.btn-lg { padding: 16px 32px; font-size: 1.05rem; }
.btn-block { width: 100%; }
.btn-icon { width: 48px; padding: 0; border-radius: 50%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.back-btn {
  font-size: 1.2rem; font-weight: 700; cursor: pointer;
  background: transparent; border: none; color: var(--text-primary);
  padding: 6px 10px; border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  line-height: 1; min-width: 36px; min-height: 36px;
  transition: all var(--transition);
}
.back-btn:hover { background: var(--soft-gray); }

/* ---- Cards ---- */
.card {
  background: var(--card-bg);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: all var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-interactive { cursor: pointer; }
.card-interactive:active { transform: scale(0.98); }

/* ---- Modal ---- */
.modal-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: var(--card-bg); border-radius: var(--radius-xl);
  padding: 28px; max-width: 360px; width: 100%;
  box-shadow: var(--shadow-lg); animation: modalIn 0.3s ease;
}
@keyframes modalIn { from { opacity: 0; transform: scale(0.9) translateY(20px); } }
.modal h3 { margin-bottom: 12px; }
.modal p { color: var(--text-secondary); margin-bottom: 20px; font-size: 0.9rem; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }

/* ---- Input ---- */
.input-field {
  width: 100%; padding: 14px 16px; border: 2px solid var(--border);
  border-radius: var(--radius-md); font-family: var(--font-ui);
  font-size: 1rem; background: var(--card-bg); color: var(--text-primary);
  transition: border-color var(--transition); outline: none;
}
.input-field:focus { border-color: var(--emerald); }
.input-field.arabic-input {
  font-family: var(--font-arabic); font-size: 1.3rem;
  direction: rtl; text-align: right;
}

/* ---- Progress Bars ---- */
.progress-bar {
  height: 10px; background: var(--soft-gray); border-radius: 5px;
  overflow: hidden; position: relative;
}
.progress-bar .fill {
  height: 100%; border-radius: 5px;
  background: linear-gradient(90deg, var(--emerald), var(--emerald-light));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}
.progress-bar .fill.gold {
  background: linear-gradient(90deg, var(--gold), var(--gold-light));
}

/* ---- Stars ---- */
.stars { display: flex; gap: 4px; }
.stars .star { font-size: 1.2rem; opacity: 0.3; transition: all var(--transition); }
.stars .star.earned { opacity: 1; animation: starPop 0.4s ease; }
@keyframes starPop { 0% { transform: scale(0); } 50% { transform: scale(1.3); } 100% { transform: scale(1); } }

/* ---- Badge ---- */
.badge-item {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 16px 8px; border-radius: var(--radius-md);
  background: var(--soft-gray); text-align: center;
  transition: all var(--transition);
}
.badge-item.unlocked { background: linear-gradient(135deg, rgba(212,168,67,0.15), rgba(27,107,74,0.1)); }
.badge-item.locked { opacity: 0.4; filter: grayscale(1); }
.badge-item .badge-icon { font-size: 2rem; }
.badge-item .badge-name { font-size: 0.75rem; font-weight: 600; }

/* ---- Notification Badge (counter) ---- */
.notif-badge {
  position: absolute; top: -6px; right: -6px;
  background: var(--danger); color: #fff;
  font-size: 0.7rem; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  padding: 0 5px;
}

/* ---- Tabs ---- */
.tabs { display: flex; gap: 4px; padding: 4px; background: var(--soft-gray); border-radius: var(--radius-md); }
.tab-btn {
  flex: 1; padding: 10px 8px; border: none; background: transparent;
  font-family: var(--font-ui); font-size: 0.8rem; font-weight: 600;
  color: var(--text-muted); border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition);
}
.tab-btn.active { background: var(--card-bg); color: var(--text-primary); box-shadow: var(--shadow-sm); }

/* ========================================================
   SCREEN-SPECIFIC STYLES
   ======================================================== */

/* ---- Splash Screen ---- */
.splash-screen {
  align-items: center; justify-content: center; gap: 30px;
  background: linear-gradient(135deg, var(--navy) 0%, var(--emerald) 100%);
  color: #fff;
}
.splash-logo { font-size: 4rem; animation: float 3s ease-in-out infinite; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.splash-title { font-size: 1.6rem; font-weight: 800; text-align: center; letter-spacing: 1px; }
.splash-subtitle { font-size: 0.9rem; opacity: 0.7; text-align: center; }
.splash-loader { width: 200px; height: 4px; background: rgba(255,255,255,0.2); border-radius: 2px; overflow: hidden; }
.splash-loader .bar { height: 100%; background: var(--gold); border-radius: 2px; animation: loading 2s ease-in-out; }
@keyframes loading { from { width: 0; } to { width: 100%; } }

/* ---- Profile Screen ---- */
.profile-screen { padding: 24px 20px; gap: 20px; }
.profile-screen h2 { text-align: center; margin-bottom: 4px; }
.avatar-picker { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; padding: 10px 0; }
.avatar-option {
  width: 56px; height: 56px; display: flex; align-items: center; justify-content: center;
  font-size: 1.8rem; border-radius: 50%; border: 3px solid var(--border);
  cursor: pointer; transition: all var(--transition);
}
.avatar-option.selected { border-color: var(--gold); background: rgba(212,168,67,0.1); transform: scale(1.1); }
.profile-list { display: flex; flex-direction: column; gap: 10px; }
.profile-card {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  border-radius: var(--radius-md); background: var(--card-bg);
  border: 1px solid var(--border); cursor: pointer;
  transition: all var(--transition);
}
.profile-card:hover { border-color: var(--emerald); box-shadow: var(--shadow-md); }
.profile-card .p-avatar { font-size: 2rem; }
.profile-card .p-info { flex: 1; }
.profile-card .p-info .p-name { font-weight: 700; }
.profile-card .p-info .p-sub { font-size: 0.8rem; color: var(--text-muted); }
.profile-card .p-arrow { color: var(--text-muted); font-size: 1.2rem; }

/* ---- Home Screen ---- */
.home-screen { padding: 0; }
.home-header {
  background: linear-gradient(135deg, var(--navy), var(--emerald));
  padding: 24px 20px 30px; border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  color: #fff;
}
.home-header-top { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.home-avatar { font-size: 2.4rem; background: rgba(255,255,255,0.15); width: 56px; height: 56px; border-radius: 50%; display:flex; align-items:center; justify-content:center; }
.home-info { flex: 1; }
.home-name { font-size: 1.1rem; font-weight: 700; }
.home-level { font-size: 0.85rem; opacity: 0.8; }
.home-settings-btn {
  width: 40px; height: 40px; border-radius: 50%; border: none;
  background: rgba(255,255,255,0.15); color: #fff; font-size: 1.2rem;
  cursor: pointer; transition: all var(--transition);
}
.home-xp-bar { margin-top: 8px; }
.home-xp-bar .progress-bar { background: rgba(255,255,255,0.15); height: 8px; }
.home-xp-bar .fill { background: linear-gradient(90deg, var(--gold), var(--gold-light)); }
.home-xp-label { display: flex; justify-content: space-between; font-size: 0.75rem; opacity: 0.7; margin-top: 4px; }
.home-streak { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 0.9rem; }
.home-streak .fire { font-size: 1.3rem; animation: pulse 1.5s infinite; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.15); } }

.home-menu { padding: 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.menu-card {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 22px 12px; border-radius: var(--radius-lg);
  background: var(--card-bg); border: 1px solid var(--border);
  cursor: pointer; transition: all var(--transition); position: relative;
  box-shadow: var(--shadow-sm); text-align: center;
}
.menu-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.menu-card:active { transform: scale(0.97); }
.menu-card .mc-icon { font-size: 2rem; }
.menu-card .mc-label { font-size: 0.85rem; font-weight: 600; color: var(--text-primary); }
.menu-card.highlight { background: linear-gradient(135deg, rgba(27,107,74,0.08), rgba(212,168,67,0.08)); border-color: var(--gold); }

/* ---- Quest Map Screen ---- */
.quest-screen { padding: 0; }
.quest-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.quest-header .back-btn { font-size: 1.2rem; cursor: pointer; background:none; border:none; color: var(--text-primary); padding: 8px; }
.quest-header h2 { flex: 1; }
.quest-map {
  flex: 1; overflow-y: auto; padding: 30px 20px;
  background: linear-gradient(180deg, var(--cream) 0%, rgba(27,107,74,0.05) 100%);
  display: flex; flex-direction: column-reverse; gap: 0; position: relative;
}
.quest-path { position: relative; padding-left: 40px; }
.quest-path::before {
  content: ''; position: absolute; left: 20px; top: 0; bottom: 0;
  width: 4px; background: var(--border); border-radius: 2px;
}
.island-node {
  position: relative; padding: 16px 0; cursor: pointer;
}
.island-dot {
  position: absolute; left: -28px; top: 24px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--border); border: 3px solid var(--card-bg);
  z-index: 2; transition: all var(--transition);
}
.island-node.unlocked .island-dot { background: var(--emerald); }
.island-node.current .island-dot { background: var(--gold); box-shadow: 0 0 12px rgba(212,168,67,0.5); animation: pulse 2s infinite; }
.island-card {
  padding: 16px 18px; border-radius: var(--radius-md);
  background: var(--card-bg); border: 1px solid var(--border);
  box-shadow: var(--shadow-sm); transition: all var(--transition);
}
.island-node.locked .island-card { opacity: 0.5; }
.island-node.unlocked .island-card:hover { box-shadow: var(--shadow-md); border-color: var(--emerald); }
.island-card .island-emoji { font-size: 1.5rem; margin-bottom: 4px; }
.island-card .island-name { font-weight: 700; font-size: 0.95rem; }
.island-card .island-sub { font-size: 0.8rem; color: var(--text-muted); }
.island-levels { display: flex; gap: 6px; margin-top: 10px; flex-wrap: wrap; }
.level-pip {
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 0.7rem; background: var(--soft-gray); color: var(--text-muted);
  border: 1px solid var(--border); transition: all var(--transition);
}
.level-pip.completed { background: rgba(27,107,74,0.1); color: var(--emerald); border-color: var(--emerald); }
.level-pip.current-level { border-color: var(--gold); box-shadow: 0 0 8px rgba(212,168,67,0.3); }

/* ---- Library Screen ---- */
.library-screen { padding: 0; }
.library-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.library-header .back-btn { font-size: 1.2rem; cursor: pointer; background:none; border:none; color: var(--text-primary); padding: 8px; }
.library-tabs { padding: 12px 20px 0; }
.library-content { flex: 1; overflow-y: auto; padding: 16px 20px 30px; }
.library-surah-list { display: flex; flex-direction: column; gap: 10px; }
.library-surah-card {
  display: flex; align-items: center; gap: 14px; padding: 16px;
  background: var(--card-bg); border-radius: var(--radius-md);
  border: 1px solid var(--border); cursor: pointer;
  transition: all var(--transition);
}
.library-surah-card:hover { box-shadow: var(--shadow-md); }
.surah-num {
  width: 44px; height: 44px; border-radius: 50%;
  background: linear-gradient(135deg, var(--emerald), var(--navy));
  color: #fff; font-weight: 700; font-size: 0.9rem;
  display: flex; align-items: center; justify-content: center;
}
.ayat-display { padding: 20px; background: var(--soft-gray); border-radius: var(--radius-md); margin-bottom: 16px; }
.ayat-item { margin-bottom: 20px; }
.ayat-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--emerald); color: #fff; font-size: 0.75rem;
  font-weight: 700; margin-left: 8px;
}
.ayat-arabic { font-family: var(--font-arabic); font-size: 1.6rem; direction: rtl; text-align: right; line-height: 2.4; margin: 8px 0; color: var(--text-primary); }
.ayat-translation { font-size: 0.9rem; color: var(--text-secondary); font-style: italic; line-height: 1.6; padding-left: 36px; }

.mufradat-table { width: 100%; border-collapse: separate; border-spacing: 0 4px; }
.mufradat-table th { padding: 10px; text-align: left; font-size: 0.8rem; color: var(--text-muted); font-weight: 600; }
.mufradat-table td { padding: 10px; background: var(--card-bg); font-size: 0.9rem; }
.mufradat-table td:first-child { font-family: var(--font-arabic); font-size: 1.2rem; direction: rtl; text-align: right; border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.mufradat-table td:last-child { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.kaidah-content { line-height: 1.8; font-size: 0.9rem; }
.kaidah-content table { width: 100%; margin: 12px 0; border-collapse: collapse; font-size: 0.85rem; }
.kaidah-content th, .kaidah-content td { padding: 8px; border: 1px solid var(--border); text-align: left; }
.kaidah-content th { background: var(--soft-gray); font-weight: 600; }

/* ---- Quiz Screen ---- */
.quiz-screen { padding: 0; }
.quiz-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 20px; background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}
.quiz-progress-info { flex: 1; }
.quiz-progress-text { font-size: 0.85rem; font-weight: 600; }
.quiz-progress-bar { margin-top: 6px; }
.quiz-content { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 20px; }
.quiz-question-card {
  background: var(--card-bg); border-radius: var(--radius-lg);
  padding: 24px; box-shadow: var(--shadow-md); border: 1px solid var(--border);
}
.quiz-question-text { font-size: 1rem; font-weight: 600; line-height: 1.6; margin-bottom: 8px; }
.quiz-question-arabic { font-family: var(--font-arabic); font-size: 1.8rem; direction: rtl; text-align: center; line-height: 2.2; color: var(--navy); margin: 16px 0; }
.quiz-options { display: flex; flex-direction: column; gap: 10px; }
.quiz-option {
  padding: 14px 18px; border: 2px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; transition: all var(--transition); font-size: 0.95rem;
  background: var(--card-bg); min-height: 48px; display: flex; align-items: center; gap: 12px;
}
.quiz-option:hover { border-color: var(--emerald); background: rgba(27,107,74,0.04); }
.quiz-option.selected { border-color: var(--navy); background: rgba(27,54,93,0.06); }
.quiz-option.correct { border-color: var(--success); background: rgba(34,197,94,0.08); color: var(--success); }
.quiz-option.wrong { border-color: var(--danger); background: rgba(239,68,68,0.08); color: var(--danger); }
.quiz-option .opt-letter {
  width: 32px; height: 32px; border-radius: 50%; background: var(--soft-gray);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 0.85rem; flex-shrink: 0;
}
.quiz-option.correct .opt-letter { background: var(--success); color: #fff; }
.quiz-option.wrong .opt-letter { background: var(--danger); color: #fff; }

/* True/False */
.tf-buttons { display: flex; gap: 14px; }
.tf-btn {
  flex: 1; padding: 20px; border: 2px solid var(--border); border-radius: var(--radius-lg);
  font-size: 1.5rem; cursor: pointer; background: var(--card-bg);
  transition: all var(--transition); display: flex; flex-direction: column;
  align-items: center; gap: 8px;
}
.tf-btn:hover { border-color: var(--emerald); }
.tf-btn.correct { border-color: var(--success); background: rgba(34,197,94,0.08); }
.tf-btn.wrong { border-color: var(--danger); background: rgba(239,68,68,0.08); }
.tf-btn span { font-size: 0.85rem; font-weight: 600; }

/* Flashcard */
.flashcard-container { perspective: 800px; margin: 20px 0; }
.flashcard {
  position: relative; width: 100%; min-height: 260px;
  transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  transform-style: preserve-3d; cursor: pointer;
}
.flashcard.flipped { transform: rotateY(180deg); }
.flashcard-face {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  backface-visibility: hidden; border-radius: var(--radius-lg);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px; text-align: center;
}
.flashcard-front {
  background: linear-gradient(135deg, var(--navy), var(--emerald));
  color: #fff;
}
.flashcard-front .fc-label { font-size: 0.85rem; opacity: 0.7; margin-bottom: 12px; }
.flashcard-front .fc-arabic { font-family: var(--font-arabic); font-size: 2.4rem; line-height: 2; }
.flashcard-back {
  background: var(--card-bg); border: 2px solid var(--gold);
  transform: rotateY(180deg);
}
.flashcard-back .fc-meaning { font-size: 1.3rem; font-weight: 700; color: var(--navy); }
.flashcard-back .fc-translit { font-size: 0.9rem; color: var(--text-muted); margin-top: 8px; }
.flashcard-actions { display: flex; gap: 12px; margin-top: 16px; }

/* Word Scramble */
.scramble-slots { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; padding: 12px; background: var(--soft-gray); border-radius: var(--radius-md); border: 2px dashed var(--border); margin-bottom: 14px; }
.scramble-bank { display: flex; flex-wrap: wrap; gap: 8px; }
.word-chip {
  padding: 10px 16px; border-radius: var(--radius-sm); background: var(--card-bg);
  border: 1px solid var(--border); cursor: pointer; font-size: 0.9rem;
  font-weight: 500; transition: all var(--transition); user-select: none;
}
.word-chip.arabic-chip { font-family: var(--font-arabic); font-size: 1.1rem; direction: rtl; }
.word-chip:hover { border-color: var(--emerald); background: rgba(27,107,74,0.05); }
.word-chip.placed { opacity: 0.3; pointer-events: none; }
.word-chip.in-slot { background: rgba(27,107,74,0.08); border-color: var(--emerald); }

/* Matching */
.matching-container { display: flex; gap: 14px; }
.matching-col { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.match-item {
  padding: 14px; border: 2px solid var(--border); border-radius: var(--radius-md);
  text-align: center; cursor: pointer; transition: all var(--transition);
  min-height: 48px; display: flex; align-items: center; justify-content: center;
  font-size: 0.9rem; background: var(--card-bg);
}
.match-item.selected { border-color: var(--gold); background: rgba(212,168,67,0.08); }
.match-item.matched { border-color: var(--success); background: rgba(34,197,94,0.08); opacity: 0.6; pointer-events: none; }
.match-item.wrong-match { border-color: var(--danger); animation: shake 0.4s; }
.match-item.arabic-match { font-family: var(--font-arabic); font-size: 1.2rem; direction: rtl; }

/* Feedback */
.feedback-toast {
  position: fixed; top: 70px; left: 50%; transform: translateX(-50%);
  padding: 12px 24px; border-radius: var(--radius-xl);
  font-weight: 700; font-size: 0.9rem; z-index: 9999;
  animation: toastIn 0.3s ease, toastOut 0.3s ease 1.3s forwards;
  box-shadow: var(--shadow-lg); max-width: 320px; text-align: center;
  pointer-events: none;
}
.feedback-toast.correct { background: #DCFCE7; color: #166534; border: 1px solid #86EFAC; }
.feedback-toast.wrong { background: #FEE2E2; color: #991B1B; border: 1px solid #FCA5A5; }
.feedback-toast.info { background: #FEF3C7; color: #92400E; border: 1px solid #FDE68A; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(-10px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(-50%) translateY(-10px); } }

/* ---- Results Screen ---- */
.results-screen { padding: 0; align-items: center; }
.results-content {
  flex: 1; display: flex; flex-direction: column; align-items: center;
  justify-content: center; padding: 30px 20px; gap: 24px; text-align: center;
}
.results-stars { font-size: 3rem; display: flex; gap: 8px; }
.results-stars .star { opacity: 0.2; }
.results-stars .star.earned { opacity: 1; animation: starPop 0.5s ease; }
.results-title { font-size: 1.4rem; font-weight: 800; }
.results-stats { width: 100%; max-width: 300px; }
.stat-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.stat-row .stat-val { font-weight: 700; }
.results-xp { font-size: 1.2rem; font-weight: 700; color: var(--gold); }
.results-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 300px; }

/* ---- Dashboard Screen ---- */
.dashboard-screen { padding: 0; }
.dashboard-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--card-bg); border-bottom: 1px solid var(--border); }
.dashboard-content { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; }
.mastery-ring {
  width: 140px; height: 140px; border-radius: 50%; position: relative;
  margin: 0 auto; display: flex; align-items: center; justify-content: center;
}
.mastery-ring .ring-text { font-size: 1.8rem; font-weight: 800; }
.mastery-ring .ring-label { font-size: 0.75rem; color: var(--text-muted); }
.surah-progress-list { display: flex; flex-direction: column; gap: 12px; }
.surah-progress-card { padding: 14px; background: var(--card-bg); border-radius: var(--radius-md); border: 1px solid var(--border); }
.surah-progress-card .sp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.surah-progress-card .sp-name { font-weight: 700; font-size: 0.9rem; }
.mastery-legend { display: flex; gap: 16px; justify-content: center; font-size: 0.8rem; }
.mastery-legend span::before { content: ''; display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 4px; vertical-align: middle; }
.mastery-legend .mastered::before { background: var(--success); }
.mastery-legend .learning::before { background: var(--warning); }
.mastery-legend .difficult::before { background: var(--danger); }

.bar-chart { display: flex; align-items: flex-end; gap: 12px; height: 120px; padding: 10px 0; }
.bar-chart .bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.bar-chart .bar { width: 100%; border-radius: 6px 6px 0 0; background: linear-gradient(0deg, var(--emerald), var(--emerald-light)); transition: height 0.6s ease; min-height: 4px; }
.bar-chart .bar-label { font-size: 0.65rem; color: var(--text-muted); text-align: center; }

/* ---- Settings Screen ---- */
.settings-screen { padding: 0; }
.settings-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--card-bg); border-bottom: 1px solid var(--border); }
.settings-content { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.settings-group { margin-bottom: 8px; }
.settings-group-title { font-size: 0.8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 8px; }
.setting-item {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px;
  background: var(--card-bg); border-radius: var(--radius-md);
  border: 1px solid var(--border); cursor: pointer; transition: all var(--transition);
}
.setting-item:hover { border-color: var(--emerald); }
.setting-item .si-icon { font-size: 1.3rem; }
.setting-item .si-info { flex: 1; }
.setting-item .si-label { font-weight: 600; font-size: 0.9rem; }
.setting-item .si-desc { font-size: 0.8rem; color: var(--text-muted); }
.setting-item .si-arrow { color: var(--text-muted); }
/* Toggle switch */
.toggle-switch {
  position: relative; width: 48px; height: 28px; background: var(--border);
  border-radius: 14px; cursor: pointer; transition: background var(--transition);
}
.toggle-switch.on { background: var(--emerald); }
.toggle-switch::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 22px; height: 22px; border-radius: 50%; background: #fff;
  transition: transform var(--transition); box-shadow: var(--shadow-sm);
}
.toggle-switch.on::after { transform: translateX(20px); }

/* ---- Share Screen ---- */
.share-screen { padding: 0; }
.share-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--card-bg); border-bottom: 1px solid var(--border); }
.share-content { flex: 1; overflow-y: auto; padding: 20px; display: flex; flex-direction: column; gap: 16px; align-items: center; }
.share-preview { width: 100%; max-width: 280px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); }
.share-text-box { width: 100%; padding: 16px; background: var(--soft-gray); border-radius: var(--radius-md); font-size: 0.85rem; white-space: pre-line; line-height: 1.6; }
.share-actions { display: flex; flex-direction: column; gap: 10px; width: 100%; }

/* ---- Achievements Screen ---- */
.achievements-screen { padding: 0; }
.achievements-header { display: flex; align-items: center; gap: 12px; padding: 16px 20px; background: var(--card-bg); border-bottom: 1px solid var(--border); }
.achievements-content { flex: 1; overflow-y: auto; padding: 20px; }
.badge-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.leaderboard-table { width: 100%; }
.leaderboard-table th { padding: 8px; text-align: left; font-size: 0.8rem; color: var(--text-muted); }
.leaderboard-table td { padding: 10px 8px; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.leaderboard-table tr:first-child td { font-weight: 700; color: var(--gold); }

/* ---- Animations ---- */
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes confettiBurst {
  0% { transform: translateY(0) rotate(0deg) scale(1); opacity: 1; }
  100% { transform: translateY(-400px) rotate(720deg) scale(0); opacity: 0; }
}
.confetti-piece {
  position: fixed; width: 10px; height: 10px; z-index: 9999;
  animation: confettiBurst 1.5s ease-out forwards;
}

/* ---- Utility ---- */
.gap-sm { gap: 8px; } .gap-md { gap: 14px; } .gap-lg { gap: 20px; }
.p-20 { padding: 20px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; }
.flex { display: flex; } .flex-col { flex-direction: column; } .flex-center { align-items: center; justify-content: center; }
.flex-between { justify-content: space-between; } .flex-1 { flex: 1; }
.hidden { display: none !important; }
.w-full { width: 100%; }
.scrollable { overflow-y: auto; -webkit-overflow-scrolling: touch; }
