:root {
  color-scheme: dark;
  --scroll-fade: 0.22;
  --font-ui: "SpaceGroteskLocal", "Space Grotesk", "Vazirmatn", system-ui, sans-serif;
  --font-display: "LalezarLocal", "Lalezar", "Vazirmatn", system-ui, sans-serif;
  --color-bg: #06080f;
  --color-text: #e6e9ef;
  --color-text-soft: #cbd5e1;
  --color-text-muted: #94a3b8;
  --color-accent: #22d3ee;
  --color-accent-strong: #06b6d4;
  --color-primary: #7c3aed;
  --color-primary-strong: #6d28d9;
  --color-danger: #e94560;
  --color-border: rgba(148, 163, 184, 0.28);
  --color-border-strong: rgba(148, 163, 184, 0.48);
  --surface-1: rgba(15, 23, 42, 0.88);
  --surface-2: rgba(15, 23, 42, 0.62);
  --surface-3: rgba(2, 6, 23, 0.58);
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-pill: 999px;
  --shadow-soft: 0 12px 24px rgba(2, 6, 23, 0.34);
  --shadow-panel: 0 14px 35px rgba(0, 0, 0, 0.34);
  --motion-fast: 160ms;
  --motion-med: 220ms;
}

@font-face {
  font-family: "SpaceGroteskLocal";
  src: url("/data/fonts/space-grotesk-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

@font-face {
  font-family: "LalezarLocal";
  src: url("/data/fonts/lalezar-arabic.woff2") format("woff2");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-text);
  font-family: var(--font-ui);
  overscroll-behavior-y: auto;
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

html {
  background: var(--color-bg);
  overscroll-behavior-y: auto;
  min-height: 100%;
  overflow-x: hidden;
}

.font-sans {
  font-family: var(--font-ui) !important;
}

.lalezar-force {
  font-family: var(--font-display) !important;
  font-weight: 400 !important;
}

.font-display {
  font-family: var(--font-display) !important;
  font-weight: 400 !important;
}

.hero-main-title {
  font-family: var(--font-display) !important;
  font-weight: 400;
  letter-spacing: 0.01em;
  line-height: 1.18;
}

h1,
h2,
h3 {
  font-family: var(--font-display) !important;
  font-weight: 400;
  letter-spacing: 0.01em;
}

.section-heading,
.showcase-heading,
.showcase-panel-title,
.game-title {
  font-family: var(--font-display) !important;
}

.page-wrap {
  padding: 2.75rem 1rem;
}

.section-wrap {
  margin-inline: auto;
  width: 100%;
  max-width: var(--screen-wide, 1280px);
}

.section-heading {
  font-family: var(--font-display) !important;
  color: var(--color-text);
}

.text-soft {
  color: var(--color-text-soft);
}

.text-muted {
  color: var(--color-text-muted);
}

.text-accent {
  color: var(--color-accent);
}

.surface-panel {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--surface-1), var(--surface-2));
  box-shadow: var(--shadow-panel);
}

.token-field {
  width: 100%;
  border: 1px solid var(--color-border-strong);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.95rem;
  color: var(--color-text);
  background: rgba(15, 23, 42, 0.78);
  transition: border-color var(--motion-fast) ease, box-shadow var(--motion-fast) ease;
}

.token-field::placeholder {
  color: var(--color-text-muted);
}

.token-field:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--color-accent) 60%, #ffffff 40%);
  box-shadow: 0 0 0 3px rgba(34, 211, 238, 0.18);
}

.token-btn {
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.1;
  transition: transform var(--motion-fast) ease, background var(--motion-fast) ease, border-color var(--motion-fast) ease;
}

.token-btn:hover {
  transform: translateY(-1px);
}

.token-btn-primary {
  color: #fff;
  border-color: color-mix(in srgb, var(--color-primary) 58%, #fff 18%);
  background: linear-gradient(135deg, var(--color-primary), var(--color-accent-strong));
}

.token-btn-ghost {
  color: var(--color-accent);
  border-color: color-mix(in srgb, var(--color-accent) 45%, #fff 12%);
  background: color-mix(in srgb, var(--color-accent) 16%, transparent);
}

.token-btn-neutral {
  color: var(--color-text);
  border-color: var(--color-border-strong);
  background: rgba(15, 23, 42, 0.7);
}

.token-pill {
  display: inline-flex;
  align-items: center;
  border-radius: var(--radius-pill);
  border: 1px solid color-mix(in srgb, var(--color-danger) 38%, #fff 10%);
  background: color-mix(in srgb, var(--color-danger) 16%, transparent);
  color: #fda4af;
  padding: 0.28rem 0.75rem;
  font-size: 0.72rem;
}

.token-note {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--surface-3);
  color: var(--color-text-soft);
  padding: 1rem 1.1rem;
}

.token-link {
  color: var(--color-accent);
  text-decoration: none;
  transition: color var(--motion-fast) ease;
}

.token-link:hover {
  color: color-mix(in srgb, var(--color-accent) 60%, #fff 40%);
}

.theme-light {
  --color-bg: #f4f8ff;
  --color-text: #0f172a;
  --color-text-soft: #334155;
  --color-text-muted: #475569;
  --color-border: rgba(100, 116, 139, 0.34);
  --color-border-strong: rgba(100, 116, 139, 0.5);
  --surface-1: rgba(248, 250, 252, 0.95);
  --surface-2: rgba(241, 245, 249, 0.88);
  --surface-3: rgba(226, 232, 240, 0.62);
}

.site-bg::before,
.site-bg::after {
  content: "";
  position: fixed;
  inset: -15%;
  z-index: -2;
  pointer-events: none;
}

.site-bg::before {
  background:
    radial-gradient(1400px 700px at 15% 25%, rgba(124, 58, 237, 0.30), transparent 65%),
    radial-gradient(1200px 600px at 85% 75%, rgba(34, 211, 238, 0.28), transparent 65%),
    radial-gradient(1000px 500px at 45% 85%, rgba(233, 69, 96, 0.24), transparent 65%);
  filter: blur(58px);
  animation: bgFloat 20s ease-in-out infinite;
}

.site-bg::after {
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.04) 20%, rgba(0, 0, 0, var(--scroll-fade)) 100%),
    radial-gradient(700px 360px at 35% 60%, rgba(233, 69, 96, 0.14), transparent 55%),
    radial-gradient(600px 320px at 65% 35%, rgba(124, 58, 237, 0.16), transparent 55%);
  filter: blur(72px);
  opacity: 0.95;
  z-index: -1;
  animation: bgPulse 14s ease-in-out infinite;
}

.site-header {
  border-bottom: 1px solid rgba(148, 163, 184, 0.24) !important;
  background:
    linear-gradient(180deg, rgba(7, 13, 26, 0.90), rgba(7, 13, 26, 0.70)),
    radial-gradient(460px 110px at 16% 0%, rgba(255, 255, 255, 0.16), transparent 72%);
  box-shadow:
    inset 0 -1px 0 rgba(255, 255, 255, 0.05),
    0 16px 32px rgba(0, 0, 0, 0.28);
}

.header-top {
  display: grid;
  direction: ltr;
  grid-template-columns: minmax(220px, auto) 1fr auto;
  align-items: center;
  gap: 18px;
}

.brand-side {
  display: flex;
  align-items: center;
  justify-self: start;
  min-width: 0;
}

.brand-lockup {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  isolation: isolate;
  max-width: 100%;
}

.brand-lockup::after {
  content: "";
  position: absolute;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  width: 270px;
  height: 54px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(255,255,255,0.17), rgba(255,255,255,0.04) 50%, transparent 80%);
  filter: blur(12px);
  z-index: -1;
}

