/* Gitte-Tuner — dark glass UI */
:root {
  --bg: #0d0f10;
  --bg-elev: rgba(255, 255, 255, 0.04);
  --glass: rgba(255, 255, 255, 0.06);
  --glass-border: rgba(255, 255, 255, 0.1);
  --accent: #1fb5a6;
  --accent-bright: #3fd4c3;
  --text: #e8eceb;
  --muted: #8a9491;
  --danger: #e85d5d;
  --ok: #3dd68c;
  --warn: #e8c05d;
  --radius: 18px;
  --touch: 48px;
  --font: "Inter", system-ui, -apple-system, sans-serif;
  --display: "Barlow Semi Condensed", "Inter", sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  overscroll-behavior: none;
}
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: var(--safe-t);
}

.app {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 520px;
  width: 100%;
  margin: 0 auto;
  padding: 12px 16px calc(72px + var(--safe-b));
  gap: 12px;
}

header.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 2px;
}
header h1 {
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
  margin: 0;
  color: var(--accent-bright);
}
.badge {
  font-size: 0.7rem;
  color: var(--muted);
  border: 1px solid var(--glass-border);
  border-radius: 999px;
  padding: 4px 10px;
}

.card {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 16px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.panel { display: none; flex-direction: column; gap: 12px; flex: 1; }
.panel.active { display: flex; }

/* —— Tuner —— */
.tuner-display {
  position: relative;
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tuner-display.hidden { display: none; }

.note-big {
  text-align: center;
  z-index: 2;
}
.note-big .letter {
  font-family: var(--display);
  font-size: 4.5rem;
  font-weight: 700;
  line-height: 1;
  transition: color 0.15s ease;
}
.note-big .letter.in-tune { color: var(--ok); }
.note-big .string-id {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 2px;
}
.note-big .sounding {
  font-size: 0.75rem;
  color: var(--accent);
  min-height: 1.1em;
}
.note-big .cents {
  font-family: var(--display);
  font-size: 1.4rem;
  font-weight: 600;
  margin-top: 6px;
  letter-spacing: 0.04em;
}
.arrows {
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-top: 4px;
  font-size: 1.1rem;
  color: var(--muted);
}
.arrows .hot { color: var(--accent-bright); }

/* VU needle */
.vu-wrap {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.vu-arc {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 260px;
  height: 130px;
  margin-left: -130px;
  border: 2px solid var(--glass-border);
  border-bottom: none;
  border-radius: 130px 130px 0 0;
}
.vu-needle {
  position: absolute;
  left: 50%;
  bottom: 28px;
  width: 3px;
  height: 118px;
  margin-left: -1.5px;
  background: linear-gradient(to top, var(--accent), var(--accent-bright));
  transform-origin: bottom center;
  transform: rotate(0deg);
  border-radius: 2px;
  transition: transform 0.08s linear;
  box-shadow: 0 0 12px rgba(31, 181, 166, 0.5);
}
.vu-center {
  position: absolute;
  left: 50%;
  bottom: 22px;
  width: 12px;
  height: 12px;
  margin-left: -6px;
  border-radius: 50%;
  background: var(--accent-bright);
}

/* Level (Wasserwaage) */
.level-wrap {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
}
.level-track {
  position: relative;
  height: 56px;
  border-radius: 28px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--glass-border);
  overflow: hidden;
}
.level-zone {
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 14%;
  margin-left: -7%;
  background: rgba(61, 214, 140, 0.15);
  border-left: 1px solid rgba(61, 214, 140, 0.35);
  border-right: 1px solid rgba(61, 214, 140, 0.35);
}
.level-bubble {
  position: absolute;
  top: 6px;
  width: 44px;
  height: 44px;
  margin-left: -22px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, var(--accent-bright), var(--accent));
  box-shadow: 0 0 16px rgba(31, 181, 166, 0.55);
  left: 50%;
  transition: left 0.08s linear, background 0.15s;
}
.level-bubble.in-tune {
  background: radial-gradient(circle at 35% 30%, #7dffb2, var(--ok));
}
.level-labels {
  display: flex;
  justify-content: space-between;
  font-size: 0.7rem;
  color: var(--muted);
  margin-top: 6px;
  padding: 0 4px;
}

.strings-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.string-btn {
  appearance: none;
  border: 1px solid var(--glass-border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 12px;
  min-height: var(--touch);
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.string-btn.active {
  border-color: var(--accent);
  background: rgba(31, 181, 166, 0.18);
  color: var(--accent-bright);
}
.string-btn.in-tune {
  border-color: var(--ok);
  color: var(--ok);
}
.string-btn .sub {
  display: block;
  font-size: 0.65rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
}

.row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.row.spread { justify-content: space-between; }
.row.center { justify-content: center; }

label.field-label {
  font-size: 0.75rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.btn {
  appearance: none;
  border: 1px solid var(--glass-border);
  background: var(--bg-elev);
  color: var(--text);
  border-radius: 14px;
  min-height: var(--touch);
  min-width: var(--touch);
  padding: 0 16px;
  font-family: var(--font);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:active { transform: scale(0.97); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), #178f84);
  border-color: transparent;
  color: #041312;
}
.btn.primary:disabled {
  opacity: 0.45;
}
.btn.ghost { background: transparent; }
.btn.icon { padding: 0; width: var(--touch); }
.btn.wide { flex: 1; }
.btn.active-toggle {
  border-color: var(--accent);
  color: var(--accent-bright);
  background: rgba(31, 181, 166, 0.15);
}
.btn:disabled, .btn[disabled] {
  opacity: 0.35;
  cursor: not-allowed;
}

.seg {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 14px;
  padding: 4px;
  gap: 2px;
  border: 1px solid var(--glass-border);
}
.seg button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  min-height: 40px;
  padding: 0 12px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
}
.seg button.on {
  background: rgba(31, 181, 166, 0.25);
  color: var(--accent-bright);
}

.slider-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 36px;
  background: transparent;
  margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-bright);
  margin-top: -10px;
  box-shadow: 0 0 12px rgba(63, 212, 195, 0.45);
  border: none;
}
input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
}
input[type="range"]::-moz-range-thumb {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent-bright);
  border: none;
}

