:root {
  --bg: #07090d;
  --bg-elevated: #0f131a;
  --surface: rgba(18, 22, 30, 0.82);
  --surface-hover: rgba(24, 30, 42, 0.92);
  --stroke: rgba(255, 255, 255, 0.09);
  --stroke-strong: rgba(255, 255, 255, 0.16);
  --text: #f2f5fa;
  --text-soft: rgba(242, 245, 250, 0.62);
  --accent: #6fe89a;
  --accent-dim: rgba(111, 232, 154, 0.14);
  --accent-2: #7aa2ff;
  --accent-3: #f0b35a;
  --danger: #ff8f9a;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.48);
  --radius: 16px;
  --radius-lg: 22px;
  --max: 1140px;
  --header-h: 72px;
  --font: "Outfit", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.55;
  overflow-x: hidden;
}

main { position: relative; z-index: 1; }

a { color: inherit; text-decoration: none; }

button, a.btn, .text-link {
  font: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

.container {
  width: min(100% - 28px, var(--max));
  margin: 0 auto;
}

/* Ambient background */
.ambient {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.ambient-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 80% 70% at 50% 0%, black, transparent);
}

.ambient-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.55;
}

.orb-a {
  width: 520px;
  height: 520px;
  top: -180px;
  left: -120px;
  background: radial-gradient(circle, rgba(111, 232, 154, 0.35), transparent 68%);
}

.orb-b {
  width: 480px;
  height: 480px;
  top: 20%;
  right: -160px;
  background: radial-gradient(circle, rgba(122, 162, 255, 0.28), transparent 70%);
}

/* Header + integrated tabs */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  backdrop-filter: blur(18px) saturate(140%);
  background: rgba(7, 9, 13, 0.78);
  border-bottom: 1px solid var(--stroke);
}

.header-bar {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 20px;
  min-height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-icon {
  border-radius: 11px;
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}

.brand-copy {
  display: flex;
  flex-direction: column;
  line-height: 1.15;
}

.brand-name {
  font-weight: 700;
  font-size: 1.05rem;
  letter-spacing: -0.02em;
}

.brand-tag {
  font-size: 0.72rem;
  color: var(--text-soft);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.site-tabs {
  display: inline-flex;
  align-self: center;
  justify-self: center;
  gap: 4px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
}

.site-tab {
  position: relative;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-soft);
  font-size: 0.88rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  transition: color 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.site-tab:hover {
  color: var(--text);
  background: rgba(255,255,255,0.04);
}

.site-tab.is-active {
  color: var(--text);
  background: linear-gradient(180deg, rgba(111,232,154,0.18), rgba(111,232,154,0.08));
  border-color: rgba(111,232,154,0.35);
  box-shadow: 0 0 0 1px rgba(111,232,154,0.08), 0 8px 24px rgba(111,232,154,0.12);
}

.site-tab.is-active .site-tab-label::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 6px;
  height: 2px;
  border-radius: 2px;
  background: var(--accent);
  opacity: 0.85;
}

.site-tab-label { position: relative; display: inline-block; }

.header-cta { justify-self: end; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.92rem;
  transition: transform 0.15s, box-shadow 0.2s, background 0.2s, border-color 0.2s;
}

.btn:hover { transform: translateY(-1px); }
.btn:active, .btn.is-pressed { transform: translateY(0) scale(0.98); }

.btn-primary {
  color: #04140a;
  background: linear-gradient(135deg, #8ef5b2, var(--accent));
  box-shadow: 0 12px 32px rgba(111, 232, 154, 0.22);
}

.btn-secondary {
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--stroke-strong);
}

.btn-ghost {
  color: var(--text);
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke);
}

.btn-small { padding: 9px 14px; font-size: 0.84rem; }
.btn-wide { width: 100%; }
.btn-icon { line-height: 1; }

.text-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--accent);
  font-size: 0.88rem;
  font-weight: 600;
}

