*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #0a0c12;
  --surface: #13161f;
  --surface-2: #1c2030;
  --surface-glass: #13161f;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f0f2f8;
  --text-muted: #8b95a8;
  --accent: #7c6cf0;
  --accent-hover: #9488f5;
  --accent-glow: rgba(124, 108, 240, 0.35);
  --success: #2dd4a8;
  --warning: #f5a623;
  --warning-bg: rgba(245, 166, 35, 0.1);
  --rail-width: 48px;
  --iframe-min-height: 160vh;
  --topbar-height: 68px;
  --radius: 16px;
  --radius-sm: 10px;
  --font: "Vazirmatn", system-ui, sans-serif;
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, 0.45), 0 0 0 1px var(--border);
  --shadow-frame: 0 8px 40px rgba(0, 0, 0, 0.5);
}

html {
  scroll-behavior: auto;
  scroll-padding-top: calc(var(--topbar-height) + 1rem);
}

[id] {
  scroll-margin-top: calc(var(--topbar-height) + 1rem);
}

body {
  font-family: var(--font);
  background:
    radial-gradient(ellipse 80% 40% at 50% -5%, rgba(124, 108, 240, 0.14), transparent 55%),
    var(--bg);
  color: var(--text);
  line-height: 1.7;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  position: relative;
  padding-top: var(--topbar-height);
}

.bg-glow {
  display: none;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color 0.2s;
}

a:hover {
  color: var(--accent-hover);
}

.container {
  width: min(1180px, 100% - 2rem);
  margin-inline: auto;
  position: relative;
  z-index: 1;
}

/* Fixed top bar */
.site-topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 300;
  background: rgba(19, 22, 31, 0.96);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.28);
}

.topbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: var(--topbar-height);
  padding-block: 0.45rem;
  position: relative;
  z-index: 30;
}

.brand-text {
  min-width: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-width: 0;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: opacity 0.2s, transform 0.15s;
  min-width: 0;
}

.brand-link:hover {
  color: inherit;
  opacity: 0.92;
  transform: translateY(-1px);
}

