:root {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #f5f7fb;
  background: #0b0d12;
  font-synthesis: none;
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at top, #151a25 0, #0b0d12 45rem); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }

.shell { width: min(1180px, calc(100% - 32px)); margin: 0 auto; padding: 42px 0 56px; }
.hero { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 24px; }
.eyebrow { margin: 0 0 8px; text-transform: uppercase; letter-spacing: .12em; font-size: .78rem; color: #9eabd0; }
h1 { margin: 0; font-size: clamp(2rem, 5vw, 3.5rem); line-height: 1; }
h2 { margin: 0 0 10px; font-size: 1.15rem; }
p { color: #b9c1d5; line-height: 1.55; }
.lead { max-width: 760px; margin-bottom: 0; font-size: 1.05rem; }

.panel, .status-card { border: 1px solid #2a3141; background: rgba(18, 22, 31, .88); box-shadow: 0 12px 38px rgba(0,0,0,.18); border-radius: 18px; }
.panel { padding: 22px; }
.status-card { padding: 14px 16px; min-width: 210px; display: grid; gap: 8px; }
.status-dot::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: #d9874f; margin-right: 8px; }
.status-dot.running::before { background: #68c78f; }
.start-panel { display: flex; align-items: center; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.start-panel p { margin-bottom: 0; }

.grid { display: grid; gap: 18px; margin-top: 18px; }
.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.test-grid { grid-template-columns: minmax(0, 1.05fr) minmax(360px, .95fr); }

button { border: 1px solid #3a4358; color: #f5f7fb; background: #1b2130; border-radius: 11px; padding: 10px 14px; transition: transform .12s ease, border-color .12s ease, background .12s ease; }
button:hover { transform: translateY(-1px); border-color: #65739a; background: #242c3e; }
button:focus-visible, input:focus-visible { outline: 3px solid #8fa8ff; outline-offset: 2px; }
.primary { background: #4d67d8; border-color: #6f85e8; font-weight: 700; }
.primary:hover { background: #5a73df; }
.secondary { background: transparent; }

.direction-pad { display: grid; grid-template-columns: repeat(3, minmax(82px, 1fr)); grid-template-areas: ". front ." "left center right" ". back ."; gap: 10px; max-width: 430px; margin: 18px auto; }
.dir.front { grid-area: front; }
.dir.left { grid-area: left; }
.dir.center { grid-area: center; }
.dir.right { grid-area: right; }
.dir.back { grid-area: back; }
.dir.active, .button-row button.active { background: #354a9f; border-color: #8397ee; }

.button-row { display: flex; gap: 10px; align-items: center; }
.wrap { flex-wrap: wrap; }
.range-row { display: grid; grid-template-columns: 120px 1fr 76px; gap: 12px; align-items: center; margin-top: 20px; }
.range-row input { width: 100%; }
.range-row output { font-variant-numeric: tabular-nums; text-align: right; color: #d8def0; }
.readout { display: flex; justify-content: space-between; gap: 12px; padding-top: 10px; border-top: 1px solid #2a3141; color: #9da7bf; }
.readout strong { color: #f5f7fb; }
.hint { font-size: .9rem; color: #8f9ab4; }
kbd { border: 1px solid #4a546b; background: #10141d; border-radius: 5px; padding: 1px 6px; color: #eef2ff; }

.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; }
.blind-question { min-height: 76px; display: grid; place-items: center; margin: 20px 0; border: 1px dashed #46506a; border-radius: 14px; font-size: 1.15rem; font-weight: 700; color: #dce3f6; text-align: center; padding: 14px; }
.blind-answers { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.score-row { display: flex; flex-wrap: wrap; align-items: center; gap: 15px; margin-top: 18px; color: #aab4ca; }
.score-row strong { color: #fff; }
.score-row button { margin-left: auto; }

canvas { width: 100%; height: auto; display: block; background: #0b0f16; border: 1px solid #2b3447; border-radius: 14px; }
.debug-data { display: grid; gap: 8px; margin-top: 12px; }
.debug-data div, .diag-grid div { display: flex; justify-content: space-between; gap: 16px; }
.debug-data span, .diag-grid span { color: #8995ae; }

.diag-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 22px; }
.diag-grid div { padding: 10px 0; border-bottom: 1px solid #282f3e; }
footer { padding: 24px 6px 0; text-align: center; }

@media (max-width: 820px) {
  .hero, .start-panel, .panel-heading { flex-direction: column; }
  .status-card { width: 100%; }
  .two, .test-grid { grid-template-columns: 1fr; }
  .diag-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 520px) {
  .shell { width: min(100% - 20px, 1180px); padding-top: 24px; }
  .panel { padding: 17px; }
  .range-row { grid-template-columns: 1fr 70px; }
  .range-row span { grid-column: 1 / -1; }
  .blind-answers, .diag-grid { grid-template-columns: 1fr; }
}
