/* مغامرات ذَهِين — أنماط الواجهة (الشاشات نفسها في screens.css) */
@font-face { font-family: 'Baloo Bhaijaan 2'; src: url(fonts/baloo-bhaijaan-2.woff) format('woff'); font-weight: 400 800; font-display: swap; }
@font-face { font-family: 'Noto Naskh Arabic'; src: url(fonts/noto-naskh-arabic.woff) format('woff'); font-weight: 400 700; font-display: swap; }

:root {
  --ink: #1B1F3B; --night: #1B1F3B; --orange: #FF8A1F; --orange-d: #C45A00; --blue: #2D8CFF; --blue-d: #1765C7;
  --green: #22B357; --cream: #FFF6E8; --line: #C8CDE3; --muted: #4A4F75;
}
html, body { height: 100%; margin: 0; background: var(--night); overflow: hidden; }
body { font-family: 'Baloo Bhaijaan 2', 'Noto Naskh Arabic', 'Segoe UI', Tahoma, sans-serif; color: var(--ink);
  -webkit-tap-highlight-color: transparent; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
#wrap { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; }
#stage { width: 390px; height: 844px; position: relative; overflow: hidden; flex: none; transform-origin: center center; background: var(--night); }
button { font-family: inherit; cursor: pointer; }
[hidden] { display: none !important; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--blue); outline-offset: 3px; }

