:root {
  --bg-dark: #0b1120;
  --bg-panel: #131c31;
  --bg-surface: #1c2742;
  --border: #2c3a5e;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0284c7;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg-dark);
  color: var(--text-main);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  overflow: hidden;
}

.app-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
  width: 100vw;
}

/* Kopfzeile */
.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  padding: 10px 18px;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
}

.song-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.title-row h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  color: var(--accent);
}

.subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
}

.tubes-needed {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 2px;
}

.tube-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.25);
}

/* Steuerleiste */
.controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn, .select {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text-main);
  padding: 7px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, border-color 0.15s ease;
}

.btn:hover, .select:hover {
  background: #253356;
  border-color: #475d94;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover {
  background: #0369a1;
}

.slider-group {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 5px 11px;
  border-radius: 8px;
  font-size: 0.84rem;
}

.slider-group input[type="range"] {
  width: 105px;
  accent-color: var(--accent);
  cursor: pointer;
}

.toggle-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}

.toggle-chip input {
  accent-color: var(--accent);
  cursor: pointer;
}

/* Karaoke-Textzeile */
.lyrics-bar {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 58px;
  padding: 6px 16px;
  background: linear-gradient(180deg, #10182c 0%, #0b1120 100%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

.lyrics-current {
  font-size: clamp(1.05rem, 2.2vw, 1.55rem);
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #cbd5e1;
}

.lyrics-current .syl-active {
  color: #fde047;
  text-shadow: 0 0 14px rgba(253, 224, 71, 0.55);
  transform: scale(1.06);
  display: inline-block;
}

.lyrics-current .syl-done {
  color: #ffffff;
}

.lyrics-next {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin-top: 2px;
  min-height: 1.1em;
}

/* Canvas-Bühne */
.stage-wrapper {
  position: relative;
  flex: 1;
  min-height: 0;
  width: 100%;
  background: radial-gradient(circle at 50% 80%, #16223d 0%, #090e1a 75%);
}

#stageCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.drop-overlay {
  position: absolute;
  inset: 14px;
  border: 3px dashed var(--accent);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.86);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--accent);
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* Fortschrittsbalken unten */
.progress-bar-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 7px 18px;
  background: var(--bg-panel);
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.time-label {
  min-width: 68px;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text-main);
}

.progress-track {
  flex: 1;
  height: 10px;
  background: var(--bg-surface);
  border-radius: 999px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid var(--border);
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #818cf8);
  transition: width 0.05s linear;
}

.hint-label {
  display: none;
}

@media (min-width: 960px) {
  .hint-label {
    display: inline;
  }
}

/* JSON-Modal */
.json-modal {
  margin: auto;
  width: min(760px, 94vw);
  max-height: 90vh;
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.65);
}

.json-modal::backdrop {
  background: rgba(2, 6, 23, 0.75);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.modal-hint {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 10px;
  line-height: 1.4;
}

.modal-hint code {
  background: var(--bg-surface);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--accent);
}

#jsonEditor {
  width: 100%;
  height: 330px;
  background: #090e1a;
  color: #e2e8f0;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  resize: vertical;
}

.json-error {
  color: #fb7185;
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-top: 6px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 10px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}