.brand-logo-shell {
  width: clamp(42px, 6vw, 56px);
  height: clamp(42px, 6vw, 56px);
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  border: 1px solid rgba(203, 213, 225, 0.30);
  background: linear-gradient(160deg, rgba(255,255,255,0.18), rgba(148,163,184,0.08));
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 22px rgba(0,0,0,0.32), inset 0 1px 0 rgba(255,255,255,0.35);
}

.brand-logo-img {
  width: 84%;
  height: 84%;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(255,255,255,0.25));
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand-wordmark {
  font-family: "SpaceGroteskLocal", "Space Grotesk", "Lalezar", sans-serif;
  font-size: clamp(1.15rem, 2vw, 1.8rem);
  letter-spacing: 0.03em;
  font-weight: 700;
  color: #f8fbff;
  line-height: 1.1;
}

.brand-tagline {
  font-family: "SpaceGroteskLocal", "Space Grotesk", sans-serif;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: rgba(226, 232, 240, 0.86);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-nav {
  width: 100%;
  display: flex;
  justify-content: center;
  justify-self: center;
  flex: 1 1 auto;
}

.header-nav > ul {
  direction: rtl;
}

.header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  justify-self: end;
  min-width: 44px;
}

.site-header nav a {
  border-radius: 14px !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.56), rgba(15, 23, 42, 0.54)) !important;
  color: #e6e9ef !important;
  transition: transform .18s ease, background .2s ease, border-color .2s ease, box-shadow .2s ease !important;
}

.site-header nav a:hover {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(124, 58, 237, 0.26), rgba(30, 41, 59, 0.62)) !important;
  border-color: rgba(124, 58, 237, 0.36) !important;
  box-shadow: 0 8px 18px rgba(124, 58, 237, 0.22);
}

.genre-btn {
  border-radius: 999px !important;
  border: 1px solid rgba(148, 163, 184, 0.42) !important;
  background: linear-gradient(135deg, rgba(22, 33, 62, 0.92), rgba(83, 52, 131, 0.75)) !important;
  color: #f8fafc !important;
  transition: transform .2s ease, box-shadow .3s ease, border-color .2s ease !important;
}

.genre-btn:hover {
  transform: translateY(-2px) scale(1.02);
  border-color: rgba(233, 69, 96, 0.78) !important;
  box-shadow: 0 12px 30px rgba(233, 69, 96, 0.35);
}

.surface-card {
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.88), rgba(15, 23, 42, 0.62));
  border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: 0 14px 35px rgba(0, 0, 0, 0.34);
}

.header-search-row {
  display: grid;
  justify-content: center;
  gap: 8px;
  padding-right: 0;
}

.search-shell {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(520px, 100%);
  min-height: 48px;
  position: relative;
  border: 1px solid rgba(203, 213, 225, 0.28);
  border-radius: 16px;
  padding: 6px;
  background:
    linear-gradient(165deg, rgba(255,255,255,0.14), rgba(255,255,255,0.02)),
    rgba(7, 13, 26, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.25),
    0 12px 24px rgba(2, 6, 23, 0.34);
  backdrop-filter: blur(12px);
}

