:root {
  --bg-0: #080e1c;
  --bg-1: #0f172a;
  --bg-2: #1e293b;
  --border: #334155;
  --text-main: #f8fafc;
  --text-muted: #cbd5e1;
  --accent-blue: #0369a1;
  --accent-pink: #be185d;
  --accent-emerald: #15803d;
  --accent-violet: #6d28d9;
  --accent-amber: #b45309;
  --cyan-bright: #7dd3fc;
}

*, *::before, *::after {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(circle at 20% 0%, #172554 0%, var(--bg-0) 60%);
  color: var(--text-main);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  overflow-x: hidden;
  max-width: 100%;
}

.app-shell {
  max-width: 1004px;
  margin: 0 auto;
  padding: 8px 12px 6px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: nowrap;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 7px 12px;
}

.brand-block {
  min-width: 0;
}

.brand-block h1 {
  margin: 0;
  font-size: 1.08rem;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #f8fafc;
}

.subtitle {
  margin: 2px 0 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn {
  appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 600;
  color: #ffffff;
  background: var(--accent-blue);
  cursor: pointer;
  line-height: 1.15;
  transition: filter 0.14s ease, transform 0.08s ease;
}

.btn:hover {
  filter: brightness(1.12);
}

.btn:active {
  transform: translateY(1px);
}

.btn-violet { background: var(--accent-violet); }
.btn-pink { background: var(--accent-pink); }
.btn-emerald { background: var(--accent-emerald); }
.btn-amber { background: var(--accent-amber); }

.controls-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(min(100%, 190px), 1fr));
  gap: 7px;
}

.control-card {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 7px 9px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.control-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--cyan-bright);
}

.readout-pill {
  background: #1e293b;
  border: 1px solid #475569;
  color: #f8fafc;
  padding: 1px 6px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

select, input[type="range"] {
  width: 100%;
  accent-color: #38bdf8;
}

select {
  background: #0f172a;
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 6px;
  padding: 4px 6px;
  font-size: 0.76rem;
}

.stage-panel {
  position: relative;
  background: #070d19;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 6px 8px 6px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.stage-hud {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.hud-badges {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.status-badge {
  padding: 2px 8px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.72rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.status-ignited {
  background: #15803d;
  color: #ffffff;
}

.status-sub {
  background: #b45309;
  color: #ffffff;
}

#harmonicaCanvas {
  width: 100%;
  height: 318px;
  display: block;
  border-radius: 8px;
  background: #050914;
  touch-action: none;
  cursor: pointer;
}

.bell-strip {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 5px;
}

.bell-btn {
  background: #111827;
  color: #f8fafc;
  border: 1px solid #475569;
  border-radius: 7px;
  padding: 4px 2px;
  font-size: 0.73rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.bell-btn:hover, .bell-btn.active {
  background: #1e3a8a;
  border-color: #7dd3fc;
}

.argon-bench-slot {
  font-size: 0.75rem;
  color: #e2e8f0;
  background: rgba(30, 41, 59, 0.65);
  border: 1px dashed #475569;
  border-radius: 7px;
  padding: 4px 9px;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.footer-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.72rem;
  color: var(--text-muted);
  padding: 2px 4px;
}

.footer-bar a {
  color: var(--cyan-bright);
  text-decoration: underline;
}

kbd, code {
  background: #1e293b;
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 0 4px;
  font-size: 0.7rem;
  color: #f8fafc;
}

@media (max-width: 760px) {
  .top-header {
    flex-wrap: wrap;
  }
  .subtitle {
    white-space: normal;
  }
  .controls-grid {
    grid-template-columns: repeat(2, minmax(min(100%, 145px), 1fr));
  }
  .bell-strip {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  select, input {
    font-size: 16px;
  }
  #harmonicaCanvas {
    height: 256px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn {
    transition: none;
  }
}
