:root {
  color-scheme: dark;
  --page: #07090e;
  --sheet: #0d1119;
  --surface: #141b27;
  --surface-2: #1a2332;
  --line: #2b3749;
  --text: #f5f7fb;
  --muted: #9aa9bc;
  --accent: #9dff57;
  --accent-2: #6a7cff;
  --hot: #ff4fd8;
  --focus: #b6ff84;
  --shadow: 0 22px 60px rgba(0, 0, 0, .36);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root[data-theme="light"] {
  color-scheme: light;
  --page: #e7ebf0;
  --sheet: #f8fafc;
  --surface: #ffffff;
  --surface-2: #eef2f7;
  --line: #ccd5e2;
  --text: #111722;
  --muted: #5e6b7d;
  --accent: #4cc30d;
  --accent-2: #5265ff;
  --hot: #d800a5;
  --focus: #3248ff;
  --shadow: 0 22px 60px rgba(40, 49, 65, .14);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  min-width: 320px;
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, color-mix(in srgb, var(--accent-2) 20%, transparent), transparent 34rem),
    var(--page);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button { font: inherit; }
button:focus-visible, [role="tab"]:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}

.app-shell {
  width: min(100%, 540px);
  min-height: 100svh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--sheet);
  box-shadow: var(--shadow);
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: max(18px, calc(env(safe-area-inset-top) + 10px)) 22px 18px;
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; font-size: 16px; font-weight: 900; letter-spacing: .05em; }
.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent) 60%, var(--line));
  border-radius: 11px;
  background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  color: var(--accent);
  font-size: 13px;
}
.format-pill, .count-badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 11px;
  background: var(--surface);
  color: var(--muted);
  font: 800 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .08em;
}

