@font-face {
  font-family: "Chakra Petch";
  src: url("/fonts/chakra-petch-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Sans";
  src: url("/fonts/ibm-plex-sans.woff2") format("woff2");
  font-weight: 100 700;
  font-display: swap;
}
@font-face {
  font-family: "IBM Plex Mono";
  src: url("/fonts/ibm-plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "VT323";
  src: url("/fonts/vt323-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Righteous";
  src: url("/fonts/righteous-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

:root {
  --bg: #121212;
  --panel: #1b1b19;
  --line: #2f2e2b;
  --ink: #e8e4da;
  --muted: #9a958a;
  --faint: #8a857b;
  --amber: #ff8a1f;
  --amber-deep: #9c4f08;
  --lcd: #7dff9b;
  --lcd-dim: #4fa865;
  --lcd-bg: #0b1a0f;
  --key: #3b3a36;
  --key-edge: #4b4a45;
  --display: "Chakra Petch", "Segoe UI", system-ui, sans-serif;
  --text: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --screen: "VT323", ui-monospace, Consolas, monospace;
  --gutter: clamp(16px, 4vw, 40px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { scroll-behavior: smooth; scroll-padding-top: 80px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 1rem/1.6 var(--text);
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
code { font-family: var(--mono); font-size: 0.9em; }
svg { display: block; }
h1, h2, h3 { margin: 0; font-family: var(--display); font-weight: 600; text-transform: uppercase; line-height: 1.05; letter-spacing: 0.02em; }

:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; border-radius: 2px; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: var(--gutter); top: -100px; z-index: 10;
  background: var(--amber); color: var(--bg); padding: 10px 16px; font-weight: 600; border-radius: 4px;
}
.skip:focus { top: 12px; }

/* Header */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 28px;
  padding: calc(14px + env(safe-area-inset-top, 0px)) var(--gutter) 14px;
  background: rgb(18 18 18 / 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; margin-right: auto; font-family: "Righteous", var(--display); font-size: 1.35rem; text-decoration: none; }
.led { width: 8px; height: 8px; border-radius: 50%; background: var(--lcd); box-shadow: 0 0 8px var(--lcd); }
.top nav { display: flex; gap: 24px; }
.top nav a { color: var(--muted); text-decoration: none; padding: 10px 0; }
.top nav a:hover { color: var(--ink); }
@media (max-width: 640px) { .top nav { display: none; } }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 18px; border-radius: 4px;
  font-weight: 600; text-decoration: none; cursor: pointer;
  transition: transform 120ms ease, box-shadow 120ms ease, border-color 150ms ease;
}
.btn-amber { background: var(--amber); color: var(--bg); box-shadow: 0 3px 0 var(--amber-deep); }
.btn-amber:hover { transform: translateY(-1px); box-shadow: 0 4px 0 var(--amber-deep); }
.btn-amber:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--amber-deep); }
.btn-ghost { border: 1px solid var(--key-edge); color: var(--ink); }
.btn-ghost:hover { border-color: var(--muted); }

/* Hero */
.intro {
  display: grid; grid-template-columns: 1.1fr 1fr; gap: 40px; align-items: end;
  padding: 56px var(--gutter) 32px; max-width: 1200px; margin: 0 auto;
}
.intro h1 { font-size: clamp(2.4rem, 6vw, 4rem); line-height: 0.98; }
.intro p { color: var(--muted); margin: 0 0 20px; max-width: 46ch; }
.intro .btn + .btn { margin-left: 10px; }
@media (max-width: 860px) { .intro { grid-template-columns: 1fr; gap: 20px; padding-top: 40px; } }

/* Deck */
.deck {
  position: relative;
  max-width: calc(1200px - 2 * 40px);
  margin: 0 var(--gutter) 40px;
  padding: 20px;
  display: grid; grid-template-columns: 1.5fr 1fr; gap: 20px;
  background: linear-gradient(#2a2a28, #1d1d1b);
  border: 1px solid #3a3935; border-radius: 10px;
  box-shadow: inset 0 1px 0 #4a4944, 0 16px 40px rgb(0 0 0 / 0.65);
}
@media (min-width: 1281px) { .deck { margin-inline: auto; } }
@media (max-width: 760px) { .deck { grid-template-columns: 1fr; } }

.lcd {
  min-width: 0;
  background: var(--lcd-bg); border: 2px solid #050c07; border-radius: 6px;
  padding: 14px 16px;
  font-family: var(--screen); color: var(--lcd); text-shadow: 0 0 6px rgb(125 255 155 / 0.45);
}
.lcd-meta { display: flex; justify-content: space-between; gap: 12px; font-size: 1.1rem; color: var(--lcd-dim); }
.lcd-song { font-size: clamp(1.4rem, 3vw, 1.9rem); line-height: 1.05; margin: 8px 0 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lcd-lyrics { display: flex; flex-direction: column; font-size: 1.3rem; line-height: 1.15; color: #c4ffd2; min-height: 2.3em; }
.lcd-past { color: var(--lcd-dim); }
.vu { display: flex; gap: 3px; height: 16px; align-items: flex-end; margin-top: 12px; }
.vu i { width: 9px; background: var(--lcd); transition: height 90ms linear; }
.lv-0 { height: 6%; } .lv-1 { height: 20%; } .lv-2 { height: 35%; } .lv-3 { height: 50%; }
.lv-4 { height: 62%; } .lv-5 { height: 75%; } .lv-6 { height: 88%; } .lv-7 { height: 100%; }

.deck-controls { display: flex; flex-direction: column; justify-content: center; gap: 18px; }
.keys { display: flex; gap: 8px; }
.key {
  flex: 1; min-height: 44px; display: grid; place-items: center;
  background: linear-gradient(var(--key), #2b2a27); color: var(--ink);
  border: 1px solid var(--key-edge); border-radius: 4px;
  box-shadow: 0 3px 0 #0c0c0b;
  font: 600 0.8rem var(--display); letter-spacing: 0.1em; text-transform: uppercase;
  cursor: pointer; transition: transform 80ms ease, box-shadow 80ms ease;
}
.key svg { width: 16px; height: 16px; fill: currentColor; }
.key:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 #0c0c0b; }
.key:disabled { cursor: default; }
.key-on, .key[aria-pressed="true"] { background: linear-gradient(#ff9a3d, #e8740c); border-color: #ffb066; color: var(--bg); }
.key .icon-play { display: none; }
.key.is-paused .icon-pause { display: none; }
.key.is-paused .icon-play { display: block; }

.knobs { display: flex; justify-content: space-between; gap: 8px; }
.knob {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  min-width: 56px; padding: 4px 0;
  background: none; border: 0; color: var(--muted); cursor: pointer;
  font: 600 0.7rem var(--display); letter-spacing: 0.08em; text-transform: uppercase;
}
.knob:disabled { cursor: default; }
.knob[aria-pressed="true"] { color: var(--amber); }
.dial {
  width: 42px; height: 42px; border-radius: 50%; position: relative;
  background: radial-gradient(circle at 35% 30%, #5a5953, #222220 70%);
  border: 1px solid var(--key-edge);
}
.dial::after {
  content: ""; position: absolute; left: 50%; top: 4px;
  width: 2px; height: 12px; margin-left: -1px;
  background: var(--amber); transform-origin: 1px 17px;
  transition: transform 220ms ease;
}
.dial-b::after { transform: rotate(-40deg); }
.dial-c::after { transform: rotate(35deg); }
.knob[aria-pressed="true"] .dial::after { transform: rotate(120deg); }

.plate {
  position: absolute; left: 22px; right: 22px; bottom: -32px; margin: 0;
  white-space: nowrap; overflow: hidden;
  font: 600 0.65rem var(--display); letter-spacing: 0.2em; color: var(--faint);
}

/* Sections */
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 var(--gutter); }
section { padding-top: 64px; }
.label {
  display: flex; align-items: center; gap: 12px; margin: 0 0 10px;
  font: 600 0.72rem var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--amber);
}
.label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
h2 { font-size: clamp(1.6rem, 3.4vw, 2rem); margin-bottom: 24px; }
.note { color: var(--muted); font-size: 0.875rem; margin: 16px 0 0; }

.specs {
  display: grid; grid-template-columns: repeat(3, 1fr); margin: 0;
  border-top: 1px solid var(--line); border-left: 1px solid var(--line);
}
.specs div { padding: 18px 20px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.specs dt { font: 600 0.9rem var(--display); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
.specs dd { margin: 0; color: var(--muted); }
.specs code { color: var(--ink); }
@media (max-width: 900px) { .specs { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .specs { grid-template-columns: 1fr; } }

.steps { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.steps li { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 18px; }
.step-n { font: 2.1rem/1 var(--screen); color: var(--lcd); }
.steps h3 { font-size: 0.95rem; margin: 10px 0 6px; }
.steps p { color: var(--muted); margin: 0; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; } }

/* Commands */
.selector { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin: 24px 0 8px; }
.selector-keys { display: flex; flex-wrap: wrap; gap: 8px; }
.selector-keys .key { flex: 0 0 auto; padding: 0 16px; }
.search {
  margin-left: auto; width: min(280px, 100%); min-height: 44px; padding: 4px 12px;
  background: var(--lcd-bg); color: var(--lcd); caret-color: var(--lcd);
  border: 2px solid #050c07; border-radius: 4px;
  font: 1.3rem var(--screen);
}
.search::placeholder { color: var(--lcd-dim); }
@media (max-width: 640px) { .search { margin-left: 0; width: 100%; } }
.empty { color: var(--muted); margin: 16px 0 0; }

.commands { width: 100%; border-collapse: collapse; margin-top: 24px; }
.commands caption {
  text-align: left; padding-bottom: 8px;
  font: 600 0.72rem var(--display); letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted);
}
.commands th { text-align: left; font: 600 0.72rem var(--display); letter-spacing: 0.1em; text-transform: uppercase; color: var(--faint); padding: 8px 12px; border-bottom: 1px solid var(--line); }
.commands td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; color: var(--muted); }
.commands td:first-child { width: 34%; }
.commands td:first-child code { color: var(--ink); white-space: nowrap; }
.commands td:last-child { text-align: right; white-space: nowrap; }
.commands td:last-child code { color: var(--muted); }
.commands th:last-child { text-align: right; }
@media (max-width: 640px) {
  .commands thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .commands tr { display: grid; grid-template-columns: 1fr auto; padding: 10px 0; border-bottom: 1px solid var(--line); }
  .commands td { border: 0; padding: 2px 0; }
  .commands td:first-child { width: auto; }
  .commands td:nth-child(2) { grid-row: 2; grid-column: 1 / -1; }
  .commands td:first-child code { white-space: normal; }
}

/* Troubleshooting */
.faq details { border-bottom: 1px solid var(--line); }
.faq summary {
  display: flex; align-items: baseline; gap: 16px; min-height: 44px; padding: 14px 0;
  cursor: pointer; list-style: none; font-weight: 500;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; font-family: var(--mono); color: var(--muted); }
.faq details[open] summary::after { content: "−"; }
.faq .code { font: 1.25rem var(--screen); color: var(--amber); min-width: 46px; }
.faq details p { color: var(--muted); margin: 0 0 18px 62px; max-width: 70ch; }
@media (max-width: 560px) { .faq details p { margin-left: 0; } }

/* Footer */
.foot { max-width: 1200px; margin: 72px auto 0; padding: 0 var(--gutter) env(safe-area-inset-bottom, 0px); }
.foot-in {
  display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center;
  padding: 22px 0; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.875rem;
}
.foot a { padding: 10px 0; }
.foot-plate { margin-right: auto; font: 600 0.7rem var(--display); letter-spacing: 0.12em; color: var(--faint); }

/* 404 */
.lost { min-height: 70vh; display: grid; place-items: center; padding: 40px var(--gutter); text-align: center; }
.lost .lcd { max-width: 520px; width: 100%; margin: 0 auto 24px; text-align: left; }
.lost h1 { font-size: clamp(1.6rem, 4vw, 2.4rem); margin-bottom: 12px; }
.lost p { color: var(--muted); margin: 0 0 24px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