/* ── الرئيسية ── */
.home { position: absolute; inset: 0; display: flex; flex-direction: column; color: #fff; }
.home-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: .28; }
.home-top { position: relative; padding: 18px 18px 0; display: flex; align-items: center; gap: 12px; }
.home-title { flex: 1; }
.home-title h1 { margin: 0; font-size: 27px; font-weight: 800; line-height: 1.2; }
.home-title p { margin: 2px 0 0; font-size: 14px; font-weight: 700; color: #FFD9A8; }
.points { flex: none; background: var(--blue); color: #fff; border-radius: 999px; padding: 6px 12px; font-weight: 800; font-size: 16px; box-shadow: 0 4px 0 var(--blue-d); }
.points b { color: #FFD24A; display: inline-flex; vertical-align: -2px; }
.points { display: flex; align-items: center; gap: 4px; }
.gear { flex: none; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255,255,255,.16); display: flex; align-items: center; justify-content: center; padding: 0; }
.hero-row { position: relative; display: flex; align-items: flex-end; gap: 8px; padding: 6px 18px 0; height: 132px; }
.hero-row img { height: 132px; flex: none; }
.bubble { position: relative; margin-bottom: 30px; background: #fff; color: var(--ink); border-radius: 18px; padding: 10px 14px; font-weight: 800; font-size: 16.5px; line-height: 1.5; box-shadow: 0 4px 0 rgba(27,31,59,.35); }
.bubble::after { content: ''; position: absolute; right: -9px; bottom: 14px; border: 9px solid transparent; border-left-color: #fff; border-right: 0; }

.game-card { position: relative; margin: 12px 16px 0; height: 104px; border-radius: 22px; overflow: hidden; border: 0; padding: 0; width: calc(100% - 32px);
  box-shadow: 0 5px 0 #8C3F00; background: var(--orange); text-align: right; color: #fff; display: block; }
.game-card img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 62%; filter: saturate(1.1); }
.game-card .shade { position: absolute; inset: 0; background: linear-gradient(270deg, rgba(27,31,59,.88) 0%, rgba(27,31,59,.55) 55%, rgba(27,31,59,.05) 100%); }
.game-card .txt { position: absolute; top: 14px; right: 16px; left: 120px; }
.game-card b { display: block; font-size: 22px; font-weight: 800; line-height: 1.2; }
.game-card span { display: block; margin-top: 4px; font-size: 14px; font-weight: 700; color: #FFE2BF; }
.game-card .tag { position: absolute; left: 12px; bottom: 12px; background: #fff; color: var(--orange-d); border-radius: 999px; padding: 3px 12px; font-size: 13px; font-weight: 800; }

.path-head { position: relative; margin: 16px 18px 6px; font-size: 18px; font-weight: 800; color: #fff; display: flex; align-items: center; justify-content: space-between; }
.path-head small { font-size: 13px; color: #C9CDEB; font-weight: 700; }
.path { position: relative; flex: 1; overflow-y: auto; padding: 4px 16px 24px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.path::-webkit-scrollbar { display: none; }
.station { width: 100%; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 20px; background: #fff; color: var(--ink);
  padding: 8px 8px 8px 12px; margin: 0 0 12px; box-shadow: 0 4px 0 #9AA0C2; text-align: right; position: relative; }
.station .num { flex: none; width: 34px; height: 34px; border-radius: 50%; background: var(--orange); color: #fff; font-weight: 800; font-size: 17px;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 3px 0 var(--orange-d); }
.station .info { flex: 1; min-width: 0; }
.station .info b { display: block; font-size: 17.5px; font-weight: 800; line-height: 1.3; }
.station .info span { display: block; font-size: 13.5px; font-weight: 700; color: var(--muted); line-height: 1.4; }
.station .thumb { flex: none; width: 62px; height: 62px; border-radius: 14px; overflow: hidden; background: #E8EBF7; }
.station .thumb img { width: 100%; height: 100%; object-fit: cover; }
.station .thumb.cut img { object-fit: contain; object-position: center bottom; }
.station:active, .game-card:active { transform: translateY(2px); }

/* ── التحميل ── */
.loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 800; font-size: 18px; }

.bubble.nudge { animation: dh-shake .42s ease-in-out; }
.chips { position: relative; display: flex; gap: 8px; padding: 2px 16px 0; flex-wrap: wrap; }
.chip { border: 0; border-radius: 999px; padding: 7px 14px; font-size: 15px; font-weight: 800; display: flex; align-items: center; gap: 6px; max-width: 100%; }
.chip.go { background: var(--green); color: #fff; box-shadow: 0 4px 0 #13813C; }
.chip.rev { background: #fff; color: var(--ink); box-shadow: 0 4px 0 #9AA0C2; }
.chip small { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 170px; }
.stars, .station .info .stars { display: inline-flex; gap: 1px; margin-top: 3px; font-style: normal; }
.stars i { font-style: normal; display: inline-flex; color: #D5D9EA; }
.stars i.on { color: #FFB200; }
.station .info .now { display: inline-block; width: auto; margin-top: 3px; background: var(--orange); color: #fff; border-radius: 999px; padding: 1px 10px; font-size: 12.5px; font-weight: 800; }
.station .info .lock { display: inline-flex; margin-top: 3px; color: #7A80A6; }
.station.done .num { background: var(--green); box-shadow: 0 3px 0 #13813C; }
.station.current { box-shadow: 0 4px 0 var(--orange-d), 0 0 0 3px var(--orange); }
.station.locked { background: #DADDEB; box-shadow: 0 4px 0 #8E93B3; }
.station.locked .num { background: #9AA0C2; box-shadow: 0 3px 0 #7A80A6; }
.station.locked .info, .station.locked .thumb { opacity: .55; }
.station.locked .thumb img { filter: grayscale(1); }

/* ── تهنئة نهاية المحطة ── */
.toast { position: absolute; left: 16px; right: 16px; top: 74px; z-index: 50; background: #fff; color: var(--ink); border-radius: 20px; padding: 12px 16px;
  box-shadow: 0 6px 0 rgba(27,31,59,.35), 0 0 0 3px var(--green); display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center;
  animation: dh-pop .5s ease-out both; transition: opacity .5s, transform .5s; }
.toast b { font-size: 17px; font-weight: 800; }
.toast .stars svg { width: 28px; height: 28px; }
.toast span { font-size: 14px; font-weight: 700; color: var(--muted); }
.toast.out { opacity: 0; transform: translateY(-12px); pointer-events: none; }

/* ── الإعدادات ── */
.sheet-wrap { position: absolute; inset: 0; z-index: 10; background: rgba(12,14,30,.55); display: flex; align-items: flex-end; }
.sheet { width: 100%; max-height: 86%; overflow-y: auto; background: var(--cream); color: var(--ink); border-radius: 26px 26px 0 0; padding: 14px 18px 26px; box-sizing: border-box; animation: dh-rise .35s ease-out both; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 4px; }
.sheet-head b { font-size: 21px; font-weight: 800; }
.sheet .x { width: 38px; height: 38px; border-radius: 50%; border: 0; background: #fff; color: var(--ink); box-shadow: 0 3px 0 #C8CDE3; display: flex; align-items: center; justify-content: center; padding: 0; }
.sheet .sec { background: #fff; border-radius: 18px; padding: 12px 14px; margin-top: 12px; display: flex; flex-direction: column; gap: 6px; }
.sheet .sec > b { font-size: 17px; font-weight: 800; }
.sheet p { margin: 0; font-size: 14.5px; font-weight: 700; color: var(--muted); line-height: 1.5; }
.sheet .row { display: flex; gap: 8px; }
.sheet input { flex: 1; min-width: 0; font: inherit; font-size: 17px; font-weight: 800; border: 3px solid var(--line); border-radius: 14px; padding: 6px 12px; text-align: center; background: #fff; color: var(--ink); }
.sheet input:focus { outline: none; border-color: var(--blue); }
.btn { border: 0; border-radius: 14px; padding: 9px 16px; font-size: 15.5px; font-weight: 800; background: var(--blue); color: #fff; box-shadow: 0 4px 0 var(--blue-d); }
.btn.ghost { background: #fff; color: var(--ink); border: 3px solid var(--line); box-shadow: none; align-self: flex-start; }
.btn.danger { background: #E0453A; box-shadow: 0 4px 0 #9E1F18; align-self: flex-start; }
.sheet .err { color: #C0392B; }
.sheet .confirm { display: flex; flex-direction: column; gap: 6px; }
.skills { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.skills li { display: grid; grid-template-columns: 1fr 90px 30px; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; }
.skills .bar { height: 10px; border-radius: 999px; background: #E8EBF7; overflow: hidden; }
.skills .bar i { display: block; height: 100%; border-radius: 999px; background: var(--orange); }
.skills b { text-align: left; font-variant-numeric: tabular-nums; }


.segs { display: flex; gap: 6px; background: #EEF0F8; border-radius: 14px; padding: 4px; }
.segs.wrap { flex-wrap: wrap; }
.seg { flex: 1; min-width: 52px; border: 0; border-radius: 11px; padding: 7px 6px; background: transparent; color: var(--ink); font-size: 15px; font-weight: 800; }
.seg.on { background: #fff; color: var(--blue-d); box-shadow: 0 2px 0 #C8CDE3; }
.sheet .k { color: var(--ink); font-weight: 800; }
.sheet .hint { font-size: 13px; }
.sheet .ask { display: flex; flex-direction: column; gap: 6px; background: #FFF6E8; border-radius: 14px; padding: 10px; }
.sheet .parent { border: 3px solid #FFD9A8; }
.sec.link { border: 0; text-align: right; color: var(--ink); width: 100%; flex-direction: row; align-items: center; justify-content: space-between; font-family: inherit; }
.sec.link span { font-size: 14px; font-weight: 700; color: var(--blue-d); display: inline-flex; align-items: center; gap: 4px; }

.sheet .ver { text-align: center; font-size: 13px; margin: 14px 0 0; }
.credits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }
.credits li { display: flex; flex-direction: column; gap: 1px; font-size: 13.5px; font-weight: 700; color: var(--muted); border-bottom: 1px solid #EEF0F8; padding-bottom: 7px; }
.credits li:last-child { border-bottom: 0; padding-bottom: 0; }
.credits b { color: var(--ink); font-size: 14.5px; }
.credits span[dir="ltr"] { text-align: right; unicode-bidi: plaintext; }
.credits a { color: var(--blue-d); }
.banner { position: absolute; left: 16px; right: 16px; bottom: 120px; z-index: 60; background: var(--ink); color: #fff; border-radius: 16px; padding: 10px 14px; text-align: center;
  font-size: 15.5px; font-weight: 800; box-shadow: 0 0 0 3px var(--orange); animation: dh-rise .35s ease-out both; transition: opacity .5s; }
.banner.out { opacity: 0; }
.timeup { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 24px; text-align: center; color: #fff;
  background: radial-gradient(circle at 50% 35%, #2B3163 0%, var(--night) 70%); }
.timeup img { height: 230px; }
.timeup .tu-gear { position: absolute; top: 18px; left: 18px; }
.timeup .tu-new { font-size: 14.5px; color: #DCE0F5; margin: 0 0 6px; width: 100%; }
.timeup .row { flex-wrap: wrap; justify-content: center; }
.timeup b { font-size: 28px; font-weight: 800; }
.timeup p { margin: 0; font-size: 18px; font-weight: 700; color: #DCE0F5; }
.timeup .sum { color: #FFD24A; }
.timeup .more { margin-top: 26px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.timeup .btn.ghost { align-self: center; background: transparent; color: #C9CDEB; border-color: #4A4F75; font-size: 14px; }
.timeup .row { display: flex; gap: 8px; }
.timeup input { width: 110px; font: inherit; font-size: 18px; font-weight: 800; text-align: center; border-radius: 12px; border: 3px solid #4A4F75; background: #fff; color: var(--ink); padding: 4px 8px; }
.timeup .err { color: #FF9C8F; font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .toast, .sheet, .bubble.nudge, .banner { animation: none; } }
