/* app.css */

:root {
  --bg: #07080d;
  --panel: rgba(14, 16, 26, 0.72);
  --stroke: rgba(255, 255, 255, 0.12);
  --text: #eef1f8;
  --dim: rgba(238, 241, 248, 0.6);
  --accent: #7cf0d8;
  --accent2: #ffa8e0;
  --kick: #ffc454;
  --snare: #96ffbe;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial,
    sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

button,
select,
input {
  font: inherit;
  color: inherit;
  touch-action: manipulation;
}

.hidden {
  display: none !important;
}

/* ------------------------------ Buehne ----------------------------- */

#app {
  position: fixed;
  inset: 0;
  opacity: 0;
  transition: opacity 0.5s ease;
}
#app.ready {
  opacity: 1;
}

#video,
#overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#video {
  object-fit: cover;
  transform: scaleX(-1); /* Spiegelbild, wie im Badezimmerspiegel */
  background: #000;
}

#overlay {
  pointer-events: none;
}

/* ------------------------------ Kopf ------------------------------- */

.topbar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
  background: linear-gradient(to bottom, rgba(5, 6, 11, 0.78), rgba(5, 6, 11, 0));
  z-index: 3;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  letter-spacing: 0.2px;
  font-size: 15px;
}
.brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

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

.chip {
  font-size: 12px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(8px);
  white-space: nowrap;
}
.chip.accent {
  color: #0a0d14;
  background: var(--accent);
  border-color: transparent;
  min-width: 46px;
  text-align: center;
}
.chip.dim {
  color: var(--dim);
}
.chip.drum {
  opacity: 0.28;
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.chip.kick {
  color: var(--kick);
  border-color: rgba(255, 196, 84, 0.4);
}
.chip.snare {
  color: var(--snare);
  border-color: rgba(150, 255, 190, 0.4);
}
.chip.drum.flash {
  opacity: 1;
  transform: scale(1.14);
  transition: none;
}

.icon-btn {
  width: 34px;
  height: 34px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
  cursor: pointer;
  font-weight: 700;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.status {
  position: absolute;
  top: 58px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 3;
  font-size: 12px;
  color: var(--dim);
  background: rgba(8, 10, 18, 0.6);
  padding: 4px 12px;
  border-radius: 999px;
  backdrop-filter: blur(8px);
  pointer-events: none;
  max-width: 90vw;
  text-align: center;
}
.status:empty {
  display: none;
}

/* --------------------------- Bedienfeld ---------------------------- */

.panel {
  position: absolute;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(880px, 100%);
  z-index: 4;
  background: var(--panel);
  backdrop-filter: blur(18px);
  border: 1px solid var(--stroke);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  transition: transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
  padding-bottom: env(safe-area-inset-bottom);
}
.panel.collapsed {
  transform: translateX(-50%) translateY(calc(100% - 30px));
}

.panel-toggle {
  display: block;
  width: 100%;
  height: 30px;
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 0;
}
.panel-toggle .grip {
  display: block;
  width: 46px;
  height: 4px;
  margin: 13px auto;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.35);
}

.panel-body {
  padding: 2px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 62vh;
  overflow-y: auto;
}

.block h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
}

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

.pill {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 10px 9px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgba(255, 255, 255, 0.05);
  cursor: pointer;
  text-align: left;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.12s ease;
}
.pill:hover {
  background: rgba(255, 255, 255, 0.11);
}
.pill:active {
  transform: scale(0.97);
}
.pill.on {
  background: rgba(124, 240, 216, 0.16);
  border-color: rgba(124, 240, 216, 0.6);
  box-shadow: 0 0 22px rgba(124, 240, 216, 0.18) inset;
}
.pill .num {
  font-size: 10px;
  color: var(--dim);
  font-weight: 700;
}
.pill.on .num {
  color: var(--accent);
}
.pill .nm {
  font-size: 13px;
  font-weight: 650;
  line-height: 1.15;
}
.pill .hint {
  font-size: 10.5px;
  color: var(--dim);
  line-height: 1.2;
}

.grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

