@import url('https://fonts.googleapis.com/css2?family=Tajawal:wght@400;500;700;800&family=Barlow+Condensed:wght@600;700&display=swap');

/* هوية نوج: أخضر على كريمي */
:root {
  --bg: #fffbf2;
  --bg2: #f6f2e8;
  --card: #ffffff;
  --card2: #f6f2e8;
  --line: #e7ebdf;
  --line2: #d9dfd0;
  --text: #14564e;
  --muted: #667970;
  --dim: #98a69e;
  --green: #196d62;
  --deep: #14564e;
  --accent: #196d62;
  --accent-ink: #ffffff;
  --accent-soft: rgba(25, 109, 98, .09);
  --gold: #b18442;
  --gold-soft: rgba(177, 132, 66, .13);
  --ok: #2c9a5f;
  --ok-soft: rgba(44, 154, 95, .12);
  --danger: #c4513f;
  --shadow: 0 10px 30px -14px rgba(20, 86, 78, .28);
  --font: 'Tajawal', system-ui, sans-serif;
  --num: 'Barlow Condensed', 'Tajawal', sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; color: inherit; border: 0; background: none; cursor: pointer; -webkit-tap-highlight-color: transparent; }
input, textarea { font: inherit; color: inherit; }
small { font-size: .7em; font-weight: 400; opacity: .75; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* شعار نوج (PNG شفاف) */
.logo { display: block; height: 34px; width: auto; }

/* توقيع المطوّر */
.credit {
  display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--dim); text-decoration: none;
  padding: 6px 12px; border-radius: 999px; transition: color .2s, background .2s;
}
.credit b { font-weight: 700; color: var(--muted); }
.credit:hover { color: var(--green); background: var(--accent-soft); }
.credit:hover b { color: var(--green); }

/* ---------- اللوحة السعودية ---------- */
.plate {
  container-type: inline-size;
  width: 100%; max-width: 380px;
  display: flex; direction: ltr; position: relative;
  background: #fff; color: #111;
  border: 2px solid #161616; border-radius: 9px;
  box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 4.5px #161616, 0 12px 26px -14px rgba(20, 40, 36, .55);
  padding: 5px;
  user-select: none;
}
.plate.sm { max-width: 170px; padding: 3px; border-width: 1.5px; border-radius: 6px; box-shadow: inset 0 0 0 2px #fff, inset 0 0 0 3px #161616; }
.plate.xs { max-width: 120px; padding: 2px; border-width: 1px; border-radius: 5px; box-shadow: inset 0 0 0 1.5px #fff, inset 0 0 0 2.2px #161616; }
.plate-body { flex: 1; display: grid; grid-template-columns: 4fr 3fr; }
.plate-grp { display: flex; justify-content: center; position: relative; }
.plate-grp.digits { border-right: 1.5px solid #161616; }
.pc {
  flex: 1; max-width: 25%; display: grid; grid-template-rows: 1fr 1fr; text-align: center; position: relative;
  border-radius: 5px; transition: background .2s;
}
.letters .pc { max-width: 33.4%; }
.pc-ar, .pc-en { display: grid; place-items: center; line-height: 1; }
.pc-ar { font-family: var(--font); font-weight: 800; font-size: 11cqw; border-bottom: 1.5px solid #161616; padding: 1.8cqw 0 1cqw; }
.pc-en { font-family: var(--num); font-weight: 700; font-size: 11.5cqw; padding: 1.2cqw 0 1cqw; letter-spacing: .02em; }
.plate-strip {
  width: 12.5%; border-left: 1.5px solid #161616; margin-left: 1px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; padding: 1cqw 0;
  color: #0d5a3a; line-height: 1;
}
.plate-emblem { width: 6cqw; height: 6cqw; }
.ps-ar { font-size: 2.5cqw; font-weight: 700; color: #111; white-space: nowrap; }
.ps-en { font-family: var(--num); font-size: 3.4cqw; font-weight: 700; color: #111; text-align: center; }
.plate.xs .ps-ar, .plate.xs .ps-en { display: none; }
.plate.xs .plate-strip { justify-content: center; }

/* لوحة تفاعلية: حقول حقيقية شفافة فوق الحروف والأرقام تفتح كيبورد الجهاز */
.plate.interactive .pc.empty .pc-ar::after { content: ''; width: 1.6cqw; height: 1.6cqw; border-radius: 50%; background: #c9cec5; }
.plate.interactive .pc.empty .pc-en::after { content: ''; width: 1.2cqw; height: 1.2cqw; border-radius: 50%; background: #dde1d8; }
.plate.interactive .plate-grp.focus { background: rgba(177, 132, 66, .07); }
.plate.interactive .pc.active { background: #f6ead2; }
.plate.interactive .pc.active::after {
  content: ''; position: absolute; left: 22%; right: 22%; bottom: 3px; height: 3px; border-radius: 3px;
  background: var(--gold); animation: caret 1s steps(2) infinite;
}
.plate-input {
  position: absolute; inset: 0; width: 100%; height: 100%; z-index: 2;
  opacity: 0; border: 0; background: transparent; color: transparent; caret-color: transparent;
  font-size: 16px; /* أقل من 16 يخلي آيفون يكبّر الشاشة */
  cursor: pointer;
}
@keyframes caret { 50% { opacity: 0; } }
.pc.pop .pc-ar, .pc.pop .pc-en { animation: pop .35s var(--spring); }
@keyframes pop { from { transform: scale(.4); opacity: 0; } }

/* ---------- السيارة ---------- */
.car { display: block; width: 100%; height: auto; overflow: visible; }
.car .car-paint { transition: fill .5s var(--ease); }

/* ---------- عناصر عامة ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  height: 54px; padding: 0 22px; border-radius: 999px; font-weight: 700; font-size: 16px; white-space: nowrap;
  transition: transform .15s var(--ease), background .2s, opacity .2s, box-shadow .2s;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--green); color: #fff; box-shadow: 0 12px 26px -12px rgba(25, 109, 98, .8); }
.btn.ghost { background: var(--card); border: 1px solid var(--line2); color: var(--text); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.gold { background: var(--gold); color: #fff; }
.btn:disabled { opacity: .45; pointer-events: none; box-shadow: none; }

.toast {
  position: fixed; left: 50%; top: max(14px, env(safe-area-inset-top)); z-index: 90;
  transform: translate(-50%, -160%); transition: transform .45s var(--spring);
  background: var(--deep); color: #fff; font-weight: 700; padding: 12px 20px; border-radius: 999px;
  box-shadow: 0 16px 40px -12px rgba(20, 86, 78, .6); white-space: nowrap; max-width: calc(100vw - 32px); overflow: hidden; text-overflow: ellipsis;
}
.toast.show { transform: translate(-50%, 0); }

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