/* حكاية أرض — styles. Palette and ornaments follow Palestinian tatreez: red, indigo, saffron, olive on paper. */

@font-face { font-family: 'Aref'; src: url('../assets/fonts/ArefRuqaa-Bold.ttf'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Aref'; src: url('../assets/fonts/ArefRuqaa-Regular.ttf'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('../assets/fonts/IBMPlexSansArabic-Regular.ttf'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('../assets/fonts/IBMPlexSansArabic-Medium.ttf'); font-weight: 500; font-display: swap; }
@font-face { font-family: 'Plex'; src: url('../assets/fonts/IBMPlexSansArabic-Bold.ttf'); font-weight: 700; font-display: swap; }
@font-face { font-family: 'Amiri'; src: url('../assets/fonts/Amiri-Regular.ttf'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Amiri'; src: url('../assets/fonts/Amiri-Bold.ttf'); font-weight: 700; font-display: swap; }

:root {
  --paper: #f3ead7;
  --paper-2: #ebdfc4;
  --card: #fbf6e8;
  --ink: #231f1a;
  --ink-2: #5b5246;
  --line: #cdbf9d;
  --red: #9c2b23;
  --red-d: #7a1f19;
  --olive: #55632c;
  --olive-l: #dfe5c4;
  --indigo: #2a3f73;
  --saffron: #c28b17;
  --ok: #4d6b28;
  --bad: #9c2b23;
  --shadow: 4px 4px 0 rgba(35, 31, 26, .85);
  --f-display: 'Aref', 'Amiri', serif;
  --f-body: 'Plex', system-ui, sans-serif;
  --f-text: 'Amiri', 'Plex', serif;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .27 0 0 0 0 .15 0 0 0 .1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background: var(--paper) var(--grain);
  font: 400 17px/1.7 var(--f-body);
  overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--f-display); font-weight: 700; margin: 0; line-height: 1.25; }
p { margin: 0; }
button { font: inherit; color: inherit; cursor: pointer; }
a { color: var(--red); }
.ic { vertical-align: middle; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--indigo); outline-offset: 3px; }
#app:focus, #app:focus-visible { outline: none; }
[hidden] { display: none !important; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--paper) var(--grain); border-bottom: 2px solid var(--ink); }
.topbar-in { max-width: 1180px; margin: 0 auto; padding: 8px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; color: var(--ink); }
.brand .logo { font: 700 30px/1 var(--f-display); letter-spacing: .5px; }
.brand .logo small { display: block; font: 400 11px/1.2 var(--f-body); color: var(--ink-2); letter-spacing: 0; margin-top: 2px; }
.tools { display: flex; gap: 8px; align-items: center; }
.iconbtn { width: 42px; height: 42px; display: grid; place-items: center; background: transparent; border: 2px solid var(--ink); color: var(--ink); }
.iconbtn:hover { background: var(--ink); color: var(--paper); }
.band { height: 24px; background-image: var(--band); background-repeat: repeat-x; background-position: center; background-size: auto 24px; opacity: .95; border-bottom: 1px solid var(--line); }

/* ---------- generic ---------- */
#app { max-width: 1180px; margin: 0 auto; padding: 22px 18px 70px; }
.screen { animation: enter .35s ease both; }
@keyframes enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.btn {
  --bg: var(--ink); --fg: var(--paper); --sh: var(--red);
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 12px 26px; min-height: 48px; border: 0; background: var(--bg); color: var(--fg);
  font: 700 18px/1.2 var(--f-body); box-shadow: 4px 4px 0 var(--sh);
  transition: transform .12s, box-shadow .12s;
}
.btn::after { content: ''; position: absolute; inset: 4px; border: 1.5px dashed color-mix(in srgb, var(--fg) 55%, transparent); pointer-events: none; }
.btn:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--sh); }
.btn:active { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--sh); }
.btn.red { --bg: var(--red); --sh: var(--ink); }
.btn.olive { --bg: var(--olive); --sh: var(--ink); }
.btn.ghost { --bg: transparent; --fg: var(--ink); --sh: var(--line); border: 2px solid var(--ink); }
.btn.small { min-height: 38px; padding: 6px 16px; font-size: 15px; box-shadow: 3px 3px 0 var(--sh); }
.btn[disabled] { opacity: .45; pointer-events: none; }

