/*
 * styles.css – Klangbaum (Wind- & Bewegungsklangspiel)
 * Minimalistisches, vollbild-orientiertes Zen-Design
 */

:root {
  --theme-accent: #2dd4bf;
  --theme-bg: #070c0f;
  --theme-card-bg: rgba(15, 23, 30, 0.72);
  --theme-card-border: rgba(255, 255, 255, 0.1);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --font-family: 'Lato', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-family);
  background: var(--theme-bg);
  color: var(--text-main);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

/* ── Navigation: immer dunkel, unabhängig vom Geräte-Farbschema ──────────── */
.sim-nav {
  background: #000;
  border-bottom-color: rgba(255, 255, 255, 0.08);
  color-scheme: dark;
}

.sim-nav__title {
  color: var(--text-main);
}

.sim-nav__back,
.sim-nav__lang-select {
  color: var(--theme-accent);
}

.sim-nav__lang-select {
  border-color: rgba(255, 255, 255, 0.18);
}

.sim-nav__lang-select:hover {
  background: rgba(45, 212, 191, 0.12);
}

.sim-nav__lang-select option {
  background: #000;
  color: var(--text-main);
}

/* ── Utilities ────────────────────────────────────────────────────────────── */
.hidden {
  display: none !important;
}

/* ── Vollbild-Canvas Visualisierung ───────────────────────────────────────── */
#visualizer-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  z-index: 0;
  pointer-events: none;
  background: radial-gradient(circle at 50% 40%, #0e1920 0%, #060a0d 100%);
}

/* ── 1. Start- / Berechtigungs-Bildschirm ─────────────────────────────────── */
.permission-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: radial-gradient(circle at 50% 40%, #0d1b22 0%, #05080a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
}

.permission-card {
  max-width: 400px;
  width: 100%;
  background: rgba(18, 28, 36, 0.88);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: 24px;
  padding: 2.2rem 1.8rem;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 30px rgba(45, 212, 191, 0.15);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.2rem;
  animation: fadeInScale 0.5s cubic-bezier(0.16, 1, 0.3, 1);
}

.permission-icon-wrap {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(45, 212, 191, 0.25) 0%, rgba(45, 212, 191, 0.04) 70%);
  border: 1px solid rgba(45, 212, 191, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--theme-accent);
  box-shadow: 0 0 25px rgba(45, 212, 191, 0.25);
}

.permission-title {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: #ffffff;
}

.permission-subtitle {
  font-size: 0.92rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.permission-btn {
  width: 100%;
  padding: 0.95rem 1.4rem;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #14b8a6, #0d9488);
  color: #ffffff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(20, 184, 166, 0.35);
  transition: transform 0.15s, filter 0.15s;
}

.permission-btn:active {
  transform: scale(0.97);
  filter: brightness(0.9);
}

.permission-hint {
  font-size: 0.76rem;
  color: #64748b;
  line-height: 1.4;
}

/* ── 2. Haupt-Anwendungsbereich (Floating UI über dem Canvas) ─────────────── */
.app-container {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-top: calc(var(--sim-nav-offset, 44px) + 8px);
  padding-bottom: max(calc(env(safe-area-inset-bottom, 20px) + 16px), 24px);
  padding-left: 0.85rem;
  padding-right: 0.85rem;
  pointer-events: none;
  overflow: hidden;
}

/* ── Oberes HUD ───────────────────────────────────────────────────────────── */
.top-hud {
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

.sensor-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(10, 16, 22, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 10px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  color: #cbd5e1;
}

.sensor-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--theme-accent);
  box-shadow: 0 0 8px var(--theme-accent);
  animation: pulseDot 2s infinite ease-in-out;
}