.search-icon {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: rgba(148, 163, 184, 0.88);
  background: rgba(15, 23, 42, 0.56);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.search-input {
  flex: 1;
  min-width: 0;
  border: 0 !important;
  outline: none;
  box-shadow: none;
  appearance: none;
  border-radius: 12px;
  height: 36px;
  padding: 0 12px;
  background: rgba(15, 23, 42, 0.44) !important;
  color: #e2e8f0 !important;
  font-size: 0.94rem;
  font-family: "SpaceGroteskLocal", "Space Grotesk", "Vazirmatn", system-ui, sans-serif;
}

.search-input:focus {
  outline: 2px solid rgba(125, 211, 252, 0.45);
}

.search-input::placeholder {
  color: rgba(148, 163, 184, 0.86);
}

.search-input:-webkit-autofill,
.search-input:-webkit-autofill:hover,
.search-input:-webkit-autofill:focus {
  -webkit-text-fill-color: #e2e8f0;
  -webkit-box-shadow: 0 0 0 1000px rgba(15, 23, 42, 0.44) inset;
  transition: background-color 9999s ease-out;
}

.search-submit {
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: linear-gradient(150deg, rgba(255,255,255,0.22), rgba(34, 211, 238, 0.40), rgba(124, 58, 237, 0.52));
  color: #fff;
  border-radius: 12px;
  height: 36px;
  padding: 0 14px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.search-status {
  min-height: 16px;
  text-align: center;
  font-size: 11px;
  color: #93c5fd;
}

.search-suggest {
  position: absolute;
  inset-inline: 0;
  top: calc(100% + 8px);
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(7, 13, 26, 0.96));
  box-shadow: 0 20px 34px rgba(2, 6, 23, 0.52);
  overflow: hidden;
  z-index: 65;
}

.search-suggest-row {
  width: 100%;
  border: 0;
  padding: 10px;
  text-align: start;
  color: #e2e8f0;
  background: transparent;
  cursor: pointer;
  display: grid;
  grid-template-columns: 46px 1fr;
  align-items: center;
  gap: 10px;
}

.search-suggest-row:hover,
.search-suggest-row.is-active {
  background: rgba(124, 58, 237, 0.22);
}

.search-suggest-thumb {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: rgba(15, 23, 42, 0.75);
}

.search-suggest-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.search-suggest-title {
  display: block;
  font-family: "SpaceGroteskLocal", "Space Grotesk", "Vazirmatn", sans-serif;
  line-height: 1.25;
  font-size: 0.92rem;
}

.search-suggest-meta {
  display: block;
  margin-top: 2px;
  font-size: 0.76rem;
  color: #94a3b8;
}

.search-suggest-empty {
  padding: 11px 12px;
  text-align: center;
  font-size: 0.82rem;
  color: #cbd5e1;
}

.genre-wrap {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.load-more-btn {
  margin: 18px auto 0;
  border: 1px solid rgba(34, 211, 238, 0.5);
  border-radius: 999px;
  padding: 10px 18px;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.72);
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
}

.load-more-btn:hover {
  border-color: rgba(233, 69, 96, 0.6);
  transform: translateY(-1px);
}

.read-analysis-btn {
  border: 1px solid rgba(124, 58, 237, 0.45);
  background: rgba(124, 58, 237, 0.12);
  color: #c4b5fd;
  border-radius: 12px;
  padding: 8px 10px;
  font-size: 12px;
  cursor: pointer;
}

.analysis-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.analysis-modal.is-open {
  display: flex;
}

.analysis-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(5px);
}

.analysis-modal-card {
  position: relative;
  width: min(760px, 100%);
  border-radius: 18px;
  padding: 18px;
  z-index: 1;
}

.analysis-modal-close {
  position: absolute;
  top: 8px;
  left: 8px;
  border: 0;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  font-size: 26px;
  line-height: 1;
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  cursor: pointer;
}

@media (max-width: 980px) {
  .header-top {
    direction: rtl;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .header-nav {
    justify-content: center;
    overflow-x: auto;
    max-width: 100%;
  }

  .header-actions {
    justify-content: center;
    justify-self: center;
  }
}

.skeleton {
  position: relative;
  overflow: hidden;
  background: rgba(148, 163, 184, 0.14);
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  animation: shimmer 1.2s linear infinite;
}

.image-shell {
  position: relative;
  overflow: hidden;
}

.image-shell > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-corner-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  padding: 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: linear-gradient(165deg, rgba(2, 6, 23, 0.68), rgba(2, 6, 23, 0.42));
  box-shadow: 0 8px 16px rgba(0,0,0,0.28);
  z-index: 2;
  pointer-events: none;
}

.image-corner-badge img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.game-title {
  font-family: "Space Grotesk", "Vazirmatn", sans-serif;
  letter-spacing: 0.01em;
}

.image-shell.is-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(148, 163, 184, 0.14);
}

.image-shell.is-loading::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.16), transparent);
  animation: shimmer 1.2s linear infinite;
}

.fade-in {
  animation: fadeIn 0.45s ease forwards;
}

.theme-toggle {
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(15, 23, 42, 0.56);
  color: #e2e8f0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
}

.theme-toggle:hover {
  background: rgba(124, 58, 237, 0.15);
  border-color: rgba(124, 58, 237, 0.35);
}

.theme-light {
  color-scheme: light;
  background: #f8fafc;
  color: #1e293b;
}

.theme-light .site-bg::before,
.theme-light .site-bg::after {
  opacity: 0.15;
  filter: blur(80px);
}

.theme-light .surface-card {
  background: #ffffff;
  border-color: #e2e8f0;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05), 0 2px 4px -1px rgba(0, 0, 0, 0.03);
}

.theme-light .site-header {
  background: rgba(255, 255, 255, 0.9) !important;
  border-bottom: 1px solid #e2e8f0 !important;
  box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
}

.theme-light .brand-logo-shell {
  background: linear-gradient(160deg, rgba(255,255,255,0.92), rgba(203,213,225,0.72));
  border-color: rgba(148, 163, 184, 0.45);
}

.theme-light .search-shell {
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(248,250,252,0.94));
  border-color: #cbd5e1;
}

.theme-light .search-input {
  background: #eef2ff !important;
  color: #1f2937 !important;
}

.theme-light .search-icon {
  color: #64748b;
  border-color: #cbd5e1;
  background: #f8fafc;
}

.theme-light .search-suggest {
  border-color: #cbd5e1;
  background: linear-gradient(180deg, rgba(255,255,255,0.99), rgba(248,250,252,0.99));
}

.theme-light .search-suggest-row {
  color: #1e293b;
}

.theme-light .search-suggest-row:hover,
.theme-light .search-suggest-row.is-active {
  background: rgba(59, 130, 246, 0.12);
}

.theme-light .search-suggest-meta {
  color: #64748b;
}

.theme-light .search-status {
  color: #475569;
}

.theme-light .image-corner-badge {
  border-color: rgba(148, 163, 184, 0.42);
  background: linear-gradient(165deg, rgba(248, 250, 252, 0.94), rgba(241, 245, 249, 0.78));
}

.theme-light .site-header nav a {
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  color: #475569 !important;
}

