:root {
  --bg: #070b14;
  --bg-2: #0d1424;
  --card: #121a2e;
  --card-2: #18233c;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f7fb;
  --muted: #93a0b8;
  --accent: #6ee7c4;
  --accent-2: #60a5fa;
  --gold: #fbbf24;
  --rose: #fb7185;
  --violet: #a78bfa;
  --orange: #fb923c;
  --radius: 22px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: "Segoe UI", "Tajawal", "Noto Sans Arabic", system-ui, sans-serif;
  background: radial-gradient(1200px 700px at 90% -10%, #1a2a52 0%, transparent 50%),
              radial-gradient(900px 500px at -10% 20%, #12352c 0%, transparent 45%),
              var(--bg);
  color: var(--text);
  overflow: hidden;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
}

.splash {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--bg);
  gap: 10px;
  animation: fadeOut 0.5s ease 1.2s forwards;
  pointer-events: none;
}
.splash-mark {
  width: 84px; height: 84px;
  border-radius: 24px;
  display: grid; place-items: center;
  font-size: 40px; font-weight: 800;
  background: linear-gradient(145deg, #6ee7c4, #60a5fa);
  color: #061018;
  box-shadow: 0 20px 50px rgba(96, 165, 250, 0.25);
}
.splash h1 { font-size: 32px; letter-spacing: 2px; }
.splash p { color: var(--muted); font-size: 14px; }
@keyframes fadeOut { to { opacity: 0; visibility: hidden; } }

.topbar {
  padding: calc(14px + var(--safe-t)) 18px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar-start { display: flex; align-items: center; gap: 10px; }
.greet { color: var(--muted); font-size: 12px; }
.topbar h2 { font-size: 20px; font-weight: 800; }
.avatar, .icon-btn {
  width: 40px; height: 40px; border: 0; border-radius: 14px;
  background: var(--card); color: var(--text); cursor: pointer;
}
.avatar {
  background: linear-gradient(145deg, #6ee7c4, #60a5fa);
  color: #061018; font-weight: 800;
}
.hidden { display: none !important; }

#screens {
  flex: 1;
  overflow: auto;
  padding: 6px 16px calc(92px + var(--safe-b));
  -webkit-overflow-scrolling: touch;
}

.hero {
  background: linear-gradient(135deg, #152447, #12352c);
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 18px;
  margin-bottom: 16px;
}
.hero h3 { font-size: 18px; margin-bottom: 6px; }
.hero p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.pill {
  font-size: 12px; padding: 6px 10px; border-radius: 999px;
  background: rgba(110, 231, 196, 0.12); color: var(--accent);
}

.section-head {
  display: flex; align-items: center; justify-content: space-between;
  margin: 8px 2px 10px;
}
.section-head h3 { font-size: 16px; }
.section-head button, .link {
  background: none; border: 0; color: var(--accent); font-size: 13px; cursor: pointer;
}

.track-grid, .lesson-list, .stat-grid { display: grid; gap: 10px; }
.track-card, .lesson-card, .stat-card, .quiz-card, .profile-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}
.track-card { display: grid; grid-template-columns: 56px 1fr auto; gap: 12px; align-items: center; cursor: pointer; }
.track-icon {
  width: 56px; height: 56px; border-radius: 18px;
  display: grid; place-items: center; font-size: 26px; font-weight: 800;
}
.track-card h4 { font-size: 15px; margin-bottom: 4px; }
.track-card p, .muted { color: var(--muted); font-size: 12px; line-height: 1.6; }
.progress-mini {
  height: 6px; background: #0b1220; border-radius: 99px; overflow: hidden; margin-top: 8px;
}
.progress-mini span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }

.chip {
  font-size: 11px; padding: 4px 8px; border-radius: 8px;
  background: var(--card-2); color: var(--muted);
}

.stat-grid { grid-template-columns: 1fr 1fr; margin-bottom: 14px; }
.stat-card b { font-size: 22px; display: block; margin-bottom: 4px; }
.stat-card span { color: var(--muted); font-size: 12px; }

.lesson-card { cursor: pointer; }
.lesson-card h4 { font-size: 15px; margin-bottom: 6px; }
.meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.done { color: var(--accent); }

.content-block {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 16px;
  line-height: 1.9;
  font-size: 14px;
  color: #dbe4f3;
  margin-bottom: 12px;
}
.content-block h4 { color: var(--text); margin: 10px 0 6px; font-size: 15px; }
.content-block ul { padding-inline-start: 18px; }
.content-block li { margin: 6px 0; }
.tip {
  background: rgba(96, 165, 250, 0.1);
  border: 1px solid rgba(96, 165, 250, 0.2);
  padding: 12px; border-radius: 16px; margin-top: 10px;
}

.btn, .option {
  width: 100%; border: 0; cursor: pointer; font-family: inherit;
}
.btn {
  margin-top: 8px; padding: 14px; border-radius: 16px;
  background: linear-gradient(135deg, #6ee7c4, #60a5fa);
  color: #061018; font-weight: 800; font-size: 15px;
}
.btn.ghost {
  background: var(--card-2); color: var(--text); border: 1px solid var(--line);
}
.option {
  text-align: right; padding: 13px 14px; border-radius: 14px;
  background: var(--card-2); color: var(--text); margin-bottom: 8px;
  border: 1px solid var(--line);
}
.option.correct { background: rgba(110, 231, 196, 0.16); border-color: var(--accent); }
.option.wrong { background: rgba(251, 113, 133, 0.16); border-color: var(--rose); }

.tabbar {
  position: absolute;
  left: 12px; right: 12px; bottom: calc(10px + var(--safe-b));
  background: rgba(18, 26, 46, 0.92);
  border: 1px solid var(--line);
  backdrop-filter: blur(16px);
  border-radius: 22px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  padding: 8px 4px;
}
.tabbar button {
  background: none; border: 0; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 11px; cursor: pointer;
}
.tabbar svg { width: 20px; height: 20px; }
.tabbar .active { color: var(--accent); }

.input {
  width: 100%; padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: #0b1220; color: var(--text);
  font-family: inherit; font-size: 14px; margin: 8px 0 12px;
}

.search {
  width: 100%; padding: 12px 14px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--card); color: var(--text);
  font-family: inherit; margin-bottom: 12px;
}

.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

@media (min-width: 900px) {
  body { padding: 16px 0; }
  #app {
    height: calc(100% - 32px);
    border: 1px solid var(--line);
    border-radius: 28px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0,0,0,.35);
  }
}