.text-link:hover { color: #9ef5bc; }

/* Tab panels */
main .tab-panel { display: none; }
main .tab-panel[hidden] { display: none !important; }
main .tab-panel.is-active { display: block !important; }

/* Hero */
.hero { padding: 48px 0 56px; }

.hero-layout {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 40px;
  align-items: center;
}

.kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1, h2, h3 { margin: 0; line-height: 1.1; letter-spacing: -0.03em; }

h1 {
  font-size: clamp(2.4rem, 5vw, 4rem);
  font-weight: 700;
}

.text-gradient {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero-lead {
  margin: 18px 0 24px;
  max-width: 52ch;
  color: var(--text-soft);
  font-size: 1.05rem;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}

.hero-stats li {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  border: 1px solid var(--stroke);
  font-size: 0.84rem;
  color: var(--text-soft);
}

.hero-stats strong {
  color: var(--text);
  font-family: var(--mono);
}

.fine-print {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.86rem;
}

/* Device mockup */
.hero-device-wrap { display: flex; justify-content: center; }

.device-frame {
  width: min(100%, 340px);
  padding: 18px;
  border-radius: 28px;
  background: var(--surface);
  border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
}

.device-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-weight: 600;
  font-size: 0.9rem;
}

.device-pill {
  padding: 5px 10px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.72rem;
}

.device-screen {
  position: relative;
  aspect-ratio: 10/9;
  border-radius: 14px;
  overflow: hidden;
  background: #0c1218;
  border: 1px solid rgba(255,255,255,0.06);
}

.device-scanlines {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(111,232,154,0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(111,232,154,0.07) 1px, transparent 1px);
  background-size: 12px 12px;
}

.device-glow {
  position: absolute;
  inset: 16%;
  border-radius: 16px;
  background: radial-gradient(circle at 35% 30%, rgba(111,232,154,0.35), rgba(122,162,255,0.15) 45%, transparent 72%);
}

.device-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 16px;
  padding: 0 6px;
}

.dpad {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  position: relative;
}

.dpad::before, .dpad::after {
  content: "";
  position: absolute;
  background: rgba(255,255,255,0.1);
  border-radius: 4px;
}

.dpad::before { width: 24px; height: 62px; top: 11px; left: 30px; }
.dpad::after { width: 62px; height: 24px; top: 30px; left: 11px; }

.ab-buttons { display: flex; gap: 12px; }
.ab-buttons span {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke);
  color: var(--text-soft);
  font-weight: 700;
}

/* Sections */
.section-block { padding: 36px 0 72px; }

.section-intro { margin-bottom: 28px; max-width: 62ch; }
.section-intro h2 { font-size: clamp(1.7rem, 3vw, 2.4rem); margin-bottom: 8px; }
.section-intro p { margin: 0; color: var(--text-soft); }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.feature-tile {
  padding: 22px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(10px);
  transition: border-color 0.2s, transform 0.2s;
}

.feature-tile:hover {
  transform: translateY(-2px);
  border-color: rgba(111,232,154,0.28);
}

.feature-tile--accent {
  border-color: rgba(111,232,154,0.22);
  background: linear-gradient(180deg, rgba(111,232,154,0.08), var(--surface));
}

.feature-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 1rem;
}

.feature-tile h3 { font-size: 1.02rem; margin-bottom: 6px; }
.feature-tile p { margin: 0; color: var(--text-soft); font-size: 0.92rem; }

/* Panels */
.panel {
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  margin-bottom: 16px;
}

.search-panel { margin-bottom: 16px; }

.search-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) 160px auto;
  gap: 12px;
  align-items: end;
}

.field { display: flex; flex-direction: column; gap: 8px; }
.field--grow { position: relative; }
.field--compact { min-width: 160px; }

.field-label {
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.field input,
.field select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--stroke-strong);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(111,232,154,0.28);
  outline-offset: 1px;
}

.field-error {
  margin: 10px 0 0;
  color: var(--danger);
  font-size: 0.88rem;
}

.suggest-list {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 20;
  max-height: 260px;
  overflow: auto;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--stroke-strong);
  box-shadow: var(--shadow);
}

.suggest-item {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 10px 12px;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  background: transparent;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.suggest-item:hover { background: rgba(111,232,154,0.08); }
.suggest-item:last-child { border-bottom: none; }
.suggest-meta { color: var(--text-soft); font-family: var(--mono); font-size: 0.72rem; }

.filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.8fr);
  gap: 16px;
  margin-bottom: 14px;
}

.chip-row, .game-chip-row .chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--stroke);
  background: var(--bg-elevated);
  color: var(--text-soft);
  font-size: 0.82rem;
  font-weight: 600;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}

