/* ═══════════════════════════════════════════════════════════════
   Khaled Games — الصفحة الرئيسية

   عربية من اليمين إلى اليسار، خلفية كحلية متدرجة، وألوان
   سماوية وذهبية مرحة مريحة للعين. كل الأصول محلية: لا CDN
   ولا طلب خارجي واحد.

   الهدف: الصفحة تظهر في شاشة واحدة تقريباً بلا تمرير في
   المقاسات المعتادة.
   ═══════════════════════════════════════════════════════════════ */

/* ── خط تجوال، محلي بالكامل ── */
@font-face {
  font-family: 'Tajawal';
  src: url('/assets/fonts/tajawal-arabic-500-normal.woff2') format('woff2');
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/assets/fonts/tajawal-arabic-700-normal.woff2') format('woff2');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Tajawal';
  src: url('/assets/fonts/tajawal-arabic-800-normal.woff2') format('woff2');
  font-weight: 800;
  font-style: normal;
  font-display: swap;
}

:root {
  /* الكحلي الداكن */
  --navy-900: #070E22;
  --navy-800: #0B1430;
  --navy-700: #122145;
  --navy-600: #1B2E5C;

  /* الأزرق الكهربائي والسماوي */
  --blue: #2E9BFF;
  --cyan: #6FE3FF;

  /* الذهبي */
  --gold: #FFD166;
  --gold-deep: #F2B420;

  /* النصوص */
  --text: #EAF2FF;
  --text-soft: #A9BDDF;

  --font: 'Tajawal', 'Segoe UI', Tahoma, Arial, sans-serif;

  --radius: 18px;
  --gap: clamp(14px, 2.2vw, 26px);
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-weight: 500;
  color: var(--text);
  background:
    radial-gradient(120% 90% at 82% 8%, rgba(46, 155, 255, 0.20) 0%, transparent 58%),
    radial-gradient(90% 80% at 12% 92%, rgba(111, 227, 255, 0.13) 0%, transparent 62%),
    linear-gradient(168deg, var(--navy-800) 0%, var(--navy-900) 100%);
  /* لا تمرير أفقي أبداً */
  overflow-x: hidden;
}

/* ═══════════ الشريط العلوي ═══════════ */

