:root {
  /* ── جسر التوكنات: الأسماء القديمة مربوطة بنظام التصميم الجديد
       (colors_and_type.css). تُبقى الأسماء كما هي ليُعاد كسوة كل القواعد
       الموجودة باللوحة + الخطوط الجديدة بلا تغيير بنيوي. يتبدّل
       الفاتح/الداكن عبر data-theme على <html>. */
  --bg-color: var(--bg);
  --panel-bg: var(--surface);
  --glass-border: var(--border);
  --text-primary: var(--fg);
  --text-secondary: var(--fg-muted);
  --primary-color: var(--primary);
  --success-color: var(--up);
  --danger-color: var(--down);
  --warning-color: var(--gold);
  --font-main: var(--font-body);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  /* No font-size here on purpose: inherit --fs-body from colors_and_type.css.
     A hard-coded 1.2rem used to win over that token and made every inherited
     text 13% larger than the design system intends. */
  background-color: var(--bg-color);
  color: var(--text-primary);
  background-image: var(--bg-grad);
  background-attachment: fixed;
  min-height: 100vh;
  overflow-x: hidden;
}

.glass-panel {
  background: var(--panel-bg);
  border: 0.0625rem solid var(--glass-border);
  border-radius: 1rem;
  box-shadow: 0 0.25rem 1rem rgba(0, 0, 0, 0.3);
}

.screen {
  display: none;
  min-height: 100vh;
  padding: 1.25rem;
  animation: fadeIn 0.5s ease;
}

.screen.active {
  display: block;
}

#landing-screen.active {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-y: auto;
  padding: 0;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(0.625rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Typography & Base */
h1,
h2,
h3 {
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.mt-2 {
  margin-top: 1rem;
}

/* ============================================================================
   لعبة الأسهم — Marketing Website Design System (RTL & rem only)
   ============================================================================ */

/* snav / landing-nav */
.snav {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.875rem 2rem;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  -webkit-backdrop-filter: blur(0.875rem);
  backdrop-filter: blur(0.875rem);
  border-bottom: 0.0625rem solid var(--border);
}

/* على الشاشات الكبيرة تذوب الحاوية فيصير أبناؤها عناصر flex مباشرة في .snav،
   والترتيب البصري يُضبط بـ order: الشعار ← الروابط ← البريد والملف الشخصي ← المظهر ← الخروج. */
.snav-menu {
  display: contents;
}

.snav .brand {
  order: 1;
  display: flex;
  align-items: center;
  gap: 0.6875rem;
}

.snav .brand img {
  height: 2.625rem;
}

.snav .brand b {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.3125rem;
  color: var(--fg);
}

[data-theme="light"] .snav .brand b,
body.light-theme .snav .brand b {
  color: var(--black) !important;
}

.snav .brand b .a {
  color: var(--primary);
}

.snav-links {
  order: 2;
  margin-inline: auto;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.snav-links a {
  color: var(--fg-muted);
  font-weight: 500;
  font-size: var(--fs-sm);
  padding: 0.5rem 0.875rem;
  border-radius: var(--r-sm);
  transition: all var(--dur) var(--ease-out);
}

.snav-links a:hover {
  color: var(--fg);
  background: var(--surface-3);
}

/* On a wide nav the account controls dissolve into .snav too, so the theme button (.snav-tools)
   sits between the profile button and logout: email, profile ← theme ← logout. */
.snav-right {
  order: 4;
  display: contents;
}

.snav-tools {
  order: 4;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-user {
  display: none;
  align-items: center;
  gap: 0.75rem;
}

.signed-in .nav-user {
  display: contents;
}

.nav-user > * {
  order: 3;
}

.nav-user > .nav-logout-btn,
.nav-auth {
  order: 5;
}

.nav-profile-btn {
  margin-inline-start: 0.75rem;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.snav .iconbtn {
  display: grid;
  place-items: center;
  width: 2.625rem;
  height: 2.625rem;
  border-radius: 0.75rem;
  border: 0.0625rem solid var(--border);
  background: var(--surface-2);
  color: var(--fg);
  cursor: pointer;
  transition: all var(--dur) var(--ease-out);
}

.snav .iconbtn:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* زر القائمة (البرغر) — للجوال فقط.
   المحدِّد مُقيَّد بـ .snav ليتغلّب على القاعدة: .snav .iconbtn { display: grid } */
.snav .snav-burger {
  display: none;
  padding: 0;
}

.snav-burger-ic {
  width: 1.375rem;
  height: 1.375rem;
}

.snav-burger-ic--close,
.snav.is-open .snav-burger-ic--open {
  display: none;
}

.snav.is-open .snav-burger-ic--close {
  display: block;
}

/* =========================================================
   NAVBAR — الجوال: الروابط وحالة الحساب داخل قائمة منسدلة
========================================================= */
@media (max-width: 47.5rem) {
  .snav {
    flex-wrap: wrap;
    gap: 0.625rem;
    padding: 0.75rem 1rem;
  }

  .snav .brand {
    margin-inline-end: auto;
  }

  .snav .brand img {
    height: 2.2rem;
  }

  .snav .brand b {
    font-size: 1.15rem;
  }

  .snav-tools {
    order: 2;
  }

  .snav .snav-burger {
    display: grid;
  }

  .snav .iconbtn {
    width: 2.4rem;
    height: 2.4rem;
  }

  /* القائمة المنسدلة: صف كامل تحت الشعار، مخفية حتى يُفتح البرغر */
  .snav-menu {
    order: 3;
    display: none;
    flex-basis: 100%;
    width: 100%;
    flex-direction: column;
    gap: 0.75rem;
    margin-top: 0.5rem;
    padding-top: 0.75rem;
    border-top: 0.0625rem solid var(--border);
  }

  .snav.is-open .snav-menu {
    display: flex;
    animation: snavMenuIn var(--dur) var(--ease-out);
  }

  .snav-links {
    margin-inline: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0.125rem;
  }

  .snav-links a {
    padding: 0.6875rem 0.75rem;
    font-size: 1rem;
  }

  .snav-right {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.5rem;
  }

  .nav-auth {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
  }

  #open-auth-btn {
    width: 100%;
    padding: 0.75em 1em;
    font-size: 1rem;
  }

  /* حالة المستخدم: البريد في سطر، والأزرار في صف تحته */
  .signed-in .nav-user {
    display: flex;
  }

  .nav-user {
    flex-wrap: wrap;
    align-items: center;
    width: 100%;
    gap: 0.5rem;
  }

  #user-email-display {
    flex: 1 0 100%;
    font-size: 0.85rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-align: start;
    margin-bottom: 0;
  }

  .nav-user .btn {
    flex: 1;
    min-width: 0;
  }

  .nav-profile-btn {
    margin-inline-start: 0;
  }
}

@keyframes snavMenuIn {
  from {
    opacity: 0;
    transform: translateY(-0.375rem);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.wrap {
  max-width: 71.25rem;
  margin: 0 auto;
  width: 100%;
  padding-inline: 2rem;
}

.sec {
  padding: clamp(3rem, 8vw, 6.875rem) 0;
}

/* ==========================================================================
   Pure Typographic Winged Title (بدون كبسولة وبدون أرقام)
   Large, prominent typography on the page, flanked by architectural winged lines
   with diamond accent terminals.
   ========================================================================== */

/* Backward compatibility alias for sec-tag */
.sec-tag {
  display: none;
}

/* Winged Header Container: holds right line, large text, left line */
.sec-wing-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
  width: 100%;
  margin: 0 auto 0.85rem;
  position: relative;
  z-index: 1;
}

/* Winged Beam Lines extending to right and left */
.sec-wing-line {
  flex: 1;
  height: 0.09375rem;
  max-width: 10rem;
  position: relative;
}

.sec-wing-line--right {
  background: linear-gradient(
    to left,
    var(--primary),
    transparent
  );
  opacity: 0.8;
}

.sec-wing-line--left {
  background: linear-gradient(
    to right,
    var(--primary),
    transparent
  );
  opacity: 0.8;
}

/* Diamond Accent Terminal at the tip of each line facing the title */
.sec-wing-line--right::after {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 0.375rem;
  height: 0.375rem;
  background: var(--primary);
  box-shadow: 0 0 0.5rem var(--primary);
}

.sec-wing-line--left::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%) rotate(45deg);
  width: 0.375rem;
  height: 0.375rem;
  background: var(--primary);
  box-shadow: 0 0 0.5rem var(--primary);
}

/* The Main Title Text directly on the page — Large, bold, brand green, pure text (no box/capsule/images) */
.sec-wing-title {
  display: inline-block;
  font-family: var(--font-display);
  font-weight: var(--fw-black);
  font-size: clamp(1.6rem, 1.25rem + 1.2vw, 2.35rem);
  line-height: 1.15;
  color: var(--primary);
  white-space: nowrap;
  letter-spacing: 0.02em;
  text-shadow: 0 0 1.5rem var(--primary-soft);
  user-select: none;
}

/* تسمية علوية (eyebrow) أعلى الهيرو: نص متباعد الأحرف بخط ذهبي رفيع أسفله */
.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 0.92rem + 0.6vw, 1.35rem);
  letter-spacing: 0.08em;
  color: var(--primary);
  margin-bottom: 1.375rem;
  padding-bottom: 0.5rem;
  background-image: linear-gradient(
    to left,
    var(--gold),
    color-mix(in srgb, var(--gold) 15%, transparent)
  );
  background-repeat: no-repeat;
  background-position: bottom;
  background-size: 100% 0.125rem;
}

/* الأيقونة بلون ذهبي لتتماشى مع الخط السفلي */
.hero-eyebrow svg {
  color: var(--gold);
}

.sec-h {
  text-align: center;
  max-width: 40rem;
  margin: 0 auto 3rem;
}

.sec-h h2 {
  margin: 0 0 0.75rem;
}

.sec-h p {
  color: var(--fg-muted);
  font-size: var(--fs-lg);
  margin: 0;
}

/* shero */
.shero {
  position: relative;
  overflow: hidden;
}

.shero-grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 3.125rem;
  align-items: center;
  padding-block: clamp(2.5rem, 6vw, 5.625rem) clamp(1.875rem, 4vw, 3.75rem);
}

.shero h1 {
  font-size: var(--fs-display);
  margin: 0.875rem 0 1rem;
  line-height: var(--lh-tight);
}

.shero h1 .g {
  color: var(--primary);
}

.shero .lede {
  font-size: var(--fs-lg);
  color: var(--fg-muted);
  margin: 0 0 1.875rem;
  max-width: 36ch;
  line-height: var(--lh-normal);
}

.shero-cta {
  display: flex;
  gap: 0.875rem;
  align-items: center;
  flex-wrap: wrap;
}

.shero-art {
  position: relative;
  display: grid;
  place-items: center;
}

.shero-art img {
  width: min(100%, 25rem);
  filter: drop-shadow(0 2.125rem 4rem rgba(0, 0, 0, 0.5));
  animation: floaty 6s var(--ease-in-out) infinite;
}

.shero-glow {
  position: absolute;
  inset: 8%;
  background: radial-gradient(ellipse, var(--primary-soft), transparent 62%);
  filter: blur(2.25rem);
  z-index: -1;
}

@keyframes floaty {
  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-1rem);
  }
}

@media (prefers-reduced-motion: reduce) {
  .shero-art img {
    animation: none;
  }
}

.trust {
  display: flex;
  gap: 2rem;
  flex-wrap: wrap;
  justify-content: center;
  padding: 0.375rem 0 0;
}

.trust .t {
  text-align: center;
}

.trust .t .n {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 2.375rem;
  line-height: 1;
  color: var(--primary);
}

.trust .t .l {
  color: var(--fg-muted);
  font-size: var(--fs-sm);
}

/* features */
.fgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.75rem;
}

.fcard {
  padding: 4rem 2.75rem;
}

.fcard .ic {
  width: 5.75rem;
  height: 5.75rem;
  border-radius: 1.5rem;
  display: grid;
  place-items: center;
  margin-bottom: 1.75rem;
}

.fcard .ic svg {
  width: 2.875rem;
  height: 2.875rem;
}