.brand-title {
  font-size: clamp(0.95rem, 2.5vw, 1.15rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
  background: linear-gradient(135deg, #fff 30%, #c4bdf5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-mark {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border-strong);
  box-shadow: 0 0 16px var(--accent-glow);
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: left center;
  display: block;
}

.brand-ai-badge {
  position: absolute;
  left: 4px;
  bottom: 4px;
  padding: 0.1rem 0.35rem;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent), #2dd4a8);
  color: #fff;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  line-height: 1.3;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.brand-icon {
  font-size: 2.25rem;
  line-height: 1;
  filter: drop-shadow(0 0 16px var(--accent-glow));
}

.brand h1 {
  font-size: clamp(1.2rem, 3vw, 1.6rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #fff 30%, #c4bdf5);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.brand-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.05rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-by {
  color: var(--accent);
  font-weight: 600;
}

.header-nav a[aria-current="page"] {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.header-nav a,
.nav-trigger {
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid transparent;
  transition: all 0.2s;
  background: transparent;
  font-family: inherit;
  cursor: pointer;
}

.header-nav a:hover,
.nav-trigger:hover,
.nav-item--dropdown.is-open .nav-trigger {
  color: var(--text);
  background: var(--surface-2);
  border-color: var(--border);
}

.nav-item--dropdown {
  position: relative;
  z-index: 40;
}

.nav-item--dropdown.is-open {
  z-index: 50;
}

.nav-trigger {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.nav-chevron {
  font-size: 0.7rem;
  transition: transform 0.2s;
}

.nav-item--dropdown.is-open .nav-chevron {
  transform: rotate(180deg);
}

.cat-dropdown {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  z-index: 200;
  width: min(520px, calc(100vw - 2rem));
  background: linear-gradient(165deg, #1c2030 0%, #13161f 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(124, 108, 240, 0.08);
  padding: 0.75rem;
  animation: catDropIn 0.18s ease-out;
}

@keyframes catDropIn {
  from {
    opacity: 0;
    transform: translateY(-6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cat-dropdown-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.4rem;
}

.cat-item {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  width: 100%;
  text-align: right;
  padding: 0.75rem;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
}

.cat-item:hover {
  background: rgba(124, 108, 240, 0.12);
  border-color: rgba(124, 108, 240, 0.25);
  transform: translateY(-1px);
}

.cat-item--featured {
  grid-column: 1 / -1;
  background: rgba(124, 108, 240, 0.08);
  border-color: rgba(124, 108, 240, 0.2);
}

.cat-item-icon {
  font-size: 1.25rem;
  line-height: 1.2;
  flex-shrink: 0;
}

.cat-item-body {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
}

.cat-item-title {
  font-size: 0.9rem;
  font-weight: 700;
}

.cat-item-desc {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.cat-dropdown-footer {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid var(--border);
  text-align: center;
}

.cat-dropdown-footer a {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  border: none;
  padding: 0.35rem 0.5rem;
}

.cat-dropdown-footer a:hover {
  background: transparent;
  color: var(--accent-hover);
}

.intro-cat-link {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--accent);
  cursor: pointer;
  font-weight: 600;
}

.intro-cat-link:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

@media (max-width: 640px) {
  .cat-dropdown {
    right: auto;
    left: 0;
    width: min(100vw - 1.5rem, 360px);
  }

  .cat-dropdown-grid {
    grid-template-columns: 1fr;
  }
}

.intro-banner {
  position: relative;
  z-index: 1;
  margin-top: 1rem;
  margin-bottom: 0.75rem;
  background: linear-gradient(135deg, var(--surface-2) 0%, var(--surface) 100%);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.intro-banner p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}

.intro-banner strong {
  color: var(--text);
}

.feature-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  list-style: none;
  font-size: 0.82rem;
}

.feature-list li {
  color: var(--text-muted);
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 999px;
  border: 1px solid var(--border);
}

.feature-list li::before {
  content: "✓ ";
  color: var(--success);
  font-weight: 700;
}

/* Embed section */
.embed-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
  z-index: 1;
  padding-bottom: 2rem;
}

.embed-toolbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 1;
}

.embed-toolbar-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 56px;
  flex-wrap: wrap;
  padding-block: 0.6rem;
}

.embed-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.embed-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
  text-decoration: none;
  white-space: nowrap;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #6355d8);
  color: #fff;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  color: #fff;
  box-shadow: 0 6px 28px var(--accent-glow);
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: #252a3d;
  color: var(--text);
}

.btn-google {
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  flex-shrink: 0;
}

.btn-google:hover {
  background: #f8f9fa;
  color: #3c4043;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
}

.btn-block {
  width: 100%;
}

.google-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sync-toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1100;
  padding: 0.75rem 1.25rem;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  font-size: 0.85rem;
  color: var(--text);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: toastIn 0.3s ease-out;
  max-width: min(90vw, 420px);
  text-align: center;
}

.sync-toast.hidden {
  display: none;
}

.back-to-top {
  position: fixed;
  left: 1.25rem;
  bottom: 1.25rem;
  z-index: 250;
  width: 46px;
  height: 46px;
  border: 1px solid var(--border-strong);
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #6355d8);
  color: #fff;
  font-size: 1.25rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 8px 24px var(--accent-glow);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px);
  transition: opacity 0.2s, transform 0.2s, visibility 0.2s;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  transform: translateY(-2px);
}

.login-return-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.login-return-card {
  width: min(420px, 100%);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 2rem 1.5rem;
  text-align: center;
  box-shadow: var(--shadow-lg);
}

.login-return-card h1 {
  font-size: 1.2rem;
  margin-bottom: 0.75rem;
}

.login-return-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.25rem;
}

.login-return-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.btn-large {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
}

/* Embed stage with scroll rails */
.embed-stage {
  display: grid;
  grid-template-columns: var(--rail-width) 1fr var(--rail-width);
  gap: 0;
  width: 100%;
  max-width: 100%;
  margin-inline: auto;
  padding-inline: 0.5rem;
}

.scroll-rail {
  height: var(--iframe-min-height);
  flex-shrink: 0;
  background: transparent;
  pointer-events: auto;
}

.iframe-frame {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-frame);
  border: 1px solid var(--border-strong);
  background: #0d0f14;
  position: relative;
}

.iframe-frame::before {
  display: none;
}

.iframe-wrapper {
  position: relative;
  min-height: var(--iframe-min-height);
  background: #0d0f14;
}

.iframe-wrapper iframe {
  width: 100%;
  height: var(--iframe-min-height);
  min-height: var(--iframe-min-height);
  border: none;
  display: block;
  transform: translateZ(0);
  backface-visibility: hidden;
}