.card { background: var(--card); border: 2px solid var(--ink); box-shadow: var(--shadow); position: relative; }
.eyebrow { font: 700 13px/1 var(--f-body); letter-spacing: .04em; color: var(--red); display: flex; align-items: center; gap: 10px; }
.eyebrow::after { content: ''; height: 0; width: 70px; border-top: 2px dashed var(--red); }
.muted { color: var(--ink-2); }
.num { font-variant-numeric: tabular-nums; }
.star8 { fill: none; stroke: var(--ink); stroke-width: 1.2; stroke-linejoin: round; }
.star8.on { fill: var(--red); stroke: var(--red-d); }
.stars { display: inline-flex; gap: 3px; vertical-align: middle; }

/* ---------- onboarding ---------- */
.welcome { max-width: 760px; margin: 22px auto 0; padding: 34px 34px 38px; transform: rotate(-.4deg); }
.welcome h1 { font-size: 46px; margin: 6px 0 8px; }
.field { display: block; margin: 22px 0 0; }
.field > span { display: block; font-weight: 700; margin-bottom: 6px; }
.field input[type=text] { width: 100%; font: 500 20px var(--f-body); padding: 10px 14px; background: #fffdf5; border: 2px solid var(--ink); }
.agepick { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 8px; }
.agecard { text-align: right; background: #fffdf5; border: 2px solid var(--ink); padding: 14px 16px; display: grid; gap: 4px; position: relative; }
.agecard strong { font: 700 24px var(--f-display); }
.agecard[aria-checked=true] { background: var(--olive-l); box-shadow: 4px 4px 0 var(--olive); }
.agecard[aria-checked=true]::before { content: '✓'; position: absolute; inset-inline-end: 12px; top: 8px; font-weight: 700; font-size: 22px; color: var(--olive); }

/* ---------- home ---------- */
.hero { display: grid; grid-template-columns: 1.05fr .95fr; gap: 34px; align-items: center; margin-top: 8px; }
.hero h1.title { font-size: clamp(64px, 9vw, 112px); line-height: .95; margin: 12px 0 14px; position: relative; display: inline-block; }
.hero h1.title::after { content: ''; position: absolute; inset-inline: 0; bottom: -6px; height: 10px; background: repeating-linear-gradient(90deg, var(--red) 0 10px, transparent 10px 16px); opacity: .85; }
.hero .lede { font: 400 21px/1.85 var(--f-text); max-width: 34em; margin-top: 18px; color: #33291f; }
.hero .cta { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 26px; }
.hello { margin-top: 18px; font-size: 16px; color: var(--ink-2); }
.hello b { color: var(--ink); }
.hero-map { padding: 10px; transform: rotate(1.4deg); max-width: 430px; justify-self: center; }
.hero-map .map { display: block; width: 100%; height: auto; max-height: 540px; }
.hero-map::before, .hero-map::after { content: ''; position: absolute; width: 74px; height: 22px; background: rgba(194, 139, 23, .55); top: -10px; }
.hero-map::before { inset-inline-end: 24px; transform: rotate(5deg); }
.hero-map::after { inset-inline-start: 24px; transform: rotate(-6deg); }
.hero-map figcaption { font: 400 14px var(--f-body); padding: 8px 6px 2px; color: var(--ink-2); display: flex; justify-content: space-between; }

.section-title { display: flex; align-items: baseline; gap: 14px; margin: 54px 0 16px; }
.section-title h2 { font-size: 34px; }
.section-title::after { content: ''; flex: 1; border-top: 2px dashed var(--line); transform: translateY(-6px); }

.modes { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.mode { text-align: right; padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 8px; min-height: 210px; background: var(--card); border: 2px solid var(--ink); box-shadow: 4px 4px 0 var(--accent, var(--ink)); transition: transform .15s, box-shadow .15s; }
.mode:hover { transform: translate(-2px, -3px); box-shadow: 7px 8px 0 var(--accent, var(--ink)); }
.mode .m-ico { width: 54px; height: 54px; display: grid; place-items: center; border: 2px solid var(--accent); margin-bottom: 4px; }
.mode h3 { font-size: 26px; }
.mode p { font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.mode .tag { margin-top: auto; font: 700 13px var(--f-body); color: var(--accent); }
.mode:nth-child(odd) { transform: rotate(-.35deg); }
.mode:nth-child(even) { transform: rotate(.3deg); }
.mode:hover { transform: translate(-2px, -3px) rotate(0); }

.sidegrid { display: grid; grid-template-columns: 1.2fr 1fr 1fr; gap: 20px; align-items: start; }
.panel { padding: 20px 22px; }
.panel h3 { font-size: 26px; margin-bottom: 10px; }
.rankbar { height: 14px; border: 2px solid var(--ink); background: #fffdf5; margin: 10px 0 6px; position: relative; }
.rankbar i { position: absolute; inset: 0 auto 0 0; inset-inline-start: 0; background: repeating-linear-gradient(135deg, var(--red) 0 6px, var(--red-d) 6px 12px); }
.bigrank { font: 700 38px/1.1 var(--f-display); color: var(--red); }
.fact { font: 400 21px/1.9 var(--f-text); }
.fact-src { font-size: 13px; margin-top: 10px; color: var(--ink-2); }
.panel .thobe { width: 100%; max-width: 230px; display: block; margin: 0 auto; }

/* ---------- journey ---------- */
.screen-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.screen-head h2 { font-size: 40px; }
.screen-head .sub { color: var(--ink-2); }
.journey { display: grid; grid-template-columns: 1.15fr 1fr; gap: 28px; align-items: start; }
.mapcard { padding: 10px; position: sticky; top: 96px; }
.mapcard .map { display: block; width: 100%; height: auto; max-height: 78vh; }
.map .maplabel { font: 400 15px var(--f-display); fill: #8c7d57; }
.map .maplabel.sea { fill: #7e9ba3; font-size: 17px; letter-spacing: 1px; }
.map .route { fill: none; stroke: var(--red); stroke-width: 2.4; stroke-dasharray: 2 7; stroke-linecap: round; opacity: .8; }
.map .leader { stroke: #2a2418; stroke-width: 1.2; stroke-dasharray: 2 3; }
.map .cdot { fill: var(--red); stroke: var(--paper); stroke-width: 1.5; }
.snode { cursor: pointer; }
.snode .ring { fill: var(--paper); stroke: var(--ink); stroke-width: 2.4; }
.snode.locked { cursor: not-allowed; }
.snode.locked .ring { fill: #d7cbad; stroke: #8b7f66; stroke-dasharray: 3 3; }
.snode.sel .ring { stroke: var(--red); stroke-width: 4; }
.snode:hover .ring { fill: #fff6df; }
.snode .nm { font: 700 15px var(--f-display); fill: var(--ink); paint-order: stroke; stroke: var(--paper); stroke-width: 4px; text-anchor: middle; }
.snode .pulse { fill: none; stroke: var(--red); stroke-width: 2; opacity: 0; }
.snode.cur .pulse { animation: pulse 1.8s ease-out infinite; }
@keyframes pulse { 0% { opacity: .9; r: 24; } 100% { opacity: 0; r: 42; } }

.stationlist { display: grid; gap: 10px; }
.sitem { display: grid; grid-template-columns: 58px 1fr auto; align-items: center; gap: 14px; padding: 10px 14px 10px 10px; background: var(--card); border: 2px solid var(--ink); text-align: right; position: relative; }
.sitem .badge { width: 58px; height: 58px; display: grid; place-items: center; border: 2px solid var(--c); background: #fffdf5; }
.sitem h3 { font-size: 24px; }
.sitem p { font-size: 14.5px; color: var(--ink-2); line-height: 1.5; }
.sitem.sel { box-shadow: 4px 4px 0 var(--c); background: #fff9e8; }
.sitem.locked { opacity: .62; border-style: dashed; }
.sitem .go { font-weight: 700; color: var(--c); font-size: 14px; }
.detail { padding: 18px 20px; margin-bottom: 16px; }
.detail h3 { font-size: 32px; }
.detail .meta { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0 14px; color: var(--ink-2); font-size: 15px; }
.detail .row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* ---------- quiz ---------- */
.quiz { max-width: 880px; margin: 0 auto; }
.hud { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; margin-bottom: 10px; }
.hud .left { display: flex; gap: 10px; align-items: center; justify-content: flex-end; }
.hud .where { font: 700 20px var(--f-display); display: flex; align-items: center; gap: 10px; }
.pips { display: flex; gap: 6px; direction: rtl; }
.pip { width: 20px; height: 20px; border: 2px solid var(--ink); background: transparent; position: relative; }
.pip.cur { background: var(--saffron); }
.pip.right { background: var(--ok); }
.pip.part { background: linear-gradient(135deg, var(--ok) 50%, var(--red) 50%); }
.pip.wrong { background: var(--red); }
.scorebox { font: 700 22px var(--f-body); display: flex; align-items: baseline; gap: 6px; }
.scorebox small { font-size: 12px; font-weight: 500; color: var(--ink-2); }
.combo { display: inline-flex; align-items: center; padding: 1px 10px; font: 700 15px var(--f-body); background: var(--saffron); color: var(--ink); border: 2px solid var(--ink); animation: pop .3s; }
@keyframes pop { 0% { transform: scale(.6); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }

.thread { height: 12px; border: 2px solid var(--ink); background: #fffdf5; position: relative; overflow: hidden; margin-bottom: 16px; }
.thread i { position: absolute; top: 0; bottom: 0; inset-inline-start: 0; width: 100%; background: repeating-linear-gradient(135deg, var(--olive) 0 7px, #44511f 7px 14px); transition: width .2s linear; }
.thread.low i { background: repeating-linear-gradient(135deg, var(--red) 0 7px, var(--red-d) 7px 14px); }
.thread.off { opacity: .35; }

.qcard { padding: 24px 28px 26px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; align-items: center; }
.chip { font: 700 13px var(--f-body); padding: 2px 12px; border: 1.5px solid var(--ink); background: var(--paper-2); }
.chip.type { background: var(--ink); color: var(--paper); }
.chip.lv { display: inline-flex; gap: 2px; align-items: center; }
.qtext { font: 700 28px/1.65 var(--f-display); margin-bottom: 18px; }
.qtext .blank { display: inline-block; min-width: 4.5em; border-bottom: 3px dashed var(--red); text-align: center; color: var(--red); padding: 0 6px; }
.qtext .blank.filled { border-bottom-style: solid; }
.qimg { margin: 0 auto 18px; max-width: 520px; background: #fff; padding: 8px 8px 10px; border: 1.5px solid var(--ink); box-shadow: 4px 4px 0 rgba(35, 31, 26, .25); transform: rotate(-.7deg); position: relative; }
.qimg::before { content: ''; position: absolute; width: 70px; height: 20px; top: -12px; left: 50%; margin-left: -35px; background: rgba(194, 139, 23, .55); transform: rotate(2deg); }
.qimg img { display: block; width: 100%; height: auto; max-height: 300px; object-fit: cover; }

.opts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.opt { text-align: right; display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 12px; padding: 10px 14px 10px 12px; min-height: 64px; background: #fffdf5; border: 2px solid var(--ink); font: 500 19px/1.5 var(--f-body); position: relative; transition: transform .1s, background .15s; }
.opt .k { width: 38px; height: 38px; display: grid; place-items: center; background: var(--ink); color: var(--paper); font: 700 21px var(--f-display); }
.opt:hover:not([disabled]) { transform: translate(-2px, -2px); box-shadow: 3px 3px 0 var(--ink); background: #fff7e0; }
.opt[disabled] { cursor: default; }
.opt.gone { opacity: .25; text-decoration: line-through; pointer-events: none; }
.opt.right { background: #e3ecc9; border-color: var(--ok); box-shadow: 3px 3px 0 var(--ok); }
.opt.right .k { background: var(--ok); }
.opt.wrong { background: #f2d6cf; border-color: var(--bad); animation: shake .35s; }
.opt.wrong .k { background: var(--bad); }
.opt.dim { opacity: .5; }
@keyframes shake { 20%, 60% { transform: translateX(6px); } 40%, 80% { transform: translateX(-6px); } }

.tf { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.tf .opt { grid-template-columns: 1fr; justify-items: center; text-align: center; min-height: 100px; font: 700 28px var(--f-display); gap: 4px; }
.tf .opt .ic { width: 34px; height: 34px; }
.tf .opt.yes { color: var(--ok); } .tf .opt.no { color: var(--bad); }
.tf .opt.right, .tf .opt.wrong { color: var(--ink); }

.clues { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 8px; }
.clues li { padding: 8px 14px; background: #fffdf5; border-inline-start: 6px solid var(--saffron); font: 400 21px/1.7 var(--f-text); animation: enter .3s; }
.clues li.locked { opacity: .45; border-inline-start-color: var(--line); font-family: var(--f-body); font-size: 15px; }
.clues li span { font: 700 13px var(--f-body); color: var(--saffron); margin-inline-end: 8px; }

.order { display: grid; gap: 10px; margin-bottom: 14px; }
.ochip { display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; padding: 10px 14px; background: #fffdf5; border: 2px solid var(--ink); text-align: right; font: 500 19px var(--f-body); min-height: 58px; }
.ochip .n { width: 40px; height: 40px; border: 2px dashed var(--line); display: grid; place-items: center; font: 700 22px var(--f-display); color: var(--ink); }
.ochip.picked { background: #fff1c8; }
.ochip.picked .n { border: 2px solid var(--ink); background: var(--saffron); }
.ochip .yr { display: none; }
.ochip.right { background: #e3ecc9; border-color: var(--ok); }
.ochip.wrong { background: #f2d6cf; border-color: var(--bad); }
.ochip .yr { margin-inline-start: auto; font: 700 14px var(--f-body); color: var(--ink-2); }
.ochip .txt { display: flex; justify-content: space-between; gap: 10px; width: 100%; align-items: center; }
.ochip.revealed .yr { display: inline; }
.hintline { font-size: 15px; color: var(--ink-2); margin: -6px 0 12px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; align-items: center; }

.match { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 40px; margin-bottom: 14px; }
.mcol { display: grid; gap: 10px; align-content: start; }
.mitem { text-align: center; padding: 10px 12px; min-height: 58px; background: #fffdf5; border: 2px solid var(--ink); font: 500 18px/1.4 var(--f-body); position: relative; }
.mitem.active { background: #fff1c8; box-shadow: 3px 3px 0 var(--ink); }
.mitem[data-pair] { background: color-mix(in srgb, var(--pc) 22%, #fffdf5); border-color: var(--pc); box-shadow: 3px 3px 0 var(--pc); }
.mitem[data-pair]::before { content: attr(data-pair); position: absolute; inset-inline-start: -14px; top: 50%; margin-top: -13px; width: 26px; height: 26px; background: var(--pc); color: #fff; font: 700 15px var(--f-body); display: grid; place-items: center; }
.mitem.right { background: #e3ecc9; border-color: var(--ok); box-shadow: 3px 3px 0 var(--ok); }
.mitem.wrong { background: #f2d6cf; border-color: var(--bad); box-shadow: 3px 3px 0 var(--bad); }

.mapq { margin-bottom: 12px; }
.mapq .mapbox { position: relative; border: 2px solid var(--ink); background: #cddde0; touch-action: manipulation; }
.mapq .map { display: block; width: 100%; height: min(62vh, 640px); cursor: crosshair; }
.mapq .map .guess { fill: var(--indigo); stroke: #fff; stroke-width: 2; }
.mapq .map .truth { fill: var(--ok); stroke: #fff; stroke-width: 2; }
.mapq .map .radius { fill: rgba(77, 107, 40, .18); stroke: var(--ok); stroke-width: 2; stroke-dasharray: 5 4; }
.mapq .map .hintr { fill: rgba(194, 139, 23, .18); stroke: var(--saffron); stroke-width: 2.5; stroke-dasharray: 3 4; }
.mapq .map .link { stroke: var(--red); stroke-width: 2.5; stroke-dasharray: 4 4; }
.mapq .map text.pl { font: 700 20px var(--f-display); fill: var(--ink); paint-order: stroke; stroke: #fff8e6; stroke-width: 5px; }
.mapq .tip { font-size: 15px; margin-top: 8px; color: var(--ink-2); }

.numq { text-align: center; padding: 6px 0 10px; }
.numq .readout { font: 700 64px/1.1 var(--f-display); color: var(--red); }
.numq .readout small { font: 500 22px var(--f-body); color: var(--ink-2); margin-inline-start: 10px; }
.numq .slider { display: flex; gap: 12px; align-items: center; max-width: 620px; margin: 14px auto 6px; direction: ltr; }
.numq input[type=range] { flex: 1; accent-color: var(--red); height: 36px; }
.numq .bound { font: 500 14px var(--f-body); color: var(--ink-2); min-width: 40px; }
.numq .stepbtn { width: 46px; height: 46px; font: 700 26px var(--f-body); border: 2px solid var(--ink); background: #fffdf5; }
.numq .answer-line { margin-top: 10px; font-weight: 700; }

.helpers { display: flex; gap: 10px; align-items: center; margin-top: 16px; flex-wrap: wrap; }
.helper { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border: 2px dashed var(--ink); background: transparent; font-weight: 500; font-size: 16px; }
.helper:hover:not([disabled]) { background: #fff1c8; }
.helper[disabled] { opacity: .4; cursor: default; }

.feedback { margin-top: 20px; padding: 16px 20px 18px; border: 2px solid var(--ink); background: #fff9e8; position: relative; animation: enter .3s; }
.feedback.ok { border-inline-start: 12px solid var(--ok); }
.feedback.part { border-inline-start: 12px solid var(--saffron); }
.feedback.bad { border-inline-start: 12px solid var(--bad); }
.fb-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.fb-head h3 { font-size: 30px; }
.fb-head .pts { margin-inline-start: auto; font: 700 24px var(--f-body); color: var(--ok); }
.fb-head .pts.zero { color: var(--bad); }
.fb-ans { font-weight: 700; margin-bottom: 6px; }
.fb-know { font: 400 21px/1.85 var(--f-text); }
.fb-know::before { content: 'هل تعلم؟ '; font: 700 15px var(--f-body); color: var(--red); margin-inline-end: 6px; }
.srcs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; font-size: 13.5px; color: var(--ink-2); }
.srcs a { padding: 1px 10px; border: 1px solid var(--line); background: #fff; text-decoration: none; color: var(--ink); }
.srcs a:hover { border-color: var(--ink); }
.fb-next { margin-top: 14px; display: flex; justify-content: flex-end; }

/* ---------- result ---------- */
.result { display: grid; grid-template-columns: 1fr 1.1fr; gap: 32px; align-items: start; }
.stamp { padding: 30px 24px 26px; text-align: center; }
.seal { width: 190px; height: 190px; margin: 0 auto 14px; border-radius: 50%; border: 4px double var(--c, var(--red)); display: grid; place-items: center; color: var(--c, var(--red)); transform: rotate(-8deg); position: relative; }
.seal .motif { width: 92px; height: auto; }
.seal::after { content: ''; position: absolute; inset: 9px; border: 2px dashed var(--c, var(--red)); border-radius: 50%; }
.stamp h2 { font-size: 40px; }
.stamp .sc { font: 700 56px/1.1 var(--f-body); margin: 10px 0 0; }
.stamp .sc small { font-size: 18px; color: var(--ink-2); font-weight: 500; }
.stamp .stars { margin: 6px 0; }
.stamp .stars svg { animation: pop .5s both; }
.stamp .stars svg:nth-child(2) { animation-delay: .15s; } .stamp .stars svg:nth-child(3) { animation-delay: .3s; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 18px 0; }
.kpi { border: 2px solid var(--ink); background: #fffdf5; padding: 8px 6px; }
.kpi b { display: block; font: 700 26px var(--f-body); }
.kpi span { font-size: 13px; color: var(--ink-2); }
.review h3 { font-size: 28px; margin-bottom: 10px; }
.ritem { border: 2px solid var(--ink); background: var(--card); margin-bottom: 10px; }
.ritem summary { padding: 10px 14px; cursor: pointer; display: flex; gap: 10px; align-items: center; font-weight: 500; list-style: none; }
.ritem summary::-webkit-details-marker { display: none; }
.ritem summary .dot { width: 14px; height: 14px; flex: none; border: 2px solid var(--ink); }
.ritem summary .dot.right { background: var(--ok); } .ritem summary .dot.wrong { background: var(--bad); } .ritem summary .dot.part { background: var(--saffron); }
.ritem .body { padding: 2px 16px 14px; border-top: 1px dashed var(--line); }
.ritem .body .fb-know { font-size: 19px; }
.newbadge { display: flex; gap: 12px; align-items: center; padding: 10px 14px; margin-top: 12px; border: 2px solid var(--saffron); background: #fff3cf; text-align: right; }

/* ---------- album ---------- */
.album-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 14px; }
.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.bdg { padding: 12px 14px; border: 2px solid var(--ink); background: var(--card); display: grid; grid-template-columns: 46px 1fr; gap: 10px; align-items: center; }
.bdg.locked { opacity: .5; border-style: dashed; background: transparent; }
.bdg .bi { width: 46px; height: 46px; display: grid; place-items: center; border: 2px solid var(--saffron); background: #fff6dc; }
.bdg.locked .bi { border-color: var(--line); background: transparent; filter: grayscale(1); }
.bdg strong { font: 700 19px var(--f-display); display: block; line-height: 1.2; }
.bdg small { font-size: 13px; color: var(--ink-2); line-height: 1.4; display: block; }
.settings { display: grid; gap: 16px; }
.toggle { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.switch { width: 62px; height: 32px; border: 2px solid var(--ink); background: #fffdf5; position: relative; padding: 0; }
.switch::after { content: ''; position: absolute; top: 3px; inset-inline-start: 3px; width: 22px; height: 22px; background: var(--ink-2); transition: .15s; }
.switch[aria-checked=true] { background: var(--olive-l); }
.switch[aria-checked=true]::after { inset-inline-start: 33px; background: var(--olive); }

/* sources page */
.srclist { columns: 2; column-gap: 28px; padding: 0; list-style: none; }
.srclist li { break-inside: avoid; padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 15.5px; }
.note { padding: 18px 22px; background: #fff6dc; border: 2px dashed var(--saffron); margin: 16px 0; font: 400 20px/1.9 var(--f-text); }

/* toast */
.toasts { position: fixed; top: 76px; inset-inline-start: 50%; transform: translateX(50%); z-index: 50; display: grid; gap: 10px; pointer-events: none; }
html[dir=rtl] .toasts { inset-inline-start: auto; right: 50%; left: auto; }
.toast { padding: 10px 20px; background: var(--ink); color: var(--paper); border: 2px solid var(--saffron); box-shadow: 4px 4px 0 var(--saffron); display: flex; gap: 12px; align-items: center; font-weight: 500; animation: drop .45s both; }
@keyframes drop { from { opacity: 0; transform: translateY(-18px); } to { opacity: 1; transform: none; } }

footer.foot { max-width: 1180px; margin: 0 auto; padding: 0 18px 40px; color: var(--ink-2); font-size: 14px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
footer.foot button { background: none; border: 0; text-decoration: underline; padding: 0; color: inherit; }

/* ---------- responsive ---------- */
@media (max-width: 980px) {
  .hero { grid-template-columns: 1fr; }
  .hero-map { max-width: 320px; order: -1; }
  .modes { grid-template-columns: 1fr 1fr; }
  .sidegrid, .journey, .result, .album-grid { grid-template-columns: 1fr; }
  .srclist { columns: 1; }
}
@media (max-width: 640px) {
  body { font-size: 16px; }
  #app { padding: 14px 12px 60px; }
  .welcome { padding: 22px 18px 26px; }
  .welcome h1 { font-size: 36px; }
  .agepick { grid-template-columns: 1fr; }
  .opts, .match, .tf { grid-template-columns: 1fr; }
  .match { gap: 18px; }
  .tf { grid-template-columns: 1fr 1fr; }
  .qcard { padding: 16px 14px 18px; }
  .qtext { font-size: 23px; }
  .hud { grid-template-columns: 1fr; }
  .hud .left, .hud .where { justify-content: space-between; }
  .pips { justify-content: center; }
  .pip { width: 16px; height: 16px; }
  .modes { grid-template-columns: 1fr; }
  .mode { min-height: 0; }
  .mode:nth-child(n) { transform: none; }
  .numq .readout { font-size: 48px; }
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .screen-head h2 { font-size: 32px; }
  .brand .logo { font-size: 26px; }
  .brand .logo small { display: none; }
  .mapq .map { height: 52vh; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* modal */
.modal { position: fixed; inset: 0; background: rgba(35, 31, 26, .55); display: grid; place-items: center; z-index: 80; padding: 18px; animation: enter .2s; }
.modal-box { max-width: 460px; width: 100%; padding: 24px 26px; }
.modal-box h3 { font-size: 30px; margin-bottom: 6px; }

/* stitching animation for a newly earned patch */
.slot.fresh path { stroke-dasharray: 1; stroke-dashoffset: 1; animation: sew 2.6s .5s ease-in-out forwards; }
@keyframes sew { to { stroke-dashoffset: 0; } }
.result .col { display: grid; gap: 20px; align-content: start; }

.modal-box.wide { max-width: 640px; max-height: 88vh; overflow: auto; }
.rules { margin: 10px 0 0; padding: 0 20px 0 0; display: grid; gap: 10px; font-size: 17px; line-height: 1.8; }
