:root {
  --ink: #0F172A;
  --muted: #64748B;
  --line: #E2E8F0;
  --bg: #F4F7FC;
  --card: #FFFFFF;
  --navy: #1E2A5A;
  --gold: #E8A400;
  --blue: #2F7DE1;
  --gray: #8A94A6;
  --ok: #10B981;
  --bad: #EF4444;
  --ooredoo: #E30613;
  --djezzy: #2B2B2B;
  --mobilis: #00A651;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.10);
  --font: "Tajawal", "Segoe UI", Tahoma, sans-serif;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); }
body { direction: rtl; overscroll-behavior: none; }
button { font-family: var(--font); cursor: pointer; }
.hidden { display: none !important; }

/* ---------- screens ---------- */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px 16px; overflow-y: auto; }
.panel { width: 100%; max-width: 460px; background: var(--card); border-radius: 24px; box-shadow: var(--shadow); padding: 24px 20px; }
.brand-kicker { display: inline-block; font-size: 13px; font-weight: 700; color: var(--navy); background: #E8EDFB; padding: 6px 12px; border-radius: 999px; }
h1 { font-size: 27px; line-height: 1.35; margin: 14px 0 8px; }
h2 { font-size: 20px; margin: 0 0 12px; }
p.lead { color: var(--muted); font-size: 16px; line-height: 1.7; margin: 0 0 18px; }
.steps { list-style: none; padding: 0; margin: 0 0 20px; display: grid; gap: 10px; }
.steps li { display: flex; gap: 10px; align-items: center; background: var(--bg); border-radius: 14px; padding: 10px 12px; font-size: 15px; }
.steps b { flex: 0 0 30px; height: 30px; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; font-size: 14px; }

.btn { width: 100%; border: 0; border-radius: 14px; padding: 15px 18px; font-size: 18px; font-weight: 800; background: var(--navy); color: #fff; box-shadow: 0 8px 18px rgba(30, 42, 90, 0.25); }
.btn:active { transform: translateY(1px); }
.btn.ghost { background: #EEF2F8; color: var(--ink); box-shadow: none; }
.btn.small { padding: 10px 12px; font-size: 15px; border-radius: 12px; }
.btn:disabled { opacity: 0.45; }

label.field { display: block; font-weight: 700; margin: 14px 0 8px; font-size: 15px; }
input.text { width: 100%; padding: 14px; font-size: 18px; border-radius: 14px; border: 2px solid var(--line); font-family: var(--font); }
input.text:focus { outline: none; border-color: var(--navy); }

.choices { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.choices.two { grid-template-columns: 1fr 1fr; }
.choice { border: 2px solid var(--line); background: #fff; border-radius: 16px; padding: 12px 8px; text-align: center; font-weight: 800; font-size: 15px; color: var(--ink); }
.choice small { display: block; font-weight: 500; color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.4; }
.choice .ico { font-size: 28px; display: block; margin-bottom: 4px; }
.choice.sel { border-color: var(--navy); background: #EEF2FD; box-shadow: 0 0 0 3px rgba(30, 42, 90, 0.12); }
.choice:disabled { opacity: 0.4; }
.op-ooredoo.sel { border-color: var(--ooredoo); background: #FDECEC; }
.op-djezzy.sel { border-color: var(--djezzy); background: #EFEFEF; }
.op-mobilis.sel { border-color: var(--mobilis); background: #E6F7EE; }
.op-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; vertical-align: middle; margin-inline-start: 6px; }
.err { color: var(--bad); font-weight: 700; min-height: 22px; margin-top: 10px; text-align: center; }
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; line-height: 1.6; }

/* ---------- game ---------- */
#game { padding: 0; justify-content: stretch; align-items: stretch; background: #E9EEF6; }
#map { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; }
.hud-top { position: absolute; top: 10px; right: 10px; left: 10px; display: flex; gap: 8px; align-items: center; pointer-events: none; }
.chip { pointer-events: auto; background: rgba(255, 255, 255, 0.95); border-radius: 999px; padding: 8px 12px; font-weight: 800; font-size: 14px; box-shadow: 0 4px 14px rgba(15, 23, 42, 0.12); display: flex; align-items: center; gap: 6px; border: 0; color: var(--ink); }
.chip .dot { width: 12px; height: 12px; border-radius: 50%; }
.ticker { position: absolute; top: 58px; right: 10px; left: 10px; background: rgba(15, 23, 42, 0.86); color: #fff; border-radius: 14px; padding: 9px 12px; font-size: 13.5px; line-height: 1.5; box-shadow: 0 6px 16px rgba(15, 23, 42, 0.2); transition: opacity .4s; }
.hud-bottom { position: absolute; bottom: calc(12px + env(safe-area-inset-bottom)); right: 10px; left: 10px; display: grid; gap: 8px; grid-template-columns: 1fr 1fr; }
.hud-bottom .btn { font-size: 16px; padding: 13px 10px; }
.hud-bottom .enter { grid-column: 1 / -1; background: var(--ok); box-shadow: 0 8px 18px rgba(16, 185, 129, 0.35); animation: pulse 1.4s infinite; }
@keyframes pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.025); } }
.hint { position: absolute; bottom: calc(132px + env(safe-area-inset-bottom)); right: 50%; transform: translateX(50%); background: rgba(255, 255, 255, 0.95); padding: 8px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 700; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1); white-space: nowrap; }

/* ---------- sheets / modals ---------- */
.overlay { position: fixed; inset: 0; background: rgba(15, 23, 42, 0.45); display: flex; align-items: flex-end; justify-content: center; z-index: 20; }
.sheet { width: 100%; max-width: 520px; max-height: 92vh; overflow-y: auto; background: #fff; border-radius: 26px 26px 0 0; padding: 20px 18px calc(22px + env(safe-area-inset-bottom)); box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.25); animation: up .25s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.sheet h3 { margin: 0 0 6px; font-size: 21px; }
.sheet .sub { color: var(--muted); margin: 0 0 14px; font-size: 14.5px; line-height: 1.6; }
.stagebar { display: flex; gap: 6px; margin-bottom: 14px; }
.stagebar span { flex: 1; height: 6px; border-radius: 4px; background: var(--line); }
.stagebar span.on { background: var(--navy); }
.stage-title { font-size: 13px; font-weight: 800; color: var(--navy); letter-spacing: .3px; margin-bottom: 4px; }
.dim { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; background: var(--bg); margin-bottom: 8px; opacity: 0; transform: translateY(8px); transition: all .35s ease; }
.dim.show { opacity: 1; transform: none; }
.dim .ic { font-size: 24px; flex: 0 0 34px; text-align: center; }
.dim .tx { flex: 1; font-size: 14.5px; line-height: 1.5; }
.dim .tx b { display: block; font-size: 13px; color: var(--muted); }
.bar { height: 8px; border-radius: 6px; background: #E2E8F0; overflow: hidden; margin-top: 5px; }
.bar i { display: block; height: 100%; border-radius: 6px; background: var(--navy); transition: width .6s ease; }
.dim.bad { background: #FEF0F0; }
.stars { display: flex; gap: 6px; justify-content: center; margin: 12px 0; direction: ltr; }
.stars button { font-size: 38px; background: none; border: 0; color: #CBD5E1; padding: 0 2px; }
.stars button.on { color: #F5B700; }
.check { display: flex; gap: 10px; align-items: center; padding: 12px; border-radius: 14px; background: #FFF7E8; font-weight: 700; margin: 6px 0 14px; }
.check input { width: 22px; height: 22px; }
.result-card { border-radius: 18px; padding: 16px; color: #fff; margin: 10px 0; }
.result-card .big { font-size: 26px; font-weight: 900; }
.result-card .why { font-size: 14.5px; line-height: 1.7; opacity: .95; margin-top: 6px; }
.kv { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.kv div { background: var(--bg); border-radius: 14px; padding: 10px; text-align: center; font-size: 13px; color: var(--muted); }
.kv div b { display: block; font-size: 22px; color: var(--ink); }
.qlist { display: grid; gap: 8px; }
.qlist button { text-align: right; border: 2px solid var(--line); background: #fff; border-radius: 14px; padding: 13px 14px; font-size: 16px; font-weight: 700; color: var(--ink); }
.qlist button:active { background: #EEF2FD; }
.answers { display: grid; gap: 8px; }
.answers button { border: 0; border-radius: 14px; padding: 14px; font-size: 16.5px; font-weight: 800; background: #EEF2FD; color: var(--navy); }

/* Dick & Basu matrix */
.matrix { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin: 10px 0 6px; }
.matrix .cell { border-radius: 14px; padding: 12px 8px; text-align: center; font-weight: 800; font-size: 14px; min-height: 66px; display: grid; place-items: center; }
.matrix .cell small { display: block; font-weight: 500; font-size: 11.5px; opacity: .85; }
.matrix .cell.me { outline: 4px solid var(--ink); outline-offset: -4px; }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; }

/* toast */
.toast { position: fixed; left: 50%; bottom: calc(150px + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 16px; border-radius: 14px; font-weight: 700; font-size: 14.5px; z-index: 40; box-shadow: var(--shadow); max-width: 90vw; text-align: center; }

/* ---------- company screen ---------- */
#company { justify-content: flex-start; background: var(--bg); }
.co-wrap { width: 100%; max-width: 560px; display: grid; gap: 12px; padding-bottom: 30px; }
.co-head { border-radius: 22px; padding: 18px; color: #fff; box-shadow: var(--shadow); }
.co-head .t { font-size: 14px; opacity: .9; }
.co-head .n { font-size: 26px; font-weight: 900; }
.co-card { background: #fff; border-radius: 20px; padding: 16px; box-shadow: var(--shadow); }
.co-card h4 { margin: 0 0 10px; font-size: 17px; }
.lever { margin-bottom: 12px; }
.lever .row { display: flex; justify-content: space-between; font-weight: 700; font-size: 14.5px; }
.lever input[type=range] { width: 100%; accent-color: var(--navy); height: 28px; }
.budget { font-weight: 800; font-size: 14px; padding: 8px 12px; border-radius: 12px; background: var(--bg); text-align: center; margin-bottom: 10px; }
.budget.over { background: #FEE2E2; color: var(--bad); }
.loybars { display: grid; gap: 8px; }
.loybar { display: grid; grid-template-columns: 92px 1fr 30px; gap: 8px; align-items: center; font-size: 13.5px; font-weight: 700; }
.loybar .bar { height: 12px; margin: 0; }
.feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; max-height: 220px; overflow-y: auto; }
.feed li { background: var(--bg); border-radius: 12px; padding: 8px 10px; font-size: 13.5px; line-height: 1.5; }
#minimap { width: 100%; border-radius: 14px; background: #E9EEF6; display: block; }
.camp { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