.hud-center-meters {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(10, 16, 22, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 5px 10px;
  border-radius: 20px;
}

.tilt-badge {
  font-size: 0.7rem;
  color: #94a3b8;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.wind-meter {
  width: 44px;
  height: 4px;
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
  overflow: hidden;
}

.wind-meter-fill {
  width: 15%;
  height: 100%;
  background: linear-gradient(90deg, #14b8a6, #f59e0b);
  border-radius: 4px;
  transition: width 0.15s ease-out;
}

.gyro-mini-horizon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(10, 16, 22, 0.72);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.gyro-bubble {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--theme-accent);
  box-shadow: 0 0 8px var(--theme-accent);
  transition: transform 0.08s linear;
}

/* ── Unteres Dock (Vollbreite, nach unten versetzt) ───────────────────────── */
.bottom-dock {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 520px;
  margin: 0 auto;
}

/* ── 1. Stimmungswähler (Füllt 100% Breite, zweizeilig) ──────────────────── */
.mood-selector-bar {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  background: rgba(15, 23, 30, 0.75);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--theme-card-border);
}

.mood-btn {
  width: 100%;
  padding: 5px 2px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: none;
  color: var(--text-muted);
  font-size: 0.72rem;
  font-weight: 600;
  line-height: 1.15;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mood-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.mood-btn.active {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

/* ── 2. Vier kompakte Klang-Ebenen (Füllen 100% der Reihe) ───────────────── */
.layers-row {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 1px 0;
}

.layer-btn {
  width: 100%;
  height: 52px;
  border-radius: 16px;
  background: var(--theme-card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--theme-card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
  color: #94a3b8;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.3);
}

.layer-btn:active {
  transform: scale(0.95);
}

.layer-btn svg {
  transition: transform 0.2s ease, stroke 0.2s ease;
}

.layer-status-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  transition: all 0.25s ease;
}

/* Aktiver Layer-Zustand */
.layer-btn.active {
  background: rgba(20, 34, 44, 0.9);
  border-color: var(--theme-accent);
  color: var(--theme-accent);
  box-shadow: 0 0 16px rgba(45, 212, 191, 0.25), inset 0 0 12px rgba(45, 212, 191, 0.1);
}

.layer-btn.active .layer-status-dot {
  background: var(--theme-accent);
  box-shadow: 0 0 8px var(--theme-accent);
}

.layer-btn.active svg {
  stroke: var(--theme-accent);
}

/* ── 3. Licht- & Atmosphären-Wähler ───────────────────────────────────────── */
.light-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--theme-card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--theme-card-border);
  border-radius: 14px;
  padding: 4px;
}

.light-toggles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  width: 100%;
}

.light-btn {
  width: 100%;
  padding: 6px 0;
  border-radius: 10px;
  border: 1px solid transparent;
  background: none;
  color: #94a3b8;
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
  text-align: center;
}

.light-btn:hover {
  color: #f1f5f9;
}

.light-btn.active {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25);
}

/* ── 4. Controls-Bar (Füllt 100% der Zeile: 50% / 50%) ───────────────────── */
.controls-bar {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-btn {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--theme-card-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--theme-card-border);
  color: #e2e8f0;
  padding: 10px 12px;
  border-radius: 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25);
}

.action-btn:active {
  transform: scale(0.96);
}

.action-btn.calibrated {
  background: rgba(45, 212, 191, 0.25);
  border-color: var(--theme-accent);
  color: #ffffff;
}

/* ── 5. OLED Baum-Modus (Reines 100% Schwarz ohne Restleuchten) ──────────── */
.treemode-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: #000000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 2rem;
  text-align: center;
}

.treemode-glow-orb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--theme-accent);
  box-shadow: 0 0 30px var(--theme-accent);
  animation: treeBreath 4s infinite ease-in-out;
  margin-bottom: 1.5rem;
}

.treemode-text {
  font-size: 0.76rem;
  color: #475569;
  letter-spacing: 0.05em;
  user-select: none;
}

/* ── Animationen ──────────────────────────────────────────────────────────── */
@keyframes fadeInScale {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(0.85); }
}

@keyframes treeBreath {
  0%, 100% { opacity: 0.15; transform: scale(0.8); }
  50% { opacity: 0.7; transform: scale(1.15); }
}
