/* Leonay GPS Caddie — V2 Pro · 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; }
button { font-family: inherit; }

#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, #glCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#mapOverlay { touch-action: none; }
#glCanvas { touch-action: none; background: #000; }
#mapWrap::before {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 130px;
  background: linear-gradient(180deg, rgba(0,0,0,.62), rgba(0,0,0,0));
  pointer-events: none; z-index: 1;
}
#glMsg {
  position: absolute; z-index: 2; left: 24px; right: 24px; top: 42%;
  transform: translateY(-50%);
  background: var(--glass); border: 1px solid var(--stroke); border-radius: 16px;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  padding: 20px; text-align: center; font-size: 15px; color: var(--muted); line-height: 1.5;
}

/* ---------- top bar ---------- */
#topBar {
  position: absolute; z-index: 3;
  top: calc(env(safe-area-inset-top, 0px) + 8px);
  left: max(12px, env(safe-area-inset-left, 0px));
  right: max(12px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: 7px;
}
#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: 50px; padding: 2px;
}
#holePill button {
  border: 0; background: transparent; color: #fff; cursor: pointer;
  font: 800 28px/1 -apple-system, BlinkMacSystemFont, sans-serif;
  min-width: 50px; 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: 17px; 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); }

/* ---------- hole strip (1–18 dots) ---------- */
#holeStrip {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 4px; height: 22px;
}
#holeStrip button {
  flex: 1 1 0; height: 22px; border: 0; background: transparent; cursor: pointer;
  position: relative; min-width: 0; padding: 0;
}
#holeStrip button::after {
  content: ""; position: absolute; left: 50%; top: 50%;
  width: 6px; height: 6px; border-radius: 50%;
  transform: translate(-50%, -50%);
  background: rgba(255,255,255,.30);
  box-shadow: 0 0 4px rgba(0,0,0,.9);
  transition: transform .18s, background .18s;
}
#holeStrip button.cur::after {
  background: #34d399; transform: translate(-50%, -50%) scale(1.9);
  box-shadow: 0 0 8px rgba(52,211,153,.8);
}

/* ---------- sim banner + toast ---------- */
#simBanner {
  position: absolute; z-index: 2;
  top: calc(env(safe-area-inset-top, 0px) + 96px);
  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;
}
#toast {
  position: absolute; z-index: 5; left: 50%;
  top: calc(env(safe-area-inset-top, 0px) + 100px);
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  background: rgba(8, 10, 12, .92); border: 1px solid var(--stroke);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-radius: 999px; padding: 10px 12px 10px 18px;
  box-shadow: 0 8px 28px rgba(0,0,0,.6);
  font-size: 14px; font-weight: 700; white-space: nowrap;
  animation: toastIn .22s ease-out;
}
#simBanner:not(.hidden) ~ #toast { top: calc(env(safe-area-inset-top, 0px) + 140px); }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, -8px); } }
#toastUndo {
  border: 0; border-radius: 999px; cursor: pointer;
  background: rgba(52,211,153,.16); color: #7ef0b0;
  font-size: 12px; font-weight: 800; letter-spacing: .08em;
  padding: 8px 14px; min-height: 34px;
}

/* ---------- right rail ---------- */
#rail {
  position: absolute; z-index: 3; right: max(10px, env(safe-area-inset-right, 0px));
  top: 50%; transform: translateY(-62%);
  display: flex; flex-direction: column; gap: 10px;
}
#rail button {
  width: 48px; height: 48px; border-radius: 15px; cursor: pointer;
  border: 1px solid var(--stroke);
  background: var(--glass);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  color: #fff; font-size: 24px; font-weight: 700; line-height: 1;
  box-shadow: 0 4px 18px rgba(0,0,0,.5);
}
#rail button:active { background: rgba(255,255,255,.16); }
#recenterBtn { font-size: 26px; }
#flyBtn { font-size: 15px !important; font-weight: 800 !important; letter-spacing: .04em; color: #7ef0b0 !important; }
#flyBtn.on { background: rgba(52,211,153,.2) !important; border-color: rgba(52,211,153,.5) !important; }

/* ---------- 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: 12px 14px calc(env(safe-area-inset-bottom, 0px) + 10px);
  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: 36ch; }
.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 ---------- */
sup { font-size: .62em; font-weight: 800; vertical-align: super; margin-left: 3px; }
sup.up { color: #fbbf24; }
sup.dn { color: #60a5fa; }

#targetRow {
  display: flex; align-items: baseline; justify-content: center; gap: 7px;
  font-size: 15px; min-height: 22px; margin-bottom: 1px;
}
#targetRow .tlab { font-size: 10px; font-weight: 800; letter-spacing: .18em; color: var(--faint); }
#targetRow .tnum { font-size: 19px; font-weight: 800; color: #fff; }
#targetRow sup { font-size: 12px; }
#targetRow .tarrow { color: var(--faint); font-size: 14px; margin: 0 2px; }
#targetRow.idle { opacity: .35; }

#heroLabel { font-size: 11px; font-weight: 800; letter-spacing: .34em; color: var(--faint); }
#hero { line-height: 0.95; margin: 0; white-space: nowrap; }
#heroNum { font-size: 78px; font-weight: 800; letter-spacing: -0.02em; color: #fff; transition: opacity .3s; }
#heroPl { font-size: 25px; font-weight: 800; vertical-align: 42px; margin-left: 6px; color: var(--muted); }
#heroPl.up { color: #fbbf24; }
#heroPl.dn { color: #60a5fa; }
#readout.stale #heroNum { opacity: .45; }
#readout.attack #heroLabel::after { content: " · ATTACK"; color: #34d399; letter-spacing: .2em; }
#acc { font-size: 12px; color: var(--faint); font-weight: 600; margin-top: 1px; min-height: 15px; }
#acc.poor { color: #fbbf24; }

#chips { display: flex; gap: 8px; margin-top: 8px; }
.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: 10px 4px; min-height: 48px; cursor: pointer;
  color: #fff; transition: border-color .2s, background .2s;
}
.chip:active { background: rgba(255,255,255,.14); }
.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); }
.chip.sel { border-color: rgba(255,255,255,.45); background: rgba(255,255,255,.10); }

#fcb {
  display: flex; justify-content: center; gap: 8px; margin-top: 8px;
  border-top: 1px solid rgba(255,255,255,.07); padding-top: 8px;
}
#fcb .fcbi { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 0; }
#fcb .flab { font-size: 9px; font-weight: 800; letter-spacing: .22em; color: var(--faint); }
#fcb b { color: #e8edf2; font-size: 26px; font-weight: 800; line-height: 1.1; }
#fcb .fcbi.on b { color: #fff; font-size: 32px; }
#fcb sup { font-size: 11px; }

@media (max-height: 760px) {
  #heroNum { font-size: 62px; }
  #heroPl { font-size: 20px; vertical-align: 32px; }
  #fcb b { font-size: 22px; }
  #fcb .fcbi.on b { font-size: 26px; }
  #chips { margin-top: 5px; }
  #fcb { margin-top: 5px; padding-top: 5px; }
}
