:root {
  color-scheme: dark;
  --bg-deep: #0a080c;
  --bg-mid: #120e16;
  --panel: #16121a;
  --panel-edge: rgba(255, 255, 255, 0.06);
  --text: #f4f0f6;
  --muted: #a8a0b0;
  --accent: #f472b6;
  --accent-deep: #db2777;
  --accent-glow: rgba(244, 114, 182, 0.38);
  --rim: rgba(244, 114, 182, 0.22);
  --motion-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --motion-duration: 0.42s;
}

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

html,
body {
  margin: 0;
  padding: 0;
  min-height: 100%;
  background:
    radial-gradient(ellipse 120% 80% at 50% -20%, rgba(244, 114, 182, 0.14), transparent 52%),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(236, 72, 153, 0.06), transparent 45%),
    linear-gradient(165deg, var(--bg-mid) 0%, var(--bg-deep) 58%, #060408 100%);
  color: var(--text);
  font-family: Outfit, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

body {
  display: flex;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(20px, env(safe-area-inset-bottom));
}

.app {
  width: min(100%, 480px);
  display: grid;
  gap: 22px;
}

.header h1 {
  margin: 0;
  font-size: clamp(1.35rem, 4.8vw, 1.95rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  background: linear-gradient(120deg, var(--text) 0%, #e7e0ed 50%, var(--accent-deep) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.subline {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 450;
  line-height: 1.45;
}

.compass-card {
  position: relative;
  background: linear-gradient(180deg, color-mix(in srgb, var(--panel) 92%, white 8%) 0%, var(--panel) 100%);
  border: 1px solid var(--panel-edge);
  border-radius: 22px;
  padding: 24px 16px 22px;
  display: grid;
  justify-items: center;
  gap: 16px;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.04) inset,
    0 24px 48px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(0, 0, 0, 0.35) inset;
}

.compass-card::before {
  content: "";
  position: absolute;
  inset: 1px;
  border-radius: 21px;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.04) 0%, transparent 42%, transparent 58%, rgba(244, 114, 182, 0.04) 100%);
}

.compass-shell {
  position: relative;
  width: min(82vw, 320px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

.compass-bezel {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background:
    conic-gradient(from 200deg, rgba(255, 255, 255, 0.05), transparent 28%, rgba(0, 0, 0, 0.22) 50%, transparent 72%, rgba(255, 255, 255, 0.04)),
    linear-gradient(155deg, #2a2430 0%, #161018 48%, #0c0a10 100%);
  box-shadow:
    0 0 0 1px rgba(255, 255, 255, 0.07),
    0 0 0 2px rgba(0, 0, 0, 0.35) inset,
    0 10px 28px rgba(0, 0, 0, 0.55),
    0 2px 0 rgba(255, 255, 255, 0.05) inset;
  pointer-events: none;
}

.compass-bezel::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 50%;
  box-shadow:
    0 0 0 1px var(--rim),
    0 0 22px rgba(244, 114, 182, 0.06) inset;
  opacity: 0.9;
  pointer-events: none;
}

.compass-face {
  position: relative;
  z-index: 1;
  width: calc(100% - 26px);
  height: calc(100% - 26px);
  border-radius: 50%;
  background:
    radial-gradient(circle at 32% 22%, rgba(255, 255, 255, 0.1) 0%, transparent 30%),
    radial-gradient(circle at 50% 118%, rgba(244, 114, 182, 0.07) 0%, transparent 55%),
    radial-gradient(circle at 40% 30%, #3a3442 0%, #1a1620 52%, #0e0c12 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow:
    inset 0 0 0 1px rgba(0, 0, 0, 0.35),
    inset 0 2px 22px rgba(255, 255, 255, 0.03),
    inset 0 -16px 40px rgba(0, 0, 0, 0.55),
    0 4px 16px rgba(0, 0, 0, 0.4);
  overflow: hidden;
}

.target-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  transform: rotate(0deg);
  transform-origin: 50% 50%;
  transition: transform var(--motion-duration) var(--motion-ease);
  z-index: 3;
  pointer-events: none;
}

.dir-label {
  position: absolute;
  color: var(--text);
  font-weight: 600;
  text-align: center;
  text-wrap: balance;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.65);
  width: 48%;
  left: 26%;
  font-size: clamp(0.72rem, 3.2vw, 0.88rem);
  letter-spacing: 0.02em;
}

/* 0° zum Ziel — oben */
.dir-label--top {
  top: 8%;
  font-size: clamp(0.68rem, 3vw, 0.8rem);
  font-weight: 700;
  color: var(--accent);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* 180° weg vom Ziel */
.dir-label--bottom {
  bottom: 8%;
  color: var(--muted);
  font-weight: 500;
  font-size: clamp(0.65rem, 2.9vw, 0.78rem);
}

.compass-glass {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: radial-gradient(ellipse 90% 55% at 50% 12%, rgba(255, 255, 255, 0.08), transparent 52%);
  mix-blend-mode: soft-light;
  pointer-events: none;
  z-index: 2;
}

.needles {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.needle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 70%;
  height: 70%;
  max-width: 280px;
  max-height: 280px;
  --needle-rot: 0deg;
  transform: translate(-50%, -50%) rotate(var(--needle-rot));
  transform-origin: 50% 50%;
  transition: transform var(--motion-duration) var(--motion-ease);
}

.needle-svg {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
}

.needle--target {
  z-index: 0;
}

.needle--target .needle-svg {
  filter: drop-shadow(0 0 14px rgba(236, 72, 153, 0.32)) drop-shadow(0 2px 6px rgba(0, 0, 0, 0.32));
}

.center-cap {
  position: absolute;
  z-index: 5;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle at 32% 28%, #ffffff, #e8e0ec 42%, #8a8094 100%);
  box-shadow:
    0 0 0 3px rgba(14, 10, 18, 0.92),
    0 0 0 4px rgba(244, 114, 182, 0.2),
    0 3px 10px rgba(0, 0, 0, 0.5),
    inset 0 -2px 4px rgba(0, 0, 0, 0.28);
}

.distance {
  margin: 0;
  font-size: clamp(1.02rem, 4.2vw, 1.22rem);
  font-weight: 600;
  letter-spacing: -0.01em;
  color: #ebe4f0;
}

.status {
  margin: 0;
  color: var(--muted);
  text-align: center;
  min-height: 2.4em;
  font-size: 0.92rem;
  line-height: 1.45;
  max-width: 32ch;
}

.controls {
  display: grid;
}

.primary-btn {
  border: none;
  border-radius: 14px;
  background: linear-gradient(180deg, #fbcfe8 0%, var(--accent) 52%, var(--accent-deep) 100%);
  color: #1a0510;
  font-size: 1rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: 0.01em;
  padding: 15px 18px;
  min-height: 52px;
  cursor: pointer;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.45) inset,
    0 8px 24px var(--accent-glow),
    0 4px 12px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease, filter 0.15s ease;
}

.primary-btn:hover:not(:disabled) {
  filter: brightness(1.06);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.5) inset,
    0 10px 32px var(--accent-glow),
    0 6px 16px rgba(0, 0, 0, 0.38);
}

.primary-btn:active:not(:disabled) {
  transform: scale(0.98);
}

.primary-btn:disabled {
  opacity: 0.55;
  cursor: default;
  box-shadow: none;
}

@media (prefers-reduced-motion: reduce) {
  .target-ring,
  .needle {
    transition: none;
  }

  .primary-btn {
    transition: none;
  }
}