.fcard h3 {
  margin: 0 0 1rem;
  font-size: 1.875rem;
}

.fcard p {
  color: var(--fg-muted);
  font-size: var(--fs-lg);
  margin: 0;
  line-height: var(--lh-snug);
}

/* how it works */
.steps3 {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.5rem;
}

.s3 {
  text-align: center;
  padding: 3.75rem 1.75rem;
  position: relative;
}

.s3 .n {
  width: 5.75rem;
  height: 5.75rem;
  border-radius: 1.5rem;
  display: grid;
  place-items: center;
  margin: 0 auto 1.625rem;
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 3.25rem;
  line-height: 1;
  background: var(--gold-soft);
  color: var(--gold);
}

.s3 h4 {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.625rem;
}

.s3 p {
  margin: 0;
  color: var(--fg-muted);
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
}

/* pricing */
.pricing {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  max-width: 65rem;
  margin: 0 auto;
  align-items: stretch;
}

/* ثلاث بطاقات فأكثر (تجربة مجانية + عدة خطط من جدول plans): الشبكة الثابتة
   بعمودين تُنتج صفاً ثانياً بعمود يتيم، والحشوة والسعر المقاسان لنصف الصف
   يفيضان من ثلثه. القالب يضيف هذا الصنف حسب عدد البطاقات وحده. */
.pricing--compact {
  grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr));
  gap: 1.5rem;
  max-width: 82rem;
}

.pricing--compact .plan {
  padding: 3rem 2.25rem;
}

.pricing--compact .plan h3 {
  font-size: 1.75rem;
}

.pricing--compact .plan .price .amt {
  font-size: 4.5rem;
}

.pricing--compact .plan .desc,
.pricing--compact .plan .per {
  font-size: var(--fs-body);
}

.pricing--compact .plan .per {
  margin-bottom: 1.5rem;
}

.plan {
  padding: 4.5rem 3.5rem;
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.plan.featured {
  border-color: color-mix(in srgb, var(--primary) 45%, transparent);
  box-shadow: var(--shadow-glow);
}

.plan h3 {
  margin: 0 0 0.625rem;
  font-size: 2.25rem;
}

.plan .desc {
  color: var(--fg-muted);
  font-size: var(--fs-lg);
  margin: 0 0 1.875rem;
}

.plan .price {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.plan .price .amt {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 7.5rem;
  line-height: 1;
}

.plan .price .cur {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--fg-muted);
  font-size: 1.625rem;
}

.plan .per {
  color: var(--fg-subtle);
  font-size: var(--fs-lg);
  margin-bottom: 2.25rem;
}

.plan ul {
  list-style: none;
  padding: 0;
  margin: 0 0 2rem;
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
  flex: 1;
}

.plan li {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  font-size: 1.1875rem;
}

.plan li svg {
  width: 1.625rem;
  height: 1.625rem;
  color: var(--primary);
  flex-shrink: 0;
}

.plan li.con {
  color: var(--fg-muted);
}

.plan li.con svg {
  color: var(--down);
}

.plan-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  width: 100%;
}

.pm-row {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.375rem;
  justify-content: center;
}

.pm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.6875rem;
  font-weight: 700;
  padding: 0.3125rem 0.5625rem;
  border-radius: 0.4375rem;
  color: var(--white);
}

.pm.mada {
  background: var(--brand-mada);
}

.pm.visa {
  background: var(--brand-visa);
  color: var(--brand-visa-fg);
}

.pm.mc {
  background: var(--brand-mastercard);
}

.pm.apple {
  background: var(--brand-apple);
}

.pm.stc {
  background: var(--brand-stc);
}

/* faq */
.faq {
  max-width: 60rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.qitem {
  border: 0.0625rem solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  overflow: hidden;
}

.qhead {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.375rem;
  padding: 2.125rem 2.5rem;
  background: none;
  border: none;
  color: var(--fg);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.375rem;
  text-align: start;
  cursor: pointer;
}

.qhead svg {
  transition: transform var(--dur) var(--ease-out);
  flex-shrink: 0;
  color: var(--fg-muted);
  width: 1.625rem;
  height: 1.625rem;
}

.qitem.open .qhead svg {
  transform: rotate(180deg);
}

.qbody {
  max-height: 0;
  overflow: hidden;
  transition: max-height var(--dur-slow) var(--ease-out);
}

.qitem.open .qbody {
  max-height: 20rem;
}

.qbody p {
  margin: 0;
  padding: 0 2.5rem 2.125rem;
  color: var(--fg-muted);
  font-size: var(--fs-lg);
  line-height: var(--lh-snug);
}

/* cta band */
.cta-band {
  text-align: center;
  padding: clamp(2.5rem, 6vw, 5rem) 2rem;
  border-radius: var(--r-2xl);
  background: linear-gradient(140deg, var(--ink-850), var(--ink-800));
  border: 0.0625rem solid var(--border);
  position: relative;
  overflow: hidden;
}

[data-theme="light"] .cta-band {
  background: linear-gradient(140deg, var(--emerald-50), var(--white));
}

.cta-band::before {
  content: "";
  position: absolute;
  inset: -40% 60% -40% -10%;
  background: radial-gradient(ellipse, var(--primary-soft), transparent 65%);
  filter: blur(1.875rem);
}

.cta-band > * {
  position: relative;
}

/* responsive layout adjustments */
@media (max-width: 60rem) {
  .steps3 {
    grid-template-columns: 1fr 1fr;
  }

  .plan .price .amt {
    font-size: 6rem;
  }

  .plan {
    padding: 3.5rem 2.25rem;
  }

  .fcard {
    padding: 3rem 2rem;
  }
}

@media (max-width: 53.75rem) {
  .shero-grid,
  .pricing {
    grid-template-columns: 1fr;
  }

  .shero-art {
    order: -1;
  }

  .fgrid,
  .steps3 {
    grid-template-columns: 1fr 1fr;
  }
}

/* الجوال: تُضبط أعمدة .fgrid / .steps3 (عمودان كحدّ أقصى) في كتلة
   «MOBILE — صفحة الهبوط» أسفل الملف مع الحشوات وأحجام الخطوط المصغّرة. */

/* =========================================================
   BUTTONS
========================================================= */
/* Removed .btn, .btn:active, .btn-outline to allow components.css to take precedence */

.primary-btn {
  background: var(--primary-color);
  color: var(--fg-on-accent);
  box-shadow:
    0 0.375rem 1rem -0.375rem rgba(0, 185, 107, 0.45),
    inset 0 0.0625rem 0 rgba(255, 255, 255, 0.3);
}

.primary-btn:hover {
  background: var(--primary-hover);
  box-shadow:
    0 0.75rem 1.75rem -0.5rem rgba(0, 185, 107, 0.5),
    inset 0 0.0625rem 0 rgba(255, 255, 255, 0.35);
}

.success-btn {
  background: var(--success-color);
  color: white;
}

.success-btn:hover {
  background: var(--emerald-700);
  box-shadow: 0 0 0.9375rem rgba(46, 160, 67, 0.5);
}

.danger-btn {
  background: var(--danger-color);
  color: white;
}

.danger-btn:hover {
  background: var(--rose-700);
  box-shadow: 0 0 0.9375rem rgba(248, 81, 73, 0.5);
}

.secondary-btn {
  background: transparent;
  border: 0.0625rem solid var(--text-secondary);
  color: var(--text-primary);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-large {
  padding: 0.9375em 1.875em;
  font-size: 1.2rem;
  width: 100%;
}

/* Forms */
.form-group {
  margin-bottom: 1.25rem;
}

.form-group label {
  display: block;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.75rem;
  border-radius: 0.5rem;
  border: 0.0625rem solid var(--glass-border);
  background: rgba(0, 0, 0, 0.2);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 1.1rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input[type="number"] {
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
  letter-spacing: 0.125rem;
}

.form-group input:focus,
.form-group select:focus {
  border-color: var(--primary-color);
}

.form-group select option {
  background-color: var(--bg-color);
  color: var(--text-primary);
}

.en-num {
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif !important;
  direction: ltr !important;
  unicode-bidi: embed;
  display: inline-block;
}

input.en-num {
  text-align: right;
}

/* Setup Screen */
.setup-panel {
  max-width: 37.5rem;
  margin: 2.5rem auto;
  padding: 2.5rem;
}

/* Main Game Layout */
.game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.625rem 1.25rem;
  margin-bottom: 0.9375rem;
}

/* =========================================================
   STOCK TICKER - Animated Scrolling Bar
========================================================= */
.stock-ticker-bar {
  position: relative;
  overflow: hidden;
  background: linear-gradient(
    135deg,
    rgba(13, 17, 23, 0.95),
    rgba(22, 27, 34, 0.9)
  );
  border: 0.0625rem solid rgba(47, 129, 247, 0.2);
  border-radius: 0.75rem;
  padding: 0;
  font-size: 1.4rem;
  /* Gradient mask for smooth fade on edges */
  -webkit-mask-image: linear-gradient(
    to left,
    transparent 0%,
    black 4%,
    black 96%,
    transparent 100%
  );
  mask-image: linear-gradient(
    to left,
    transparent 0%,
    black 4%,
    black 96%,
    transparent 100%
  );
}

.stock-ticker-bar::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 0.0625rem;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(47, 129, 247, 0.4),
    transparent
  );
}

.stock-ticker-bar::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 0.0625rem;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(47, 129, 247, 0.2),
    transparent
  );
}

.ticker-track {
  display: flex;
  align-items: center;
  white-space: nowrap;
  will-change: transform;
  /* animation is applied by JS after dynamic @keyframes are injected */
  padding: 0.75rem 0;
  gap: 0;
}

.ticker-track:hover {
  animation-play-state: paused;
}

/* @keyframes scrollTicker is injected dynamically by JS for pixel-perfect seamless scrolling */

.ticker-set {
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 1.2rem;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.3s ease;
  border-radius: 0.5rem;
  cursor: default;
}

.ticker-item:hover {
  background: rgba(47, 129, 247, 0.08);
}

.ticker-item-name {
  font-weight: 900;
  color: var(--text-primary);
  font-size: clamp(1.2rem, 1.4vw, 2.2rem);
  letter-spacing: 0.02em;
}

.ticker-item-price {
  font-weight: bold;
  color: var(--azure-300);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: clamp(1.2rem, 1.4vw, 2.2rem);
  direction: ltr;
  unicode-bidi: embed;
  display: inline-block;
}

.ticker-item-change {
  font-weight: bold;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
  font-size: clamp(1rem, 1.2vw, 1.8rem);
  padding: 0.15rem 0.5rem;
  border-radius: 0.3rem;
  direction: ltr;
  unicode-bidi: embed;
  display: inline-block;
}

.ticker-item-change.up {
  color: var(--emerald-500);
  background: rgba(63, 185, 80, 0.1);
}

.ticker-item-change.down {
  color: var(--rose-500);
  background: rgba(248, 81, 73, 0.1);
}

.ticker-item-change.neutral {
  color: var(--text-secondary);
  background: rgba(139, 148, 158, 0.1);
}

.ticker-separator {
  color: rgba(255, 255, 255, 0.12);
  font-size: 1.5rem;
  padding: 0 0.3rem;
  flex-shrink: 0;
  user-select: none;
}

/* Legacy class kept for container reference */
.event-ticker {
  flex-grow: 1;
  margin: 0;
  padding: 0;
  background: transparent;
  border: none;
  border-radius: 0.75rem;
}

/* Ticker Brand Pill */
.ticker-brand {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 0.375rem;
  font-size: 0.85rem;
  font-weight: 900;
  letter-spacing: 0.05em;
  background: var(--primary-color);
  color: var(--slate-800);
  margin-left: 0.75rem;
  white-space: nowrap;
  vertical-align: middle;
}

.game-layout {
  display: grid;
  grid-template-columns: 21.875rem 1fr;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

/* Teams Sidebar */
.teams-sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.9375rem;
}

.team-card {
  padding: 0.75rem 0.9375rem;
  border-left: 0.3125rem solid var(--glass-border);
  transition: all 0.4s ease;
  opacity: 0.4;
  filter: brightness(0.6);
}