.value-pill {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--accent-bright);
  min-width: 4ch;
  text-align: center;
}

.mic-status {
  font-size: 0.8rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.2em;
}
.mic-status.err { color: var(--danger); }

/* —— Metronome —— */
.bpm-display {
  text-align: center;
  padding: 8px 0 4px;
}
.bpm-display .num {
  font-family: var(--display);
  font-size: 5rem;
  font-weight: 700;
  line-height: 1;
  color: var(--text);
  letter-spacing: -0.02em;
}
.bpm-display .unit {
  font-size: 0.85rem;
  color: var(--muted);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.beat-dots {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin: 8px 0 4px;
  min-height: 18px;
}
.beat-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--glass-border);
  transition: background 0.05s, transform 0.05s;
}
.beat-dot.on {
  background: var(--accent-bright);
  transform: scale(1.25);
  box-shadow: 0 0 14px rgba(63, 212, 195, 0.55);
}
.beat-dot.accent.on {
  background: #fff;
}

.transport {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 8px;
}
.tap-btn {
  min-height: 64px;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.ctrl-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.ctrl-block .seg { width: 100%; }
.ctrl-block .seg button { flex: 1; padding: 0 6px; font-size: 0.78rem; }

.mute-row {
  display: grid;
  grid-template-columns: auto 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}
.mute-row input[type="number"] {
  width: 100%;
  min-height: 44px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text);
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  font-family: var(--display);
}
.bar-counter {
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
}
.bar-counter strong { color: var(--accent-bright); }

/* Bottom tab switcher */
.tab-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 8px 16px calc(8px + var(--safe-b));
  background: rgba(13, 15, 16, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--glass-border);
  z-index: 50;
}
.tab-bar-inner {
  max-width: 520px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 16px;
  padding: 4px;
  border: 1px solid var(--glass-border);
}
.tab-bar button {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--muted);
  min-height: 48px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 1rem;
  font-family: var(--display);
  letter-spacing: 0.04em;
  cursor: pointer;
}
.tab-bar button.on {
  background: rgba(31, 181, 166, 0.22);
  color: var(--accent-bright);
}

.hidden { display: none !important; }
.swing-disabled { opacity: 0.35; pointer-events: none; }

@media (min-width: 600px) {
  .app { padding-top: 24px; }
  .bpm-display .num { font-size: 5.5rem; }
}