.hero {
  position: relative;
  display: grid;
  min-height: 390px;
  align-items: end;
  overflow: hidden;
  padding: 26px 22px;
  isolation: isolate;
  background: linear-gradient(145deg, #151a24, #090c12 62%);
}
.hero::before {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(180deg, transparent 30%, rgba(5, 7, 11, .94) 84%),
    repeating-linear-gradient(90deg, transparent 0 30px, rgba(255,255,255,.025) 30px 31px);
  content: "";
}
.hero-copy { position: relative; z-index: 2; max-width: 410px; }
.eyebrow, .section-index {
  margin: 0 0 9px;
  color: var(--accent);
  font: 900 12px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .11em;
}
.hero h1 {
  max-width: 470px;
  margin: 0;
  font-size: clamp(38px, 9vw, 52px);
  line-height: .98;
  letter-spacing: -.055em;
  color: #fff;
  text-shadow: 0 2px 24px rgba(0,0,0,.78);
}
.hero-copy > p:last-child { max-width: 380px; margin: 16px 0 0; color: #c5cfdd; font-size: 18px; font-weight: 650; line-height: 1.42; }
.hero-stack { position: absolute; inset: 24px 10px auto 116px; height: 235px; z-index: -1; }
.hero-stack img {
  position: absolute;
  width: 78%;
  aspect-ratio: 16/9;
  object-fit: cover;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 22px;
  box-shadow: 0 18px 42px rgba(0,0,0,.42);
}
.hero-stack img:first-child { top: 0; right: 0; transform: rotate(4deg); }
.hero-stack img:last-child { top: 74px; left: 0; transform: rotate(-7deg); }

.section { padding: 28px 22px; border-top: 1px solid var(--line); }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section h2 { margin: 0; font-size: 26px; line-height: 1.08; letter-spacing: -.035em; }
.chip-row { display: flex; gap: 9px; overflow-x: auto; padding: 3px 3px 8px; scrollbar-width: none; scroll-snap-type: x mandatory; }
.chip-row::-webkit-scrollbar { display: none; }
.filter-chip {
  flex: 0 0 auto;
  min-height: 45px;
  scroll-snap-align: start;
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 0 15px;
  background: var(--surface);
  color: var(--muted);
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
}
.filter-chip[aria-selected="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, var(--surface)); color: var(--text); }
.selection-hint { margin: 0; color: var(--muted); font-size: 13px; white-space: nowrap; }
.selection-hint b { color: var(--accent); font-size: 17px; }

.controller-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.controller-card {
  position: relative;
  display: flex;
  min-width: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.controller-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent); }
.controller-card[hidden] { display: none; }
.card-image-wrap { position: relative; overflow: hidden; aspect-ratio: 16/10; background: #0b0e14; }
.card-image-wrap img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.controller-card:hover img { transform: scale(1.035); }
.rank {
  position: absolute;
  top: 9px;
  left: 9px;
  border-radius: 8px;
  padding: 6px 8px;
  background: rgba(5, 8, 13, .78);
  color: #fff;
  font: 900 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  backdrop-filter: blur(8px);
}
.card-body { display: flex; flex: 1; flex-direction: column; padding: 13px; }
.card-body h3 { margin: 0; font-size: 17px; line-height: 1.14; letter-spacing: -.025em; }
.tagline { margin: 7px 0 11px; color: var(--muted); font-size: 13px; font-weight: 650; line-height: 1.35; }
.badge-row { display: flex; flex-wrap: wrap; gap: 5px; margin-top: auto; }
.badge { border-radius: 7px; padding: 5px 7px; background: var(--surface-2); color: var(--muted); font: 800 10px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.select-button {
  width: 100%;
  min-height: 43px;
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  cursor: pointer;
}
.controller-card.is-selected .select-button { border-color: var(--accent); background: var(--accent); color: #0c1607; }

.arena { background: linear-gradient(180deg, color-mix(in srgb, var(--accent-2) 8%, var(--sheet)), var(--sheet)); }
.text-button { border: 0; padding: 8px 0; background: transparent; color: var(--muted); font-size: 14px; font-weight: 800; cursor: pointer; }
.empty-state { display: grid; min-height: 190px; place-items: center; border: 1px dashed var(--line); border-radius: 20px; padding: 28px; text-align: center; }
.empty-state span { display: grid; width: 62px; height: 62px; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--hot); font-weight: 950; }
.empty-state p { max-width: 340px; margin: 15px 0 0; color: var(--muted); font-size: 16px; line-height: 1.5; }
.empty-state[hidden], .compare-panel[hidden] { display: none; }
.compare-head { position: relative; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.compare-subject { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); }
.compare-subject img { width: 100%; aspect-ratio: 16/10; object-fit: cover; }
.compare-subject strong { display: block; padding: 12px; font-size: 15px; line-height: 1.2; }
.vs-badge { position: absolute; top: 50%; left: 50%; display: grid; width: 44px; height: 44px; place-items: center; transform: translate(-50%, -50%); border: 2px solid var(--sheet); border-radius: 50%; background: var(--hot); color: #fff; font-weight: 950; }
.compare-rows { display: grid; gap: 8px; margin-top: 12px; }
.compare-row { border: 1px solid var(--line); border-radius: 15px; padding: 13px; background: var(--surface); }
.compare-row > span { display: block; margin-bottom: 9px; color: var(--accent); font: 850 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.compare-values { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.compare-values p { margin: 0; color: var(--muted); font-size: 14px; font-weight: 650; line-height: 1.4; }
.compare-values p + p { border-left: 1px solid var(--line); padding-left: 10px; }

.critic-note { background: var(--surface); }
.critic-note p { margin: 13px 0; font-size: 18px; line-height: 1.48; }
.critic-note small { display: block; color: var(--muted); font-size: 13px; line-height: 1.45; }
footer { display: flex; justify-content: space-between; gap: 12px; padding: 20px 22px max(24px, calc(env(safe-area-inset-bottom) + 15px)); border-top: 1px solid var(--line); color: var(--muted); font: 800 10px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .08em; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

@media (max-width: 380px) {
  .controller-grid { grid-template-columns: 1fr; }
  .hero { min-height: 370px; }
  .hero h1 { font-size: 37px; }
}
@media (min-width: 620px) {
  body { padding: 24px 0; }
  .app-shell { border: 1px solid var(--line); border-radius: 28px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}