.team-card.active-turn {
  transform: scale(1.05);
  box-shadow: 0 0 1.875rem rgba(47, 129, 247, 0.6);
  border-color: var(--primary-color);
  opacity: 1;
  filter: brightness(1.2);
  background: rgba(22, 27, 34, 0.9);
}

.team-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.9375rem;
}

.team-icon {
  font-size: 1.5rem;
}

.team-stats {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  border-bottom: 0.0625rem solid var(--glass-border);
  padding-bottom: 0.3125rem;
}

.stat-value {
  font-weight: bold;
  font-family: monospace;
  font-size: 1.2rem;
}

.stat-value.up {
  color: var(--success-color);
}

.stat-value.down {
  color: var(--danger-color);
}

/* Market View */
.market-view {
  padding: 1.25rem;
  display: block;
  /* always visible */
  animation: fadeIn 0.4s ease;
}

.market-view.active {
  display: block;
}

.market-table-header {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr 1.2fr 2fr;
  padding: 0.625rem;
  border-bottom: 0.125rem solid var(--glass-border);
  color: var(--text-secondary);
  font-weight: bold;
  margin-bottom: 0.625rem;
}

.stocks-list {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.stock-item {
  display: grid;
  grid-template-columns: 1.5fr 1.2fr 1.2fr 2fr;
  align-items: center;
  padding: 0.5rem 0.625rem;
  border-radius: 0.5rem;
  transition: all 0.2s;
}

/* Structural Contrast & Color: Fill vs Outline */
.stock-item:nth-child(odd) {
  background: rgba(47, 129, 247, 0.06);
  /* Subtle Blue Tint */
  border: 0.0625rem solid rgba(47, 129, 247, 0.15);
  box-shadow: 0 0.25rem 0.375rem rgba(0, 0, 0, 0.2);
}

.stock-item:nth-child(even) {
  background: rgba(137, 87, 229, 0.03);
  /* Subtle Purple Tint */
  border: 0.0625rem dashed rgba(137, 87, 229, 0.2);
  box-shadow: none;
}

.stock-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border: 0.0625rem solid rgba(255, 255, 255, 0.3);
  transform: translateX(-0.3125rem);
  /* Add a slight slide effect on hover */
}

.stock-name-cell {
  display: flex;
  flex-direction: column;
}

.stock-symbol {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.stock-price {
  font-weight: bold;
  font-family: monospace;
  font-size: 1.4rem;
}

.stock-change {
  font-weight: bold;
  display: flex;
  align-items: center;
  gap: 0.3125rem;
}

.stock-change.up {
  color: var(--success-color);
}

.stock-change.down {
  color: var(--danger-color);
}

.game-actions {
  text-align: center;
  margin-top: 1.25rem;
}

/* ===== Auth Modal (Login / Sign-up) ===== */
.auth-modal-content {
  position: relative; /* مرجع لزر الإغلاق المطلق، وإلا التصق بزاوية الشاشة */
  max-width: 26rem;
  width: 90%;
  text-align: right;
  padding: 2rem 2rem 1.5rem;
}

.auth-tabs {
  display: flex;
  gap: 0.5rem;
  margin: 0.5rem 0 1.5rem;
  border-bottom: 0.0625rem solid var(--glass-border);
}

.auth-tab {
  flex: 1;
  background: transparent;
  border: none;
  border-bottom: 0.1875rem solid transparent;
  color: var(--text-secondary);
  font-family: var(--font-main);
  font-size: 1rem;
  font-weight: bold;
  padding: 0.75rem 0.5rem;
  cursor: pointer;
  transition:
    color 0.2s,
    border-color 0.2s;
}

.auth-tab:hover {
  color: var(--text-primary);
}

.auth-tab.active {
  color: var(--primary-color);
  border-bottom-color: var(--primary-color);
}

.auth-title {
  font-size: 1.35rem;
  margin: 0 0 1.5rem;
  color: var(--text-primary);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  margin-bottom: 1.1rem;
}

.auth-field label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: bold;
}

.auth-field input {
  padding: 0.7rem 0.9rem;
  border-radius: 0.5rem;
  border: 0.0625rem solid var(--glass-border);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 1rem;
  outline: none;
  transition:
    border-color 0.25s,
    box-shadow 0.25s;
}

.auth-field input::placeholder {
  color: var(--text-secondary);
  opacity: 0.6;
}

.auth-field input:focus {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 0.1875rem rgba(47, 129, 247, 0.15);
}

/* --- زر إظهار/إخفاء كلمة المرور --- */
.password-wrap {
  position: relative;
  display: flex;
  align-items: stretch;
}

/* مساحة في نهاية الحقل (يسار RTL) لزر الكشف حتى لا يتداخل النص معه */
.password-wrap input {
  width: 100%;
  padding-inline-end: 2.8rem;
}

.password-toggle {
  position: absolute;
  inset-inline-end: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.1rem;
  height: 2.1rem;
  padding: 0;
  border: 0;
  border-radius: 0.4rem;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    color 0.2s,
    background 0.2s;
}

.password-toggle:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.password-toggle:focus-visible {
  outline: 0.125rem solid var(--primary-color);
  outline-offset: 0.125rem;
}

.password-toggle svg {
  width: 1.25rem;
  height: 1.25rem;
  display: block;
}

/* افتراضياً كلمة المرور مخفية: نعرض أيقونة العين (اضغط للإظهار) */
.password-toggle .icon-eye-hide {
  display: none;
}

/* عند الكشف: نعرض أيقونة العين المشطوبة (اضغط للإخفاء) */
.password-wrap.is-visible .password-toggle .icon-eye-show {
  display: none;
}

.password-wrap.is-visible .password-toggle .icon-eye-hide {
  display: block;
}

.auth-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
  opacity: 0.85;
  margin: 0.1rem 0 0;
}

.auth-forgot {
  display: inline-block;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--primary-color);
  text-decoration: none;
  align-self: flex-start;
}

.auth-forgot:hover {
  text-decoration: underline;
}

.auth-error {
  color: var(--danger-color);
  font-weight: bold;
  font-size: 0.9rem;
  background: rgba(248, 81, 73, 0.1);
  padding: 0.6rem 0.9rem;
  border-radius: 0.5rem;
  margin-bottom: 1rem;
}

.auth-submit-btn {
  width: 100%;
  font-size: 1.05rem;
  padding: 0.8rem;
  margin-top: 0.25rem;
}

.auth-switch {
  text-align: center;
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 1.25rem 0 0;
}

.auth-switch a {
  color: var(--primary-color);
  font-weight: bold;
  text-decoration: none;
  margin-right: 0.3rem;
}

.auth-switch a:hover {
  text-decoration: underline;
}

/* Modals */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.active {
  display: flex;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }

  to {
    opacity: 1;
    transform: scale(1);
  }
}

.modal-content {
  width: 90%;
  max-width: 37.5rem;
  padding: 1.875rem;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.25rem;
  border-bottom: 0.0625rem solid var(--glass-border);
  padding-bottom: 0.9375rem;
}

.timer {
  width: 3.75rem;
  height: 3.75rem;
  border-radius: 50%;
  border: 0.1875rem solid var(--primary-color);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--primary-color);
}

.timer.danger {
  color: var(--danger-color);
  border-color: var(--danger-color);
}

.badge {
  background: var(--primary-color);
  color: white;
  font-size: 0.8rem;
  padding: 0.1875rem 0.5rem;
  border-radius: 0.75rem;
  vertical-align: middle;
}

.question-text {
  font-size: 1.8rem;
  font-weight: bold;
  line-height: 1.6;
  margin-bottom: 1.5625rem;
  text-align: center;
  color: var(--text-primary);
}

.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9375rem;
}

.option-btn {
  padding: 0.9375em;
  background: rgba(255, 255, 255, 0.05);
  border: 0.0625rem solid var(--glass-border);
  border-radius: 0.5rem;
  color: var(--text-primary);
  font-family: var(--font-main);
  font-size: 1.3rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s;
}

.option-btn:hover:not(:disabled) {
  background: rgba(47, 129, 247, 0.2);
  border-color: var(--primary-color);
}

.option-btn.correct {
  background: var(--success-color);
  border-color: var(--success-color);
  color: white;
}

.option-btn.wrong {
  background: var(--danger-color);
  border-color: var(--danger-color);
  color: white;
}

/* Event Modal */
.event-content {
  text-align: center;
}

.event-icon {
  font-size: 4rem;
  margin: 1.25rem 0;
}

.event-text {
  font-size: 1.2rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
}

.event-impact {
  background: rgba(0, 0, 0, 0.3);
  padding: 0.9375rem;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
}

/* =========================================================
   QUESTION MODAL — الهندسة (كانت inline في index.html)
========================================================= */
.question-modal-content {
  position: relative;
  max-width: 56.25rem;
  width: 95%;
  padding: 2.5rem;
  /* One type scale for the whole question modal, so the header, the category
     chip and the question itself keep their hierarchy at every width. It is
     tuned to stay at the full exhibition size on a 4K display (a 4.5rem
     question) while a 1920-wide laptop gets 2.5rem instead of the previous
     4.2rem. The phrases below are multiples of it; the phone breakpoint
     further down overrides all four with fixed rem values. */
  --qm-scale: clamp(1.6rem, 1.65vw + 0.5rem, 4.5rem);
}

.question-modal-content .modal-header {
  margin-bottom: 1.875rem;
}

.qm-title {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  font-size: calc(var(--qm-scale) * 0.9);
}

.qm-category {
  font-size: calc(var(--qm-scale) * 0.62);
  padding: 0.3125rem 0.9375rem;
  margin: 0 0.9375rem;
}

.qm-sep {
  color: var(--text-secondary);
  margin: 0 0.9375rem;
}

.qm-turn {
  font-size: calc(var(--qm-scale) * 0.62);
  color: var(--primary-color);
  font-weight: 900;
  background: rgba(128, 128, 128, 0.15);
  padding: 0.3125rem 1.25rem;
  border-radius: 0.5rem;
}

.qm-timer {
  position: absolute;
  left: 1.875rem;
  width: 5rem;
  height: 5rem;
  font-size: calc(var(--qm-scale) * 0.72);
}

.question-modal-content .question-text {
  font-size: var(--qm-scale);
  line-height: 1.8;
  margin-bottom: 2.5rem;
}

.question-modal-content .options-grid {
  gap: 1.25rem;
}

/* =========================================================
   CATEGORY MODAL — الهندسة (كانت inline في index.html)
========================================================= */
.category-modal-content {
  position: relative;
  text-align: center;
  max-width: 56.25rem;
  width: 95%;
}

.cm-close {
  position: absolute;
  top: 1.25rem;
  right: 1.25rem;
  background: none;
  border: none;
  font-size: 2.5rem;
  line-height: 1;
  font-weight: bold;
  color: var(--danger-color);
  cursor: pointer;
}

.cm-title {
  font-size: clamp(2rem, 3vw, 4rem);
  margin-bottom: 1.875rem;
  padding-top: 1rem;
}

.cm-turn {
  font-size: clamp(1.8rem, 2.5vw, 3rem);
  color: var(--primary-color);
  font-weight: 900;
  background: rgba(128, 128, 128, 0.15);
  padding: 0.3125rem 1.25rem;
  border-radius: 0.5rem;
}

.cm-label {
  display: block;
  font-size: clamp(1.4rem, 2vw, 2.5rem);
  font-weight: bold;
  margin-bottom: 1.25rem;
}

.cm-cats {
  text-align: right;
}

.cm-cats-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 1.25rem;
}

/* =========================================================
   DAILY REPORT MODAL — الهندسة (كانت inline في index.html)
========================================================= */
.report-modal-content {
  max-width: 75%;
  width: 75%;
  padding: 2.5rem;
  text-align: center;
}

.report-icon {
  display: flex;
  justify-content: center;
  font-size: 5rem;
  margin-bottom: 1.25rem;
}

.report-title {
  font-size: 2.8rem;
  margin-bottom: 1.25rem;
  color: var(--primary-color);
}

