/* =========================================================
   HARD SITUATION — FINAL UNIFIED VERSION
   ✅ PART 1/3 — BASE (LAPTOP & DESKTOP CORE)
   المصدر الأساسي: BEST LAPTOP.txt
   ========================================================= */

/* ---------- Variables ---------- */
:root{
  --hs-base: #2c2648;
  --hs-base-700: #262141;
  --hs-base-800: #201c38;
  --hs-accent: #5170FF;
  --hs-accent-400: #6F86FF;
  --hs-accent-200: #A8B4FF;
  --hs-text: #f5f5ff;
  --hs-muted: #b7b7d6;
  --hs-card: #322b55;
  --hs-border: rgba(255,255,255,.10);
  --hs-shadow: 0 4px 18px rgba(0,0,0,.35);
}

/* ---------- Base / Reset ---------- */
*{ box-sizing:border-box; margin:0; padding:0; }
html,body{ height:100%; }
body{
  font-family:'Tajawal','Segoe UI','Tahoma',Arial,sans-serif;
  background:linear-gradient(135deg, var(--hs-base) 0%, var(--hs-base-800) 100%);
  color:var(--hs-text);
}
body.layout{ display:flex; min-height:100vh; flex-direction:column; }
.wrap{ width:100%; max-width:1200px; margin:0 auto; padding:24px 18px; }

/* =========================================================
   Topbar + Auth
   ========================================================= */
.topbar{
  position:sticky; top:0; z-index:1000;
  background:rgba(0,0,0,.35);
  backdrop-filter:blur(8px);
  border-bottom:1px solid var(--hs-border);
}
.topbar .wrap{
  display:flex; align-items:center; justify-content:space-between;
  padding:12px 18px;
}
.brand-title{ display:flex; align-items:center; gap:10px; font-weight:900; }
.brand-title .badge{
  background:rgba(81,112,255,.14);
  color:var(--hs-accent-200);
  padding:6px 10px; border-radius:10px;
  border:1px solid rgba(81,112,255,.25);
}
.brand-title span{ font-size:1rem; color:var(--hs-accent-200); opacity:.9; }
.auth-links{ display:flex; align-items:center; gap:10px; }
.auth-links .welcome{ font-weight:600; color:var(--hs-accent-200); }

/* =========================================================
   Footer + Social
   ========================================================= */
.footer{
  margin-top:auto;
  padding:18px 0;
  background:rgba(0,0,0,.45);
  color:var(--hs-text);
  border-top:1px solid var(--hs-border);
}
.footer .wrap{
  display:flex; justify-content:space-between; align-items:center;
}
.social{ display:flex; gap:12px; }
.social a{
  display:flex; align-items:center; justify-content:center;
  width:48px; height:48px; border-radius:10px;
  background:rgba(255,255,255,.12);
  color:var(--hs-accent-200);
  transition:transform .15s, background .15s;
}
.social a:hover{ transform:translateY(-3px); background:rgba(255,255,255,.22); }
.social svg{ width:28px; height:28px; }

/* =========================================================
   Hero (اختياري)
   ========================================================= */
.hero{
  max-width:1200px; margin:50px auto 30px; padding:32px 18px; text-align:center;
}
.hero .logo{
  width:110px; height:110px; margin:0 auto 18px;
  background:var(--hs-accent); border-radius:50%;
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-weight:900; font-size:2.2rem;
  box-shadow:0 6px 16px rgba(0,0,0,.25);
}
.hero h1{ margin:0; font-size:2.2rem; color:var(--hs-accent-200); }
.hero p{ margin-top:12px; color:var(--hs-muted); font-size:1.1rem; }

/* =========================================================
   Buttons / Inputs / Cards / Badges
   ========================================================= */
