:root{
  --bg: #0b0e14;
  --bg-elevated: #12161f;
  --line: #232a38;
  --text: #eef1f6;
  --text-dim: #8b93a3;
  --teal: #2de1c2;
  --teal-soft: rgba(45,225,194,0.35);
  --magenta: #ff4fa3;
  --magenta-soft: rgba(255,79,163,0.35);
  --amber: #ffb020;
  --radius: 18px;
}

*{ box-sizing: border-box; }

/* Verlässlich verstecken: einige Klassen (z.B. .screen, .accuracy-badge) setzen
   selbst einen display-Wert, der sonst das eingebaute display:none von [hidden]
   überstimmen würde – dadurch blieben versteckte Bildschirme sichtbar/bedienbar. */
[hidden]{ display: none !important; }

html,body{
  margin:0;
  height:100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body{
  min-height: 100dvh;
  display:flex;
  flex-direction:column;
  overflow-x:hidden;
}

/* Ambient festival glow im Hintergrund, rein dekorativ */
.glowfield{
  position:fixed;
  inset:0;
  z-index:-1;
  background:
    radial-gradient(480px 320px at 15% 8%, var(--teal-soft), transparent 60%),
    radial-gradient(520px 360px at 90% 85%, var(--magenta-soft), transparent 60%);
  filter: blur(10px);
  opacity:0.6;
}

.topbar{
  display:flex;
  align-items:center;
  gap:10px;
  padding: max(18px, env(safe-area-inset-top)) 20px 10px;
}
.logo-dot{
  width:10px; height:10px; border-radius:50%;
  background: var(--teal);
  box-shadow: 0 0 10px 3px var(--teal-soft);
}
.wordmark{
  font-weight:800;
  letter-spacing:0.14em;
  font-size:14px;
  color: var(--text-dim);
}

.insecure-note{
  margin: 0 20px 12px;
  padding: 10px 14px;
  background: rgba(255,176,32,0.1);
  border: 1px solid rgba(255,176,32,0.4);
  border-radius: 12px;
  color: var(--amber);
  font-size: 12.5px;
  line-height: 1.5;
}

.screen{
  flex:1;
  display:flex;
  flex-direction:column;
  padding: 8px 20px calc(28px + env(safe-area-inset-bottom));
  max-width: 480px;
  width:100%;
  margin: 0 auto;
}

.join-card{
  margin-top: 6vh;
}
.eyebrow{
  text-transform:uppercase;
  letter-spacing:0.16em;
  font-size:12px;
  color: var(--teal);
  margin:0 0 8px;
  font-weight:700;
}
h1{
  font-size: 26px;
  line-height:1.25;
  margin:0 0 10px;
  font-weight:800;
}
h2{
  font-size:15px;
  margin:0;
  font-weight:700;
  color: var(--text);
}
.hint{
  color: var(--text-dim);
  font-size:14px;
  line-height:1.5;
  margin: 0 0 22px;
}
.hint.small{ font-size:12.5px; margin: 6px 0 0; }
.hint.center{ text-align:center; }

.field-label{
  display:block;
  font-size:12.5px;
  color: var(--text-dim);
  margin: 0 0 6px;
  font-weight:600;
}

input[type="text"], input[type="password"], input[inputmode="numeric"]{
  width:100%;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 22px;
  font-weight:700;
  letter-spacing: 0.04em;
  padding: 14px 16px;
  border-radius: 12px;
  margin-bottom: 18px;
  outline:none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
#name-input{ font-size:16px; font-weight:500; }
input:focus{
  border-color: var(--teal);
  box-shadow: 0 0 0 3px var(--teal-soft);
}

.btn-primary{
  width:100%;
  padding: 16px;
  border-radius: 14px;
  border:none;
  background: linear-gradient(135deg, var(--teal), #17b7a1);
  color: #05130f;
  font-weight:800;
  font-size:16px;
  letter-spacing:0.02em;
  cursor:pointer;
  box-shadow: 0 8px 24px -8px var(--teal-soft);
}
.btn-primary:active{ transform: translateY(1px); }

.btn-secondary{
  margin: 6px auto 0;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid var(--teal);
  background: transparent;
  color: var(--teal);
  font-weight:700;
  font-size:13.5px;
  cursor:pointer;
}

.btn-ghost{
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-elevated);
  color: var(--text-dim);
  font-size:13px;
  cursor:pointer;
}

.error-text{
  color: var(--amber);
  font-size:13.5px;
  margin-top: -6px;
}

.server-details{
  margin-top: 22px;
  color: var(--text-dim);
  font-size: 13px;
}
.server-details summary{
  cursor:pointer;
  color: var(--text-dim);
}
.server-details input{ margin-top:10px; font-size:14px; font-weight:500; }

/* Finder-Screen */
.status-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin: 10px 0 6px;
}
.status-chip{
  display:flex;
  align-items:center;
  gap:8px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.status-actions{
  display:flex;
  gap:8px;
}
.btn-ghost.copied{
  border-color: var(--teal);
  color: var(--teal);
}
.room-code-hint{
  color: var(--text-dim);
  font-size: 12.5px;
  margin: 0 0 4px;
}
.room-code-hint b{
  color: var(--text);
  letter-spacing: 0.04em;
}
.chip-dot{
  width:8px; height:8px; border-radius:50%;
  background: var(--amber);
  box-shadow: 0 0 8px 2px rgba(255,176,32,0.5);
}
.status-chip.live .chip-dot{
  background: var(--teal);
  box-shadow: 0 0 8px 2px var(--teal-soft);
}
.status-chip.offline .chip-dot{
  background: #ff5c5c;
  box-shadow: 0 0 8px 2px rgba(255,92,92,0.5);
}

.compass-wrap{
  display:flex;
  flex-direction:column;
  align-items:center;
  margin-top: 10px;
}
.compass-ring{
  width: min(66vw, 260px);
  height: min(66vw, 260px);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, #171d29, #0b0e14 70%);
  border: 1px solid var(--line);
  display:flex;
  align-items:center;
  justify-content:center;
  box-shadow: inset 0 0 40px rgba(0,0,0,0.5), 0 0 40px -12px var(--teal-soft);
}
.arrow-svg{
  width: 58%;
  height: 58%;
  transform: rotate(0deg);
  transition: transform .45s cubic-bezier(.22,.61,.36,1);
  filter: drop-shadow(0 0 14px var(--teal-soft));
}
.compass-readout{
  text-align:center;
  margin-top: 16px;
}
.distance{
  font-size: 34px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.distance-unit{
  color: var(--text-dim);
  font-size: 13.5px;
  margin-top:2px;
}

.accuracy-badge{
  display:inline-block;
  margin-top: 8px;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(45,225,194,0.12);
  border: 1px solid var(--teal-soft);
  color: var(--teal);
  font-size: 11.5px;
  font-weight:700;
  letter-spacing:0.01em;
}

#tilt-hint{ margin-top: 14px; }

.sensor-status{
  text-align:center;
  color: var(--text-dim);
  font-size: 12px;
  margin: 6px 0 0;
}

.radar-section{
  margin-top: 26px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px 16px 14px;
}
.radar-title-row{
  display:flex;
  align-items:center;
  justify-content:space-between;
  margin-bottom: 10px;
}
.radar-scale{
  font-size:12px;
  color: var(--text-dim);
}
#radar{
  width:100%;
  height:auto;
  display:block;
  border-radius: 12px;
  background: #05070c;
}
.legend{
  display:flex;
  gap:18px;
  margin: 12px 2px 0;
  font-size: 12.5px;
  color: var(--text-dim);
}
.legend-item{ display:flex; align-items:center; gap:7px; }
.legend-dot{ width:9px; height:9px; border-radius:50%; display:inline-block; }
.legend-dot.me{ background: var(--teal); box-shadow: 0 0 6px 2px var(--teal-soft); }
.legend-dot.friend{ background: var(--magenta); box-shadow: 0 0 6px 2px var(--magenta-soft); }
.legend-ring{
  width:9px; height:9px; border-radius:50%; display:inline-block;
  border: 1.5px solid var(--teal-soft);
}

#finder-note{ margin-top: 16px; }

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