.report-message {
  font-size: 1.8rem;
  line-height: 1.8;
  margin-bottom: 1.875rem;
}

.report-ok-btn {
  font-size: 1.5rem;
  padding: 0.9375rem 2.5rem;
  background: var(--warning-color);
  color: white;
  border: none;
  border-radius: 0.5rem;
}

/* Option Buttons and Custom Alert */
.custom-alert-content {
  text-align: center;
  max-width: 50rem;
  width: 85%;
  padding: 3.125rem;
  /* One type scale for the alert dialog, same idea as --qm-scale. It stays at
     the full exhibition size on a 4K display (title 96) and lands at 50 on a
     1920-wide laptop, where it used to be 77 and dominated the whole screen.
     Icon, message and reward are multiples of it so the order never inverts.
     The phone breakpoint further down overrides them all with fixed values. */
  --ca-scale: clamp(1.9rem, 2.5vw + 0.125rem, 6rem);
}

.custom-alert-icon {
  font-size: calc(var(--ca-scale) * 1.35);
  margin-bottom: 0.9375rem;
}

.custom-alert-title {
  font-size: var(--ca-scale);
  margin-bottom: 1.5625rem;
}

/* مُقيَّدان بالحاوية كي يتغلّبا على المحدِّدَين المعرّفين لاحقاً: .event-text و .reward-text */
.custom-alert-content .custom-alert-message {
  font-size: calc(var(--ca-scale) * 0.62);
  line-height: 1.6;
}

.custom-alert-content .custom-alert-reward {
  font-size: calc(var(--ca-scale) * 0.72);
}

/* أزرار نافذة التنبيه/التأكيد: هندسة موحّدة للزرين والتمييز باللون وحده.
   المحدِّد على الحاوية لا على الصنف، لأن confirm() و showCustomAlert()
   تعيدان تعيين className فتمحوان أي صنف هندسي يُضاف على الزر نفسه. */
.custom-alert-content .btn {
  width: 100%;
  font-size: clamp(1.5rem, 2vw, 3rem);
  padding: 1.25rem 3.125rem;
  margin-top: 1.875rem;
}

/* الزر الثاني (الإلغاء) يلتصق بالأول بفاصل أصغر */
.custom-alert-content .btn + .btn {
  margin-top: 1rem;
}

.reward-text {
  font-size: 1.5rem;
  color: var(--success-color);
  font-weight: bold;
  margin: 1.25rem 0;
  padding: 0.625rem;
  background: rgba(46, 160, 67, 0.1);
  border-radius: 0.5rem;
  display: inline-block;
}

/* Trade Modal */
.trade-info {
  background: rgba(0, 0, 0, 0.2);
  padding: 0.9375rem;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
}

.trade-actions {
  display: flex;
  gap: 0.625rem;
}

.trade-actions button {
  flex: 1;
}

/* End Screen */
.end-panel {
  max-width: 50rem;
  margin: 2.5rem auto;
  padding: 2.5rem;
  text-align: center;
}

.winner-text {
  font-size: 2rem;
  color: var(--warning-color);
  margin: 1.875rem 0;
  font-weight: bold;
}

.leaderboard {
  margin-bottom: 2.5rem;
  text-align: right;
}

.leaderboard-item {
  display: flex;
  justify-content: space-between;
  padding: 0.9375rem;
  background: rgba(255, 255, 255, 0.05);
  margin-bottom: 0.625rem;
  border-radius: 0.5rem;
  align-items: center;
}

.leaderboard-item:first-child {
  background: rgba(210, 153, 34, 0.2);
  border: 0.0625rem solid var(--warning-color);
}

/* إبراز الصدارة لكل الفرق المتعادلة، لا للأول في الترتيب وحده */
.leaderboard-item.is-leader {
  background: rgba(210, 153, 34, 0.2);
  border: 0.0625rem solid var(--warning-color);
}

.rank-tied {
  color: var(--warning-color);
  font-weight: var(--fw-semibold);
  margin-inline-start: 0.35rem;
}

/* Responsive */
@media (max-width: 56.25rem) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .options-grid {
    grid-template-columns: 1fr;
  }
}

/* Responsive - Landing Page */
@media (max-width: 56.25rem) {
  .landing-nav {
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
  }

  .nav-auth {
    flex-direction: column;
    width: 100%;
  }

  .nav-auth .btn {
    width: 100%;
  }

  .hero-content {
    flex-direction: column-reverse;
    gap: 2rem;
    text-align: center;
  }

  .hero-text {
    text-align: center;
  }

  .hero-image-wrapper {
    max-width: 20rem;
  }

  .features-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .howto-step {
    padding: 1rem 1.25rem;
  }
}

@media (max-width: 30rem) {
  .features-grid {
    grid-template-columns: 1fr;
  }
}

/* Light Theme Overrides */
[data-theme="light"] body,
body.light-theme {
  --bg-color: var(--bg);
  --panel-bg: var(--surface);
  --text-primary: var(--fg);
  --text-secondary: var(--fg-muted);
  --glass-border: var(--border);
  --primary-color: var(--primary);
  --success-color: var(--up);
  --warning-color: var(--gold);
  --danger-color: var(--down);

  background-color: var(--bg) !important;
  background-image: var(--bg-grad) !important;
}

body.light-theme .glass-panel {
  background: var(--panel-bg);
  box-shadow: 0 0.5rem 2rem 0 rgba(0, 0, 0, 0.05);
}

body.light-theme .landing-nav {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 0.25rem 1.25rem rgba(0, 0, 0, 0.08);
}

body.light-theme .auth-field input {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.15);
  color: var(--text-primary);
}

body.light-theme .password-toggle:hover {
  background: rgba(0, 0, 0, 0.06);
}

body.light-theme .nav-title {
  background: linear-gradient(135deg, var(--primary-color), var(--azure-600));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.light-theme .hero-title-main {
  background: linear-gradient(135deg, var(--slate-850) 0%, var(--primary-color) 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

body.light-theme .feature-card:hover {
  box-shadow: 0 0.75rem 2.5rem rgba(11, 87, 208, 0.1);
}

body.light-theme .howto-step:hover {
  background: rgba(11, 87, 208, 0.04);
  border-color: rgba(11, 87, 208, 0.2);
}

body.light-theme .team-card.active-turn {
  background: rgba(255, 255, 255, 1);
  box-shadow: 0 0 1.25rem rgba(47, 129, 247, 0.4);
}

body.light-theme .modal-content {
  background: var(--white);
  color: var(--text-primary);
}

body.light-theme input,
body.light-theme select {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text-primary);
  border: 0.0625rem solid rgba(0, 0, 0, 0.2);
}

/* Structural contrast overrides for light theme */
body.light-theme .stock-item:nth-child(odd) {
  background: rgba(11, 87, 208, 0.05);
  /* Subtle Blue Tint */
  border: 0.0625rem solid rgba(11, 87, 208, 0.15);
  box-shadow: 0 0.125rem 0.3125rem rgba(0, 0, 0, 0.05);
}

body.light-theme .stock-item:nth-child(even) {
  background: rgba(102, 51, 153, 0.03);
  /* Subtle Purple Tint */
  border: 0.0625rem dashed rgba(102, 51, 153, 0.2);
  box-shadow: none;
}

body.light-theme .stock-item:hover {
  background: rgba(0, 0, 0, 0.08);
}

body.light-theme #trade-qty,
body.light-theme [id^="qty-"] {
  background: rgba(0, 0, 0, 0.05) !important;
  color: var(--text-primary) !important;
  border: 0.0625rem solid rgba(0, 0, 0, 0.3) !important;
}

/* Light Theme — Stock Ticker */
body.light-theme .stock-ticker-bar {
  background: linear-gradient(
    135deg,
    rgba(255, 255, 255, 0.98),
    rgba(245, 247, 250, 0.95)
  );
  border-color: rgba(0, 0, 0, 0.12);
  box-shadow: 0 0.125rem 0.5rem rgba(0, 0, 0, 0.06);
}

body.light-theme .stock-ticker-bar::before {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(11, 87, 208, 0.2),
    transparent
  );
}

body.light-theme .stock-ticker-bar::after {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(11, 87, 208, 0.1),
    transparent
  );
}

body.light-theme .ticker-item-name {
  color: var(--slate-850);
}

body.light-theme .ticker-item-price {
  color: var(--azure-900);
}

body.light-theme .ticker-separator {
  color: rgba(0, 0, 0, 0.12);
}

body.light-theme .ticker-item:hover {
  background: rgba(11, 87, 208, 0.06);
}

body.light-theme .ticker-item-change.up {
  color: var(--emerald-900);
  background: rgba(20, 108, 46, 0.08);
}

body.light-theme .ticker-item-change.down {
  color: var(--rose-800);
  background: rgba(179, 38, 30, 0.08);
}

/* Light Theme — Question Text */
body.light-theme .question-text {
  color: var(--slate-850) !important;
}

/* =========================================================
   تخطيط الشاشات العملاقة (الشبكة المدمجة) - Compact Layout
   هذا الوضع يعرض الأسهم في عمودين بدلاً من واحد ليظهر كل شيء
   في الشاشات الذكية دون الحاجة للنزول لأسفل.
   يمكن تفعيله من الزر 🗂️ في التطبيق أو يدوياً هنا
========================================================= */
body.compact-layout .stocks-list {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.625rem 1.25rem;
}

body.compact-layout .market-table-header {
  display: none;
}

body.compact-layout .stock-item {
  grid-template-columns: 1.4fr 1.2fr 0.8fr 1.6fr !important;
  padding: 0.4rem 0.6rem !important;
  align-items: center !important;
}

body.compact-layout .stock-change {
  justify-self: center !important;
  align-self: center !important;
  padding: 0.3rem 0.6rem !important;
  border-radius: 0.5rem !important;
  margin: 0 0.5rem !important;
  /* Prevents touching buttons */
  white-space: nowrap !important;
}

body.compact-layout .stock-change.up {
  background: rgba(46, 160, 67, 0.15) !important;
  border: 0.0625rem solid rgba(46, 160, 67, 0.3) !important;
}

body.compact-layout .stock-change.down {
  background: rgba(248, 81, 73, 0.15) !important;
  border: 0.0625rem solid rgba(248, 81, 73, 0.3) !important;
}

body.compact-layout .stock-change.neutral {
  background: rgba(139, 148, 158, 0.15) !important;
  border: 0.0625rem solid rgba(139, 148, 158, 0.3) !important;
}

body.compact-layout .stock-en-name {
  display: none !important;
}

body.compact-layout .traded-icon {
  display: none !important;
}

body.compact-layout .stock-actions {
  flex-wrap: wrap !important;
}

body.compact-layout .stock-actions input {
  order: -1 !important;
  width: 60% !important;
  margin-bottom: 0.2rem !important;
  padding: 0.3rem !important;
  font-size: 0.9rem !important;
}

body.compact-layout .btn-buy-all {
  order: 2 !important;
}

body.compact-layout .btn-buy {
  order: 1 !important;
}

body.compact-layout .btn-sell {
  order: 3 !important;
}

body.compact-layout .btn-sell-all {
  order: 4 !important;
}

body.compact-layout .stock-actions button {
  flex: 1 1 45% !important;
  /* Forces buttons to wrap neatly underneath */
  padding: 0.3rem 0.2rem !important;
  font-size: 0.8rem !important;
}

body.compact-layout .stock-price span,
body.compact-layout .stock-name-cell strong {
  font-size: clamp(1.2rem, 1.5vw, 1.8rem) !important;
}

/* Fix Zebra Striping for 2-column Grid */
body.compact-layout .stock-item {
  background: transparent;
  /* Reset base global nth-child(odd/even) */
  border: 0.0625rem solid transparent;
  box-shadow: none;
}

/* Rows 1, 3, 5... (items 1,2, 5,6, etc.) */
body.compact-layout .stock-item:nth-child(4n-3),
body.compact-layout .stock-item:nth-child(4n-2) {
  background: rgba(47, 129, 247, 0.06);
  /* Subtle Blue Tint */
  border: 0.0625rem solid rgba(47, 129, 247, 0.15);
  box-shadow: 0 0.25rem 0.375rem rgba(0, 0, 0, 0.2);
}

