:root {
  color-scheme: dark;
  --bg: #07100a;
  --panel: #0c1710;
  --panel-raised: #102017;
  --line: #25412c;
  --line-hot: #3b6d47;
  --text: #e6eee7;
  --muted: #9eaea1;
  --dim: #718276;
  --green: #4dff75;
  --green-deep: #19c948;
  --cyan: #54dff7;
  --yellow: #ffd166;
  --purple: #d6a8ff;
  --focus: #fff3a8;
  --shadow: 0 18px 55px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 1rem; }
body {
  margin: 0;
  min-width: 280px;
  background:
    linear-gradient(rgba(77, 255, 117, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77, 255, 117, 0.02) 1px, transparent 1px),
    radial-gradient(circle at 78% -10%, rgba(84, 223, 247, 0.08), transparent 32rem),
    var(--bg);
  background-size: 32px 32px, 32px 32px, auto, auto;
  color: var(--text);
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cyan); text-underline-offset: 0.22em; }
a:hover { color: var(--green); }
button, input, select { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
code { color: var(--green); font-family: inherit; overflow-wrap: anywhere; }
[hidden] { display: none !important; }

.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;
}
.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.55rem 0.8rem;
  color: #07100a;
  background: var(--focus);
  font-weight: 700;
  transform: translateY(-180%);
}
.skip-link:focus { color: #07100a; transform: translateY(0); }
.shell { width: min(1180px, calc(100% - 2rem)); margin: 0 auto; }

.site-top {
  border-bottom: 1px solid var(--line);
  background: rgba(7, 16, 10, 0.92);
}
.top-row {
  min-height: 4.2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.breadcrumb { display: flex; align-items: center; gap: 0.65rem; color: var(--dim); font-size: 0.84rem; }
.breadcrumb a { color: var(--green); font-weight: 700; text-decoration: none; }
.breadcrumb span[aria-current] { color: var(--muted); }
.slash { color: var(--line-hot); }
.auth-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.65rem;
  flex-wrap: wrap;
  font-size: 0.76rem;
}
.auth-controls a { color: var(--muted); }
.auth-controls .login {
  border: 1px solid var(--green-deep);
  color: var(--green);
  padding: 0.32rem 0.65rem;
  text-decoration: none;
}
.auth-identity { color: var(--text); }

.hero { padding: clamp(2.2rem, 5vw, 4rem) 0 2.2rem; border-bottom: 1px solid var(--line); }
.kicker {
  margin: 0 0 0.6rem;
  color: var(--green);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.18em;
}
h1 {
  margin: 0;
  max-width: 13ch;
  font-size: clamp(2.5rem, 7vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.07em;
  color: var(--text);
}
h1 span { color: var(--green); }
.lede { max-width: 75ch; margin: 1rem 0 0; color: var(--muted); font-size: clamp(0.92rem, 2vw, 1.05rem); }
.hero-meta { display: flex; gap: 1.4rem; margin-top: 1.2rem; color: var(--dim); font-size: 0.78rem; flex-wrap: wrap; }
.hero-meta strong { color: var(--text); font-size: 1.05rem; }

.filter-panel { padding-top: 1.4rem; }
.filters {
  display: grid;
  grid-template-columns: minmax(14rem, 2fr) repeat(3, minmax(9rem, 1fr)) auto;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid var(--line);
  background: rgba(12, 23, 16, 0.96);
  box-shadow: var(--shadow);
}
.field { min-width: 0; }
.field label,
.twitch-setup-form label {
  display: block;
  margin-bottom: 0.32rem;
  color: var(--muted);
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.field input,
.field select,
.twitch-setup-form input {
  width: 100%;
  min-height: 2.7rem;
  border: 1px solid var(--line-hot);
  border-radius: 0;
  background: #08110b;
  color: var(--text);
  padding: 0.55rem 0.65rem;
}
.field input::placeholder,
.twitch-setup-form input::placeholder { color: var(--dim); }
.filter-actions { display: flex; align-items: end; }
.filter-actions button,
.twitch-setup-form button {
  min-height: 2.7rem;
  border: 1px solid var(--line-hot);
  border-radius: 0;
  padding: 0.5rem 0.8rem;
  color: var(--text);
  background: #13251a;
}
.filter-actions button:hover,
.twitch-setup-form button:hover { border-color: var(--green); color: var(--green); }
.result-bar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin: 0.8rem 0 0;
  color: var(--dim);
  font-size: 0.75rem;
}
.result-count { color: var(--green); white-space: nowrap; }
.runtime-note { max-width: 78ch; text-align: right; }
.noscript-note { margin: 0.75rem 0 0; color: var(--yellow); font-size: 0.78rem; }

.notice-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 0.8rem;
  margin: 1.5rem 0 2rem;
}
.notice {
  grid-column: span 2;
  padding: 1.05rem;
  border: 1px solid var(--line);
  border-top: 3px solid var(--cyan);
  background: var(--panel);
}
.notice.twitch, .notice.studio { grid-column: span 3; }
.notice.discord { border-top-color: #8da2fb; }
.notice.twitch { border-top-color: #bf94ff; }
.notice.studio { border-top-color: var(--purple); }
.notice.kick { border-top-color: #53fc18; }
.notice.egg { border-top-color: var(--yellow); }
.notice h2 { margin: 0 0 0.45rem; font-size: 0.9rem; color: var(--text); }
.notice p { margin: 0.35rem 0; color: var(--muted); font-size: 0.79rem; }
.notice a { overflow-wrap: anywhere; }
.twitch-setup-form { margin: 0.8rem 0; }
.twitch-setup-form > div { display: flex; align-items: stretch; gap: 0.45rem; }
.twitch-setup-form input { flex: 1 1 12rem; min-width: 0; }
.twitch-setup-form button { flex: 0 0 auto; color: var(--green); border-color: var(--green-deep); }

.catalog-layout {
  display: grid;
  grid-template-columns: minmax(190px, 0.28fr) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
  padding: 1rem 0 5rem;
}
.category-nav { position: sticky; top: 1rem; padding: 1rem 0; }
.category-nav p { color: var(--dim); margin: 0 0 0.7rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.15em; }
.category-nav a { display: block; padding: 0.36rem 0; color: var(--muted); font-size: 0.78rem; text-decoration: none; }
.category-nav a::before { content: "> "; color: var(--green-deep); }
.catalog-main { min-width: 0; }
.command-group { margin: 0 0 3.2rem; }
.section-heading { display: flex; align-items: baseline; gap: 0.7rem; margin: 0 0 0.85rem; border-bottom: 1px solid var(--line); }
.section-heading h2 { margin: 0; padding-bottom: 0.55rem; font-size: 0.9rem; text-transform: uppercase; letter-spacing: 0.12em; color: var(--text); }
.section-index { margin: 0; color: var(--green-deep); font-size: 0.72rem; }
.anchor-link { margin-left: auto; color: var(--dim); text-decoration: none; }
.command-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.8rem; }
.command-card { padding: 1.1rem; min-width: 0; border: 1px solid var(--line); background: linear-gradient(145deg, var(--panel-raised), var(--panel)); }
.command-card:hover { border-color: var(--line-hot); }
.command-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.7rem; }
.command-head h3 { margin: 0; font-size: 1.05rem; font-weight: 700; }
.badges { display: flex; justify-content: flex-end; gap: 0.3rem; flex-wrap: wrap; }
.badge { border: 1px solid var(--line-hot); color: var(--muted); padding: 0.08rem 0.35rem; font-size: 0.6rem; text-transform: uppercase; letter-spacing: 0.06em; white-space: nowrap; }
.badge-experimental { color: var(--yellow); border-color: #806a2e; }
.summary { margin: 0.7rem 0 0.9rem; color: var(--text); font-size: 0.87rem; }
.syntax, .aliases { margin: 0.35rem 0; color: var(--muted); font-size: 0.75rem; overflow-wrap: anywhere; }
.syntax > span, .aliases > span { color: var(--dim); display: inline-block; width: 4.5rem; }
.command-meta { margin: 0.9rem 0 0; padding-top: 0.7rem; border-top: 1px solid var(--line); font-size: 0.7rem; }
.command-meta div { display: grid; grid-template-columns: 4.5rem 1fr; gap: 0.4rem; }
.command-meta dt { color: var(--dim); }
.command-meta dd { margin: 0; color: var(--muted); }
details { margin-top: 0.7rem; color: var(--muted); font-size: 0.75rem; }
summary { cursor: pointer; color: var(--cyan); }
details p { margin: 0.55rem 0 0; }
.no-results { padding: 2rem; border: 1px dashed var(--line-hot); color: var(--muted); text-align: center; }

footer { border-top: 1px solid var(--line); color: var(--dim); font-size: 0.72rem; }
footer .shell { min-height: 6rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
footer .prompt::before { content: "$ "; color: var(--green); }
.privacy-link { white-space: nowrap; }

@media (max-width: 1020px) {
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filter-actions { align-items: stretch; }
  .filter-actions button { width: 100%; }
}

@media (max-width: 920px) {
  .catalog-layout { grid-template-columns: 1fr; }
  .category-nav { position: static; display: flex; gap: 0.75rem; overflow-x: auto; padding-bottom: 0; }
  .category-nav p { display: none; }
  .category-nav a { flex: 0 0 auto; }
  .notice { grid-column: span 3; }
}

@media (max-width: 650px) {
  .shell { width: min(100% - 1.2rem, 1180px); }
  .top-row { align-items: flex-start; padding: 0.8rem 0; flex-direction: column; }
  .auth-controls { justify-content: flex-start; }
  .hero { padding-top: 2.4rem; }
  .notice-grid, .command-grid, .filters { grid-template-columns: 1fr; }
  .notice, .notice.twitch, .notice.studio { grid-column: auto; }
  .runtime-note { text-align: left; }
  .result-bar { flex-direction: column; }
  .twitch-setup-form > div { align-items: stretch; flex-direction: column; }
  .twitch-setup-form button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