.theme-light .site-header nav a:hover {
  background: #e0e7ff !important;
  border-color: #c7d2fe !important;
  color: #4338ca !important;
}

.theme-light .genre-btn {
  background: #f1f5f9 !important;
  border-color: #e2e8f0 !important;
  color: #475569 !important;
}

.theme-light .genre-btn:hover {
  background: #e0e7ff !important;
  border-color: #c7d2fe !important;
  color: #4338ca !important;
}

.theme-light .text-slate-300 {
  color: #64748b;
}

.theme-light .text-slate-400 {
  color: #94a3b8;
}

.theme-light .text-white {
  color: #0f172a;
}

.theme-light .theme-toggle {
  background: #f1f5f9;
  border-color: #e2e8f0;
  color: #475569;
}

.theme-light .theme-toggle:hover {
  background: #e2e8f0;
  border-color: #cbd5e1;
}

@keyframes shimmer {
  to { transform: translateX(100%); }
}

@keyframes bgFloat {
  0%, 100% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(6px, -10px, 0) scale(1.03); }
}

@keyframes bgPulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

@media (max-width: 780px) {
  .brand-lockup::after {
    width: 180px;
    right: 14px;
  }

  .brand-tagline {
    max-width: 170px;
    font-size: 0.56rem;
    letter-spacing: 0.13em;
  }

  .site-header nav {
    width: 100%;
    justify-content: center;
  }

  .search-shell {
    width: min(100%, 460px);
  }
}

@media (min-width: 860px) {
  .genre-wrap {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

/* ------------------------------------------------------------------
   v4 Modern Header / Showcase / Footer
------------------------------------------------------------------- */
.site-header {
  position: sticky;
  isolation: isolate;
  overflow: visible;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22) !important;
  background:
    linear-gradient(180deg, rgba(4, 10, 24, 0.97), rgba(4, 10, 24, 0.82)) !important;
}

.site-header::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(380px 120px at 50% 0%, rgba(255, 255, 255, 0.18), rgba(255, 255, 255, 0) 76%),
    linear-gradient(180deg, rgba(148, 197, 255, 0.06), rgba(255, 255, 255, 0));
  z-index: -1;
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -16px;
  height: 24px;
  pointer-events: none;
  background: radial-gradient(60% 100% at 50% 0%, rgba(125, 211, 252, 0.18), rgba(125, 211, 252, 0) 80%);
  filter: blur(12px);
  animation: headerFlicker 4.8s ease-in-out infinite;
}

@keyframes headerFlicker {
  0%, 100% {
    opacity: 0.82;
    transform: translateY(0px);
    filter: blur(12px);
  }
  38% {
    opacity: 0.96;
    transform: translateY(1px);
    filter: blur(14px);
  }
  63% {
    opacity: 0.72;
    transform: translateY(-1px);
    filter: blur(10px);
  }
}

.header-top {
  direction: ltr;
  display: grid;
  grid-template-columns: minmax(210px, auto) 1fr minmax(320px, auto);
  align-items: center;
  gap: 14px;
}

.brand-side {
  justify-self: start;
  align-items: center;
}

.brand-lockup {
  gap: 10px;
}

.brand-logo-shell {
  display: none !important;
}

.brand-logo-plain {
  width: clamp(50px, 5.2vw, 62px);
  height: clamp(50px, 5.2vw, 62px);
  object-fit: contain;
  filter: contrast(1.18) saturate(1.16) drop-shadow(0 0 12px rgba(255, 255, 255, 0.32));
}

.brand-copy {
  gap: 0;
}

.brand-wordmark {
  font-size: clamp(1.08rem, 1.8vw, 1.52rem);
  letter-spacing: 0.035em;
  line-height: 1.05;
}

.brand-tagline {
  font-size: 0.57rem;
  letter-spacing: 0.14em;
}

.header-nav {
  justify-content: center;
}

.header-nav > ul {
  direction: rtl;
  align-items: center;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  justify-self: end;
}

.header-actions .theme-toggle {
  order: 2;
}

.header-actions .search-status {
  display: none;
}

.header-search-shell {
  width: clamp(300px, 32vw, 460px);
  min-height: 42px;
}

.search-shell {
  min-height: 42px;
  border-radius: 14px;
  border-color: rgba(148, 163, 184, 0.24);
  background:
    linear-gradient(170deg, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0.01)),
    rgba(8, 15, 33, 0.82);
}

.search-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
}

.search-input {
  height: 32px;
  padding: 0 10px;
  font-size: 0.88rem;
}

.search-submit {
  height: 32px;
  padding: 0 12px;
  font-size: 0.8rem;
  border-radius: 10px;
}

.search-suggest {
  top: calc(100% + 7px);
}

.showcase-shell {
  border: 1px solid rgba(148, 163, 184, 0.2);
  background:
    radial-gradient(540px 180px at 50% 0%, rgba(255, 255, 255, 0.11), rgba(255, 255, 255, 0) 75%),
    linear-gradient(160deg, rgba(8, 16, 36, 0.96), rgba(8, 16, 36, 0.72));
  box-shadow: 0 16px 34px rgba(2, 6, 23, 0.45);
}

.showcase-intro {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.showcase-kicker {
  font-size: 0.74rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: rgba(125, 211, 252, 0.95);
}

.showcase-heading {
  font-family: "Lalezar", "Vazirmatn", sans-serif;
  color: #f8fbff;
  font-size: clamp(1.25rem, 2.8vw, 2rem);
  line-height: 1.3;
}

.showcase-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.showcase-panel {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 14px;
  background: linear-gradient(170deg, rgba(15, 23, 42, 0.82), rgba(2, 6, 23, 0.82));
}

.showcase-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.showcase-panel-title {
  font-size: 1rem;
  color: #f8fafc;
  font-weight: 700;
}

.showcase-chip {
  font-size: 0.7rem;
  color: #7dd3fc;
  border: 1px solid rgba(125, 211, 252, 0.4);
  background: rgba(125, 211, 252, 0.08);
  border-radius: 999px;
  padding: 3px 8px;
}

.showcase-top-list {
  display: grid;
  gap: 10px;
}

.showcase-rank-item {
  display: grid;
  grid-template-columns: auto 56px 1fr auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  padding: 8px;
  background: rgba(15, 23, 42, 0.5);
}

.showcase-rank-no {
  width: 30px;
  height: 30px;
  border-radius: 9px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #e0f2fe;
  background: linear-gradient(155deg, rgba(59, 130, 246, 0.52), rgba(99, 102, 241, 0.42));
}

.showcase-rank-thumb {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.3);
}