.btn{
  display:inline-block; border:none; border-radius:10px;
  padding:10px 16px; font-weight:600; cursor:pointer;
  transition:transform .08s ease, box-shadow .18s ease, background .18s ease, border-color .18s ease;
  text-decoration:none; color:var(--hs-text);
  background:#3b3560; border:1px solid var(--hs-border);
}
.btn:hover{ transform:translateY(-1px); box-shadow:0 8px 20px rgba(0,0,0,.25); }
.btn:active{ transform:translateY(0); }
.btn.primary{
  background:linear-gradient(180deg, var(--hs-accent) 0%, #3358FF 100%);
  color:#fff; border-color:rgba(81,112,255,.6);
}
.btn.primary:hover{
  background:linear-gradient(180deg, var(--hs-accent-400) 0%, var(--hs-accent) 100%);
}
.btn.secondary{ background:rgba(255,255,255,.06); color:var(--hs-text); }
.btn.danger{ background:#c0392b; color:#fff; }
.btn.success{ background:#27ae60; color:#fff; }

.input, input[type="text"], input[type="number"]{
  width:100%; background:#262141; color:var(--hs-text);
  border:1px solid var(--hs-border); border-radius:10px;
  padding:10px 12px; outline:none;
}
.input::placeholder{ color:var(--hs-muted); }

.card, .stage, .sidebar, .wheel, .confirm-box{
  background:linear-gradient(180deg, var(--hs-base) 0%, var(--hs-base-700) 100%);
  border:1px solid var(--hs-border); border-radius:14px; box-shadow:var(--hs-shadow);
}
.card{ padding:20px; margin-bottom:20px; transition:transform .12s, box-shadow .18s; }
.card:hover{ transform:translateY(-3px); box-shadow:0 8px 24px rgba(0,0,0,.35); }

.badge{
  display:inline-block; padding:6px 10px; border-radius:10px;
  background:rgba(81,112,255,.14); color:var(--hs-accent-200);
  border:1px solid rgba(81,112,255,.25); font-weight:700;
}

/* =========================================================
   Confirm Modal
   ========================================================= */
.confirm-overlay{
  position:fixed; inset:0; background:#000a;
  display:flex; align-items:center; justify-content:center;
  z-index:999; backdrop-filter:blur(4px);
}
.confirm-box{ padding:24px; max-width:380px; text-align:center; color:var(--hs-text); }
.confirm-box h2{ color:var(--hs-accent-200); margin-bottom:12px; }
.confirm-btns{ display:flex; gap:10px; justify-content:center; margin-top:18px; }

/* =========================================================
   Scenario Cards (Desktop baseline)
   ========================================================= */
.hs-card {
  background: #1e1030;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 4px 10px rgba(0,0,0,0.3);
  transition: transform .25s ease, box-shadow .25s ease;
  display:flex; flex-direction:column; padding:0;
}
.hs-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.4);
}
.hs-card .cover {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 3;
  background: #140f24 center/contain no-repeat;
  overflow: hidden;
  border-bottom: 2px solid rgba(255,255,255,0.08);
  border-radius: 12px 12px 0 0;
  animation: imageFadeIn .6s ease;
}
/* الطبقة الخلفية */
.hs-card .cover::before,
.hs-card .cover::after {
  content: "";
  position: absolute;
  inset: 0;
  background-repeat: no-repeat;
  background-position: center;
  z-index: 0;
}
.hs-card .cover::before {
  background-image: inherit;
  background-size: cover;
  filter: blur(18px) brightness(0.5);
  transform: scale(1.1);
  z-index: 0;
}
.hs-card .cover::after {
  background-image: inherit;
  background-size: contain;
  z-index: 1;
}
.hs-card .cover.placeholder {
  background: linear-gradient(135deg, #333, #444);
  color: #aaa;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 0.9rem;
}
.hs-card .info {
  padding: 12px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #fdfdfd;
}
.hs-card .info .title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #EBCE8F;
  margin-bottom: 6px;
}
.hs-card .info .desc {
  color: #bbb;
  font-size: 0.9rem;
  line-height: 1.4;
  margin-bottom: 12px;
}
.hs-card .btn-start {
  display: block;
  width: 100%;
  text-align: center;
  margin-top: auto;
}
.hs-card:hover .cover {
  filter: brightness(1.1);
  transform: scale(1.01);
  transition: transform 0.25s ease, filter 0.25s ease;
}

/* =========================================================
   Grid Layout (Desktop)
   ========================================================= */
.grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 22px;
  justify-items: center;
  margin: 18px 0 34px;
}
.grid > .hs-card {
  width: 100%;
  max-width: 340px;
}
@media (max-width: 1024px) {
  .grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .grid { grid-template-columns: 1fr; }
}

/* =========================================================
   Effects
   ========================================================= */
