:root {
  --bg: #020603;
  --panel: rgba(0, 16, 7, 0.92);
  --panel2: rgba(0, 28, 10, 0.75);
  --green: #55ff88;
  --green2: #00d95a;
  --green3: #93ffb2;
  --dim: #1b8c46;
  --bad: #ff5f5f;
  --good: #74ff9b;
  --amber: #ffd36b;
  --line: rgba(85, 255, 136, 0.45);
  --text: #eaffef;
  --muted: #9df6b9;
  --shadow: 0 0 20px rgba(0, 255, 100, .22);
  --font: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  color: var(--text);
  font-family: var(--font);
  background:
    radial-gradient(circle at 10% 10%, rgba(54,255,103,.15), transparent 24rem),
    radial-gradient(circle at 90% 20%, rgba(0,180,80,.12), transparent 22rem),
    linear-gradient(180deg, #020603 0%, #000 100%);
  padding-bottom: 92px;
  overflow-x: auto;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .12;
  background-image:
    linear-gradient(90deg, transparent 0 92%, rgba(91,255,136,.25) 93% 94%, transparent 95%),
    linear-gradient(180deg, rgba(91,255,136,.15), transparent 6rem);
  background-size: 86px 100%, 100% 16px;
  animation: matrixDrift 12s linear infinite;
}
.scanlines {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
  background: repeating-linear-gradient(0deg, rgba(255,255,255,.035), rgba(255,255,255,.035) 1px, transparent 1px, transparent 4px);
  mix-blend-mode: screen;
  opacity: .28;
}
@keyframes matrixDrift { from { background-position: 0 0, 0 0; } to { background-position: 0 400px, 0 160px; } }

.app-shell {
  min-width: 980px;
  max-width: 1500px;
  margin: 0 auto;
  padding: 16px;
  display: grid;
  grid-template-columns: 260px minmax(480px, 1fr) 275px;
  gap: 14px;
}
.panel {
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: var(--shadow), inset 0 0 30px rgba(0,255,90,.05);
}
.brand-panel { padding: 14px; align-self: start; position: sticky; top: 12px; }
.logo-wrap {
  border: 1px solid rgba(85,255,136,.35);
  border-radius: 14px;
  background: #000;
  overflow: hidden;
}
.logo { display: block; width: 100%; height: auto; }
.mini-status {
  margin-top: 12px;
  border: 1px solid rgba(85,255,136,.25);
  border-radius: 12px;
  padding: 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.status-title, .control-title, .eyebrow, .feedback-title { color: var(--green3); letter-spacing: .08em; text-transform: uppercase; }
.status-title, .control-title { font-size: 12px; margin-bottom: 7px; }

.question-panel {
  padding: 16px;
  min-height: calc(100vh - 124px);
}
.question-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
h1 { margin: 0; color: var(--green); font-size: clamp(28px, 3vw, 44px); line-height: 1; text-shadow: 0 0 14px rgba(85,255,136,.45); }
#subTitle { margin: 5px 0 0; color: var(--muted); font-size: 14px; }
.eyebrow { font-size: 13px; margin-bottom: 5px; }
.score-card {
  min-width: 132px;
  text-align: right;
  color: var(--green3);
  border: 1px solid rgba(85,255,136,.35);
  border-radius: 12px;
  padding: 9px;
  font-size: 13px;
}
.question-card, .feedback-card {
  border: 1px solid rgba(85,255,136,.30);
  border-radius: 16px;
  background: rgba(0, 0, 0, .35);
}
.question-card { padding: 16px; }
.meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 11px;
}
.meta-row span {
  border: 1px solid rgba(85,255,136,.28);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
}
#questionText {
  margin: 0 0 16px;
  font-size: clamp(20px, 2.05vw, 30px);
  line-height: 1.25;
  color: #f6fff8;
}
.answers { display: grid; gap: 10px; }
.answer-btn {
  display: grid;
  grid-template-columns: 45px 1fr;
  align-items: stretch;
  width: 100%;
  min-height: 58px;
  padding: 0;
  border: 1px solid rgba(85,255,136,.55);
  border-radius: 14px;
  background: rgba(0, 28, 10, .62);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: transform .08s ease, background .12s ease, border-color .12s ease;
}
.answer-btn:hover, .answer-btn.focused { background: rgba(0, 72, 28, .72); border-color: var(--green); transform: translateY(-1px); }
.answer-btn.correct { background: rgba(0, 90, 35, .88); border-color: var(--good); }
.answer-btn.wrong { background: rgba(92, 8, 8, .78); border-color: var(--bad); }
.answer-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(85,255,136,.13);
  border-right: 1px solid rgba(85,255,136,.35);
  color: var(--green);
  font-size: 19px;
  font-weight: 800;
}
.answer-text {
  padding: 12px 13px;
  font-size: clamp(15px, 1.32vw, 20px);
  line-height: 1.25;
  overflow-wrap: anywhere;
}
.feedback-card {
  margin-top: 12px;
  padding: 13px 15px;
  max-height: 190px;
  overflow: auto;
}
.feedback-title { font-size: 13px; margin-bottom: 7px; }
.feedback-body { color: #dfffea; font-size: clamp(14px, 1.15vw, 18px); line-height: 1.35; }
.feedback-card.good { border-color: var(--good); }
.feedback-card.bad { border-color: var(--bad); }

.control-panel { padding: 12px; align-self: start; position: sticky; top: 12px; }
.control-block { border: 1px solid rgba(85,255,136,.24); border-radius: 14px; padding: 10px; margin-bottom: 10px; background: rgba(0, 0, 0, .25); }
.segmented { display: grid; gap: 6px; }
.segmented.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
button {
  border: 1px solid rgba(85,255,136,.55);
  border-radius: 10px;
  background: rgba(0, 34, 14, .78);
  color: var(--green3);
  font-family: var(--font);
  font-weight: 700;
  cursor: pointer;
  padding: 9px 9px;
  text-transform: uppercase;
  box-shadow: inset 0 0 10px rgba(0,255,90,.04);
}
button:hover, button.active { background: rgba(0, 95, 37, .82); color: #fff; border-color: var(--green); }
.mode-btn { font-size: 11px; padding: 8px 5px; }
.unit-block { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.unit-block .control-title { grid-column: 1 / -1; }
.unit-btn { font-size: 13px; min-height: 42px; }
.unit-btn[data-unit="all"] { grid-column: 1 / -1; }
.actions-block { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.actions-block .control-title { grid-column: 1 / -1; }
.actions-block button { font-size: 11px; }
.music-scanner { overflow: hidden; }
.visualizer-row { display: grid; grid-template-columns: 70px 1fr; gap: 9px; align-items: center; }
.radar {
  width: 66px; height: 66px; border-radius: 50%; border: 1px solid rgba(85,255,136,.5); position: relative; overflow: hidden;
  background: radial-gradient(circle, rgba(85,255,136,.18) 0 2px, transparent 3px), radial-gradient(circle, transparent 0 38%, rgba(85,255,136,.14) 39% 40%, transparent 41% 100%);
}
.radar::before { content: ""; position: absolute; inset: 50% 50% 0 50%; width: 50%; height: 1px; background: var(--green); transform-origin: left; animation: sweep 2.6s linear infinite; }
.radar span { position: absolute; inset: 9px; border: 1px solid rgba(85,255,136,.22); border-radius: 50%; }
@keyframes sweep { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.equalizer { display: flex; align-items: flex-end; height: 68px; gap: 5px; border: 1px solid rgba(85,255,136,.22); border-radius: 10px; padding: 7px; }
.eq-bar { flex: 1; min-width: 6px; border-radius: 3px 3px 0 0; background: linear-gradient(180deg, var(--green3), var(--green2)); height: 20%; box-shadow: 0 0 10px rgba(85,255,136,.25); }
.waveform { width: 100%; height: 58px; margin-top: 10px; border: 1px solid rgba(85,255,136,.22); border-radius: 10px; background: rgba(0,0,0,.2); }
.waveform path { fill: none; stroke: var(--green); stroke-width: 3; filter: drop-shadow(0 0 5px rgba(85,255,136,.55)); }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  border-top: 1px solid rgba(85,255,136,.45);
  background: rgba(0, 12, 5, .96);
  box-shadow: 0 -4px 24px rgba(0,255,90,.10);
  padding: 8px 16px 10px;
}
.nav-buttons { max-width: 980px; margin: 0 auto 6px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.nav-buttons button { padding: 9px; font-size: 13px; }
.key-strip { text-align: center; color: var(--muted); font-size: 12px; white-space: nowrap; overflow-x: auto; }

.help-dialog {
  max-width: 820px;
  width: min(820px, calc(100vw - 24px));
  color: var(--text);
  border: 1px solid var(--green);
  border-radius: 18px;
  background: rgba(0, 13, 5, .98);
  box-shadow: 0 0 40px rgba(0,255,90,.22);
}
.help-dialog::backdrop { background: rgba(0,0,0,.68); }
.help-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-bottom: 1px solid rgba(85,255,136,.25); padding-bottom: 10px; margin-bottom: 14px; }
.help-head h2 { margin: 0; color: var(--green); }
.help-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.help-grid div { border: 1px solid rgba(85,255,136,.22); border-radius: 12px; padding: 12px; line-height: 1.35; color: #e9ffee; }

@media (max-width: 1100px) {
  body { padding-bottom: 105px; }
  .app-shell { min-width: 0; grid-template-columns: 210px minmax(0, 1fr); }
  .control-panel { grid-column: 1 / -1; position: static; display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
  .control-block { margin-bottom: 0; }
  .music-scanner { grid-column: span 2; }
  .question-panel { min-height: auto; }
}
@media (max-width: 760px) {
  body { padding-bottom: 125px; }
  .app-shell { display: block; padding: 10px; }
  .brand-panel, .control-panel { position: static; margin-bottom: 10px; }
  .brand-panel { display: grid; grid-template-columns: 120px 1fr; gap: 10px; align-items: center; }
  .mini-status { margin-top: 0; }
  .question-panel { padding: 12px; }
  .question-header { display: block; }
  .score-card { text-align: left; margin-top: 10px; }
  .control-panel { display: block; }
  .control-block { margin-bottom: 9px; }
  .answers { gap: 8px; }
  .answer-btn { grid-template-columns: 40px 1fr; }
  .nav-buttons { grid-template-columns: repeat(2, 1fr); }
  .key-strip { font-size: 11px; }
  .help-grid { grid-template-columns: 1fr; }
}


.learn-more {
  margin-top: 10px;
  font-size: 0.82rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.learn-more a {
  color: var(--green);
  text-decoration: none;
  border-bottom: 1px solid rgba(0,255,102,0.45);
}
.learn-more a:hover, .learn-more a:focus {
  border-bottom-color: var(--green);
  text-shadow: 0 0 8px rgba(0,255,102,0.6);
}