/* Rows 2, 4, 6... (items 3,4, 7,8, etc.) */
body.compact-layout .stock-item:nth-child(4n-1),
body.compact-layout .stock-item:nth-child(4n) {
  background: rgba(137, 87, 229, 0.03);
  /* Subtle Purple Tint */
  border: 0.0625rem dashed rgba(137, 87, 229, 0.2);
  box-shadow: none;
}

/* =========================================================
   SETUP SCREEN
========================================================= */
.setup-outer {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 2rem 1rem;
  min-height: 100vh;
}

/* Hero */
.setup-hero {
  text-align: center;
  margin-bottom: 2rem;
}

.setup-logo-badge {
  display: block;
  width: 7rem;
  height: 7rem;
  object-fit: contain;
  margin: 0 auto 1.25rem;
  filter: drop-shadow(0 0.4rem 1rem rgba(0, 0, 0, 0.45));
}

.setup-main-title {
  font-size: clamp(2rem, 4vw, 3rem);
  font-family: var(--font-display);
  font-weight: 800;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

[data-theme="light"] .setup-main-title,
body.light-theme .setup-main-title {
  color: var(--black);
}

.setup-main-title .a {
  color: var(--primary);
}

.setup-subtitle-text {
  color: var(--text-secondary);
  font-size: 1.1rem;
  margin-bottom: 1.25rem;
}

.setup-feature-tags {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
}

.feature-tag {
  padding: 0.4rem 1rem;
  border-radius: 2rem;
  font-size: 0.9rem;
  font-weight: 700;
  border: 0.0625rem solid var(--glass-border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text-primary);
}

/* Settings Card */
.setup-card {
  width: 100%;
  max-width: 40rem;
  padding: 2rem;
  border-radius: 1.5rem;
}

.setup-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.setup-card-title {
  font-size: 1.5rem;
  font-weight: 900;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.setup-title-bar {
  display: inline-block;
  width: 0.25rem;
  height: 1.5rem;
  background: var(--primary-color);
  border-radius: 0.125rem;
}

.setup-card-actions {
  display: flex;
  gap: 0.5rem;
}

.setup-action-btn {
  font-size: 0.85rem !important;
  padding: 0.35rem 0.75rem !important;
}

/* Setting Rows */
.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 0;
  border-bottom: 0.0625rem solid rgba(255, 255, 255, 0.05);
}

.setting-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-primary);
}

.setting-icon {
  font-size: 1.4rem;
  filter: drop-shadow(0 0 0.25rem rgba(245, 200, 66, 0.3));
}

/* Stepper */
.setting-stepper {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.step-btn {
  width: 3rem;
  height: 3rem;
  border-radius: 0.75rem;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 1.6rem;
  font-weight: 900;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-main);
}

.step-btn:hover {
  background: rgba(255, 255, 255, 0.15);
}

.step-btn:active {
  transform: scale(0.9);
}

/* بلوغ الحدّ الأعلى أو الأدنى — تُضبط سمة disabled في
   main.js: syncStepperBounds(). موضعها بعد :hover و:active مقصود:
   العنصر المعطَّل يظل يطابق :hover، فترتيب المصدر هو ما يُسكته. */
.step-btn:disabled,
.step-btn:disabled:hover {
  background: rgba(255, 255, 255, 0.03);
  color: var(--fg-subtle);
  cursor: not-allowed;
  transform: none;
}

.step-value {
  font-size: 1.5rem;
  font-weight: 900;
  color: var(--primary-color);
  min-width: 3.5rem;
  text-align: center;
}

/* Chips */
.setting-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  justify-content: flex-start;
}

.chip {
  padding: 0.45rem 0.9rem;
  border-radius: 1.25rem;
  border: none;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-secondary);
  font-family: var(--font-main);
}

.chip:hover {
  background: rgba(255, 255, 255, 0.12);
}

.chip.active {
  background: var(--primary-color);
  color: var(--slate-800);
  box-shadow: 0 0 0.75rem rgba(245, 200, 66, 0.3);
}

/* Summary Strip */
.setup-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  margin: 1.5rem 0;
  padding: 1rem;
  background: rgba(245, 200, 66, 0.04);
  border: 0.0625rem solid rgba(245, 200, 66, 0.1);
  border-radius: 1rem;
  text-align: center;
}

.summary-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.summary-value {
  font-size: 1.6rem;
  font-weight: 900;
  color: var(--primary-color);
}

.summary-label {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* Start Button */
.setup-start-btn {
  margin-top: 0.5rem;
  font-size: 1.3rem !important;
  padding: 1rem 2rem !important;
  border-radius: 0.75rem !important;
}

/* Team Name Inputs in new setup */
.setup-card .form-group {
  margin-bottom: 0.75rem;
}

.setup-card .form-group label {
  font-size: 0.95rem;
}

.setup-card .form-group input {
  border-radius: 0.75rem;
  padding: 0.6rem 0.85rem;
}

.setup-card input.default-value {
  opacity: 0.55 !important;
  font-weight: normal !important;
}

/* =========================================================
   PORTFOLIO VIEW — عرض المحفظة التفصيلي
========================================================= */
.portfolio-section {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 0.0625rem solid rgba(255, 255, 255, 0.08);
}

.portfolio-title {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  font-weight: bold;
}

.portfolio-holding {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.35rem 0;
  font-size: 1.1rem;
}

.holding-name {
  color: var(--text-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}

.holding-qty {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.holding-value {
  font-weight: 900;
  font-family: "Segoe UI", monospace;
  direction: ltr;
  unicode-bidi: embed;
}

.holding-value.up {
  color: var(--success-color);
}

.holding-value.down {
  color: var(--danger-color);
}

.portfolio-empty {
  font-size: 0.9rem;
  color: var(--text-secondary);
  opacity: 0.6;
  text-align: center;
  padding: 0.5rem 0;
}

/* =========================================================
   RESPONSIVE — Setup Screen
========================================================= */
@media (max-width: 30rem) {
  .setup-card {
    padding: 1.25rem;
  }

  .setting-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.75rem;
  }

  .setting-chips {
    width: 100%;
  }

  .setup-feature-tags {
    flex-direction: column;
    align-items: center;
  }
}

#next-turn-btn span:first-child {
  font-weight: 900 !important;
}

/* Saudi Riyal Icon */
.riyal-icon {
  display: inline-block;
  width: 1.1em;
  height: 1.1em;
  background-color: currentColor;
  -webkit-mask: url("../assets/Saudi_Riyal_Symbol-2.svg") no-repeat center;
  mask: url("../assets/Saudi_Riyal_Symbol-2.svg") no-repeat center;
  -webkit-mask-size: contain;
  mask-size: contain;
  vertical-align: -0.15em;
  margin-right: 0.2em;
  /* little space on the right for arabic RTL */
}

/* =========================================================
   In-game Hamburger Menu + Resume Banner (v1.3.0)
========================================================= */
.hidden {
  display: none !important;
}

/* Hamburger wrapper sits at the start of game-header */
.game-menu-wrap {
  position: relative;
  display: inline-block;
}

.game-menu-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 0.0625rem solid var(--glass-border);
  color: var(--text-primary);
  font-size: 1.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 900;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* أيقونات قائمة اللعبة (SVG بديلة للإيموجي) */
.game-menu-ic {
  width: 1em;
  height: 1em;
  flex: none;
}

/* أيقونة الانتظار — بديل SVG للساعة الرملية، تدور ذاتياً */
.spinner-ic {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  vertical-align: -0.15em;
  display: inline-block;
  animation: spinner-ic-rotate 0.9s linear infinite;
}

@keyframes spinner-ic-rotate {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner-ic {
    animation: none;
  }
}

/* أيقونة الساعة الرملية لمؤقّت التداول (ثابتة) */
.hourglass-ic {
  width: 1.1em;
  height: 1.1em;
  flex: none;
  vertical-align: -0.15em;
  display: inline-block;
}

.game-menu-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  border-color: var(--primary-color);
}

.game-menu-dropdown {
  position: absolute;
  top: calc(100% + 0.375rem);
  inset-inline-start: 0;
  min-width: 13rem;
  background: rgba(13, 17, 23, 0.98);
  border: 0.0625rem solid var(--glass-border);
  border-radius: 0.625rem;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.45);
  z-index: 1500;
  padding: 0.375rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.game-menu-item {
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 1.1rem;
  font-weight: 700;
  padding: 0.625rem 0.875rem;
  text-align: start;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.game-menu-item:hover {
  background: rgba(47, 129, 247, 0.18);
}

.game-menu-item.danger {
  color: var(--danger-color);
}

.game-menu-item.danger:hover {
  background: rgba(248, 81, 73, 0.15);
}

/* Resume Banner on landing */
.resume-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
  background: linear-gradient(
    135deg,
    rgba(47, 129, 247, 0.12),
    rgba(46, 160, 67, 0.08)
  );
  border: 0.125rem solid rgba(47, 129, 247, 0.35);
  border-radius: 0.875rem;
  box-shadow: 0 0.25rem 0.75rem rgba(47, 129, 247, 0.15);
  flex-wrap: wrap;
}

.resume-banner-main {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.resume-icon {
  font-size: 2.25rem;
  line-height: 1;
}

.resume-text {
  display: flex;
  flex-direction: column;
  gap: 0.125rem;
}

.resume-text strong {
  color: var(--primary-color);
  font-size: 1.15rem;
  font-weight: 900;
}

.resume-info {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

.resume-actions {
  display: flex;
  gap: 0.625rem;
  flex-wrap: wrap;
}

.resume-actions .btn {
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
}

/* Setup back button — use the existing setup-action-btn style, nothing extra needed */

/* ============================================================
   Font Size Widget — button lives inside the main-screen header
   alongside zoom/theme buttons. Panel is a popup anchored to the
   button. All sizes in rem (widget scales with chosen font level).
   ============================================================ */
#font-size-wrapper {
  position: relative;
  display: inline-block;
  direction: rtl;
}

/* Magnifier-shaped icon inside the toggle button */
#font-size-toggle .fs-svg {
  width: 1.4em;
  height: 1.4em;
  display: block;
}

/* The panel's internal dimensions use em (anchored to its own font-size),
   so JS can "freeze" the panel size on open by setting an inline font-size.
   During slider movement, html font-size changes — but the panel's em
   values stay locked. Only #font-size-preview uses rem so it reflects
   the user's live font-size choice. */
#font-size-panel {
  position: absolute;
  top: calc(100% + 0.375em);
  inset-inline-start: 0;
  min-width: 18rem;
  background: rgba(13, 17, 23, 0.98);
  border: 0.0625em solid var(--glass-border);
  border-radius: 0.625em;
  padding: 0.625em;
  box-shadow: 0 0.5em 1.5em rgba(0, 0, 0, 0.45);
  color: var(--text-primary);
  font-size: 1rem;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  gap: 0.5em;
}

#font-size-panel[hidden] {
  display: none;
}

.fsp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.25em 0.5em 0.5em;
  border-bottom: 0.0625em solid rgba(255, 255, 255, 0.08);
}

.fsp-title {
  font-size: 1.05em;
  font-weight: 700;
  color: var(--text-primary);
}

#font-size-close {
  width: 1.75em;
  height: 1.75em;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-primary);
  font-size: 1.125em;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  line-height: 1;
  transition: background 0.15s;
}

#font-size-close:hover {
  background: rgba(248, 81, 73, 0.25);
}

.fsp-slider-row {
  display: flex;
  align-items: center;
  gap: 0.625em;
  padding: 0.375em 0.5em;
}

.fsp-icon-mini {
  font-size: 0.8125em;
  font-weight: 700;
  opacity: 0.7;
  width: 1em;
  text-align: center;
}

.fsp-icon-maxi {
  font-size: 1.5em;
  font-weight: 900;
  opacity: 0.9;
  width: 1.25em;
  text-align: center;
}

#font-size-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 0.375em;
  border-radius: 0.1875em;
  background: linear-gradient(to right, var(--azure-200), var(--azure-500));
  outline: none;
  direction: rtl;
}

