@font-face{font-family:Noto Naskh Arabic;src:url('./naskh-arabic.woff') format('woff');font-display:swap;font-weight:400}
@font-face{font-family:Noto Naskh Arabic;src:url('./naskh-arabic-bold.woff') format('woff');font-display:swap;font-weight:700 900}
:root{color-scheme:dark;--back:#100b21;--panel:#1c1531;--border:#392e52;--ink:#fff8ff;--muted:#cec1e3;--mint:#90f2e3;--gold:#ffd88e;--lav:#dbb9ff;--pink:#ffadd4}
*{box-sizing:border-box}
[hidden]{display:none!important}
body{margin:0;background:radial-gradient(ellipse at 82% 12%,#291741 0,transparent 42rem),var(--back);color:var(--ink);font-family:"Noto Naskh Arabic",Tahoma,Arial,sans-serif;font-size:1.125rem;line-height:1.65}
button{font:inherit;cursor:pointer;color:inherit}
button:focus-visible,[role=button]:focus-visible{outline:3px solid var(--gold);outline-offset:4px}
h1,h2,p{margin:0}
.shell{width:min(1280px,calc(100% - 96px));margin-inline:auto}
.masthead{border-bottom:1px solid #ffffff15;background:#120c23c9}
.mast-inner{display:flex;align-items:center;gap:22px;min-height:72px}
.brand{display:flex;align-items:center;gap:12px;font-weight:700;font-size:19px;white-space:nowrap}
.brand-icon{display:grid;place-items:center;width:43px;height:43px;border-radius:14px;color:var(--mint);background:#8bf5e817;border:1px solid #8bf5e84f}
.brand-icon svg{width:26px;height:26px;fill:none;stroke:currentColor;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round}
.course{color:var(--muted);font-size:14px;display:flex;align-items:center;gap:8px;margin-inline-start:auto}
.course i{display:inline-block;width:4px;height:4px;background:var(--lav);border-radius:50%}
.sound{display:flex;align-items:center;gap:7px;background:#251b3c;border:1px solid #574672;border-radius:12px;padding:6px 11px;font-size:13px;white-space:nowrap}
.sound svg{width:17px;height:17px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round}
.hero{margin-block:28px 18px;position:relative;isolation:isolate;overflow:hidden;border-radius:26px;border:1px solid #bca4fc44;background:#1d1334;min-height:490px;display:grid;align-items:center;box-shadow:0 22px 80px #05030e5c}
.scene,.scene-wash,.scene-lines{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.scene{z-index:-1;background:#382454 url('./bridge.webp') center / cover no-repeat;--lit:0}
.scene::after{content:"";position:absolute;inset:0;background:radial-gradient(ellipse at 45% 63%,#7defff35,transparent 59%);opacity:var(--lit);mix-blend-mode:screen;transition:opacity .4s}
.scene-wash{z-index:2;background:linear-gradient(270deg,#150d2af0 2%,#1c103bd8 27%,#180f32a0 45%,#140b260d 75%),linear-gradient(0deg,#0f0b21c4,transparent 36%);transition:background .35s}
.scene-lines{z-index:3;overflow:hidden}
.scene-lines path{fill:none;stroke-linecap:round}
#deck-track{visibility:hidden}
#deck-lights path{stroke:#aafff9;stroke-width:3.4;opacity:0;filter:drop-shadow(0 0 4px #66f9f6) drop-shadow(0 0 10px #78e0ff);transition:opacity .4s}
#deck-lights path:nth-child(3n){stroke:#ffe4aa}
#deck-lights path:nth-child(7n){stroke:#ffb0dc}
#deck-lights path.on{opacity:.88}
.car-trail{stroke:#c9ffff;stroke-width:2.2;stroke-dasharray:48 1800;filter:drop-shadow(0 0 5px #8ffafa);animation:traffic 13s linear infinite;opacity:.65}
.car-gold{stroke:#ffdb8d;animation-duration:18s;animation-direction:reverse;animation-delay:-4s}
@keyframes traffic{to{stroke-dashoffset:-1848}}
.hero-copy{padding:49px clamp(25px,5.2vw,82px) 64px;max-width:725px}
.lesson{display:inline-flex;align-items:center;gap:8px;padding:4px 13px;color:#f0d8ff;background:#4a2d656b;border:1px solid #c497f475;border-radius:99px;font-size:14px;font-weight:700}
.lesson span{color:var(--gold)}
h1{font-size:clamp(2.48rem,5.3vw,5.05rem);line-height:1.38;margin-block:12px 12px;font-weight:700;text-shadow:0 2px 35px #140c28}
h1 em{font-style:normal;color:var(--mint);background:linear-gradient(270deg,#a3fff3,#e5eaff 62%,#f7c7ff);background-clip:text;-webkit-text-fill-color:transparent}
.intro-line{color:#f1e4fb;font-size:clamp(1.13rem,1.8vw,1.4rem);max-width:430px;margin-block:0 23px}
.primary{display:inline-flex;align-items:center;justify-content:center;gap:20px;border:1px solid #b2fff4;color:#0b292f;background:linear-gradient(135deg,#b1ffef,#75e1de);border-radius:13px;padding:10px 19px;min-height:48px;font-weight:700;box-shadow:0 0 25px #6fe2dc35,0 5px 18px #09071750;transition:background .2s,transform .2s}
.primary span{font:700 23px/1 Arial,sans-serif}
.primary:hover{background:#c0fff5;transform:translateY(-2px)}
.city{position:absolute;bottom:15px;left:20px;color:#fff1fc;background:#171026c9;border:1px solid #ffffff44;border-radius:10px;font-size:12px;padding:4px 11px}
.city span{color:var(--gold);margin-inline-end:4px}
.progress-card{background:linear-gradient(115deg,#211832,#20152f);padding:15px 21px 19px;border:1px solid var(--border);border-radius:17px}
.progress-header,.progress-title{display:flex;align-items:center}
.progress-header{justify-content:space-between;gap:9px;margin-bottom:11px}
.progress-title{gap:9px}
.progress-title h2,.journey h2{font-size:16px}
.bolt{display:grid;place-items:center;width:27px;height:27px;background:#ffda9024;color:var(--gold);border-radius:8px;font:700 23px/1 Arial,sans-serif}
#progress-count{color:var(--gold);font-size:13px}
.lamps{display:grid;grid-auto-columns:minmax(0,1fr);grid-auto-flow:column;gap:5px}
.lamp{height:6px;border-radius:8px;background:#423555;transition:background .3s,box-shadow .3s}
.lamp.on{background:linear-gradient(90deg,#ffcc83,#ffedb5);box-shadow:0 0 10px #ffd08585}
.lamp.on:nth-child(3n){background:var(--mint);box-shadow:0 0 10px #8affeb85}
.lamp.on:nth-child(7n){background:var(--pink);box-shadow:0 0 10px #ffc1e995}
.lamp.spark{animation:light .65s ease-out}
@keyframes light{35%{transform:scaleY(2);filter:brightness(1.5)}}
.journey{margin-block:20px 16px}
.journey h2{margin-bottom:9px;color:#f3e9ff}
.stages{list-style:none;display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:10px;padding:0;margin:0}
.stage-card{display:flex;align-items:center;gap:10px;border:1px solid var(--border);background:#1c142c;border-radius:13px;padding:9px 11px;color:#eee2fa;font-size:13px;font-weight:700}
.stage-card[aria-current]{border-color:#8ff4e4a0;background:#20343a}
.stage-card.done{border-color:#81e4d353}
.stage-card-icon,#stage-icon{display:grid;place-items:center;flex:none;width:32px;height:32px;border-radius:9px;font:700 21px/1 Arial,sans-serif;color:var(--accent,var(--lav));background:color-mix(in srgb,var(--accent,var(--lav)) 18%,transparent)}
.footer{display:flex;justify-content:center;align-items:center;gap:8px;padding:10px 0 21px;font-size:13px;color:#ddd0ec}
.footer-heart{color:var(--pink);font-size:17px}
.hero.playing{min-height:478px}
.playing .scene-wash{background:linear-gradient(90deg,#180e2bdd,#171023ed)}
.playing .city,.finished .city{display:none}
.game{padding:22px clamp(13px,2.3vw,30px) 24px}
.game-top,.game-meta,.stage-label{display:flex;align-items:center;gap:10px}
.game-top{justify-content:space-between;margin-bottom:13px}
.stage-label{color:var(--lav);font-weight:700}
.game-meta{color:#e0d3ee;font-size:13px}
.timer{background:#32244c;border:1px solid #8161ad;border-radius:9px;padding:2px 10px;color:var(--gold);font-weight:700;white-space:nowrap}
.timer.urgent{color:#ffb8c6;border-color:#d982a1}
.game-grid{display:grid;justify-items:center;gap:10px;text-align:center}
#prompt{font-size:clamp(1.46rem,3.3vw,2.5rem);font-weight:700;line-height:1.55;max-width:30em;text-wrap:balance}
#prompt:focus,#challenge-title:focus,#end-title:focus{outline:none}
.figure{width:min(100%,760px);min-width:0;background:radial-gradient(ellipse at 50% 60%,#312954 0%,#211938 52%,#100d24 100%);border-radius:18px;border:1px solid #785c9d;box-shadow:0 0 38px #b486e51c,inset 0 0 30px #0c091a70;overflow:hidden;padding-bottom:7px}
#diagram{display:block;width:100%;height:auto;max-height:330px;color:#fff}
.legend{color:#eee2fc;font-size:clamp(1rem,1.6vw,1.12rem);padding:0 10px 5px;line-height:1.7}
.options{width:min(100%,760px);display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:8px}
.options:empty{display:none}
.option{min-height:46px;border:1px solid #8b70b0;background:#403056;border-radius:11px;padding:4px 8px;font-size:1rem;font-weight:700;text-align:center;line-height:1.55}
.option:not(:disabled):hover{background:#50396d}
.option:disabled{cursor:default}
.option.chosen{border-color:var(--mint);color:var(--mint);background:#193a3e}
.question-response{width:min(100%,760px)}
.feedback:empty,.question-response:has(.feedback:empty):has(.next[hidden]){display:none}
.feedback{border-radius:11px;padding:8px 12px;border:1px solid #d19b6799;background:#502e2e;color:#fff0db;font-size:1rem}
.feedback.good{border-color:#73e6cda8;background:#143a42;color:#d6fff6}
.feedback strong{display:block;margin-bottom:2px}
.feedback .heart{display:inline-block;color:#ff6a78;font-size:1.2rem;animation:heart .55s ease-out}
@keyframes heart{50%{transform:scale(1.7);text-shadow:0 0 12px #ff6793}}
.next{margin-top:9px;min-height:44px;padding:5px 15px;font-size:1rem}
.transition h2,.result h2{font-size:clamp(1.35rem,2.55vw,2rem);line-height:1.55;margin-block:4px 11px}
.transition,.result{text-align:center;padding:24px 13px 31px}
.transition p,.result p{max-width:530px;margin:0 auto 16px;color:#f0def9}
.result{padding-block:50px}
.finished .scene-wash{background:radial-gradient(ellipse,#1b1137ee 4%,#1b1137c1 41%,#160c284f 82%),linear-gradient(0deg,#0e0923d0,transparent 45%)}
.end-icon{display:grid;place-items:center;margin:0 auto 8px;width:61px;height:61px;border-radius:18px;border:1px solid #ffc2ed85;background:#9b497c49;color:#ffd4fa;box-shadow:0 0 35px #f496d251;font:700 38px/1 Arial,sans-serif}
.result .result-score{color:var(--gold);font-weight:700}
.bridge-structure{pointer-events:none}
.bridge-terrain{fill:#120e29;stroke:#42315c;stroke-width:.8}
.bridge-cables{fill:none;stroke:#b58ffd;stroke-width:1.05;opacity:.48}
.bridge-pylons{fill:#32234d;stroke:#976cbf;stroke-width:1.4}
.bridge-pylon-light{fill:none;stroke:#d9a4ff;opacity:.68;stroke-width:1.3}
.bridge-truss{fill:none;stroke:#ae83ce;stroke-width:1.25;opacity:.36}
.bridge-road{stroke:#176479;stroke-width:14;stroke-linecap:round;opacity:.6}
.bridge-lamp{fill:#6f6488}
.bridge-lamp.on{fill:#ffe5a0;filter:drop-shadow(0 0 4px #ffbf65)}
.parallel-line{filter:drop-shadow(0 0 4px #67eef2a0)}
.transversal{filter:drop-shadow(0 0 5px #ffba73a0)}
.parallel-line{stroke:#9efaff;stroke-width:5;stroke-linecap:round}
.parallel-mark{stroke:#b2ffff;stroke-width:3;fill:none;stroke-linecap:round;stroke-linejoin:round}
.transversal{stroke:#fbc687;stroke-width:5;stroke-linecap:round}
.angle-sector{fill:#a987ee30;stroke:#c098f7a0;stroke-width:1.25}
.angle-number{fill:#fff;font-family:"Noto Naskh Arabic",Tahoma,sans-serif;font-size:37px;font-weight:700;dominant-baseline:central;text-anchor:middle;direction:ltr;user-select:none}
.angle-hit{fill:transparent}
.angle-group[role=button]{cursor:pointer}
.angle-group[role=button]:hover .angle-sector,.angle-group:focus-visible .angle-sector{fill:#bc8ef083;stroke:#f2d7ff}
.angle-group.reference .angle-sector{fill:#c18effaa;stroke:#f1d0ff;stroke-width:2}
.angle-group.answer .angle-sector{fill:#53ffd298;stroke:#c1fff0;stroke-width:2}
.angle-group.wrong .angle-sector{fill:#ff8c9b87;stroke:#ffb9c2;stroke-width:2}
.angle-group[aria-disabled=true]{cursor:default}
.intersection{fill:#fff3cc}
.measure{fill:#211455;stroke:#e5beff;stroke-width:1.5}
@media(max-width:850px){.shell{width:calc(100% - 36px)}.hero{min-height:440px}.stage-card{font-size:12px}.stage-card-icon{width:27px;height:27px}}
@media(max-width:620px){.shell{width:calc(100% - 22px)}.mast-inner{min-height:58px;gap:8px}.brand{font-size:15px;gap:5px}.brand-icon{width:34px;height:34px;border-radius:10px}.brand-icon svg{width:21px}.course{font-size:12px;gap:4px}.sound{font-size:13px;padding:4px 5px;gap:3px}.sound svg{width:14px}.hero{margin-top:14px;border-radius:19px;min-height:445px;align-items:start}.hero-copy{padding:30px 19px 120px}.scene-wash{background:linear-gradient(180deg,#150e2ae8,#1c103ba0 47%,#1c103b17 76%,#0f0b21a9)}.intro-line{max-width:285px}.city{bottom:10px;left:10px;font-size:10px}.stages{grid-template-columns:repeat(2,minmax(0,1fr))}.game{padding:10px}.game-grid{gap:8px}.game-top{margin-bottom:7px}.stage-label{gap:5px;font-size:14px}.game-meta{gap:4px;font-size:13px}.timer{padding:2px 5px}.progress-card{padding:10px 11px 13px}.lamps{gap:3px}.footer{padding-top:1px}}
@media(prefers-reduced-motion:reduce){*,*::before,*::after{animation:none!important;transition:none!important;scroll-behavior:auto!important}}

@media(max-width:620px){
  .options{grid-template-columns:repeat(2,minmax(0,1fr))}
  #prompt{padding:2px 5px}
}
.heart-celebration{position:fixed;inset:0;z-index:50;pointer-events:none;overflow:hidden}
.celebration-heart{position:absolute;left:var(--x);top:var(--y);font:700 var(--size)/1.05 Arial,sans-serif;color:#ff334e;text-shadow:0 0 2px #ffedee,0 0 11px #ff355e9e;opacity:0;transform:translate(-50%,-50%) rotate(var(--tilt));animation:celebrate 2.05s ease-out var(--delay) both}
.celebration-heart:nth-child(3n){color:#ed1739}
.celebration-heart:nth-child(4n){color:#ff5464}
@keyframes celebrate{
  0%{opacity:0;transform:translate(-50%,-30%) rotate(var(--tilt)) scale(.45)}
  23%{opacity:.93;transform:translate(-50%,-55%) rotate(var(--tilt)) scale(1.08)}
  67%{opacity:.82}
  100%{opacity:0;transform:translate(-50%,-130%) rotate(var(--tilt)) scale(.9)}
}
@media(prefers-reduced-motion:reduce){.celebration-heart{opacity:.79}}
.equation{display:inline-block;white-space:nowrap;color:var(--mint);font-weight:700}