.topbar {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: clamp(10px, 1.8vh, 18px) clamp(16px, 3.5vw, 44px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-logo {
  width: clamp(42px, 5.4vw, 60px);
  height: auto;
  display: block;
}

.brand-text {
  font-size: clamp(17px, 2.3vw, 25px);
  font-weight: 800;
  letter-spacing: 0.06em;
  background: linear-gradient(95deg, var(--cyan) 0%, var(--blue) 55%, var(--gold) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.brand-tag {
  margin: 0;
  /* العبارة نقاطها فاصلة — تبقى سطراً واحداً داخل الحبّة */
  white-space: nowrap;
  font-size: clamp(12px, 1.6vw, 15px);
  font-weight: 500;
  color: var(--text-soft);
  padding: 4px 14px;
  border-radius: 999px;
  border: 1.5px solid rgba(111, 227, 255, 0.28);
  background: rgba(111, 227, 255, 0.07);
}

/* ═══════════ المسرح: عمودان على الشاشة الواسعة ═══════════ */

.stage {
  flex: 1 1 auto;
  display: grid;
  /* الكلام يميناً والصورة يساراً — الاتجاه RTL يضع الأول يميناً */
  grid-template-columns: minmax(0, 1.08fr) minmax(0, 0.92fr);
  align-items: center;
  gap: var(--gap);
  width: 100%;
  max-width: 1320px;
  margin-inline: auto;
  padding: 0 clamp(16px, 3.5vw, 44px) clamp(8px, 1.4vh, 16px);
  min-height: 0;
}

/* ═══════════ الكلام ═══════════ */

.copy {
  display: flex;
  flex-direction: column;
  gap: clamp(9px, 1.5vh, 16px);
  min-width: 0;
}

.eyebrow {
  margin: 0;
  font-size: clamp(12px, 1.6vw, 15px);
  font-weight: 700;
  color: var(--cyan);
  letter-spacing: 0.01em;
}

.headline {
  margin: 0;
  font-size: clamp(28px, 4.6vw, 54px);
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.01em;
}

.lede {
  margin: 0;
  font-size: clamp(14px, 1.9vw, 19px);
  font-weight: 500;
  color: var(--text-soft);
  line-height: 1.6;
}

/* ═══════════ البطاقات ═══════════ */

.card {
  border-radius: var(--radius);
  padding: clamp(13px, 1.9vw, 20px);
  border: 1.5px solid rgba(111, 227, 255, 0.20);
  background: linear-gradient(150deg,
    rgba(27, 46, 92, 0.72) 0%,
    rgba(18, 33, 69, 0.62) 100%);
  backdrop-filter: blur(2px);
}

.card-live { border-color: rgba(111, 227, 255, 0.40); }

.card-soon {
  border-style: dashed;
  border-color: rgba(169, 189, 223, 0.28);
  background: rgba(18, 33, 69, 0.42);
}

.card-title {
  margin: 0 0 5px;
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}

.card-soon .card-title { color: var(--text-soft); }

.soon-badge {
  font-size: clamp(10px, 1.3vw, 12px);
  font-weight: 700;
  color: var(--navy-900);
  background: var(--gold);
  border-radius: 999px;
  padding: 2px 10px;
}

.card-text {
  margin: 0;
  font-size: clamp(13px, 1.7vw, 16px);
  color: var(--text-soft);
  line-height: 1.6;
}

.card-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: clamp(10px, 1.5vh, 15px);
}

/* ═══════════ الأزرار ═══════════ */

.btn {
  /* 44 بكسل: الحد المريح للمس */
  min-height: 46px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 clamp(18px, 2.4vw, 28px);
  font-family: inherit;
  font-size: clamp(14px, 1.8vw, 17px);
  font-weight: 700;
  border-radius: 14px;
  border: 2px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.09s ease, filter 0.16s ease, background-color 0.16s ease;
}

.btn:active { transform: scale(0.97); }

.btn:focus-visible {
  outline: 3px solid var(--cyan);
  outline-offset: 3px;
}

.btn-primary {
  color: var(--navy-900);
  background: linear-gradient(95deg, var(--cyan) 0%, var(--blue) 100%);
  box-shadow: 0 6px 18px rgba(46, 155, 255, 0.28);
}

.btn-primary:hover { filter: brightness(1.08); }

.btn-ghost {
  color: var(--cyan);
  background: transparent;
  border-color: rgba(111, 227, 255, 0.55);
}

.btn-ghost:hover { background: rgba(111, 227, 255, 0.10); }

/* ═══════════ خانة رمز الغرفة ═══════════ */

.code-box {
  margin-top: clamp(10px, 1.5vh, 14px);
  padding-top: clamp(10px, 1.5vh, 14px);
  border-top: 1.5px solid rgba(111, 227, 255, 0.18);
}

.code-box[hidden] { display: none; }

.code-label {
  display: block;
  margin-bottom: 7px;
  font-size: clamp(12px, 1.6vw, 14px);
  color: var(--text-soft);
}

.code-row {
  display: flex;
  gap: 9px;
  flex-wrap: wrap;
}

.code-input {
  flex: 1 1 170px;
  min-width: 0;
  min-height: 46px;
  padding: 0 14px;
  font-family: ui-monospace, Consolas, monospace;
  font-size: clamp(19px, 2.8vw, 26px);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-align: center;
  text-transform: uppercase;
  color: var(--text);
  background: rgba(7, 14, 34, 0.75);
  border: 2px solid rgba(111, 227, 255, 0.35);
  border-radius: 14px;
}

.code-input::placeholder {
  color: rgba(169, 189, 223, 0.38);
  letter-spacing: 0.2em;
}

.code-input:focus-visible {
  outline: none;
  border-color: var(--cyan);
}

.btn-go { flex: 0 0 auto; }

.code-error {
  margin: 8px 0 0;
  font-size: clamp(12px, 1.6vw, 14px);
  font-weight: 700;
  color: var(--gold);
}

.code-error[hidden] { display: none; }

/* ═══════════ صورة خالد ═══════════ */

.portrait {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  min-height: 0;
  height: 100%;
}

.portrait-glow {
  position: absolute;
  inset: 8% 6%;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 45%,
    rgba(111, 227, 255, 0.22) 0%,
    rgba(46, 155, 255, 0.10) 45%,
    transparent 70%);
  filter: blur(6px);
}

.portrait-img {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  max-height: min(70dvh, 620px);
  /* contain: لا قصّ ولا تمديد — خالد كامل بنسبته الأصلية */
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(0 16px 34px rgba(0, 0, 0, 0.45));
}

/* ═══════════ التذييل ═══════════ */

.footer {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: clamp(9px, 1.4vh, 15px) clamp(16px, 3.5vw, 44px);
  border-top: 1px solid rgba(111, 227, 255, 0.13);
  font-size: clamp(11px, 1.5vw, 14px);
  color: var(--text-soft);
}

.rights { margin: 0; }

.footer-links {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.footer-links a {
  color: var(--cyan);
  text-decoration: none;
  padding: 4px 2px;
}

.footer-links a:hover { text-decoration: underline; }

.footer-links a:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
  border-radius: 4px;
}

.dot { opacity: 0.45; }

/* ═══════════════════════════════════════════════════════════════
   الهاتف والتابلت العمودي:
   الشعار ثم النص واللعبة والأزرار، وصورة خالد أسفل المحتوى.
   ═══════════════════════════════════════════════════════════════ */

@media (max-width: 900px), (orientation: portrait) {
  body { overflow-y: auto; }

  .stage {
    grid-template-columns: 1fr;
    align-items: start;
    gap: clamp(12px, 2.4vh, 22px);
    padding-bottom: clamp(14px, 2.4vh, 24px);
  }

  /* الصورة بعد المحتوى مهما كان ترتيبها في الشيفرة */
  .copy { order: 1; }
  .portrait { order: 2; height: auto; }

  .portrait-img { max-height: min(42dvh, 400px); }

  .card-actions { flex-direction: column; }
  .card-actions .btn { width: 100%; }

  .btn-go { width: 100%; }
  .code-input { flex-basis: 100%; }

  .footer {
    flex-direction: column;
    justify-content: center;
    text-align: center;
  }
}

/* الهاتف الأفقي: مساحة رأسية ضيقة — نضغط الارتفاعات */
@media (orientation: landscape) and (max-height: 520px) {
  .topbar { padding-block: 6px; }
  .brand-logo { width: 38px; }
  .headline { font-size: clamp(20px, 3.4vw, 30px); }
  .card { padding: 10px 13px; }
  .card-soon { display: none; }
  .portrait-img { max-height: 58dvh; }
  .footer { padding-block: 6px; }
}

/* شاشات واسعة جداً: لا نُمدّد بلا حدّ */
@media (min-width: 1500px) {
  .stage { gap: clamp(30px, 3vw, 52px); }
}

/* من يطلب تقليل الحركة */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
