:root {
  /* Raw palette tokens derived from Tiny Network logo */
  --blue-500: #0ea5e9;
  --blue-600: #0284c7;
  --blue-400: #38bdf8;
  --gold-400: #fbbf24;
  --gold-500: #f59e0b;
  --red-500: #ef4444;
  --emerald-400: #34d399;
  --emerald-600: #059669;

  /* Light & Dark semantic tokens */
  --bg-page-light: #f8fafc;
  --bg-page-dark: #070b14;
  --bg-surface-light: #ffffff;
  --bg-surface-dark: #0f172a;
  --bg-elevated-light: #f1f5f9;
  --bg-elevated-dark: #162033;

  --text-main-light: #0f172a;
  --text-main-dark: #f8fafc;
  --text-muted-light: #475569;
  --text-muted-dark: #94a3b8;

  --border-light: #cbd5e1;
  --border-dark: #1e293b;

  --brand-light: #0284c7;
  --brand-dark: #38bdf8;
  --brand-text-light: #ffffff;
  --brand-text-dark: #061224;

  /* Fallback defaults (light mode first) */
  --bg-page: var(--bg-page-light);
  --bg-surface: var(--bg-surface-light);
  --bg-elevated: var(--bg-elevated-light);
  --text-main: var(--text-main-light);
  --text-muted: var(--text-muted-light);
  --border-color: var(--border-light);
  --brand: var(--brand-light);
  --brand-text: var(--brand-text-light);
  --accent: var(--gold-500);
  --status-ok: var(--emerald-600);
  --scrollbar-thumb: #94a3b8;
  --scrollbar-track: #e2e8f0;

  /* MANDATORY: Declare light dark color-scheme on :root */
  color-scheme: light dark;
  accent-color: var(--brand);
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}

/* Fallback for browsers without light-dark() support */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-page: var(--bg-page-dark);
    --bg-surface: var(--bg-surface-dark);
    --bg-elevated: var(--bg-elevated-dark);
    --text-main: var(--text-main-dark);
    --text-muted: var(--text-muted-dark);
    --border-color: var(--border-dark);
    --brand: var(--brand-dark);
    --brand-text: var(--brand-text-dark);
    --accent: var(--gold-400);
    --status-ok: var(--emerald-400);
    --scrollbar-thumb: #334155;
    --scrollbar-track: #0b1120;
  }
}

/* Modern light-dark() when supported */
@supports (color: light-dark(white, black)) {
  :root {
    --bg-page: light-dark(var(--bg-page-light), var(--bg-page-dark));
    --bg-surface: light-dark(var(--bg-surface-light), var(--bg-surface-dark));
    --bg-elevated: light-dark(var(--bg-elevated-light), var(--bg-elevated-dark));
    --text-main: light-dark(var(--text-main-light), var(--text-main-dark));
    --text-muted: light-dark(var(--text-muted-light), var(--text-muted-dark));
    --border-color: light-dark(var(--border-light), var(--border-dark));
    --brand: light-dark(var(--brand-light), var(--brand-dark));
    --brand-text: light-dark(var(--brand-text-light), var(--brand-text-dark));
    --accent: light-dark(var(--gold-500), var(--gold-400));
    --status-ok: light-dark(var(--emerald-600), var(--emerald-400));
    --scrollbar-thumb: light-dark(#94a3b8, #334155);
    --scrollbar-track: light-dark(#e2e8f0, #0b1120);
  }
}

@supports not (scrollbar-color: auto) {
  html::-webkit-scrollbar {
    width: 10px;
  }
  html::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 999px;
  }
  html::-webkit-scrollbar-track {
    background: var(--scrollbar-track);
  }
}

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

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Vazirmatn", system-ui, -apple-system, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.75;
  overflow-x: hidden;
}

.container {
  width: min(1140px, 100% - 2rem);
  margin-inline: auto;
}

/* Navbar */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  background-color: color-mix(in oklab, var(--bg-page) 86%, transparent);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-color);
}

.nav-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-block: 0.75rem;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: var(--text-main);
  font-weight: 800;
  font-size: 1.15rem;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  object-fit: cover;
  border: 2px solid var(--accent);
  background: #ffffff;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.2s ease;
}

.nav-links a:hover,
.nav-links a:focus-visible {
  color: var(--brand);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.95rem;
  padding: 0.7rem 1.35rem;
  border-radius: 12px;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.15s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background-color: var(--brand);
  color: var(--brand-text);
  box-shadow: 0 8px 24px -6px color-mix(in oklab, var(--brand) 55%, transparent);
}

.btn-primary:hover {
  filter: brightness(1.06);
}

.btn-accent {
  background-color: var(--gold-400);
  color: #111827;
  border-color: var(--red-500);
}

.btn-accent:hover {
  background-color: var(--gold-500);
}

.btn-outline {
  background-color: transparent;
  color: var(--text-main);
  border-color: var(--border-color);
}

.btn-outline:hover {
  border-color: var(--brand);
  color: var(--brand);
}

/* Hero */
.hero {
  position: relative;
  padding-block: 4.5rem 4rem;
  background:
    radial-gradient(600px circle at 85% 15%, color-mix(in oklab, var(--blue-500) 16%, transparent), transparent 60%),
    radial-gradient(500px circle at 15% 80%, color-mix(in oklab, var(--gold-400) 12%, transparent), transparent 60%);
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 2.5rem;
  align-items: center;
}

.badge-live {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-color);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--status-ok);
  margin-bottom: 1.25rem;
}

.pulse-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background-color: var(--status-ok);
  box-shadow: 0 0 0 4px color-mix(in oklab, var(--status-ok) 25%, transparent);
}

