/* Kompass — E1 */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  height: 100%;
  background: #000;
  color: #fff;
  font-family: -apple-system, "SF Pro Display", "Helvetica Neue", Helvetica, Arial, sans-serif;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}

#app {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-evenly;
  padding: calc(env(safe-area-inset-top) + 58px) 0 env(safe-area-inset-bottom) 0;
}

/* ---- Rose ---- */
#roseWrap {
  width: min(78vw, 46vh);
  aspect-ratio: 1 / 1;
}
#rose { width: 100%; height: 100%; display: block; }

#dial { will-change: transform; }

#dial text {
  fill: #fff;
  font-family: inherit;
}
.degnum { font-size: 26px; font-weight: 400; }
.cardinal { font-size: 34px; font-weight: 500; }

/* ---- Heading ---- */
#headingBox { text-align: center; }

#headingValue {
  font-size: clamp(40px, 13vw, 66px);
  font-weight: 200;
  letter-spacing: 2px;
  line-height: 1.05;
  font-variant-numeric: tabular-nums;
}

#coordsLine {
  margin-top: 8px;
  font-size: 17px;
  font-weight: 400;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

#altLine {
  margin-top: 4px;
  font-size: 17px;
  color: #fff;
}

#windLine {
  margin-top: 4px;
  font-size: 16px;
  color: #64d2ff;
  font-variant-numeric: tabular-nums;
}

#relWindLine {
  margin-top: 2px;
  font-size: 16px;
  font-weight: 500;
  min-height: 19px;
  font-variant-numeric: tabular-nums;
}
#relWindLine.head { color: #ff9f0a; }
#relWindLine.tail { color: #30d158; }
#relWindLine.cross { color: rgba(255,255,255,0.65); }

#tourTimer {
  margin-top: 4px;
  font-size: 15px;
  color: #ffd60a;
  font-variant-numeric: tabular-nums;
  min-height: 18px;
}

#statsLine {
  margin-top: 2px;
  font-size: 15px;
  color: rgba(255,255,255,0.65);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

#statusLine {
  margin-top: 6px;
  font-size: 14px;
  color: rgba(255,255,255,0.55);
  min-height: 18px;
}

/* ---- Geschwindigkeiten ---- */
#speedPanel {
  width: 100%;
  display: flex;
  align-items: flex-end;
  justify-content: space-evenly;
  padding: 0 8px;
}

.speed-cell { text-align: center; }

.speed-val {
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.speed-cell.main .speed-val { font-size: clamp(48px, 16vw, 76px); }
.speed-cell.side .speed-val { font-size: clamp(28px, 9vw, 42px); color: rgba(255,255,255,0.85); }

.speed-label {
  margin-top: 6px;
  font-size: 13px;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,0.55);
}

/* ---- Reload-Button (dezent, oben rechts) ---- */
#reloadBtn {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 10px);
  right: 14px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.55);
  font-size: 20px;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  z-index: 5;
  padding: 0;
}
#reloadBtn:active { background: rgba(255,255,255,0.25); }

#resetBtn {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 10px);
  left: 14px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.55);
  font-size: 20px;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  z-index: 5;
  padding: 0;
}
#resetBtn:active { background: rgba(255,255,255,0.25); }

/* ---- Aufzeichnungs-Button (oben mittig) ---- */
#recBtn {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 10px);
  left: 50%;
  transform: translateX(-50%);
  width: 44px;
  height: 44px;
  border: 2px solid rgba(255,255,255,0.35);
  border-radius: 50%;
  background: rgba(255,255,255,0.06);
  cursor: pointer;
  z-index: 5;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
#recIcon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ff3b30;
  transition: border-radius 0.2s;
}
#recBtn.recording {
  border-color: rgba(255, 214, 10, 0.8);
}
#recBtn.recording #recIcon {
  background: #ffd60a;
  border-radius: 4px;
  animation: recPulse 1.6s ease-in-out infinite;
}
@keyframes recPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---- Zusammenfassung ---- */
#summaryOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
#summaryOverlay.hidden { display: none; }

.summary-inner {
  width: min(86vw, 360px);
  text-align: center;
}

.summary-title {
  font-size: 34px;
  font-weight: 200;
  margin-bottom: 24px;
}

.summary-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  row-gap: 12px;
  column-gap: 16px;
  text-align: left;
}
.sum-label { color: rgba(255,255,255,0.55); font-size: 16px; }
.sum-val {
  text-align: right;
  font-size: 17px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.summary-btns {
  margin-top: 28px;
  display: flex;
  gap: 12px;
}
.summary-btns button {
  flex: 1;
  font-size: 18px;
  font-weight: 500;
  color: #fff;
  border: none;
  border-radius: 14px;
  padding: 14px 0;
  cursor: pointer;
}
#sumContinueBtn { background: rgba(255,255,255,0.14); }
#sumEndBtn, #setDoneBtn { background: #0a84ff; }
#sumContinueBtn:active, #sumEndBtn:active, #setDoneBtn:active { opacity: 0.7; }

#sumDiscardBtn {
  margin-top: 18px;
  background: none;
  border: none;
  color: #ff453a;
  font-size: 15px;
  cursor: pointer;
}

/* ---- Einstellungen ---- */
#settingsBtn {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 12px);
  right: 14px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  background: rgba(255,255,255,0.10);
  color: rgba(255,255,255,0.55);
  font-size: 20px;
  line-height: 40px;
  text-align: center;
  cursor: pointer;
  z-index: 5;
  padding: 0;
}
#settingsBtn:active { background: rgba(255,255,255,0.25); }

#settingsOverlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}
#settingsOverlay.hidden { display: none; }

.settings-inner {
  width: min(86vw, 360px);
  text-align: center;
}

.setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.setting-row label {
  font-size: 17px;
  color: rgba(255,255,255,0.85);
  text-align: left;
}
.setting-input {
  display: flex;
  align-items: center;
  gap: 8px;
}
.setting-input input {
  width: 72px;
  font-size: 18px;
  font-weight: 500;
  text-align: right;
  color: #fff;
  background: rgba(255,255,255,0.10);
  border: none;
  border-radius: 10px;
  padding: 10px 12px;
  font-variant-numeric: tabular-nums;
}
.setting-input span {
  font-size: 15px;
  color: rgba(255,255,255,0.55);
}

/* ---- Start-Overlay ---- */
#startOverlay {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}
#startOverlay.hidden { display: none; }

.overlay-inner { text-align: center; padding: 24px; }

.overlay-title {
  font-size: 42px;
  font-weight: 200;
  letter-spacing: 1px;
}

.overlay-sub {
  margin-top: 12px;
  font-size: 16px;
  color: rgba(255,255,255,0.55);
}

#startBtn {
  margin-top: 36px;
  font-size: 20px;
  font-weight: 500;
  color: #fff;
  background: #0a84ff;
  border: none;
  border-radius: 14px;
  padding: 16px 64px;
  cursor: pointer;
}
#startBtn:active { opacity: 0.7; }

.overlay-error {
  margin-top: 20px;
  font-size: 14px;
  color: #ff453a;
  max-width: 320px;
}
