:root {
  --bg-color: #f8f9fa;
  --card-bg: rgba(255, 255, 255, 0.95);
  --card-border: rgba(0, 0, 0, 0.08);
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05);
  --text-primary: #111827;
  --text-secondary: #4b5563;
  --border-sub: #e5e7eb;
  --subbar-bg: rgba(255, 255, 255, 0.85);
  --accent-color: #2563eb;
  --accent-hover: #1d4ed8;
}

[data-theme="dark"] {
  --bg-color: #0d0e12;
  --card-bg: rgba(22, 24, 29, 0.85);
  --card-border: rgba(255, 255, 255, 0.08);
  --card-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --border-sub: rgba(255, 255, 255, 0.08);
  --subbar-bg: rgba(13, 14, 18, 0.85);
  --accent-color: #3b82f6;
  --accent-hover: #2563eb;
}

* {
  box-sizing: border-box;
}

/* إصلاح الفوتر ومحاذاة الصفحة */
html {
  height: 100%;
}

body {
  margin: 0;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  background-color: var(--bg-color);
  color: var(--text-primary);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  /* حيدنا الـ transition من الـ body لتفادي ثقل السكرول */
}

/* الشريط العلوي */
.dark-light-bremb {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 20px;
  background: var(--subbar-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-sub);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.dark-light-bremb.nav-hidden {
  transform: translateY(-100%);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 24px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #e4e4e7;
  border: 1px solid #d4d4d8;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 30px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background-color: #18181b;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
}

input:checked + .slider {
  background-color: #27272a;
  border-color: #3f3f46;
}

input:checked + .slider:before {
  transform: translateX(24px);
  background-color: #ffffff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.3);
}

/* ضبط المارجن بين شريط السويتش/البرودكروم والمحتوى الرئيسية */
.page-container {
  max-width: 1150px;
  width: 100%;
  margin: 0 auto;
  padding: 70px 15px 30px 15px; /* ضبط المسافة العلوية لتكون مناسبة مع الـ sticky header */
  flex: 1 0 auto; /* يضمن توسيع المحتوى ودفع الفوتر للأسفل مباشرة */
}

.content-wrapper {
  display: grid;
  grid-template-columns: 1fr;
  gap: 25px;
  margin-top: 15px; /* إضافة مارجن إضافي بين البيانات والشريط */
}

@media (min-width: 850px) {
  .content-wrapper {
    grid-template-columns: 340px 1fr;
  }
}

.download-sidebar {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.game-main-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 15px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(10px);
}

.cover-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-bottom: 15px;
}

.game-cover {
  width: 160px;
  height: 215px;
  object-fit: cover;
  border-radius: 10px;
  box-shadow: 0 8px 16px rgba(0,0,0,0.15);
}

.game-spec-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spec-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: rgba(0,0,0,0.03);
  border-radius: 6px;
  font-size: 0.88rem;
  border: 1px solid var(--border-sub);
}

[data-theme="dark"] .spec-item {
  background: rgba(255,255,255,0.03);
}

.spec-label {
  font-weight: 600;
  color: var(--text-secondary);
}

.spec-value {
  font-weight: 500;
  color: var(--text-primary);
}

.spec-val-link {
  color: var(--accent-color);
  text-decoration: none;
  font-weight: 600;
}

.badge-crc {
  background: #2563eb;
  color: #fff;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-weight: bold;
}

.action-panel {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--card-shadow);
}

.main-dl-btn {
  position: relative;
  width: 100%;
  padding: 12px 20px;
  background-color: var(--accent-color);
  color: #ffffff;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  overflow: hidden;
  z-index: 1;
  transition: background-color 0.2s ease, transform 0.1s ease;
}

.main-dl-btn:hover:not(:disabled) {
  background-color: var(--accent-hover);
  transform: translateY(-1px);
}

.main-dl-btn:disabled {
  cursor: wait;
}

.main-dl-btn .btn-text {
  position: relative;
  z-index: 3;
}

.main-dl-btn::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  background-color: #1d4ed8;
  z-index: 1;
  transition: width 5s linear;
}

.main-dl-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  z-index: 2;
  background-image: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.25) 25%,
    transparent 25%,
    transparent 50%,
    rgba(255, 255, 255, 0.25) 50%,
    rgba(255, 255, 255, 0.25) 75%,
    transparent 75%,
    transparent
  );
  background-size: 30px 30px;
  opacity: 0;
  transition: width 5s linear, opacity 0.2s ease;
}

.main-dl-btn.loading::before {
  width: 100%;
}

.main-dl-btn.loading::after {
  width: 100%;
  opacity: 1;
  animation: moveCandyStripe 1s linear infinite;
}

@keyframes moveCandyStripe {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 30px 0;
  }
}

.reaction-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-evenly;
  border: 1px solid var(--border-sub);
  border-radius: 8px;
  padding: 6px;
}

.reaction-btn {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  font-weight: 600;
  cursor: pointer;
}

.reaction-btn img {
  width: 18px;
  height: 18px;
}

.reaction-divider {
  width: 1px;
  height: 20px;
  background: var(--border-sub);
}

.notice-box {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.3);
  border-radius: 10px;
  padding: 12px;
}

.notice-title {
  display: block;
  font-weight: bold;
  color: #10b981;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.notice-desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.game-article {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 25px;
  box-shadow: var(--card-shadow);
  backdrop-filter: blur(10px);
}

.article-heading {
  font-size: 1.5rem;
  margin-top: 0;
  margin-bottom: 15px;
  color: var(--text-primary);
  border-bottom: 2px solid var(--border-sub);
  padding-bottom: 10px;
}

.sub-heading {
  font-size: 1.15rem;
  margin-top: 20px;
  margin-bottom: 8px;
  color: var(--accent-color);
}

.article-body p {
  line-height: 1.65;
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-bottom: 12px;
}

.media-section {
  display: grid;
  grid-template-columns: 1fr;
  gap: 15px;
  margin-top: 25px;
}

@media (min-width: 650px) {
  .media-section {
    grid-template-columns: repeat(2, 1fr);
  }
}

.media-card {
  aspect-ratio: 16 / 9;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--card-border);
  box-shadow: var(--card-shadow);
}

.media-card iframe {
  width: 100%;
  height: 100%;
}

/* ================= Scroll Reveal Animations (معالجة مشكلة التلصاق) ================= */
.reveal {
  opacity: 0;
  transform: translateY(25px);
  transition: opacity 0.4s ease-out, transform 0.4s ease-out;
  /* حيدنا will-change لحل ثقل وتلصاق السكرول */
}

.reveal.active {
  opacity: 1;
  transform: translateY(0);
}

/* لضمان التصاق الفوتر بأسفل الصفحة بالكامل دون أي فراغ */
app-footer {
  margin-top: auto;
  width: 100%;
  display: block;
}
app-footer {
  display: block !important;
  height: auto !important;
  min-height: min-content !important;
  background-color: #1a1a1a !important; /* لون الفوتر ديالك باش يخفي ديك البيوضية */
  padding-bottom: 20px !important; /* عطيو تيساع للروابط التحتانيين */
  overflow: hidden !important; 
  margin-top: auto !important; /* باش ديما يبقى في القاع */
  width: 100%;
}