.hero h1 {
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.25;
  margin: 0 0 1rem;
  font-weight: 900;
}

.hero h1 .highlight {
  color: var(--brand);
}

.hero p.lead {
  font-size: 1.08rem;
  color: var(--text-muted);
  margin: 0 0 2rem;
  max-width: 56ch;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  margin-bottom: 2rem;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.stat-item strong {
  display: block;
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--accent);
}

.stat-item span {
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* Status Card */
.status-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.75rem;
  box-shadow: 0 20px 50px -15px rgba(2, 6, 23, 0.35);
}

.status-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.status-card-header img {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  border: 2px solid var(--accent);
  background: #ffffff;
}

.dns-box {
  background-color: var(--bg-elevated);
  border: 1px dashed var(--brand);
  border-radius: 14px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.dns-ip {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 1.25rem;
  font-weight: 700;
  direction: ltr;
  color: var(--brand);
}

.node-list {
  display: grid;
  gap: 0.75rem;
}

.node-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  background-color: var(--bg-elevated);
  font-size: 0.9rem;
}

.node-ping {
  color: var(--status-ok);
  font-weight: 700;
  direction: ltr;
}

/* Sections */
.section {
  padding-block: 4rem;
}

.section-header {
  text-align: center;
  max-width: 60ch;
  margin-inline: auto;
  margin-bottom: 2.75rem;
}

.section-header h2 {
  font-size: clamp(1.5rem, 3vw, 2.15rem);
  margin: 0 0 0.6rem;
  font-weight: 800;
}

.section-header p {
  color: var(--text-muted);
  margin: 0;
}

/* Games Grid */
.games-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
  gap: 1rem;
}

.game-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 14px;
  padding: 1.15rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  transition: border-color 0.2s ease, transform 0.2s ease;
}

.game-card-head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.game-logo {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background-color: var(--bg-elevated);
  border: 1px solid var(--border-color);
}

.game-logo svg {
  width: 24px;
  height: 24px;
}

.game-card:hover {
  border-color: var(--brand);
  transform: translateY(-3px);
}

.game-title {
  font-weight: 700;
  font-size: 1rem;
}

.game-tag {
  font-size: 0.8rem;
  color: var(--status-ok);
  font-weight: 600;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  padding: 1.5rem;
}

.feature-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background-color: color-mix(in oklab, var(--brand) 15%, transparent);
  color: var(--brand);
  font-size: 1.3rem;
  margin-bottom: 1rem;
}

.feature-card h3 {
  margin: 0 0 0.5rem;
  font-size: 1.08rem;
}

.feature-card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(270px, 1fr));
  gap: 1.5rem;
  align-items: stretch;
}

.price-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 2rem 1.5rem;
  display: flex;
  flex-direction: column;
  position: relative;
}

.price-card.popular {
  border: 2px solid var(--accent);
  box-shadow: 0 18px 40px -14px color-mix(in oklab, var(--accent) 28%, transparent);
}

.popular-badge {
  position: absolute;
  top: -13px;
  inset-inline-start: 1.5rem;
  background-color: var(--gold-400);
  color: #111827;
  font-size: 0.78rem;
  font-weight: 800;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--red-500);
}

.price-amount {
  font-size: 2rem;
  font-weight: 900;
  margin: 0.75rem 0;
  color: var(--brand);
}

.price-amount small {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.price-features {
  list-style: none;
  padding: 0;
  margin: 1rem 0 1.75rem;
  display: grid;
  gap: 0.6rem;
  color: var(--text-muted);
  font-size: 0.93rem;
  flex: 1;
}

/* Setup Tabs */
.tabs-wrapper {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 1.75rem;
}

.tab-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.5rem;
}

.tab-btn {
  font-family: inherit;
  font-weight: 700;
  padding: 0.6rem 1.15rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
}

.tab-btn[aria-selected="true"] {
  background-color: var(--brand);
  color: var(--brand-text);
  border-color: var(--brand);
}

.tab-panel[hidden] {
  display: none;
}

.steps-list {
  margin: 0;
  padding-inline-start: 1.25rem;
  display: grid;
  gap: 0.65rem;
}

/* Native Modal Dialog */
dialog {
  border: 1px solid var(--border-color);
  border-radius: 20px;
  background-color: var(--bg-surface);
  color: var(--text-main);
  padding: 1.75rem;
  width: min(460px, 92vw);
  box-shadow: 0 25px 60px rgba(0, 0, 0, 0.5);
}

dialog::backdrop {
  background-color: rgba(2, 6, 23, 0.68);
  backdrop-filter: blur(4px);
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.dialog-head h3 {
  margin: 0;
}

.close-btn {
  background: var(--bg-elevated);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

.form-group {
  display: grid;
  gap: 0.4rem;
  margin-bottom: 1rem;
}

.form-group label {
  font-size: 0.9rem;
  font-weight: 600;
}

.form-group input,
.form-group select {
  font-family: inherit;
  padding: 0.65rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-elevated);
  color: var(--text-main);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--border-color);
  padding-block: 2rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* Forced Colors support */
@media (forced-colors: active) {
  .status-card,
  .game-card,
  .feature-card,
  .price-card,
  .tabs-wrapper,
  dialog {
    border: 1px solid CanvasText;
  }
  .btn-primary,
  .btn-accent {
    border: 1px solid ButtonText;
  }
}

/* Responsive */
@media (max-width: 860px) {
  .hero-grid {
    grid-template-columns: 1fr;
  }
  .nav-links {
    display: none;
  }
}