@keyframes imageFadeIn { from{ opacity:0; transform:scale(1.05);} to{ opacity:1; transform:scale(1);} }
.viewer::before {
  content:""; position:absolute; inset:0;
  background:linear-gradient(180deg, rgba(0,0,0,.25) 0%, rgba(0,0,0,.55) 100%);
  z-index:1; pointer-events:none; opacity:.8; transition:opacity .4s ease;
}
.viewer:hover::before{ opacity:.4; }
.viewer img{ animation:imageFadeIn .6s ease; transition:transform .8s cubic-bezier(.3,.1,.1,1), filter .4s ease; }
.viewer img.active{ transform:scale(1.03); filter:brightness(1.05) contrast(1.05); }
.viewer::after{
  content:""; position:absolute; inset:0; pointer-events:none; border-radius:12px;
  box-shadow:0 0 60px rgba(81,112,255,.05) inset; transition:box-shadow .3s ease;
}
.viewer:hover::after{ box-shadow:0 0 60px rgba(81,112,255,.2) inset; }

h1,h2,h3{ color:var(--hs-accent-200); letter-spacing:.2px; }
.muted{ color:var(--hs-muted); opacity:.9; }
/* =========================================================
   HARD SITUATION — FINAL UNIFIED VERSION
   ✅ PART 2/3 — MOBILE & TABLET ENHANCEMENTS
   المصدر: BEST OTHER DEVICES.txt
   ========================================================= */

/* =========================================================
   📱 تحسينات عامة — هوامش ومسافات مرنة
   ========================================================= */
@media (max-width: 900px) {
  .wrap {
    padding: 16px 10px;
  }

  .page-title {
    flex-direction: column;
    gap: 8px;
    font-size: 1.5rem;
    text-align: center;
  }

  .title-logo {
    width: 52px;
    height: 52px;
  }
}

/* =========================================================
   🎡 الكروت — تحويل الشبكة إلى تمرير أفقي
   ========================================================= */
@media (max-width: 768px) {
  .grid {
    display: flex;
    overflow-x: auto;
    gap: 16px;
    scroll-snap-type: x mandatory;
    padding: 6px 8px 14px;
    -webkit-overflow-scrolling: touch;
  }

  /* شريط التمرير السفلي */
  .grid::-webkit-scrollbar { height: 6px; }
  .grid::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.15);
    border-radius: 4px;
  }

  /* بطاقات السيناريو — سلوك تمرير أفقي */
  .hs-card {
    flex: 0 0 88vw;
    scroll-snap-align: center;
    border-radius: 14px;
    margin: 0 auto;
    max-width: none;
  }

  /* صورة الغلاف أفقية أكثر */
  .hs-card .cover {
    aspect-ratio: 16 / 10;
    border-radius: 14px 14px 0 0;
  }

  .hs-card .info {
    padding: 12px 14px 14px;
  }

  .hs-card .info .title {
    font-size: 1.05rem;
  }

  .hs-card .info .desc {
    font-size: 0.9rem;
    line-height: 1.5;
  }

  .hs-card .btn-start {
    padding: 12px;
    font-size: 1rem;
    border-radius: 10px;
    margin-top: 10px;
  }
}

/* =========================================================
   🔝 تحسين الشكل العام للتوب بار والفوتر
   ========================================================= */
@media (max-width: 768px) {
  .topbar {
    border-bottom-left-radius: 16px;
    border-bottom-right-radius: 16px;
    background: rgba(0,0,0,.45);
    padding-bottom: 4px;
  }

  .footer {
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    background: rgba(0,0,0,.45);
  }

  .social a {
    width: 40px;
    height: 40px;
  }
}

/* =========================================================
   📲 أجهزة صغيرة جدًا (أقل من 400px)
   ========================================================= */
@media (max-width: 400px) {
  .hs-card {
    flex: 0 0 94vw;
  }

  .hs-card .cover {
    aspect-ratio: 16 / 11;
  }

  .btn {
    padding: 9px 12px;
    font-size: 0.95rem;
  }

  .page-title {
    font-size: 1.3rem;
  }
}

/* =========================================================
   🧩 تحسين الـ Topbar عند الامتلاء
   ========================================================= */
