* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg: #101418;
  --fg: #e8edf2;
  --muted: #8a97a5;
  --accent: #4fc3f7;
  --ok: #66bb6a;
  --warn: #ffb74d;
  --err: #ef5350;
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, sans-serif;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
}

#app { height: 100%; }

.screen {
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 1.5rem;
  text-align: center;
}

.hidden { display: none !important; }

h1 { font-size: 2rem; font-weight: 700; }
.subtitle { color: var(--muted); }
.hint { color: var(--muted); font-size: 0.9rem; max-width: 26rem; }

button.primary {
  background: var(--accent);
  color: #06222e;
  border: none;
  border-radius: 999px;
  padding: 0.9rem 3rem;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
}
button.primary:active { filter: brightness(0.85); }

.error { color: var(--err); font-size: 0.9rem; max-width: 26rem; }

/* --- Navigation screen --- */

#nav-screen { justify-content: space-between; padding: 0; }

#target-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.2rem;
  background: #181e24;
  font-weight: 600;
}
#target-progress { color: var(--muted); font-weight: 400; font-size: 0.9rem; }

#arrow-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

#arrow {
  color: var(--accent);
  transition: transform 0.15s linear;
  will-change: transform;
}
#arrow.no-heading { color: var(--muted); }

#distance {
  font-size: 3rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

#status-line {
  color: var(--muted);
  font-size: 0.85rem;
  padding: 0.3rem 1rem 1rem;
  min-height: 2.2rem;
}
#status-line.warn { color: var(--warn); }

#arrival-banner {
  position: fixed;
  inset: 0;
  background: rgba(16, 20, 24, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: 2rem;
  text-align: center;
  z-index: 10;
}
#arrival-banner h2 { color: var(--ok); font-size: 2rem; }

#toolbar {
  width: 100%;
  display: flex;
  gap: 0.6rem;
  padding: 0.8rem 1.2rem 1.4rem;
  justify-content: center;
}
#toolbar button {
  background: #232b33;
  color: var(--fg);
  border: 1px solid #35414c;
  border-radius: 8px;
  padding: 0.55rem 1.1rem;
  font-size: 0.9rem;
  cursor: pointer;
}

/* --- AR mode (M1) --- */

#camera-feed, #ar-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  display: none;
}
#camera-feed { object-fit: cover; z-index: 0; }
#ar-canvas { z-index: 1; }

body.ar-mode #camera-feed { display: block; }
body.ar-mode #ar-canvas { display: block; }

/* UI floats above the camera; page chrome goes transparent */
body.ar-mode { background: #000; }
body.ar-mode #app { position: relative; z-index: 2; }
body.ar-mode #nav-screen { background: transparent; }
body.ar-mode #target-bar { background: rgba(24, 30, 36, 0.75); }
body.ar-mode #distance { display: none; }

/* In AR the arrow stays as a mini HUD: enters at center, drops down above the chip */
body.ar-mode #arrow-wrap {
  position: fixed;
  left: 50%;
  bottom: 10.5rem;
  transform: translateX(-50%);
  flex: none;
  z-index: 3;
  animation: arrow-drop 0.9s ease-in-out;
}
body.ar-mode #arrow svg { width: 64px; height: 64px; }
body.ar-mode #arrow { filter: drop-shadow(0 2px 8px rgba(0, 0, 0, 0.9)); }
@keyframes arrow-drop {
  from { bottom: 42vh; }
  to { bottom: 10.5rem; }
}
body.ar-mode #status-line { text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9); }

#ar-chip {
  position: fixed;
  left: 50%;
  bottom: 7.5rem;
  transform: translateX(-50%);
  display: none;
  gap: 0.8rem;
  align-items: baseline;
  background: rgba(16, 20, 24, 0.75);
  border: 1px solid rgba(79, 195, 247, 0.5);
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  z-index: 3;
  white-space: nowrap;
}
#ar-chip-name { font-weight: 600; }
#ar-chip-dist { color: var(--accent); font-variant-numeric: tabular-nums; }
body.ar-mode #ar-chip { display: flex; }

#debug-panel {
  position: fixed;
  bottom: 4.5rem;
  left: 0.6rem;
  right: 0.6rem;
  background: rgba(0, 0, 0, 0.8);
  border: 1px solid #35414c;
  border-radius: 8px;
  padding: 0.7rem;
  font-size: 0.75rem;
  line-height: 1.5;
  color: #9fe8a0;
  white-space: pre-wrap;
  z-index: 5;
}