.showcase-rank-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.showcase-rank-title {
  font-size: 0.9rem;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.2;
}

.showcase-rank-meta {
  margin-top: 3px;
  font-size: 0.73rem;
  color: #94a3b8;
}

.showcase-rank-score {
  font-size: 0.74rem;
  color: #67e8f9;
  border: 1px solid rgba(34, 211, 238, 0.4);
  border-radius: 999px;
  padding: 3px 8px;
  white-space: nowrap;
}

.showcase-carousel {
  overflow: hidden;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: rgba(2, 6, 23, 0.42);
}

.showcase-track {
  display: flex;
  align-items: stretch;
  width: max-content;
  gap: 10px;
  padding: 10px;
}

.showcase-track.is-animated {
  animation: showcaseScroll 30s linear infinite;
}

@keyframes showcaseScroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

.showcase-up-item {
  min-width: 220px;
  width: 220px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.78);
}

.showcase-up-thumb {
  height: 120px;
  width: 100%;
}

.showcase-up-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.showcase-up-copy {
  padding: 9px 10px 10px;
}

.showcase-up-title {
  color: #f8fafc;
  font-size: 0.78rem;
  line-height: 1.25;
  font-weight: 700;
}

.showcase-up-meta {
  margin-top: 2px;
  font-size: 0.67rem;
  color: #94a3b8;
}

.showcase-loading {
  font-size: 0.82rem;
  color: #94a3b8;
  padding: 10px;
  text-align: center;
}

.site-footer {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(520px 170px at 50% 0%, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0) 75%),
    linear-gradient(180deg, rgba(2, 6, 23, 0.97), rgba(2, 6, 23, 0.9));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 -14px 24px rgba(15, 23, 42, 0.32);
}

.site-footer::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 24px;
  pointer-events: none;
  background: radial-gradient(65% 100% at 50% 100%, rgba(125, 211, 252, 0.22), rgba(125, 211, 252, 0) 80%);
  filter: blur(10px);
}

.review-detail-block {
  margin-top: 8px;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  padding-top: 8px;
}

.review-detail-line {
  font-size: 0.78rem;
  line-height: 1.7;
  color: #cbd5e1;
}

@media (min-width: 960px) {
  .showcase-grid {
    grid-template-columns: 1.06fr 0.94fr;
  }
}

@media (max-width: 980px) {
  .header-top {
    grid-template-columns: 1fr;
    direction: rtl;
    gap: 10px;
  }

  .header-nav {
    justify-content: center;
    order: 2;
  }

  .header-actions {
    justify-content: stretch;
    justify-self: stretch;
    order: 3;
    display: grid;
    gap: 6px;
  }

  .header-actions .theme-toggle {
    justify-self: center;
    order: 2;
  }

  .header-actions .search-status {
    display: block;
    text-align: center;
    order: 3;
  }

  .header-search-shell {
    width: min(100%, 560px);
    justify-self: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-header::after,
  .showcase-track.is-animated {
    animation: none !important;
  }
}

/* ------------------------------------------------------------------
   v4 Polish: Header/Search/Light-Mode
------------------------------------------------------------------- */
.header-top {
  grid-template-columns: minmax(230px, auto) 1fr minmax(280px, auto);
  gap: 12px;
}

.brand-logo-plain {
  width: clamp(56px, 5.6vw, 68px);
  height: clamp(56px, 5.6vw, 68px);
}

.header-actions {
  min-width: 0;
}

.header-search-shell {
  width: clamp(260px, 28vw, 390px);
  margin-inline-start: auto;
}

.search-shell {
  min-height: 40px;
  padding: 4px 6px;
}

.search-input {
  height: 30px;
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
  color: #e2e8f0 !important;
  font-family: "SpaceGroteskLocal", "Space Grotesk", "Vazirmatn", system-ui, sans-serif !important;
}

.search-input::placeholder {
  color: rgba(226, 232, 240, 0.62) !important;
}

.search-submit {
  height: 30px;
  padding: 0 11px;
}

.theme-light {
  background: #e6edf8;
  color: #142033;
}

.theme-light .site-bg::before,
.theme-light .site-bg::after {
  opacity: 0.26;
}

.theme-light .site-header {
  background:
    linear-gradient(180deg, rgba(224, 233, 246, 0.95), rgba(216, 227, 243, 0.88)) !important;
  border-bottom: 1px solid rgba(100, 116, 139, 0.34) !important;
}

.theme-light .surface-card {
  background: linear-gradient(180deg, rgba(248, 251, 255, 0.96), rgba(240, 246, 255, 0.9));
  border-color: rgba(148, 163, 184, 0.3);
}

.theme-light .search-shell {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.94), rgba(233, 241, 252, 0.9)),
    rgba(236, 243, 252, 0.92);
  border-color: rgba(100, 116, 139, 0.34);
}

.theme-light .search-input {
  color: #0f172a !important;
}

.theme-light .search-input::placeholder {
  color: rgba(71, 85, 105, 0.72) !important;
}

.theme-light .review-detail-line {
  color: #334155;
}

.site-header::after {
  animation: none !important;
  opacity: 0.88;
}

.showcase-shell {
  border-radius: 20px;
}

.showcase-panel {
  padding: 10px;
  border-radius: 14px;
}

.showcase-rank-item {
  grid-template-columns: auto 46px 1fr auto;
  padding: 7px;
}

.showcase-rank-thumb {
  width: 46px;
  height: 46px;
}