#font-size-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25em;
  height: 1.25em;
  border-radius: 50%;
  background: var(--white);
  border: 0.125em solid var(--azure-500);
  cursor: pointer;
  box-shadow: 0 0.125em 0.375em rgba(0, 0, 0, 0.4);
}

#font-size-slider::-moz-range-thumb {
  width: 1.25em;
  height: 1.25em;
  border-radius: 50%;
  background: var(--white);
  border: 0.125em solid var(--azure-500);
  cursor: pointer;
}

.fsp-level {
  text-align: center;
  font-size: 0.8125em;
  color: rgba(255, 255, 255, 0.75);
  padding: 0 0.5em;
}

.fsp-level .en-num {
  font-weight: 700;
  color: var(--amber-300);
}

#font-size-preview {
  background: rgba(255, 255, 255, 0.04);
  border: 0.0625em dashed rgba(255, 255, 255, 0.15);
  border-radius: 0.375em;
  padding: 0.75em;
  text-align: center;
}

#font-size-preview .preview-main {
  display: block;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

#font-size-preview .preview-small {
  display: block;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.7);
}

#font-size-reset {
  width: 100%;
  background: transparent;
  border: none;
  color: var(--text-primary);
  font-size: 0.9375em;
  font-weight: 700;
  padding: 0.625em 0.875em;
  text-align: center;
  border-radius: 0.375em;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
}

#font-size-reset:hover {
  background: rgba(47, 129, 247, 0.18);
}

.fsp-hint {
  text-align: center;
  font-size: 0.6875em;
  color: rgba(255, 255, 255, 0.45);
  font-family: monospace;
  direction: ltr;
  padding: 0 0.5em 0.25em;
}

/* ── OTP Verification Modal ─────────────────────────────────────────────── */
.otp-modal-content {
  max-width: 32rem;
  text-align: center;
  padding: 2rem 1.875rem;
}

.otp-title {
  color: var(--amber-600);
  font-size: 1.5rem;
  margin: 0 0 0.5rem;
}

.otp-hint {
  color: var(--text-secondary, var(--slate-200));
  font-size: 0.95rem;
  margin: 0.5rem 0 0.25rem;
}

.otp-target {
  color: var(--amber-600);
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 1.25rem;
  word-break: break-all;
}

.otp-input-group {
  display: flex;
  gap: 0.625rem;
  justify-content: center;
  margin: 1.25rem 0 1rem;
}

.otp-digit {
  width: 3.125rem;
  height: 3.75rem;
  text-align: center;
  font-size: 1.875rem;
  font-family: "Courier New", monospace;
  font-weight: 700;
  color: var(--amber-600);
  background: var(--slate-900);
  border: 0.125rem dashed var(--slate-600);
  border-radius: 0.625rem;
  transition:
    border-color 0.2s,
    box-shadow 0.2s;
  padding: 0;
  caret-color: var(--amber-600);
}

.otp-digit:focus {
  outline: none;
  border-color: var(--amber-600);
  border-style: solid;
  box-shadow: 0 0 0 0.1875rem rgba(245, 158, 11, 0.25);
}

.otp-digit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.otp-countdown {
  color: var(--text-secondary, var(--slate-300));
  font-size: 0.95rem;
  margin: 0.75rem 0 0.5rem;
}

.otp-countdown.expired {
  color: var(--rose-600);
}

.otp-actions {
  display: flex;
  gap: 0.75rem;
  margin-top: 1.25rem;
}

.otp-actions .btn {
  flex: 1;
}

.otp-actions .btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* =========================================================
   LANDING PAGE - GAME GALLERY (Screens + Video)
========================================================= */
.features-gallery-section {
  padding: 1rem 2rem 4rem;
  max-width: 81.25rem;
  margin: 0 auto;
  width: 100%;
}

.features-gallery {
  position: relative;
  padding: 1.25rem;
  border-radius: 1.25rem;
  outline: none;
}

.features-gallery:focus-visible {
  box-shadow: 0 0 0 0.2rem var(--ring);
}

.fg-viewport {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  border-radius: 0.875rem;
  overflow: hidden;
  background: rgba(0, 0, 0, 0.35);
}

.fg-slide {
  position: absolute;
  inset: 0;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.45s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fg-slide.is-active {
  opacity: 1;
  visibility: visible;
}

.fg-slide img,
.fg-slide video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: var(--black);
}

.fg-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 0.0625rem solid rgba(255, 255, 255, 0.25);
  background: rgba(0, 0, 0, 0.55);
  color: var(--white);
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 4;
  padding: 0;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    box-shadow 0.2s ease;
}

.fg-nav:hover {
  background: var(--primary);
  transform: translateY(-50%) scale(1.07);
  box-shadow: 0 0.5rem 1.25rem rgba(0, 185, 107, 0.45);
}

.fg-nav:focus-visible {
  outline: 0.15rem solid var(--white);
  outline-offset: 0.15rem;
}

.fg-nav--prev {
  right: 1.5rem;
}

.fg-nav--next {
  left: 1.5rem;
}

.fg-counter {
  position: absolute;
  top: 1.75rem;
  left: 1.75rem;
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
  padding: 0.3rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  z-index: 3;
  border: 0.0625rem solid rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.fg-dots {
  display: flex;
  justify-content: center;
  gap: 0.5rem;
  margin-top: 1rem;
  flex-wrap: wrap;
}

.fg-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.25);
  cursor: pointer;
  padding: 0;
  transition:
    transform 0.2s ease,
    background 0.2s ease;
}

.fg-dot:hover {
  background: rgba(255, 255, 255, 0.5);
}

.fg-dot.is-active {
  background: var(--primary-color);
  transform: scale(1.4);
}

@media (max-width: 48rem) {
  .features-gallery-section {
    padding: 0.5rem 1rem 2.5rem;
  }

  .features-gallery {
    padding: 0.75rem;
  }

  .fg-nav {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.5rem;
  }

  .fg-nav--prev {
    right: 0.5rem;
  }

  .fg-nav--next {
    left: 0.5rem;
  }

  .fg-counter {
    top: 1rem;
    left: 1rem;
    font-size: 0.8rem;
    padding: 0.2rem 0.55rem;
  }
}

/* Light theme adjustments */
body.light-theme .fg-viewport {
  background: rgba(0, 0, 0, 0.08);
}

body.light-theme .fg-counter {
  background: rgba(0, 0, 0, 0.75);
}

body.light-theme .fg-dot {
  background: rgba(0, 0, 0, 0.2);
}

body.light-theme .fg-dot:hover {
  background: rgba(0, 0, 0, 0.4);
}

/* ===== Gallery zoom button ===== */
.fg-zoom {
  position: absolute;
  top: 1.75rem;
  right: 1.75rem;
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 0.55rem;
  border: 0.0625rem solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.6);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 5;
  padding: 0;
  transition:
    background 0.2s ease,
    transform 0.2s ease,
    box-shadow 0.2s ease;
}

.fg-zoom:hover {
  background: var(--primary);
  transform: scale(1.08);
  box-shadow: 0 0.5rem 1.25rem rgba(0, 185, 107, 0.45);
}

.fg-zoom:focus-visible {
  outline: 0.15rem solid var(--white);
  outline-offset: 0.15rem;
}

@media (max-width: 48rem) {
  .fg-zoom {
    top: 1rem;
    right: 1rem;
    width: 2.2rem;
    height: 2.2rem;
  }

  .fg-zoom svg {
    width: 1rem;
    height: 1rem;
  }
}

/* ===== Gallery Lightbox ===== */
.fg-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.92);
  z-index: 9000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  padding: 2rem;
}

.fg-lightbox.is-open {
  opacity: 1;
}

.fg-lightbox[hidden] {
  display: none;
}

.fg-lightbox__stage {
  max-width: 95vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fg-lightbox__img {
  max-width: 100%;
  max-height: 90vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 0.5rem;
  box-shadow: 0 1.25rem 3rem rgba(0, 0, 0, 0.6);
  user-select: none;
}

.fg-lightbox__close {
  position: absolute;
  top: 1.25rem;
  left: 1.25rem;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  border: 0.0625rem solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
  z-index: 2;
}

.fg-lightbox__close:hover {
  background: rgba(248, 81, 73, 0.85);
  transform: scale(1.07);
}

.fg-lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 50%;
  border: 0.0625rem solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  font-size: 2.2rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    background 0.2s ease,
    transform 0.2s ease;
  z-index: 2;
}

.fg-lightbox__nav:hover {
  background: var(--primary);
  transform: translateY(-50%) scale(1.07);
}

.fg-lightbox__nav--prev {
  right: 1.25rem;
}

.fg-lightbox__nav--next {
  left: 1.25rem;
}

.fg-lightbox__counter {
  position: absolute;
  bottom: 1.25rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.65);
  color: var(--white);
  padding: 0.4rem 0.9rem;
  border-radius: 0.5rem;
  font-size: 0.95rem;
  border: 0.0625rem solid rgba(255, 255, 255, 0.15);
}

@media (max-width: 48rem) {
  .fg-lightbox {
    padding: 0.5rem;
  }

  .fg-lightbox__close {
    top: 0.6rem;
    left: 0.6rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.6rem;
  }

  .fg-lightbox__nav {
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1.6rem;
  }

  .fg-lightbox__nav--prev {
    right: 0.5rem;
  }

  .fg-lightbox__nav--next {
    left: 0.5rem;
  }

  .fg-lightbox__counter {
    bottom: 0.6rem;
    font-size: 0.8rem;
  }
}

/* =========================================================
   LEGAL / AUXILIARY PAGES (Privacy, Terms, About)
========================================================= */
.legal-page {
  flex: 1;
  max-width: 60rem;
  width: 100%;
  margin: 0 auto;
  padding: 3rem 1.5rem 4rem;
  line-height: 1.9;
  color: var(--fg);
}

.legal-page h1 {
  font-size: 3.1rem;
  margin-bottom: 0.5rem;
  color: var(--gold);
  text-shadow: 0 0 1rem var(--gold-soft);
}

.legal-page .legal-meta {
  color: var(--fg-muted);
  font-size: 1.05rem;
  margin-bottom: 2rem;
  border-bottom: 0.0625rem solid var(--border-strong);
  padding-bottom: 1rem;
}

.legal-page .legal-meta p {
  margin: 0.25rem 0;
}

.legal-page h2 {
  font-size: 2.1rem;
  margin-top: 2.5rem;
  margin-bottom: 0.75rem;
  color: var(--gold);
}

.legal-page h3 {
  font-size: 1.6rem;
  margin-top: 1.5rem;
  margin-bottom: 0.5rem;
  color: var(--gold);
  filter: brightness(1.15);
}

.legal-page p,
.legal-page li {
  color: var(--fg-muted);
  font-size: 1.15rem;
}

.legal-page ul,
.legal-page ol {
  padding-inline-start: 1.5rem;
}

.legal-page li {
  margin-bottom: 0.45rem;
}

.legal-page table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.5rem 0 2rem;
  font-size: 1.05rem;
  background: var(--surface);
  border-radius: var(--r-md);
  overflow: hidden;
  border: 0.0625rem solid var(--border-strong);
}

.legal-page th,
.legal-page td {
  border: 0.0625rem solid var(--border);
  padding: 0.8rem 1rem;
  text-align: start;
  vertical-align: top;
}

.legal-page th {
  background: var(--surface-3);
  color: var(--gold);
  font-weight: var(--fw-bold);
}