.chip:hover, .chip.is-active {
  color: var(--text);
  border-color: rgba(111,232,154,0.32);
  background: rgba(111,232,154,0.1);
}

.chip.is-active { color: var(--accent); }

.game-chip-row { margin-bottom: 12px; }

.results-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.source-status { display: flex; flex-wrap: wrap; gap: 8px; }

.source-chip {
  display: inline-flex;
  flex-direction: column;
  gap: 2px;
  padding: 7px 10px;
  border-radius: 10px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--stroke);
  min-width: 88px;
}

.source-chip-name {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.source-chip-count {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--text-soft);
}

.source-chip.is-hit { border-color: rgba(111,232,154,0.3); background: rgba(111,232,154,0.08); }
.source-chip.is-hit .source-chip-count { color: var(--accent); }
.source-chip.is-miss .source-chip-count { color: rgba(255,255,255,0.35); }

.state-panel { text-align: center; }
.state-panel h3 { margin-bottom: 8px; }
.state-panel p { margin: 0 auto; max-width: 48ch; color: var(--text-soft); }

.spinner {
  width: 34px;
  height: 34px;
  margin: 0 auto 12px;
  border-radius: 50%;
  border: 3px solid rgba(111,232,154,0.15);
  border-top-color: var(--accent);
  animation: spin 0.85s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Cheat results grid */
.results-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.cheat-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(10px);
  min-height: 190px;
  transition: border-color 0.2s, transform 0.2s;
}

.cheat-card:hover {
  transform: translateY(-2px);
  border-color: rgba(111,232,154,0.25);
}

.cheat-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.cheat-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--accent-dim);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.cheat-badge--verified {
  background: rgba(111,232,154,0.16);
  color: #9ef5bc;
}

.cheat-game {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-soft);
}

.cheat-title {
  margin: 0;
  font-size: 0.98rem;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.cheat-code-wrap {
  margin-top: auto;
  padding: 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.28);
  border: 1px solid rgba(255,255,255,0.05);
}

.cheat-code-label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-soft);
}

.cheat-code {
  font-family: var(--mono);
  font-size: 0.82rem;
  color: #d7ffe6;
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.55;
}

.cheat-link {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-soft);
}

.cheat-link:hover { color: var(--accent); }

.cheat-toolbar {
  grid-column: 1 / -1;
  display: flex;
  justify-content: flex-end;
}

.cheat-lazy-sentinel { grid-column: 1 / -1; height: 1px; }

.btn.is-busy { opacity: 0.65; pointer-events: none; }

/* Download */
.download-card {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 28px;
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--surface);
  border: 1px solid var(--stroke);
  box-shadow: var(--shadow);
}

.download-info h2 { font-size: clamp(1.6rem, 3vw, 2.2rem); margin-bottom: 10px; }
.download-info p { margin: 0 0 16px; color: var(--text-soft); }

.check-list {
  margin: 0;
  padding-left: 18px;
  color: var(--text-soft);
}

.check-list li + li { margin-top: 6px; }

.download-stack { display: flex; flex-direction: column; gap: 10px; justify-content: center; }

.download-note {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.84rem;
  color: var(--text-soft);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--stroke);
  background: rgba(7,9,13,0.9);
}

.footer-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  padding: 22px 0 30px;
  color: var(--text-soft);
  font-size: 0.88rem;
}

.mono { font-family: var(--mono); font-size: 0.8rem; }

/* Responsive */
@media (max-width: 960px) {
  .header-bar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand cta"
      "tabs tabs";
    gap: 12px;
    padding: 12px 0 14px;
  }

  .brand { grid-area: brand; }
  .header-cta { grid-area: cta; }
  .site-tabs {
    grid-area: tabs;
    justify-self: stretch;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .site-tabs::-webkit-scrollbar { display: none; }

  .hero-layout,
  .feature-grid,
  .download-card,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .search-form-grid,
  .filter-grid {
    grid-template-columns: 1fr;
  }

  .site-tab { flex: 0 0 auto; white-space: nowrap; }
}

@media (max-width: 640px) {
  .hero-actions .btn,
  .download-stack .btn { width: 100%; }
  .results-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .spinner, .ambient-orb { animation: none !important; }
}