.iframe-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  background: var(--surface);
  z-index: 2;
  transition: opacity 0.3s;
}

.iframe-loading.hidden {
  opacity: 0;
  pointer-events: none;
}

.spinner {
  width: 44px;
  height: 44px;
  border: 3px solid var(--border-strong);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.iframe-fallback {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  z-index: 3;
  padding: 2rem;
  text-align: center;
}

.iframe-fallback.hidden {
  display: none;
}

.fallback-content h2 {
  font-size: 1.25rem;
  margin-bottom: 0.75rem;
}

.fallback-content p {
  color: var(--text-muted);
  max-width: 420px;
  margin: 0 auto 1.5rem;
  font-size: 0.95rem;
}

/* Footer */
.site-footer {
  position: relative;
  z-index: 2;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-block: 2.5rem 1.5rem;
  margin-top: auto;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-block h2 {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.6rem;
  color: var(--text);
}

.footer-block p,
.footer-block li {
  font-size: 0.84rem;
  color: var(--text-muted);
}

.footer-block ul {
  list-style: none;
}

.footer-block li {
  padding: 0.2rem 0;
  padding-right: 1rem;
  position: relative;
}

.footer-block li::before {
  content: "•";
  position: absolute;
  right: 0;
  color: var(--accent);
}

.footer-bottom {
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.footer-bottom p + p {
  margin-top: 0.35rem;
}

.copyright {
  opacity: 0.6;
}

.design-credit {
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.design-credit a {
  font-weight: 600;
  color: var(--accent);
}

.design-credit a:hover {
  color: var(--accent-hover);
}

/* SEO: FAQ section */
.faq-section {
  position: relative;
  z-index: 2;
  padding: 2.5rem 0 1rem;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, transparent, rgba(124, 108, 240, 0.04));
}

.faq-section h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1.25rem;
  color: var(--text);
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 0.75rem;
}

.faq-item {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.25rem 1rem 0.75rem;
  transition: border-color 0.2s;
}

.faq-item[open] {
  border-color: rgba(124, 108, 240, 0.35);
}

.faq-item summary {
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 0;
  list-style: none;
  color: var(--text);
}

.faq-item summary::-webkit-details-marker {
  display: none;
}

.faq-item summary::before {
  content: "+ ";
  color: var(--accent);
  font-weight: 700;
}

.faq-item[open] summary::before {
  content: "− ";
}

.faq-item p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.65;
  padding-bottom: 0.5rem;
}

.noscript-notice {
  padding: 1rem;
  margin-block: 1rem;
  background: var(--warning-bg);
  border: 1px solid rgba(245, 166, 35, 0.3);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  color: var(--text-muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* About page */
.about-page {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 2.5rem 0 3rem;
}

.about-page h1 {
  font-size: clamp(1.5rem, 4vw, 2rem);
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.about-lead {
  font-size: 1rem;
  color: var(--text-muted);
  max-width: 680px;
  margin-bottom: 2rem;
}

.about-card {
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  padding: 1.5rem;
  margin-bottom: 1rem;
}

.about-card h2 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.75rem;
}

.about-card p {
  font-size: 0.92rem;
  color: var(--text-muted);
}

.about-card p + p {
  margin-top: 0.75rem;
}

.about-card--highlight {
  background: linear-gradient(135deg, rgba(124, 108, 240, 0.1), var(--surface));
  border-color: rgba(124, 108, 240, 0.3);
}

.about-list {
  margin-top: 1rem;
  padding-right: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.about-list li {
  margin-bottom: 0.35rem;
}

.about-list li::marker {
  color: var(--success);
}

.about-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 2rem;
}

.hidden {
  display: none !important;
}

/* Responsive */
@media (max-width: 900px) {
  :root {
    --rail-width: 32px;
    --iframe-min-height: 140vh;
  }
}

@media (max-width: 640px) {
  :root {
    --rail-width: 20px;
    --iframe-min-height: 120vh;
    --topbar-height: 60px;
  }

  .brand-sub {
    display: none;
  }

  .header-nav a,
  .nav-trigger {
    padding: 0.4rem 0.65rem;
    font-size: 0.78rem;
  }

  .back-to-top {
    left: 0.85rem;
    bottom: 0.85rem;
    width: 42px;
    height: 42px;
  }

  .embed-stage {
    padding-inline: 0.25rem;
  }
}
