/* Phynex — الأساس المشترك: الخطوط، الألوان، الطباعة، المكونات الصغيرة */
@font-face { font-family: "Rubik PX"; src: url("../fonts/Rubik-Var.woff2") format("woff2"); font-weight: 300 900; font-display: swap; }
@font-face { font-family: "Plex PX"; src: url("../fonts/PlexArabic-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex PX"; src: url("../fonts/PlexArabic-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --indigo: #1B1B6B; --ink: #0D0D3A; --ink-2: #14144D; --ink-3: #1E1E62;
  --paper: #F5F7FF; --paper-2: #E8ECFB; --line: #D3D9F1; --text: #14163C; --muted: #4A5180;
  --on-dark: #EEF1FF; --on-dark-2: #AEB6E6; --on-dark-line: rgba(174, 182, 230, .22);
  --cyan: #4FD8F2; --cyan-2: #0FBDD9; --blue: #364BC2; --red: #D33646; --coral: #FF7A74; --violet: #763BE1; --lilac: #C79BFF;
  --ok: #0E8A5F; --warn: #B4540A;
  --f-head: "Rubik PX", "Segoe UI", Tahoma, sans-serif;
  --f-body: "Plex PX", "Segoe UI", Tahoma, sans-serif;
  --r-s: 10px; --r-m: 16px; --r-l: 24px; --r-pill: 999px;
  --gutter: clamp(16px, 4vw, 40px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --measure: 62ch;
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
/* الشاشات الكبيرة (داتا شو و4K): تكبير تدريجي للواجهة كلها لأن كل الأبعاد بالـ rem */
@media (min-width: 1600px) { html { font-size: 112.5%; } }
@media (min-width: 2200px) { html { font-size: 137.5%; } }
@media (min-width: 3000px) { html { font-size: 175%; } }
body { margin: 0; font-family: var(--f-body); font-size: 1.0625rem; line-height: 1.75; color: var(--text); background: var(--paper); font-variant-numeric: lining-nums; -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4 { font-family: var(--f-head); line-height: 1.25; margin: 0 0 .5em; font-weight: 700; letter-spacing: 0; text-wrap: balance; }
h2 { font-size: clamp(1.6rem, 1.2rem + 1.8vw, 2.4rem); }
h3 { font-size: 1.25rem; }
p { margin: 0 0 1em; max-inline-size: var(--measure); text-wrap: pretty; }
a { color: inherit; }
img, svg { display: block; max-inline-size: 100%; }
.num, [dir="ltr"], bdi { font-variant-numeric: tabular-nums; }
.visually-hidden { position: absolute !important; inline-size: 1px; block-size: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.wrap { inline-size: min(100% - 2 * var(--gutter), 72rem); margin-inline: auto; }

/* التركيز الظاهر */
:focus-visible { outline: 3px solid var(--cyan-2); outline-offset: 3px; border-radius: 6px; }
.on-dark :focus-visible, .dark :focus-visible { outline-color: var(--cyan); }

/* الأزرار: أهداف لمس ≥ 44px وردة فعل لمس دقيقة */
.btn { --bg: var(--indigo); --fg: #fff; display: inline-flex; align-items: center; justify-content: center; gap: .55em; min-block-size: 48px; padding: .6em 1.3em; border-radius: var(--r-pill);
  font: 600 1rem/1.2 var(--f-body); color: var(--fg); background: var(--bg); border: 1.5px solid transparent; text-decoration: none; cursor: pointer;
  transition: transform .18s var(--ease), background-color .2s, box-shadow .2s; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
.btn:active { transform: scale(.97); }
.btn:hover { box-shadow: 0 6px 18px -8px rgba(27, 27, 107, .55); }
.btn-light { --bg: #fff; --fg: var(--indigo); }
.btn-ghost { --bg: transparent; --fg: currentColor; border-color: currentColor; }
.btn-cyan { --bg: var(--cyan); --fg: var(--ink); }
.btn-blue { --bg: var(--blue); --fg: #fff; }
.btn-blue:hover { box-shadow: 0 6px 18px -8px rgba(54, 75, 194, .7); }
.btn-sm { min-block-size: 44px; padding: .45em 1em; font-size: .95rem; }
.btn svg { inline-size: 1.15em; block-size: 1.15em; flex: none; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.icon-btn { inline-size: 44px; block-size: 44px; display: inline-grid; place-items: center; border-radius: 12px; border: 0; background: transparent; color: inherit; cursor: pointer; }

/* حقول */
.field { display: grid; gap: .35rem; font-weight: 600; font-size: .95rem; }
.field input, .field select { font: 400 1rem var(--f-body); min-block-size: 48px; padding: .5rem .9rem; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; color: var(--text); }
.field input:focus-visible { outline-offset: 1px; }
.code-input { direction: ltr; text-align: center; font: 600 1.25rem/1 ui-monospace, "Cascadia Mono", Consolas, monospace !important; letter-spacing: .12em; text-transform: uppercase; }

/* شارات */
.chip { display: inline-flex; align-items: center; gap: .35em; font-size: .8rem; font-weight: 600; padding: .15em .7em; border-radius: var(--r-pill); white-space: nowrap; }
.chip-free { background: #DDF7EE; color: #0B6B4A; }
.chip-locked { background: var(--paper-2); color: var(--muted); }
.chip-ready { background: #E2F6FB; color: #08627A; }
.dark .chip-locked { background: rgba(174, 182, 230, .12); color: var(--on-dark-2); }
.dark .chip-free { background: rgba(79, 216, 242, .14); color: var(--cyan); }

/* الورقة السفلية (bottom sheet) */
.sheet-backdrop { position: fixed; inset: 0; background: rgba(8, 8, 36, .55); z-index: 90; opacity: 0; transition: opacity .25s; }
.sheet { position: fixed; inset-inline: 0; inset-block-end: 0; z-index: 91; max-block-size: 92dvh; overflow: auto; background: var(--paper); color: var(--text);
  border-radius: var(--r-l) var(--r-l) 0 0; padding: .75rem var(--gutter) calc(1.25rem + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .32s var(--ease);
  box-shadow: 0 -18px 50px -20px rgba(8, 8, 36, .5); }
.sheet::before { content: ""; display: block; inline-size: 44px; block-size: 5px; border-radius: 9px; background: var(--line); margin: 0 auto .9rem; }
.sheet.open { transform: none; }
.sheet-backdrop.open { opacity: 1; }
/* التوسيط مستقل عن الاتجاه، لذلك left/translateX هنا مقصودة */
@media (min-width: 760px) { .sheet { left: 50%; right: auto; inline-size: min(560px, 92vw); transform: translate(-50%, 100%); } .sheet.open { transform: translate(-50%, 0); } }

/* إشعار خفيف */
.toast { position: fixed; left: 50%; inset-block-end: calc(1rem + env(safe-area-inset-bottom)); transform: translate(-50%, 140%); z-index: 120; display: flex; gap: .8rem; align-items: center;
  background: var(--ink); color: var(--on-dark); padding: .7rem 1rem; border-radius: 14px; box-shadow: 0 12px 30px -12px rgba(0, 0, 0, .5); transition: transform .3s var(--ease); max-inline-size: calc(100% - 32px); font-size: .95rem; }
.toast.show { transform: translate(-50%, 0); }
.offline-pill { position: fixed; inset-block-start: calc(.5rem + env(safe-area-inset-top)); left: 50%; transform: translate(-50%, -160%); z-index: 110; background: #FFF4E5; color: #6B3A00;
  border: 1px solid #F3D3A6; font-size: .85rem; font-weight: 600; padding: .3rem .9rem; border-radius: var(--r-pill); transition: transform .3s var(--ease); }
.offline-pill.show { transform: translate(-50%, 0); }

/* عناصر الأوراق السفلية المشتركة */
.dev-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; padding: .5rem 0; border-block-end: 1px solid var(--line); }
.dev-row small { color: var(--muted); }
.ios-steps { padding-inline-start: 1.3rem; display: grid; gap: .4rem; margin-block-end: 1.2rem; }
.sheet-plans { display: grid; gap: .5rem; margin-block: .8rem 1.2rem; }
.sheet-plans a { display: flex; justify-content: space-between; align-items: center; gap: .8rem; min-block-size: 52px; padding: .5rem 1rem; border-radius: 14px; background: #fff; border: 1.5px solid var(--line); text-decoration: none; color: inherit; font-weight: 600; }
.sheet-plans a span:last-child { color: var(--indigo); font-family: var(--f-head); white-space: nowrap; }
.sheet-sep { display: flex; align-items: center; gap: .8rem; color: var(--muted); font-size: .9rem; margin-block: 1rem .4rem; }
.sheet-sep::before, .sheet-sep::after { content: ""; flex: 1; block-size: 1px; background: var(--line); }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; scroll-behavior: auto !important; } }