@media (max-width: 640px) {
  .topbar .wrap {
    flex-wrap: wrap;
    row-gap: 8px;
    column-gap: 6px;
    padding: 10px 12px;
  }

  .topbar .wrap > * { min-width: 0; }

  .brand-title {
    flex: 0 1 auto;
    min-width: 0;
  }

  .auth-links {
    flex: 1 1 100%;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }

  .auth-links .btn {
    padding: 8px 12px;
    font-size: .95rem;
    white-space: nowrap;
    flex: 0 0 auto;
  }

  .auth-links .welcome {
    flex: 1 1 100%;
    text-align: center;
    order: -1;
    font-size: .9rem;
    opacity: .9;
  }
}

/* =========================================================
   📱 لمسّات الكاروسيل والـ Safe-area
   ========================================================= */

/* احترام نوتش iOS (safe-area) */
@supports (padding: env(safe-area-inset-top)) {
  .topbar {
    padding-top: calc(12px + env(safe-area-inset-top));
  }

  .footer {
    padding-bottom: calc(18px + env(safe-area-inset-bottom));
  }

  body.layout {
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

/* منع ارتداد الصفحة مع تمرير الكروت */
@media (max-width: 768px) {
  .grid {
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    scroll-padding: 0 10px;
  }
}

/* =========================================================
   ⚙️ ضبط دقيق للـ Padding في الكاروسيل
   ========================================================= */
@media (max-width: 768px) {
  .grid {
    padding-right: max(8px, env(safe-area-inset-right, 0px));
    padding-left: max(8px, env(safe-area-inset-left, 0px));
  }

  .hs-card {
    flex: 0 0 calc(88vw - 8px);
  }
}
/* =========================================================
   HARD SITUATION — FINAL UNIFIED VERSION
   ✅ PART 3 (Rewritten) — CLEAN POLISH & ACCESSIBILITY FIX
   هدف هذا الجزء: تحسين الحركة والوصول بدون أي scroll إضافي.
   ========================================================= */

/* =========================================================
   🎯 Focus-visible & Keyboard Access
   ========================================================= */
.btn:focus-visible,
a:focus-visible {
  outline: 3px solid rgba(168,180,255,.7);
  outline-offset: 2px;
  box-shadow: 0 0 0 3px rgba(81,112,255,.25);
  border-radius: 8px;
}

/* =========================================================
   ⚡ Smooth scrolling + motion reduction
   ========================================================= */
html { scroll-behavior: smooth; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* =========================================================
   🧱 STRUCTURAL SAFETY — Prevent fake scrollbars
   ========================================================= */
/* لا أي حشوة إضافية للجسم أو الـ html */
html, body {
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  max-width: 100%;
  height: auto;
}

/* لا تغييرات للـ safe-area على الدسكتوب */
@media (min-width: 1025px) {
  body.layout {
    padding: 0 !important;
    margin: 0 !important;
  }
}

/* =========================================================
   📱 Touch comfort (Mobile)
   ========================================================= */
@media (max-width: 480px) {
  .btn { min-height: 42px; }
}

/* =========================================================
   💫 Hover & Active Effects — without transform scale
   ========================================================= */
.hs-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 14px rgba(0,0,0,0.4);
  transition: transform .25s ease, box-shadow .25s ease;
}

.hs-card:hover .cover {
  filter: brightness(1.08);
  transform: none;
}

/* عند النقر على زر */
.btn:active, a:active {
  transform: scale(0.98);
  opacity: 0.9;
  transition: transform 0.1s ease;
}

/* =========================================================
   🌗 Polished shadows & consistency
   ========================================================= */
@media (max-width: 768px) {
  .hs-card {
    box-shadow: 0 3px 8px rgba(0,0,0,0.25);
  }
  .hs-card:hover {
    box-shadow: 0 5px 12px rgba(0,0,0,0.35);
  }
}

/* =========================================================
   🎬 Image Fade-in — opacity only (no transform)
   ========================================================= */
@keyframes hsImageFade {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.hs-card .cover {
  animation: hsImageFade .45s ease both;
}

@media (prefers-reduced-motion: reduce) {
  .hs-card .cover { animation: none !important; }
}

/* =========================================================
   🧩 Final Cleanup
   ========================================================= */
.topbar .wrap,
.footer .wrap {
  overflow-x: visible !important;
  overflow-y: visible !important;
}

body.layout {
  background-attachment: fixed;
}

/* =========================================================
   ✅ Summary
   - لا يوجد transform-scale يغيّر ارتفاع الصفحة.
   - لا يوجد padding أو env() يسبب scroll وهمي.
   - الأنميشن آمنة: opacity فقط.
   - hover لطيف وثابت على الدسكتوب.
   ========================================================= */
/* ===== FIXED LOGO (Restored from BEST LAPTOP/DEVICES) ===== */
.title-logo {
  width: 60px;
  height: 60px;
  flex: 0 0 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #3a3270, #1c1835);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 0;
  box-shadow: 0 0 16px rgba(81,112,255,0.35);
  border: 2px solid rgba(81,112,255,0.6);
}

.title-logo img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(81,112,255,0.4));
}
/* ===== FIX: align logo and title side-by-side (exact desktop look) ===== */

.page-title {
  display: flex;
  align-items: center;     /* يجعل اللوقو والنص بنفس الخط */
  justify-content: center; /* توسيط أفقي للكل */
  flex-direction: row;     /* تأكيد الاتجاه الأفقي */
  gap: 12px;               /* المسافة بين اللوقو والنص */
  text-align: center;
  font-size: 1.9rem;
  color: var(--hs-accent-200);
  margin: 20px 0 24px;
  line-height: 1.2;
}

.page-title .title-logo {
  flex: 0 0 60px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #3a3270, #1c1835);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 16px rgba(81,112,255,0.35);
  border: 2px solid rgba(81,112,255,0.6);
  line-height: 0;
}

.page-title .title-logo img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  filter: drop-shadow(0 0 4px rgba(81,112,255,0.4));
}