.legal-page .info-card {
  background: var(--surface-2);
  border: 0.0625rem solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.legal-page .info-card strong {
  color: var(--gold);
}

.legal-page .warning-card {
  background: var(--down-soft);
  border: 0.0625rem solid var(--down);
  border-radius: var(--r-md);
  padding: 1.25rem;
  margin: 1.5rem 0;
}

.legal-page .warning-card strong {
  color: var(--down);
}

/* عنوان بطاقة التحذير مع أيقونة SVG بديلة للإيموجي */
.legal-page .warning-card-title {
  display: inline-flex;
  align-items: center;
  gap: 0.4em;
}

.legal-page .warning-card-title svg {
  width: 1.15em;
  height: 1.15em;
  flex: none;
}

.legal-page .toc {
  background: var(--surface-2);
  border: 0.0625rem solid var(--border-strong);
  border-radius: var(--r-md);
  padding: 1.5rem;
  margin: 1.5rem 0 2rem;
}

.legal-page .toc h3 {
  margin-top: 0;
  font-size: 1.35rem;
  color: var(--gold);
}

.legal-page .toc ol {
  margin: 0.5rem 0 0;
  padding-inline-start: 1.25rem;
}

.legal-page .toc a {
  color: var(--fg-muted);
  text-decoration: none;
  transition: color var(--dur) var(--ease-out);
}

.legal-page .toc a:hover {
  color: var(--gold);
  text-decoration: underline;
}

.legal-page a {
  color: var(--sky);
  transition: color var(--dur) var(--ease-out);
}

.legal-page a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.legal-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 2.5rem;
  padding: 0.75rem 1.5rem;
  border: 0.0625rem solid var(--border-strong);
  border-radius: var(--r-sm);
  color: var(--gold);
  font-size: 1.1rem;
  font-weight: var(--fw-semibold);
  text-decoration: none;
  transition:
    background var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out);
}

.legal-back:hover {
  background: var(--gold-soft);
  border-color: var(--gold);
  color: var(--gold);
}

.legal-page .badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: var(--r-pill);
  background: var(--gold-soft);
  color: var(--gold);
  font-size: 0.85rem;
  margin-inline-start: 0.5rem;
  font-weight: var(--fw-semibold);
}

/* sfooter / marketing footer */
.sfooter {
  margin-top: auto;
  border-top: 0.0625rem solid var(--border);
  background: var(--surface-2);
  width: 100%;
}

.sfoot-grid {
  display: flex;
  justify-content: space-between;
  gap: 1.875rem;
  flex-wrap: wrap;
  /* padding-block فقط: اختصار padding يصفّر padding-inline القادم من .wrap
     فتلتصق نصوص الفوتر بحواف الشاشة. */
  padding-block: 2.75rem 1.75rem;
}

.sfoot-grid .col {
  display: flex;
  flex-direction: column;
  gap: 0.625rem;
}

.sfoot-grid .col-brand {
  max-width: 17.5rem;
}

.footer-contact {
  font-size: var(--fs-sm);
  color: var(--fg-muted);
  line-height: 1.6;
  margin-top: 0.25rem;
}

.footer-mail {
  direction: ltr;
  display: inline-block;
  unicode-bidi: isolate;
  word-break: break-word;
}

.sfoot-grid h5 {
  margin: 0 0 0.25rem;
  font-family: var(--font-display);
  font-size: 0.9375rem;
  color: var(--fg);
  margin-bottom: 0.5rem;
}

.sfoot-grid a {
  color: var(--fg-muted);
  font-size: var(--fs-sm);
  text-decoration: none;
  transition: color var(--dur) var(--ease-out);
}

.sfoot-grid a:hover {
  color: var(--primary);
}

.sfoot-bottom {
  text-align: center;
  padding: 1.125rem;
  color: var(--fg-subtle);
  font-size: var(--fs-xs);
  border-top: 0.0625rem solid var(--border);
}

/* ── شارة التوثيق (وثيقة العمل الحر) داخل عمود النبذة ── */
.footer-permit {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.875rem;
  padding: 0.5rem 0.75rem;
  border: 0.0625rem solid var(--border);
  border-radius: 0.5rem;
  background: var(--surface);
  text-decoration: none;
  transition: border-color var(--dur) var(--ease-out);
}

.footer-permit:hover {
  border-color: var(--primary);
}

.footer-permit-icon {
  height: 1.75rem;
  width: auto;
  flex-shrink: 0;
}

.footer-permit-text {
  display: flex;
  flex-direction: column;
  gap: 0.0625rem;
  line-height: 1.4;
}

.footer-permit-label {
  font-size: var(--fs-xs);
  color: var(--fg-muted);
}

.footer-permit-num {
  font-family: var(--font-mono);
  font-size: var(--fs-sm);
  color: var(--fg);
  letter-spacing: 0.03125rem;
}

/* =========================================================
   MOBILE — صفحة الهبوط والفوتر
   الأحجام أعلاه مضبوطة لشاشات 4K/المعارض، فتصبح ضخمة على الجوال:
   بطاقة واحدة بحشوة عملاقة لكل شاشة. هنا تُقلَّص الحشوات وأحجام
   الخطوط حتى تُعرض بطاقتان متجاورتان كحدّ أقصى، ويُعاد ترتيب
   الفوتر في شبكة عمودين بهوامش مريحة بعيداً عن الحواف.
========================================================= */
@media (max-width: 48rem) {
  /* ── هامش الصفحة العام ── */
  .wrap {
    padding-inline: 1.25rem;
  }

  .sec {
    padding: clamp(2.25rem, 7vw, 3.5rem) 0;
  }

  .sec-h {
    margin-bottom: 2rem;
  }

  .sec-wing-header {
    gap: 0.75rem;
    margin-bottom: 0.65rem;
  }

  .sec-wing-line {
    max-width: 3.5rem;
  }

  .sec-wing-title {
    font-size: 1.35rem;
  }

  .sec-h h2 {
    font-size: 1.05rem;
  }

  .sec-h p {
    font-size: 1rem;
  }

  /* ── بطاقات المميزات: عمودان ── */
  .fgrid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
  }

  .fcard {
    padding: 1.5rem 1.125rem;
  }

  .fcard .ic {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.875rem;
    margin-bottom: 0.875rem;
  }

  .fcard .ic svg {
    width: 1.75rem;
    height: 1.75rem;
  }

  .fcard h3 {
    margin: 0 0 0.5rem;
    font-size: 1.2rem;
  }

  .fcard p {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  /* ── خطوات اللعب: عمودان ── */
  .steps3 {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.875rem;
  }

  .s3 {
    padding: 1.75rem 1rem;
  }

  .s3 .n {
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 0.875rem;
    font-size: 1.875rem;
    margin: 0 auto 0.875rem;
  }

  .s3 h4 {
    margin: 0 0 0.5rem;
    font-size: 1.15rem;
  }

  .s3 p {
    font-size: 0.95rem;
    line-height: 1.5;
  }

  /* ── مؤشرات الثقة ── */
  .trust {
    gap: 1.25rem;
  }

  .trust .t .n {
    font-size: 1.875rem;
  }

  /* ── بطاقات الأسعار (عمود واحد — البطاقة تحوي قائمة مزايا) ── */
  .plan {
    padding: 2rem 1.5rem;
  }

  .plan h3 {
    font-size: 1.6rem;
  }

  .plan .desc {
    font-size: 1rem;
    margin-bottom: 1.25rem;
  }

  .plan .price .amt {
    font-size: 4rem;
  }

  .plan .price .cur {
    font-size: 1.25rem;
  }

  .plan .per {
    font-size: 1rem;
    margin-bottom: 1.5rem;
  }

  .plan ul {
    gap: 0.75rem;
    margin-bottom: 1.5rem;
  }

  .plan li {
    font-size: 1rem;
    gap: 0.625rem;
  }

  .plan li svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  /* ── الأسئلة الشائعة ── */
  .qhead {
    padding: 1.125rem 1.25rem;
    gap: 0.75rem;
    font-size: 1.05rem;
  }

  .qhead svg {
    width: 1.25rem;
    height: 1.25rem;
  }

  .qbody p {
    padding: 0 1.25rem 1.25rem;
    font-size: 0.95rem;
  }

  /* ── شريط الدعوة للتسجيل ── */
  .cta-band {
    padding: clamp(2rem, 7vw, 2.75rem) 1.25rem;
  }

  /* ── الفوتر: شبكة عمودين + هوامش بعيدة عن الحواف ── */
  .sfoot-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.75rem 1.25rem;
    padding-block: 2rem 1.5rem;
  }

  .sfoot-grid .col {
    gap: 0.5rem;
    min-width: 0;
  }

  /* الترتيب: النبذة (عرض كامل) ← المنتج | قانوني ← الدعم (عرض كامل) */
  .sfoot-grid .col-brand {
    grid-column: 1 / -1;
    max-width: 100%;
    order: 1;
  }

  .sfoot-grid .col-product {
    order: 2;
  }

  .sfoot-grid .col-legal {
    order: 3;
  }

  .sfoot-grid .col-support {
    grid-column: 1 / -1;
    order: 4;
  }

  .sfoot-grid h5 {
    margin-bottom: 0.25rem;
    font-size: 1rem;
  }

  .sfoot-grid a {
    line-height: 1.5;
  }

  .footer-permit {
    margin-top: 0.75rem;
    align-self: flex-start;
  }

  /* padding-bottom يترك مساحة لزر «العودة للأعلى» وشارة النسخة
     (كلاهما position: fixed في الزاويتين السفليتين) فلا يغطّيان النص. */
  .sfoot-bottom {
    padding: 1.125rem 1.75rem 4.5rem;
    line-height: 1.7;
    text-wrap: balance;
  }
}

/* شاشات ضيقة جداً (أقل من 20.5rem ≈ 328بك): عمود واحد لتفادي الضغط */
@media (max-width: 20.5rem) {
  .fgrid,
  .steps3 {
    grid-template-columns: 1fr;
  }

  .sfoot-grid {
    grid-template-columns: 1fr;
  }
}

/* =========================================================
   GAME SCREEN — Premium Redesign (متوافق مع التصميم الجديد)
   يدعم المظهر الداكن والفاتح عبر data-theme
========================================================= */

/* ── رأس صفحة اللعبة ── */
#main-screen .game-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1.25rem;
  gap: 0.75rem;
  background: var(--surface);
  border: 0.0625rem solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  flex-wrap: nowrap;
  margin-bottom: 0.75rem;
}

#game-name-display {
  font-family: var(--font-display) !important;
  font-weight: 700 !important;
  font-size: 1.2rem !important;
  color: var(--primary) !important;
  background: var(--primary-soft) !important;
  border: 0.0625rem solid color-mix(in srgb, var(--primary) 35%, transparent) !important;
  padding: 0.5rem 1rem !important;
  border-radius: var(--r-pill) !important;
  white-space: nowrap;
}

.round-info {
  font-family: var(--font-display) !important;
  font-weight: 800 !important;
  font-size: 1.8rem !important;
  color: var(--sky) !important;
  background: var(--sky-soft) !important;
  border: 0.0625rem solid color-mix(in srgb, var(--sky) 35%, transparent) !important;
  padding: 0.5rem 1rem !important;
  border-radius: var(--r-pill) !important;
  white-space: nowrap;
  box-shadow: none !important;
}

/* ── بطاقات الفرق (Portfolio Cards) ── */
.team-card {
  padding: 0 !important;
  border-left: none !important;
  border-radius: var(--r-lg) !important;
  background: var(--surface) !important;
  border: 0.0625rem solid var(--border) !important;
  box-shadow: var(--shadow-sm) !important;
  overflow: hidden;
  transition: all 0.35s var(--ease-out) !important;
  opacity: 1 !important;
  filter: none !important;
}

.team-card.active-turn {
  border-color: var(--primary) !important;
  box-shadow:
    0 0 0 0.125rem var(--primary),
    var(--shadow-glow) !important;
  transform: none !important;
  background: var(--surface-2) !important;
  filter: none !important;
}

/* رأس بطاقة الفريق */
.team-card .team-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  margin-bottom: 0 !important;
  background: var(--surface-2);
  border-bottom: 0.0625rem solid var(--border);
}

.team-card.active-turn .team-header {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  border-bottom-color: color-mix(in srgb, var(--primary) 30%, transparent);
}

/* اسم الفريق داخل الهيدر */
.team-card .team-name-display {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--fg);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.team-card.active-turn .team-name-display {
  color: var(--primary);
}

/* شارة الدور الحالي */
.team-card .turn-badge {
  display: none;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 0.3rem 0.8rem;
  border-radius: var(--r-pill);
  background: var(--primary);
  color: var(--fg-on-accent);
  letter-spacing: 0.02em;
}

