/* Leonay GPS Caddie — V1 · pure-black sunlight theme */
:root {
  color-scheme: dark;
  --c90: #34d399;
  --c110: #fbbf24;
  --c130: #60a5fa;
  --glass: rgba(10, 12, 14, 0.78);
  --stroke: rgba(255, 255, 255, 0.10);
  --muted: rgba(255, 255, 255, 0.55);
  --faint: rgba(255, 255, 255, 0.35);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; overscroll-behavior: none; }
body {
  background: #000;
  color: #fff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}
.hidden { display: none !important; }

#app { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }

/* ---------- map zone ---------- */
#mapWrap { position: relative; flex: 1 1 auto; min-height: 0; background: #000; overflow: hidden; }
#mapBase, #mapOverlay { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#mapOverlay { touch-action: none; }
#mapWrap::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 110px;
  background: linear-gradient(180deg, rgba(0,0,0,.62), rgba(0,0,0,0));
  pointer-events: none; z-index: 1;
}

/* ---------- top pill ---------- */
#topBar {
  position: absolute; z-index: 3;
  top: calc(env(safe-area-inset-top, 0px) + 10px);
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
}
#holePill {
  display: flex; align-items: stretch; gap: 2px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
  border: 1px solid var(--stroke);
  border-radius: 16px;
  box-shadow: 0 6px 24px rgba(0,0,0,.55);
  height: 52px; padding: 2px;
}
#holePill button {
  border: 0; background: transparent; color: #fff; cursor: pointer;
  font: 800 30px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  min-width: 52px; border-radius: 13px;
}
#holePill button:active { background: rgba(255,255,255,.12); }
#holeLabel {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 7px;
  font-size: 18px; font-weight: 800; letter-spacing: .02em; white-space: nowrap;
}
#holeLabel .sep { color: var(--faint); font-weight: 400; }
#holeLen { color: var(--muted); font-weight: 700; }
#autoBtn {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  font: 700 11px/1 -apple-system, BlinkMacSystemFont, sans-serif !important;
  letter-spacing: .08em; color: var(--muted) !important;
  min-width: 56px !important;
  border: 1px solid transparent !important;
}
.autodot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.28); }
#autoBtn.on { color: #7ef0b0 !important; }
#autoBtn.on .autodot { background: #34d399; box-shadow: 0 0 8px rgba(52,211,153,.9); }

/* ---------- sim banner ---------- */
#simBanner {
  position: absolute; z-index: 2;
  top: calc(env(safe-area-inset-top, 0px) + 70px);
  left: 0; right: 0;
  background: rgba(245, 158, 11, .94);
  color: #000; text-align: center;
  font-size: 13px; font-weight: 800; letter-spacing: .06em;
  padding: 8px 12px;
}

/* ---------- measure clear ---------- */
#clearMeasure {
  position: absolute; z-index: 3;
  top: calc(env(safe-area-inset-top, 0px) + 74px); right: 12px;
  border: 1px solid var(--stroke); border-radius: 999px;
  background: var(--glass); -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: #fff; font-size: 14px; font-weight: 700;
  padding: 12px 18px; cursor: pointer;
}
#simBanner:not(.hidden) ~ #clearMeasure { top: calc(env(safe-area-inset-top, 0px) + 116px); }

/* ---------- bottom panel ---------- */
#panel {
  flex: 0 0 auto; z-index: 4;
  background: linear-gradient(180deg, rgba(13,15,17,.94), rgba(6,7,8,.99));
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  border-top: 1px solid var(--stroke);
  border-radius: 18px 18px 0 0;
  margin-top: -18px;
  padding: 14px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
  text-align: center;
}
#panel > div { display: none; }
#panel[data-mode="gate"]    #gate    { display: flex; }
#panel[data-mode="denied"]  #denied  { display: flex; }
#panel[data-mode="waiting"] #waiting { display: flex; }
#panel[data-mode="read"]    #readout { display: block; }

/* gate boxes */
.gatebox { flex-direction: column; align-items: center; gap: 10px; padding: 8px 4px 6px; }
.brand { font-size: 12px; font-weight: 800; letter-spacing: .3em; color: #8fd6a0; }
.brand.warn { color: #fbbf24; }
.gatebox .msg { font-size: 15px; line-height: 1.45; color: var(--muted); max-width: 34ch; }
.gatebox .msg b { color: #fff; }
button.big {
  width: 100%; max-width: 320px; padding: 16px;
  border: 0; border-radius: 14px; cursor: pointer;
  background: #1f7a3d; color: #fff;
  font-size: 18px; font-weight: 800; letter-spacing: .01em;
  box-shadow: 0 4px 18px rgba(31,122,61,.4);
}
button.big:active { background: #2a9c50; }
.privacy { font-size: 12px; color: var(--faint); }
.linkbtn {
  border: 0; background: none; cursor: pointer;
  color: var(--muted); font-size: 14px; font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px;
  padding: 8px 16px;
}
.spinner {
  width: 26px; height: 26px; border-radius: 50%;
  border: 3px solid rgba(255,255,255,.15); border-top-color: #fff;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* readout */
#fcb { display: flex; justify-content: center; gap: 26px; font-size: 14px; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
#fcb b { color: #fff; font-size: 17px; font-weight: 800; margin-left: 2px; }
#heroLabel { font-size: 11px; font-weight: 800; letter-spacing: .34em; color: var(--faint); margin-top: 2px; }
#hero { line-height: 0.95; margin: 2px 0 0; }
#heroNum { font-size: 84px; font-weight: 800; letter-spacing: -0.02em; color: #fff; transition: opacity .3s; }
#hero .unit { font-size: 24px; font-weight: 500; color: var(--muted); margin-left: 4px; }
#readout.stale #heroNum { opacity: .45; }
#playsLike { font-size: 19px; color: var(--muted); font-weight: 600; margin-top: 2px; }
#playsLike b { color: #fff; font-weight: 800; }
#acc { font-size: 12px; color: var(--faint); font-weight: 600; margin-top: 3px; min-height: 15px; }
#acc.poor { color: #fbbf24; }
#chips { display: flex; gap: 8px; margin-top: 10px; }
.chip {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  background: rgba(255,255,255,.06);
  border: 1px solid var(--stroke); border-radius: 13px;
  padding: 12px 4px; min-height: 48px;
}
.chip .dot { width: 9px; height: 9px; border-radius: 50%; flex: 0 0 auto; }
.dot.d90 { background: var(--c90); }
.dot.d110 { background: var(--c110); }
.dot.d130 { background: var(--c130); }
.chip .cr { font-size: 17px; font-weight: 800; }
.chip .hit { font-size: 13px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.chip .hit b { color: #fff; font-size: 16px; font-weight: 800; }
.chip.off { opacity: .38; }
.chip.off .hit b { color: var(--muted); }

@media (max-height: 700px) {
  #heroNum { font-size: 64px; }
  #hero .unit { font-size: 18px; }
  #chips { margin-top: 6px; }
}