.showcase-up-item {
  min-width: 152px;
  width: 152px;
}

.showcase-up-thumb {
  height: 82px;
}

.showcase-track {
  gap: 6px;
  padding: 6px;
  width: 100%;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.showcase-track::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

.showcase-track.is-animated {
  animation: none !important;
}

.image-corner-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
}

.image-corner-badge img {
  width: 34px;
  height: 34px;
}

.profile-btn {
  height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.28);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 600;
}

.profile-btn-avatar {
  display: inline-flex;
  width: 20px;
  height: 20px;
  align-items: center;
  justify-content: center;
}

.profile-btn.is-authenticated {
  border-color: rgba(34, 211, 238, 0.55);
  background: rgba(34, 211, 238, 0.12);
}

.auth-dialog {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
}

.auth-dialog-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.65);
  opacity: 0;
  transition: opacity .18s ease;
}

.auth-dialog-card {
  position: relative;
  width: min(92vw, 420px);
  border-radius: 20px;
  padding: 20px;
  transform: translateY(10px) scale(0.98);
  opacity: 0;
  transition: opacity .18s ease, transform .18s ease;
}

.auth-dialog.is-open .auth-dialog-backdrop {
  opacity: 1;
}

.auth-dialog.is-open .auth-dialog-card {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.auth-close {
  position: absolute;
  top: 8px;
  left: 10px;
  border: 0;
  background: transparent;
  color: #94a3b8;
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}

.auth-input {
  width: 100%;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(2, 6, 23, 0.65);
  color: #e2e8f0;
  padding: 10px 12px;
}

.auth-actions {
  display: flex;
  gap: 8px;
}

.auth-btn {
  flex: 1 1 0;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(30, 41, 59, 0.8);
  color: #e2e8f0;
  padding: 9px 10px;
  font-size: 0.82rem;
  font-weight: 600;
}

.auth-btn-primary {
  border-color: rgba(34, 211, 238, 0.46);
  background: linear-gradient(120deg, rgba(59, 130, 246, 0.68), rgba(34, 211, 238, 0.62));
  color: #f8fafc;
}

.auth-status {
  min-height: 20px;
  margin-top: 10px;
  font-size: 0.8rem;
  color: #7dd3fc;
}

.auth-status.is-error {
  color: #fca5a5;
}

.auth-dashboard-link {
  display: inline-flex;
  margin-top: 10px;
  color: #67e8f9;
  font-size: 0.8rem;
  text-decoration: none;
}

.theme-light .profile-btn {
  background: rgba(241, 245, 249, 0.92);
  color: #0f172a;
  border-color: rgba(100, 116, 139, 0.36);
}

.theme-light .auth-input {
  background: rgba(248, 250, 252, 0.95);
  color: #0f172a;
  border-color: rgba(148, 163, 184, 0.5);
}

/* Layout stability for footer across short pages */
.site-bg {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
}

.app-main {
  flex: 1 1 auto;
  width: 100%;
  min-height: 0;
}

footer {
  margin-top: auto;
}

.quick-refresh-btn {
  position: fixed;
  top: 84px;
  right: 16px;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(34, 211, 238, 0.55);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.86);
  color: #67e8f9;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.35);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity .2s ease, transform .2s ease, visibility .2s ease;
  z-index: 70;
}

.quick-refresh-btn.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Main showcase slider: stable compact grid instead of oversized scroller */
.showcase-carousel {
  overflow: hidden;
}

.showcase-track {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 8px;
  padding: 6px;
  width: 100%;
  overflow-x: hidden;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.showcase-track::-webkit-scrollbar {
  width: 0 !important;
  height: 0 !important;
  display: none !important;
}

.showcase-up-item {
  width: 100%;
  min-width: 0;
}

@media (max-width: 720px) {
  .showcase-track {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Arcade animated background layer */
.arcade-bg-layer {
  position: fixed;
  inset: 0;
  z-index: -3;
  pointer-events: none;
  overflow: hidden;
}

.arcade-bg-item {
  position: absolute;
  display: block;
  opacity: 0.2;
  filter: saturate(1.08);
  will-change: transform, opacity;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  contain: paint;
}

.arcade-bg-item img {
  width: clamp(120px, 18vw, 240px);
  height: auto;
  display: block;
  opacity: var(--breath-min, 0.2);
  animation: arcadeBreath var(--breath-duration, 11s) ease-in-out infinite;
  animation-delay: var(--breath-delay, 0s);
  will-change: opacity, transform;
}

.arcade-bg-item-1 { left: 2%; top: 10%; animation: arcadeFloatA 20s ease-in-out infinite; }
.arcade-bg-item-2 { right: 4%; top: 12%; animation: arcadeFloatB 24s ease-in-out infinite; }
.arcade-bg-item-3 { left: 10%; bottom: 10%; animation: arcadeFloatC 22s ease-in-out infinite; }
.arcade-bg-item-4 { right: 14%; bottom: 12%; animation: arcadeFloatA 26s ease-in-out infinite reverse; }
.arcade-bg-item-5 { left: 38%; top: 5%; animation: arcadeFloatB 19s ease-in-out infinite; }
.arcade-bg-item-6 { right: 34%; bottom: 6%; animation: arcadeFloatC 23s ease-in-out infinite; }
.arcade-bg-item-7 { left: 22%; top: 36%; animation: arcadeFloatA 28s ease-in-out infinite; }
.arcade-bg-item-8 { right: 22%; top: 34%; animation: arcadeFloatB 30s ease-in-out infinite reverse; }
.arcade-bg-item-9 { left: 46%; bottom: 16%; animation: arcadeFloatC 27s ease-in-out infinite; }

@keyframes arcadeFloatA {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(-2deg); }
  35% { transform: translate3d(28px, 18px, 0) rotate(2deg); }
  70% { transform: translate3d(-14px, -12px, 0) rotate(-1deg); }
}

@keyframes arcadeFloatB {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(1deg); }
  40% { transform: translate3d(-24px, 16px, 0) rotate(-3deg); }
  80% { transform: translate3d(12px, -14px, 0) rotate(2deg); }
}

@keyframes arcadeFloatC {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(20px, -18px, 0) rotate(3deg); }
}