.ctl {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.ctl .lbl {
  font-size: 11px;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.ctl .lbl b {
  color: var(--text);
  font-weight: 700;
}
.ctl.slim {
  grid-column: span 2;
}

select {
  appearance: none;
  background: rgba(255, 255, 255, 0.07) url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='8'><path d='M1 1l5 5 5-5' stroke='white' stroke-width='1.6' fill='none' stroke-linecap='round'/></svg>")
    no-repeat right 10px center;
  border: 1px solid var(--stroke);
  border-radius: 10px;
  padding: 9px 30px 9px 11px;
  cursor: pointer;
}

input[type='range'] {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 22px;
  background: transparent;
  cursor: pointer;
}
input[type='range']::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}
input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px;
  height: 17px;
  margin-top: -6px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  box-shadow: 0 0 10px rgba(124, 240, 216, 0.5);
}
input[type='range']::-moz-range-track {
  height: 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
}
input[type='range']::-moz-range-thumb {
  width: 17px;
  height: 17px;
  border: none;
  border-radius: 50%;
  background: var(--accent);
}

.switches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  align-items: center;
}

.sw {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
}
.sw em {
  color: var(--dim);
  font-style: normal;
}
.sw input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.sw .box {
  flex: none;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid var(--stroke);
  position: relative;
  transition: background 0.2s ease;
}
.sw .box::after {
  content: '';
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}
.sw input:checked + .box {
  background: var(--accent);
}
.sw input:checked + .box::after {
  transform: translateX(16px);
}
.sw input:focus-visible + .box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------- Start & Hilfe --------------------------- */

.screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(1200px 700px at 50% 0%, #182034 0%, #07080d 62%);
  overflow-y: auto;
}

.card {
  width: min(520px, 100%);
  background: rgba(16, 19, 30, 0.86);
  border: 1px solid var(--stroke);
  border-radius: 22px;
  padding: 30px 28px;
  text-align: center;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}
.card.wide {
  width: min(820px, 100%);
  text-align: left;
}

.card h1 {
  margin: 0 0 10px;
  font-size: 30px;
  letter-spacing: -0.4px;
}
.card .sub {
  margin: 0 0 18px;
  color: var(--dim);
  font-size: 14px;
  line-height: 1.55;
}

.steps {
  list-style: none;
  margin: 0 0 22px;
  padding: 0;
  display: grid;
  gap: 8px;
  text-align: left;
}
.steps li {
  font-size: 13.5px;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--stroke);
}

.start {
  width: 100%;
  padding: 15px 20px;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #6ec8ff);
  color: #061018;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.18s ease;
}
.start:hover {
  filter: brightness(1.08);
}
.start:active {
  transform: scale(0.985);
}
.start:disabled {
  opacity: 0.55;
  cursor: progress;
}

.hint {
  margin: 14px 0 0;
  font-size: 12px;
  color: var(--dim);
  line-height: 1.5;
}
.error {
  margin: 14px 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: #ffb4b4;
  background: rgba(255, 90, 90, 0.1);
  border: 1px solid rgba(255, 120, 120, 0.35);
  border-radius: 12px;
  padding: 11px 13px;
}

.help-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px 26px;
  margin: 6px 0 22px;
}
.help-grid h3 {
  margin: 0 0 6px;
  font-size: 14px;
  color: var(--accent);
}
.help-grid p {
  margin: 0;
  font-size: 13px;
  line-height: 1.6;
  color: rgba(238, 241, 248, 0.82);
}

/* ------------------------------ Mobil ------------------------------ */

@media (max-width: 720px) {
  .synths {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid,
  .switches {
    grid-template-columns: repeat(2, 1fr);
  }
  .ctl.slim {
    grid-column: span 2;
  }
  .help-grid {
    grid-template-columns: 1fr;
  }
  .pill .hint {
    display: none;
  }
  .panel-body {
    max-height: 56vh;
  }
  .hud .chip.dim {
    display: none;
  }
  .brand {
    font-size: 13px;
  }
}

@media (max-width: 420px) {
  .hud .chip.drum {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition-duration: 0.01ms !important;
  }
}
