:root {
  --navy: #0f3a5f;
  --ink: #10273d;
  --muted: #4e6378;
  --card: rgba(255, 255, 255, 0.94);
  --line: rgba(15, 58, 95, 0.16);
  --accent: #1769c2;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #cfe6f2; }
#map { position: fixed; inset: 0; }
button { font: inherit; cursor: pointer; }

.card {
  position: fixed; z-index: 3;
  top: calc(10px + var(--safe-t)); left: calc(10px + var(--safe-l)); right: calc(10px + var(--safe-r));
  max-width: 420px; padding: 12px 16px 12px;
  background: var(--card); border-radius: 18px; box-shadow: 0 6px 24px rgba(16, 39, 61, 0.18);
  -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 28px; }
.what { font-size: 14px; font-weight: 600; color: var(--muted); letter-spacing: 0.01em; }
.big { display: flex; align-items: baseline; gap: 8px; line-height: 1; margin: 2px 0 4px; }
#num { font-size: 60px; font-weight: 750; letter-spacing: -0.02em; color: var(--navy); font-variant-numeric: tabular-nums; }
.unit { font-size: 26px; font-weight: 650; color: var(--navy); }
.note { font-size: 13px; color: var(--muted); line-height: 1.35; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--accent); border-radius: 999px; padding: 6px 12px; font-size: 14px; font-weight: 600; min-height: 34px; }
.primary { display: block; width: 100%; margin-top: 10px; border: 0; border-radius: 12px; background: var(--accent); color: #fff; font-size: 17px; font-weight: 650; padding: 12px 14px; min-height: 48px; }
.secondary { display: block; width: 100%; margin-top: 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font-size: 16px; font-weight: 600; padding: 11px 14px; min-height: 46px; }
.primary:disabled { opacity: 0.6; }
[hidden] { display: none !important; }

.tools { position: fixed; z-index: 3; right: calc(12px + var(--safe-r)); bottom: calc(var(--attrib-h, 24px) + 14px + var(--safe-b)); display: flex; flex-direction: column; gap: 10px; }
.round { width: 52px; height: 52px; border-radius: 50%; border: 0; background: #fff; box-shadow: 0 3px 14px rgba(16, 39, 61, 0.25); display: grid; place-items: center; color: var(--navy); }
.round svg { width: 26px; height: 26px; stroke: currentColor; stroke-width: 2; fill: none; stroke-linecap: round; }
.round svg circle:first-child { fill: currentColor; stroke: none; }
.round.on { color: #fff; background: var(--accent); }
.round.on svg circle:first-child { fill: #fff; }

.nfn { position: fixed; z-index: 2; left: calc(8px + var(--safe-l)); bottom: calc(var(--attrib-h, 24px) + 8px + var(--safe-b)); font-size: 11px; font-weight: 700; color: #7a1d1d; background: rgba(255, 255, 255, 0.85); padding: 3px 7px; border-radius: 6px; letter-spacing: 0.02em; pointer-events: none; }
.offline { position: fixed; z-index: 4; left: 50%; transform: translateX(-50%); bottom: calc(14px + var(--safe-b)); background: #10273d; color: #fff; font-size: 13px; padding: 8px 12px; border-radius: 999px; box-shadow: 0 3px 12px rgba(0,0,0,0.25); max-width: calc(100% - 150px); text-align: center; }

.maplibregl-ctrl-attrib { font-size: 10px; }
.maplibregl-ctrl-bottom-right { bottom: var(--safe-b); right: var(--safe-r); }
.maplibregl-ctrl-bottom-left { display: none; }

.me { width: 22px; height: 22px; position: relative; }
.me .dot { position: absolute; inset: 3px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,0.25), 0 2px 6px rgba(0,0,0,0.3); }
.me .cone { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-origin: 0 0; }
.me .cone::before { content: ""; position: absolute; left: -14px; top: -34px; border-left: 14px solid transparent; border-right: 14px solid transparent; border-bottom: 30px solid rgba(26, 115, 232, 0.35); }
.pin { width: 30px; height: 30px; position: relative; cursor: grab; }
.pin::before, .pin::after { content: ""; position: absolute; background: #c2410c; left: 50%; top: 50%; transform: translate(-50%, -50%); border-radius: 2px; }
.pin::before { width: 30px; height: 3px; }
.pin::after { width: 3px; height: 30px; }
.pin span { position: absolute; inset: 8px; border: 3px solid #c2410c; border-radius: 50%; background: rgba(255,255,255,0.6); }

.sheet { border: 0; padding: 0; border-radius: 20px 20px 0 0; width: 100%; max-width: 520px; margin: auto auto 0; box-shadow: 0 -8px 30px rgba(0,0,0,0.25); color: var(--ink); max-height: 90vh; }
.sheet::backdrop { background: rgba(10, 25, 40, 0.35); }
.sheet-body { padding: 18px 18px calc(18px + var(--safe-b)); }
.sheet h2 { font-size: 15px; margin: 14px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.sheet h2:first-child { margin-top: 0; }
.ack { border-radius: 20px; margin: auto; max-width: 440px; width: calc(100% - 32px); }
.ack h2 { font-size: 22px; text-transform: none; letter-spacing: 0; color: #7a1d1d; }
.ack p { font-size: 16px; line-height: 1.45; margin: 0 0 10px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; }
.seg span { display: block; text-align: center; padding: 11px 6px; border: 1px solid var(--line); border-radius: 12px; font-weight: 600; min-height: 44px; }
.seg input:checked + span { background: var(--accent); color: #fff; border-color: var(--accent); }
.seg input:focus-visible + span { outline: 3px solid #94c2f5; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 2px; min-height: 44px; font-size: 16px; }
.row input { width: 22px; height: 22px; }
.row small { display: block; color: var(--muted); font-size: 13px; }
.small { font-size: 14px; color: var(--muted); line-height: 1.4; margin: 6px 0; }
.links a { color: var(--accent); }

@media (min-width: 700px) {
  .card { right: auto; width: 380px; }
}
@media (max-height: 520px) and (orientation: landscape) {
  .card { width: 320px; right: auto; padding: 8px 12px; }
  #num { font-size: 44px; }
}

/* embed (inside the store app): the app draws the number, buttons and sheets itself */
body.embed .card, body.embed .tools, body.embed .offline, body.embed #sheet, body.embed #ack { display: none !important; }