@keyframes arcadeBreath {
  0%, 100% { opacity: var(--breath-min, 0.2); }
  50% { opacity: var(--breath-max, 1); }
}

.arcade-bg-layer.is-low-power .arcade-bg-item {
  filter: saturate(1.02);
}

.arcade-bg-layer.is-low-power .arcade-bg-item img {
  animation-timing-function: linear;
}

/* Manual horizontal showcase scroll (no auto slider animation) */
.showcase-track {
  display: flex !important;
  align-items: stretch;
  flex-wrap: nowrap;
  overflow-x: auto !important;
  overflow-y: hidden;
  padding: 8px;
  gap: 8px;
  scrollbar-width: thin !important;
  scrollbar-color: rgba(34, 211, 238, 0.7) rgba(15, 23, 42, 0.45);
}

.showcase-track::-webkit-scrollbar {
  width: 10px !important;
  height: 10px !important;
  display: block !important;
}

.showcase-track::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.45);
  border-radius: 999px;
}

.showcase-track::-webkit-scrollbar-thumb {
  background: linear-gradient(120deg, rgba(34, 211, 238, 0.78), rgba(124, 58, 237, 0.78));
  border-radius: 999px;
}

.showcase-track.is-animated {
  animation: none !important;
}

.showcase-up-item {
  min-width: 170px;
  width: 170px;
  flex: 0 0 auto;
}

.showcase-up-thumb {
  height: 90px;
}

.header-actions {
  gap: 10px;
}

.profile-btn {
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .arcade-bg-item img {
    width: clamp(88px, 22vw, 160px);
  }
  .arcade-bg-item {
    opacity: 0.18;
  }
}

@media (prefers-reduced-motion: reduce) {
  .arcade-bg-item,
  .arcade-bg-item img {
    animation: none !important;
    opacity: 0.2 !important;
  }
}

/* Profile dropdown refresh */
.header-actions {
  position: relative;
}

.profile-btn {
  position: relative;
  height: 38px;
  padding: 0 12px;
  gap: 7px;
  border-radius: 999px;
  border: 1px solid rgba(125, 211, 252, 0.42);
  background: linear-gradient(140deg, rgba(15, 23, 42, 0.92), rgba(30, 41, 59, 0.82));
  box-shadow: 0 8px 18px rgba(2, 6, 23, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.profile-btn:hover {
  border-color: rgba(34, 211, 238, 0.68);
  transform: translateY(-1px);
}

.profile-btn-label {
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-btn-avatar {
  width: 18px;
  height: 18px;
  font-size: 0.85rem;
}

.profile-dropdown {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(92vw, 320px);
  border: 1px solid rgba(148, 163, 184, 0.34);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.96), rgba(15, 23, 42, 0.96));
  box-shadow: 0 18px 36px rgba(2, 6, 23, 0.56);
  transform: translateY(6px) scale(0.985);
  opacity: 0;
  pointer-events: none;
  z-index: 80;
  transition: opacity .16s ease, transform .16s ease;
}

.profile-dropdown.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.profile-dropdown-body {
  padding: 12px;
}

.profile-dropdown-head {
  margin-bottom: 10px;
}

.profile-dd-title {
  margin: 0;
  font-weight: 700;
  color: #f8fafc;
  font-size: 0.92rem;
}

.profile-dd-sub {
  margin: 2px 0 0;
  font-size: 0.72rem;
  color: #94a3b8;
}

.auth-form-inline {
  display: grid;
  gap: 8px;
}

.auth-input {
  min-height: 38px;
}

.profile-menu-links {
  display: grid;
  gap: 6px;
}

.profile-menu-link {
  width: 100%;
  text-align: right;
  text-decoration: none;
  display: inline-flex;
  justify-content: flex-start;
  align-items: center;
  min-height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(30, 41, 59, 0.58);
  color: #e2e8f0;
  padding: 0 10px;
  font-size: 0.8rem;
  cursor: pointer;
}

.profile-menu-link:hover {
  border-color: rgba(34, 211, 238, 0.5);
  background: rgba(30, 41, 59, 0.8);
}

.profile-menu-link.danger {
  color: #fda4af;
  border-color: rgba(244, 63, 94, 0.3);
}

.theme-light .profile-dropdown {
  background: linear-gradient(180deg, rgba(248, 250, 252, 0.98), rgba(241, 245, 249, 0.98));
  border-color: rgba(100, 116, 139, 0.34);
}

.theme-light .profile-dd-title {
  color: #0f172a;
}

.theme-light .profile-dd-sub {
  color: #64748b;
}

.theme-light .profile-menu-link {
  color: #0f172a;
  background: rgba(241, 245, 249, 0.92);
  border-color: rgba(148, 163, 184, 0.34);
}

.pager-btn {
  min-width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.34);
  background: rgba(15, 23, 42, 0.72);
  color: #cbd5e1;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
}

.pager-btn:hover {
  border-color: rgba(34, 211, 238, 0.6);
  color: #ecfeff;
}

.pager-btn.is-active {
  border-color: rgba(34, 211, 238, 0.68);
  background: linear-gradient(120deg, rgba(59, 130, 246, 0.7), rgba(34, 211, 238, 0.62));
  color: #fff;
}

.theme-light .pager-btn {
  background: rgba(248, 250, 252, 0.94);
  color: #0f172a;
  border-color: rgba(100, 116, 139, 0.34);
}

/* FINAL OVERRIDE: disable auto showcase slider everywhere */
#showcase-upcoming-track,
.showcase-track,
.showcase-track.is-animated {
  animation: none !important;
  transition: none !important;
  transform: none !important;
}

/* FINAL OVERRIDE: keep upcoming games compact and prevent UI break */
#showcase-hero .showcase-carousel {
  overflow: hidden;
  border-radius: 14px;
}

