:root {
  --purple-950: #39003c;
  --purple-900: #61005d;
  --purple-800: #7d006f;
  --purple-600: #c6009a;
  --purple-400: #e63aa7;
  --turquoise: #41bec3;
  --orange: #f46b35;
  --gold: #f6c64f;
  --cream: #fff7f0;
  --white: #ffffff;
  --ink: #21162d;
  --muted: #776d80;
  --line: rgba(50, 24, 76, .13);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--purple-950); }
body {
  min-height: 100vh;
  margin: 0;
  font-family: "IBM Plex Sans Arabic", system-ui, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(65,190,195,.26), transparent 30%),
    linear-gradient(145deg, var(--purple-950), #1e0026);
}
button, a { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }

.app-shell {
  width: min(100%, 1080px);
  min-height: 100svh;
  margin: 0 auto;
  background: var(--cream);
  position: relative;
  overflow: hidden;
}
.screen { display: none; min-height: 100svh; }
.screen.active { display: flex; }

.start-screen {
  position: relative;
  display: none;
  grid-template-columns: 1.15fr .85fr;
  align-items: stretch;
  background: linear-gradient(150deg, #fff8f1 0%, #fff 68%);
  color: var(--purple-950);
}
.start-screen.active { display: grid; }
.map-stage {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 44px 20px;
  overflow: hidden;
  background: var(--turquoise);
  position: relative;
}
.map-stage::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 46%, rgba(43,70,81,.14));
  pointer-events: none;
}
.map-stage img { width: min(100%, 680px); height: auto; filter: drop-shadow(0 24px 40px rgba(46,71,77,.18)); }
.start-content { display: flex; flex-direction: column; justify-content: center; padding: 52px 48px; position: relative; z-index: 1; }
.eyebrow { margin: 0 0 14px; color: var(--orange); font-weight: 700; font-size: .93rem; }
h1 { margin: 0; font-size: clamp(2.75rem, 12vw, 4rem); line-height: 1.08; letter-spacing: -.045em; }
.intro { max-width: 390px; margin: 20px 0 26px; color: #665568; font-size: 1.08rem; line-height: 1.8; }
.fine-print { margin: 12px 0 0; text-align: center; color: #958798; font-size: .8rem; }

.primary-button, .secondary-button {
  min-height: 54px;
  border-radius: 18px;
  border: 0;
  padding: 0 24px;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.primary-button:active, .secondary-button:active { transform: scale(.98); }
.primary-button { width: 100%; color: white; background: linear-gradient(135deg, var(--purple-600), var(--purple-800)); box-shadow: 0 12px 30px rgba(125,0,111,.22); }
.secondary-button { color: var(--purple-800); background: rgba(106,42,166,.09); }

.game-screen { width: min(100%, 560px); margin: 0 auto; flex-direction: column; padding: max(22px, env(safe-area-inset-top)) 22px max(24px, env(safe-area-inset-bottom)); }
.game-header { display: flex; align-items: center; justify-content: space-between; }
.icon-button { width: 42px; height: 42px; border: 0; border-radius: 50%; background: rgba(106,42,166,.08); color: var(--purple-800); font-size: 1.8rem; cursor: pointer; }
.score-pill { display: flex; align-items: baseline; gap: 4px; color: var(--purple-800); font-weight: 700; font-size: 1.25rem; }
.score-pill small { color: var(--muted); font-size: .78rem; }
.progress-track { height: 5px; background: rgba(106,42,166,.1); border-radius: 99px; margin: 18px 0 26px; overflow: hidden; }
.progress-track span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--purple-600), var(--orange), var(--gold)); border-radius: inherit; transition: width .35s ease; }
.round-meta { display: flex; justify-content: space-between; color: var(--purple-600); font-size: .82rem; font-weight: 700; }
.game-screen h2 { margin: 10px 0 0; color: var(--purple-950); font-size: 2rem; line-height: 1.25; }
.round-help { margin: 6px 0 20px; color: var(--muted); }
.experience-list { display: grid; gap: 11px; }
.experience-card {
  display: grid;
  grid-template-columns: 1fr 30px;
  gap: 14px;
  align-items: center;
  min-height: 84px;
  padding: 15px 16px;
  border: 1.5px solid var(--line);
  border-radius: 19px;
  background: rgba(255,255,255,.8);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.experience-card:hover { transform: translateY(-1px); }
.experience-card.selected { border-color: var(--purple-600); background: rgba(198,0,154,.07); }
.experience-copy strong { display: block; font-size: 1rem; line-height: 1.55; font-weight: 600; }
.experience-copy small { display: block; margin-top: 3px; color: var(--muted); font-size: .78rem; }
.check-circle { display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid rgba(106,42,166,.25); border-radius: 50%; color: transparent; font-weight: 700; }
.selected .check-circle { border-color: var(--purple-600); background: var(--purple-600); color: white; }
.game-actions { display: grid; grid-template-columns: .75fr 1.4fr; gap: 10px; margin-top: auto; padding-top: 22px; }

.result-screen {
  position: relative;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: max(32px, env(safe-area-inset-top)) 26px max(28px, env(safe-area-inset-bottom));
  text-align: center;
  color: white;
  background:
    linear-gradient(160deg, rgba(125,0,111,.94), rgba(57,0,60,.97)),
    url("saudi-map-official.png") center/cover;
}
.result-screen .eyebrow { margin-bottom: 18px; }
.score-ring {
  width: 190px;
  aspect-ratio: 1;
  display: grid;
  place-content: center;
  border-radius: 50%;
  border: 3px solid rgba(242,201,76,.8);
  box-shadow: 0 0 0 12px rgba(242,201,76,.08), 0 28px 80px rgba(0,0,0,.25);
}
.score-ring strong { color: var(--gold); font-size: 4.5rem; line-height: .95; }
.score-ring span { margin-top: 8px; color: rgba(255,255,255,.68); }
.result-screen h2 { margin: 30px 0 8px; font-size: 1.8rem; }
.result-copy { max-width: 360px; margin: 0; color: rgba(255,255,255,.72); line-height: 1.75; }
.result-stats { width: 100%; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 24px 0; }
.result-stats div { padding: 15px; border: 1px solid rgba(255,255,255,.12); border-radius: 17px; background: rgba(255,255,255,.06); }
.result-stats strong, .result-stats span { display: block; }
.result-stats strong { color: var(--gold); font-size: 1.45rem; }
.result-stats span { margin-top: 3px; color: rgba(255,255,255,.65); font-size: .78rem; }
.result-screen .primary-button { max-width: 360px; }
.text-button { margin-top: 13px; border: 0; background: transparent; color: rgba(255,255,255,.55); cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: 28px; z-index: 20; transform: translate(-50%, 16px); padding: 11px 18px; border-radius: 99px; color: white; background: #1d1226; opacity: 0; pointer-events: none; transition: .25s ease; font-size: .86rem; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 481px) {
  body { padding: 28px 0; }
  .app-shell { min-height: calc(100svh - 56px); border-radius: 30px; box-shadow: 0 30px 100px rgba(0,0,0,.42); }
  .screen { min-height: calc(100svh - 56px); }
}

@media (max-width: 720px) {
  .start-screen { grid-template-columns: 1fr; grid-template-rows: 42svh auto; }
  .map-stage { min-height: 42svh; padding: 20px 8px 8px; }
  .map-stage img { width: min(104%, 560px); }
  .start-content { justify-content: flex-start; padding: 24px 26px max(30px, env(safe-area-inset-bottom)); }
  h1 { font-size: clamp(2.5rem, 12vw, 3.3rem); }
  .intro { margin: 15px 0 20px; font-size: 1rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