/* نحافظ على الشكل الأفقي حتى بالجوال */
@media (max-width: 768px) {
  .page-title {
    flex-direction: row;
    gap: 10px;
    font-size: 1.5rem;
  }
  .page-title .title-logo {
    width: 52px;
    height: 52px;
    flex: 0 0 52px;
  }
}
/* ===== 🎟️ مودال التفعيل (تصميم مستوحى من حنكة الذيب) ===== */
.hs-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(6px);
}
.hs-modal.is-hidden { display: none; }

.hs-modal-dialog {
  position: relative;
  width: min(92%, 420px);
  background: #322b55;
  border-radius: 16px;
  border: 2px solid #5170FF;
  box-shadow: 0 8px 28px rgba(0,0,0,0.55);
  padding: 28px 24px;
  text-align: center;
  color: #f5f5ff;
  font-family: 'Tajawal', sans-serif;
  animation: modalPop .25s ease-out;
}
@keyframes modalPop {
  from { transform: scale(0.9); opacity: 0; }
  to   { transform: scale(1); opacity: 1; }
}
.hs-modal-close {
  position: absolute;
  top: 10px;
  left: 14px;
  background: transparent;
  border: none;
  color: #aaa;
  font-size: 22px;
  cursor: pointer;
  transition: color .2s;
}
.hs-modal-close:hover { color: #fff; }

.hs-modal-header h3 {
  font-size: 1.3rem;
  margin-bottom: 6px;
  color: #fff;
}
.hs-modal-sub {
  font-size: 0.9rem;
  color: #b7b7d6;
  line-height: 1.6;
}

.hs-redeem-field {
  margin: 20px 0;
  text-align: left;
}
.hs-redeem-field label {
  display: block;
  font-size: 0.85rem;
  color: #cfcfe3;
  margin-bottom: 6px;
}
.hs-redeem-field input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #444;
  background: #201c38;
  color: #f5f5ff;
  font-size: 0.95rem;
}
.hs-redeem-field input::placeholder {
  color: #7776a5;
}

.hs-modal-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}
.hs-modal-footer-hint {
  margin-top: 14px;
  font-size: 0.85rem;
  color: #b7b7d6;
}
.hs-modal-footer-hint a {
  color: #81a4ff;
  text-decoration: none;
}
.hs-modal-footer-hint a:hover {
  text-decoration: underline;
}
.hs-redeem-feedback {
  margin-top: 10px;
  font-size: 0.9rem;
  min-height: 20px;
  color: #81FFBA;
}
