:root {
  --sea: #0a4f8f;
  --sea-2: #1667b8;
  --sky: #e7f3ff;
  --foam: #f7fbff;
  --ink: #15233f;
  --muted: #5b6b88;
  --sun: #ffc22e;
  --coral: #ff6a55;
  --mint: #1fb985;
  --grape: #7b5cff;
  --line: #cfe0f5;
  --card: #ffffff;
  --shadow: 0 10px 28px rgba(10, 79, 143, 0.12);
  --radius: 22px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 20% -10%, #fff8e6 0%, transparent 55%),
    linear-gradient(180deg, var(--sky) 0%, var(--foam) 40%, #ffffff 100%);
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", "Segoe UI", Tahoma, sans-serif;
  font-size: 17px;
  line-height: 1.7;
}
h1, h2, h3, .title-font, .banner-title, .station-title, .mode-title, .stars {
  font-family: "Baloo Bhaijaan 2", "IBM Plex Sans Arabic", sans-serif;
  letter-spacing: 0;
}
button, a { font-family: inherit; }
button {
  cursor: pointer;
  border: 0;
  background: none;
  color: inherit;
}
img { max-width: 100%; display: block; }

.shell {
  max-width: 760px;
  margin: 0 auto;
  padding: calc(16px + var(--safe-top)) 16px calc(28px + var(--safe-bot));
}

/* Header */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(160deg, var(--sea-2), var(--sea));
  color: #fff;
  display: grid;
  place-items: center;
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-weight: 800;
  font-size: 20px;
  box-shadow: 0 6px 16px rgba(10, 79, 143, 0.25);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-text strong { font-family: "Baloo Bhaijaan 2", sans-serif; font-size: 20px; color: var(--sea); }
.brand-text span { font-size: 12px; color: var(--muted); }
.icon-btn {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: #fff;
  border: 1px solid var(--line);
  display: grid;
  place-items: center;
  font-size: 20px;
  box-shadow: var(--shadow);
}
.icon-btn:focus-visible, .btn:focus-visible, .track-card:focus-visible, .station:focus-visible, .mode-card:focus-visible {
  outline: 3px solid var(--sun);
  outline-offset: 2px;
}

/* Mona bubble */
.mona-row {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 8px 0 20px;
}
.mona-row img {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  border: 3px solid #fff;
  box-shadow: 0 6px 16px rgba(10, 79, 143, 0.18);
  background: #fff;
  flex-shrink: 0;
}
.bubble {
  position: relative;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 22px 22px 8px 22px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  flex: 1;
}
.bubble .who {
  font-family: "Baloo Bhaijaan 2", sans-serif;
  color: var(--sea);
  font-size: 15px;
  margin: 0 0 4px;
}
.bubble p { margin: 0; }

/* Track picker */
.page-title {
  font-size: 28px;
  margin: 0 0 6px;
  color: var(--sea);
}
.lede { margin: 0 0 18px; color: var(--muted); }
.tracks {
  display: grid;
  gap: 14px;
}
.track-card {
  text-align: right;
  background: #fff;
  border-radius: var(--radius);
  padding: 16px 16px 16px 14px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
  transition: transform 0.15s ease;
}
.track-card:active { transform: scale(0.99); }
.stripe {
  width: 10px;
  align-self: stretch;
  border-radius: 8px;
}
.track-card h2 { margin: 0 0 2px; font-size: 22px; }
.track-card p { margin: 0; color: var(--muted); font-size: 14px; }
.track-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.pill {
  background: var(--sky);
  color: var(--sea);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.stars { color: var(--sun); font-size: 18px; letter-spacing: 1px; }
.stars .dim { color: #d5deea; }

/* Map */
.map-head { margin-bottom: 8px; }
.map-head h1 { margin: 0; font-size: 26px; color: var(--sea); }
.map-head p { margin: 4px 0 0; color: var(--muted); }
.progress-bar {
  height: 10px;
  background: #dceaf8;
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 20px;
}
.progress-bar > span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--sun), #ff9a3c);
  border-radius: inherit;
  transition: width 0.35s ease;
}

.unit-banner {
  color: #fff;
  border-radius: 20px;
  padding: 14px 18px;
  margin: 8px 0 6px;
  box-shadow: 0 8px 18px rgba(0,0,0,0.12);
  position: relative;
  overflow: hidden;
}
.unit-banner::after {
  content: "";
  position: absolute;
  inset-inline-start: -20px;
  top: -30px;
  width: 90px;
  height: 90px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
}
.unit-banner .no { margin: 0; opacity: 0.9; font-size: 13px; font-weight: 600; }
.unit-banner h2 { margin: 0; font-size: 22px; position: relative; }

.journey {
  position: relative;
  margin: 0 8px 24px;
  min-height: 280px;
}
.journey svg.road {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}
.stations {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 18px 8px 8px;
}
.station {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: right;
  width: min(74%, 340px);
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 22px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
  transition: border-color 0.15s ease, transform 0.15s ease;
  position: relative;
  z-index: 1;
}
.station:nth-child(odd) { align-self: flex-start; margin-inline-end: auto; }
.station:nth-child(even) { align-self: flex-end; margin-inline-start: auto; }
.station.done { border-color: var(--mint); }
.station.current { border-color: var(--sun); }
.station:active { transform: scale(0.98); }
.badge {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  font-family: "Baloo Bhaijaan 2", sans-serif;
  font-size: 22px;
  font-weight: 800;
  flex-shrink: 0;
  box-shadow: 0 4px 10px rgba(0,0,0,0.15);
}
.station-body { flex: 1; min-width: 0; }
.station-title { margin: 0; font-size: 18px; }
.station-sub { margin: 0; color: var(--muted); font-size: 13px; }

/* Lesson hub */
.modes { display: grid; gap: 12px; margin-top: 8px; }
.mode-card {
  display: flex;
  align-items: center;
  gap: 14px;
  text-align: right;
  width: 100%;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.mode-card.locked { opacity: 0.55; }
.mode-ico {
  width: 56px;
  height: 56px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 26px;
  flex-shrink: 0;
}
.mode-card h2 { margin: 0; font-size: 20px; }
.mode-card p { margin: 0; color: var(--muted); font-size: 14px; }
.ico-teach { background: #e8f3ff; }
.ico-ex { background: #fff3d6; }
.ico-quiz { background: #ffe7e2; }
.star-chip {
  margin-inline-start: auto;
  font-size: 22px;
  color: var(--sun);
}

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 18px;
  border-radius: 16px;
  font-weight: 700;
  font-size: 16px;
}
.btn-primary {
  background: linear-gradient(180deg, var(--sea-2), var(--sea));
  color: #fff;
  box-shadow: 0 8px 16px rgba(10, 79, 143, 0.28);
  flex: 1;
}
.btn-ghost {
  background: #fff;
  border: 1px solid var(--line);
  color: var(--sea);
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* Exercise widgets */
.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.ex-title { margin: 0 0 6px; font-size: 22px; color: var(--sea); }
.ex-prompt { margin: 0 0 14px; color: var(--muted); }

.choice-list, .multi-list { display: grid; gap: 10px; }
.choice, .multi {
  width: 100%;
  text-align: right;
  background: var(--foam);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 12px 14px;
  font-size: 16px;
}
.choice.selected, .multi.selected { border-color: var(--sea-2); background: #dff0ff; }
.choice.correct, .multi.correct { border-color: var(--mint); background: #e6faf2; }
.choice.wrong, .multi.wrong { border-color: var(--coral); background: #ffeae7; }

.baskets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
  margin-top: 12px;
}
.basket {
  min-height: 120px;
  border: 2px dashed var(--line);
  border-radius: 16px;
  padding: 8px;
  background: var(--foam);
}
.basket.active { border-color: var(--sea-2); background: #e8f3ff; }
.basket h3 {
  margin: 0 0 8px;
  font-size: 15px;
  text-align: center;
  color: var(--sea);
}
.pool, .basket-items { display: flex; flex-wrap: wrap; gap: 8px; min-height: 40px; }
.chip {
  background: #fff;
  border: 2px solid var(--line);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(10,79,143,0.08);
}
.chip.picked { border-color: var(--sun); background: #fff8e0; }
.chip.in-place { cursor: grab; }

.order-list { display: grid; gap: 8px; }
.order-row {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 8px;
  align-items: center;
  background: var(--foam);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 6px 8px;
}
.order-row .label { font-weight: 600; padding: 4px 6px; }
.order-btns { display: flex; flex-direction: column; gap: 4px; }
.order-btns button {
  width: 36px;
  height: 28px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  font-size: 14px;
}
.order-btns button:disabled { opacity: 0.3; }

.feedback {
  margin-top: 14px;
  border-radius: 16px;
  padding: 12px 14px;
  font-weight: 600;
}
.feedback.ok { background: #e6faf2; color: #0b6a4a; }
.feedback.bad { background: #ffeae7; color: #9a2a1c; }

.score-board {
  text-align: center;
  padding: 20px 8px;
}
.score-board .big-stars { font-size: 42px; color: var(--sun); }
.score-board h2 { margin: 8px 0 4px; font-size: 26px; color: var(--sea); }

.foot-note {
  margin-top: 28px;
  font-size: 12px;
  color: var(--muted);
  text-align: center;
}
.hidden { display: none !important; }

@media (max-width: 480px) {
  html, body { font-size: 16px; }
  .page-title, .map-head h1 { font-size: 24px; }
  .station { width: 92%; }
  .mona-row img { width: 68px; height: 68px; }
}

.journey .road-line {
  position: absolute;
  inset: 24px 18% 24px 18%;
  border: 6px solid #b7d4f3;
  border-radius: 80px;
  border-style: dashed;
  opacity: 0.7;
  pointer-events: none;
  z-index: 0;
}