#showcase-upcoming-track.showcase-track {
  display: flex !important;
  flex-wrap: nowrap !important;
  align-items: stretch;
  gap: 10px;
  padding: 8px;
  width: 100%;
  max-width: 100%;
  overflow-x: auto !important;
  overflow-y: hidden !important;
}

#showcase-upcoming-track .showcase-up-item {
  flex: 0 0 180px;
  width: 180px;
  min-width: 180px;
  max-width: 180px;
  border-radius: 12px;
}

#showcase-upcoming-track .showcase-up-thumb {
  height: 96px;
}

#showcase-upcoming-track .showcase-up-title {
  font-size: 0.78rem;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.05em;
}

#showcase-upcoming-track .showcase-up-meta {
  font-size: 0.66rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 640px) {
  #showcase-upcoming-track .showcase-up-item {
    flex-basis: 160px;
    width: 160px;
    min-width: 160px;
    max-width: 160px;
  }

  #showcase-upcoming-track .showcase-up-thumb {
    height: 88px;
  }
}

/* FINAL OVERRIDE: viewport safety + mobile burger nav */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  min-width: 0;
}

img,
svg,
video,
canvas {
  max-width: 100%;
}

.surface-card,
.showcase-shell,
.showcase-panel,
.showcase-rank-item,
.showcase-up-item,
#games-container > article,
#reviews-feed > article,
#news-feed > article {
  max-width: 100%;
}

.header-top,
.header-nav,
.header-actions,
.header-search-shell,
.search-shell {
  max-width: 100%;
  min-width: 0;
}

.mobile-menu-toggle {
  display: none;
}

@media (max-width: 980px) {
  .header-top {
    grid-template-columns: minmax(0, 1fr) auto;
    direction: ltr;
    align-items: center;
    gap: 10px;
  }

  .brand-side {
    min-width: 0;
    overflow: hidden;
  }

  .mobile-menu-toggle {
    display: inline-flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 4px;
    width: 38px;
    height: 38px;
    border-radius: 11px;
    border: 1px solid rgba(148, 163, 184, 0.35);
    background: rgba(15, 23, 42, 0.82);
    color: #f8fafc;
    flex: 0 0 auto;
    position: relative;
    z-index: 6;
  }

  .mobile-menu-toggle-line {
    display: block;
    width: 18px;
    height: 2px;
    border-radius: 999px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
  }

  .site-header.is-menu-open .mobile-menu-toggle-line:nth-child(1) {
    transform: translateY(6px) rotate(45deg);
  }

  .site-header.is-menu-open .mobile-menu-toggle-line:nth-child(2) {
    opacity: 0;
  }

  .site-header.is-menu-open .mobile-menu-toggle-line:nth-child(3) {
    transform: translateY(-6px) rotate(-45deg);
  }

  .header-actions {
    grid-column: 1 / -1;
    order: 2;
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 8px;
  }

  .header-search-shell {
    width: 100% !important;
    flex: 1 1 100%;
    margin: 0;
  }

  .search-shell {
    width: 100%;
  }

  .header-nav {
    grid-column: 1 / -1;
    order: 3;
    width: 100%;
    display: block !important;
    justify-content: stretch;
    max-height: 0;
    opacity: 0;
    overflow: hidden;
    transform: translateY(-6px);
    pointer-events: none;
    transition: max-height 0.22s ease, opacity 0.18s ease, transform 0.18s ease;
  }

  .site-header.is-menu-open .header-nav {
    max-height: 360px;
    opacity: 1;
    overflow: visible;
    transform: translateY(0);
    pointer-events: auto;
  }

  .header-nav > ul {
    width: 100%;
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 6px 0 2px;
  }

  .header-nav > ul > li,
  .header-nav > ul > li > a {
    width: 100%;
  }

  .header-nav > ul > li > a {
    display: block;
    text-align: center;
  }
}

#reviews-heading {
  text-wrap: balance;
  line-height: 1.25;
}

#reviews-feed .game-title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (max-width: 640px) {
  .brand-tagline {
    display: none;
  }

  .brand-wordmark {
    font-size: 1rem;
  }

  .brand-logo-plain {
    width: 46px;
    height: 46px;
  }
}

/* Search overlay + mobile-safe suggestions */
.search-results-overlay {
  position: fixed;
  inset: 0;
  z-index: 120;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease;
}

.search-results-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.search-results-overlay-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.82);
  backdrop-filter: blur(8px);
}

.search-results-panel {
  position: relative;
  z-index: 1;
  width: min(1200px, 96vw);
  height: min(92vh, 960px);
  margin: 4vh auto;
  border-radius: 20px;
  border: 1px solid rgba(148, 163, 184, 0.32);
  background: linear-gradient(180deg, rgba(2, 6, 23, 0.97), rgba(15, 23, 42, 0.97));
  display: grid;
  grid-template-rows: auto 1fr;
  overflow: hidden;
}

.search-results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 14px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
}

.search-results-title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: #f8fafc;
}

.search-results-subtitle {
  margin: 2px 0 0;
  font-size: 0.74rem;
  color: #94a3b8;
}

.search-results-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.38);
  background: rgba(15, 23, 42, 0.72);
  color: #e2e8f0;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}

.search-results-body {
  overflow: auto;
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(1, minmax(0, 1fr));
  gap: 14px;
}

.search-results-body .surface-card,
.search-results-body article {
  max-width: 100%;
}

body.search-overlay-open {
  overflow: hidden;
}

@media (min-width: 760px) {
  .search-results-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (min-width: 1240px) {
  .search-results-body {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 980px) {
  body.search-suggest-open {
    overflow: hidden;
  }

  .search-suggest {
    position: fixed;
    left: 10px;
    right: 10px;
    top: 80px;
    max-height: 65vh;
    overflow-y: auto;
    border-radius: 18px;
    z-index: 110;
    box-shadow: 0 20px 40px rgba(2, 6, 23, 0.54);
  }

  .search-results-panel {
    width: 100vw;
    height: 100vh;
    margin: 0;
    border-radius: 0;
    border: 0;
  }
}