.team-card.active-turn .turn-badge {
  display: inline-flex;
}

/* تصنيف الفريق (رتبة) */
.team-rank-badge {
  font-family: var(--font-num);
  font-weight: 700;
  font-size: 1.8rem;
  width: 2.6rem;
  height: 2.8rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--gold-soft);
  color: var(--gold);
  border: 0.0625rem solid color-mix(in srgb, var(--gold) 35%, transparent);
  flex-shrink: 0;
}

/* جسم بطاقة الفريق */
.team-card .team-stats {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem !important;
  gap: 0.5rem !important;
  display: flex;
  flex-direction: column;
}

/* صفوف الإحصائيات */
.team-card .stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.6rem 0.8rem;
  border-radius: var(--r-sm);
  background: var(--surface-3);
  border-bottom: none !important;
  margin-bottom: 0;
}

.team-card .stat-row:last-child {
  background: color-mix(in srgb, var(--primary) 8%, var(--surface-3));
  border: 0.0625rem solid color-mix(in srgb, var(--primary) 25%, transparent);
}

/* قيمة الإجمالي (الأصول الكلية) */
.team-card .stat-value {
  font-family: var(--font-mono) !important;
  font-size: 1.2rem !important;
  font-weight: 600 !important;
  direction: ltr;
  unicode-bidi: isolate;
}

.team-card .stat-label {
  color: var(--fg-muted);
  font-size: 1.2rem;
}

/* مؤشر الصعود/الهبوط */
.team-card .net-change-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  border-radius: var(--r-sm);
  margin-top: 0.35rem;
}

.team-card .net-change-row.up {
  color: var(--up);
  background: var(--up-soft);
}

.team-card .net-change-row.down {
  color: var(--down);
  background: var(--down-soft);
}

/* محفظة الأسهم */
.team-portfolio-list {
  padding: 0.5rem 1rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  border-top: 0.0625rem solid var(--border);
  background: var(--surface);
}

.portfolio-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.3rem 0.5rem;
  border-radius: var(--r-xs);
  font-size: 0.82rem;
  background: var(--surface-2);
  border: 0.0625rem solid var(--border);
  transition: background var(--dur) var(--ease-out);
}

.portfolio-item:hover {
  background: var(--surface-3);
}

.portfolio-item-name {
  font-weight: 600;
  color: var(--fg);
  font-size: 0.8rem;
}

.portfolio-item-qty {
  color: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 0.78rem;
  direction: ltr;
  unicode-bidi: isolate;
}

.portfolio-item-val {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 600;
  direction: ltr;
  unicode-bidi: isolate;
}

.portfolio-item-val.up {
  color: var(--up);
}

.portfolio-item-val.down {
  color: var(--down);
}

/* عنوان قسم المحفظة */
.portfolio-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--fg-subtle);
  padding: 0.4rem 0 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* ── اللعبة – حالة الفاتح ── */
[data-theme="light"] #main-screen .game-header,
body.light-theme #main-screen .game-header {
  background: var(--surface);
  border-color: var(--border);
  box-shadow: var(--shadow-md);
}

[data-theme="light"] .team-card,
body.light-theme .team-card {
  background: var(--surface) !important;
  border-color: var(--border) !important;
}

[data-theme="light"] .team-card .team-header,
body.light-theme .team-card .team-header {
  background: var(--surface-2);
  border-bottom-color: var(--border);
}

[data-theme="light"] .team-card .stat-row,
body.light-theme .team-card .stat-row {
  background: var(--surface-3);
}

[data-theme="light"] .team-card.active-turn,
body.light-theme .team-card.active-turn {
  border-color: var(--primary) !important;
  box-shadow:
    0 0 0 0.125rem var(--primary),
    var(--shadow-glow) !important;
  background: var(--surface-raised) !important;
}

[data-theme="light"] .portfolio-item,
body.light-theme .portfolio-item {
  background: var(--surface-2);
  border-color: var(--border);
}

[data-theme="light"] .team-portfolio-list,
body.light-theme .team-portfolio-list {
  background: var(--surface);
  border-top-color: var(--border);
}

/* ── شريط الأسهم – دعم المظهر الفاتح ── */
[data-theme="light"] .stock-ticker-bar,
body.light-theme .stock-ticker-bar {
  background: linear-gradient(135deg, var(--paper-0), var(--paper-50));
  border-color: var(--border);
}

[data-theme="light"] .ticker-separator,
body.light-theme .ticker-separator {
  color: var(--border-strong);
}

/* ── شاشة السوق – دعم المظهر الفاتح ── */
[data-theme="light"] .market-view,
body.light-theme .market-view {
  background: var(--surface);
  border-color: var(--border);
}

[data-theme="light"] .market-table-header,
body.light-theme .market-table-header {
  color: var(--fg-muted);
  border-bottom-color: var(--border-strong);
}

/* ── أزرار التحكم في اللعبة ── */
#next-turn-btn {
  font-family: var(--font-display) !important;
  border-radius: var(--r-md) !important;
  font-weight: 700 !important;
  white-space: nowrap;
}

/* إخفاء font-size-wrapper إن كان موجوداً في DOM قديم */
#font-size-wrapper {
  display: none !important;
}

/* ===== Back to Top Button ===== */
.back-to-top {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  z-index: 8000;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--primary);
  color: var(--bg);
  border: none;
  box-shadow: 0 0.5rem 1rem -0.25rem
    color-mix(in srgb, var(--primary) 50%, transparent);
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transform: translateY(1rem);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-0.25rem);
  box-shadow: 0 0.75rem 1.5rem -0.25rem
    color-mix(in srgb, var(--primary) 60%, transparent);
}

@media (max-width: 48rem) {
  .back-to-top {
    bottom: 1.5rem;
    right: 1.5rem;
    width: 2.75rem;
    height: 2.75rem;
  }
}

/* مبدّل المظهر في الصفحات القانونية (privacy / terms / about).
   هذه الصفحات لا تحمل شريط التنقل الرئيسي الذي يضم مبدّل المظهر، فكان
   زائرها يقرأ السمة من localStorage بلا أي وسيلة لتغييرها — ومن يفتح
   /privacy مباشرة في متصفح نظيف يُحبس في الداكن.
   الموضع في الزاوية المقابلة لـ .back-to-top حتى لا يتصادما، ومرئي دائماً
   بخلافه (لا ينتظر التمرير) لأن الصفحة قد تكون أقصر من شاشة واحدة. */
.legal-theme-toggle {
  position: fixed;
  bottom: 2rem;
  left: 2rem;
  z-index: 8000;
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--fg);
  border: 0.0625rem solid var(--border-strong);
  cursor: pointer;
  transition:
    background var(--dur) var(--ease-out),
    border-color var(--dur) var(--ease-out),
    color var(--dur) var(--ease-out),
    transform var(--dur) var(--ease-out);
}

.legal-theme-toggle:hover {
  background: var(--surface-3);
  border-color: var(--gold);
  color: var(--gold);
  transform: translateY(-0.25rem);
}

.legal-theme-toggle:focus-visible {
  outline: 0.125rem solid var(--ring);
  outline-offset: 0.125rem;
}

.legal-theme-toggle svg {
  width: 1.5rem;
  height: 1.5rem;
}

@media (max-width: 48rem) {
  .legal-theme-toggle {
    bottom: 1.5rem;
    left: 1.5rem;
    width: 2.75rem;
    height: 2.75rem;
  }
}

/* =========================================================
   MOBILE — النوافذ المنبثقة
   الأحجام أعلاه مضبوطة لشاشات 4K/المعارض، فتخرج عن حدود الجوال.
   هنا تُقلَّص الصناديق والخطوط، وتُمرَّر النافذة رأسياً بدل الفيضان.
   ملاحظة: نوافذ عجلة المستقبل والحساب/الدفع تُعالَج في
   tm_styles.css و subscription.css لأنهما يُحمَّلان بعد هذا الملف.
========================================================= */
@media (max-width: 48rem) {
  .modal {
    padding: 1rem;
  }

  .modal-content {
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 2rem);
    max-height: calc(100dvh - 2rem);
    overflow-y: auto;
    overscroll-behavior: contain;
    padding: 1.25rem;
    border-radius: var(--r-lg);
  }

  .modal-header {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  /* --- نافذة السؤال --- */
  .question-modal-content {
    padding: 1.25rem 1rem;
  }

  .question-modal-content .modal-header {
    margin-bottom: 1rem;
  }

  .qm-title {
    flex-wrap: wrap;
    gap: 0.375rem;
    font-size: 1.15rem;
    padding-inline-end: 2.5rem; /* مكان عدّاد الوقت المطلق */
  }

  .qm-category,
  .qm-turn {
    font-size: 0.85rem;
    padding: 0.1875rem 0.5rem;
    margin: 0;
  }

  .qm-sep {
    display: none;
  }

  .qm-timer {
    left: 0.75rem;
    width: 2.5rem;
    height: 2.5rem;
    font-size: 1rem;
    border-width: 0.125rem;
  }

  .question-modal-content .question-text {
    font-size: 1.15rem;
    line-height: 1.6;
    margin-bottom: 1.25rem;
  }

  .question-modal-content .options-grid {
    gap: 0.625rem;
  }

  .option-btn {
    font-size: 1rem;
    padding: 0.75em;
  }

  /* --- نافذة الحدث --- */
  .event-content h2 {
    font-size: 1.25rem;
  }

  .event-icon {
    font-size: 2.25rem;
    margin: 0.75rem 0;
  }

  .event-text {
    font-size: 1rem;
  }

  .event-impact {
    padding: 0.75rem;
    margin-bottom: 1rem;
  }

  /* --- نافذة اختيار الفئة --- */
  .cm-close {
    top: 0.75rem;
    right: 0.75rem;
    font-size: 1.75rem;
  }

  .cm-title {
    font-size: 1.2rem;
    margin-bottom: 1rem;
    padding-top: 1.5rem;
  }

  .cm-turn {
    font-size: 0.95rem;
    padding: 0.1875rem 0.5rem;
  }

  .cm-label {
    font-size: 1rem;
    margin-bottom: 0.75rem;
  }

  .cm-cats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.625rem;
  }

  /* --- نافذة التنبيه/التأكيد (الأكثر ظهوراً للمستخدم) --- */
  .custom-alert-content {
    padding: 1.5rem 1.25rem;
  }

  .custom-alert-icon {
    font-size: 2.75rem;
    margin-bottom: 0.5rem;
  }

  .custom-alert-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
  }

  .custom-alert-content .custom-alert-message {
    font-size: 1rem;
  }

  .custom-alert-content .custom-alert-reward {
    font-size: 1.15rem;
    margin: 0.75rem 0;
  }

  .custom-alert-content .btn {
    font-size: 1rem;
    padding: 0.8rem 1.25rem;
    margin-top: 1.25rem;
  }

  .custom-alert-content .btn + .btn {
    margin-top: 0.625rem;
  }

  /* --- تقرير التداولات اليومي --- */
  .report-modal-content {
    max-width: 100%;
    width: 100%;
    padding: 1.25rem;
  }

  .report-icon {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
  }

  .report-title {
    font-size: 1.25rem;
    margin-bottom: 0.75rem;
  }

  .report-message {
    font-size: 1rem;
    line-height: 1.7;
    margin-bottom: 1.25rem;
  }

  .report-ok-btn {
    font-size: 1rem;
    padding: 0.75rem 1.25rem;
  }

  /* --- نافذة الدخول/التسجيل والتحقق --- */
  .auth-modal-content {
    padding: 1.5rem 1.25rem 1.25rem;
  }

  .auth-title {
    font-size: 1.15rem;
    margin-bottom: 1rem;
  }

  .auth-tab {
    font-size: 0.95rem;
    padding: 0.625rem 0.375rem;
  }

  .auth-tabs {
    margin-bottom: 1.25rem;
  }

  .otp-modal-content {
    padding: 1.5rem 1.25rem;
  }

  .otp-title {
    font-size: 1.2rem;
  }
}
