:root {
  --ink: #18304d;
  --muted: #5d6f88;
  --panel: rgba(255, 255, 255, .96);
  --sea: #1f8fe0;
  --green: #2fbf71;
  --yellow: #e5b800;
  --orange: #ff8a1f;
  --red: #e5322d;
  --none: #9aa8bb;
  --font: "Baloo 2", ui-rounded, "SF Pro Rounded", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
html { overflow-y: scroll; } /* a scrollbar appearing mid-load shifts everything sideways */
/* Android colors the PWA nav bar from the root background-color; the body gradient is an image, so without this it falls back to white. */
html { background-color: #5cc0ff; }
/* Edge-to-edge Chrome draws the page under the nav bar, where the gradient is near-white: paint that strip sky blue too. */
@media (display-mode: standalone) {
  body::after { content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: env(safe-area-inset-bottom); background: #5cc0ff; z-index: 1000; }
}
body {
  min-height: 100vh;
  background: linear-gradient(#5cc0ff, #a9dcff 40%, #d8f0ff);
  background-attachment: fixed;
  color: var(--ink); font: 600 18px/1.35 var(--font);
  -webkit-text-size-adjust: 100%;
}
a { color: var(--sea); }
[hidden] { display: none !important; }

header { padding: calc(env(safe-area-inset-top) + 10px) 16px 6px; max-width: 720px; margin: 0 auto; }
/* #appnav itself comes from chadsmith.dev/appnav.js; on this sky-blue header the title is white. */
#appnav { margin-bottom: 10px; }
#nearCard.empty .sub, #nearCard.empty #nearMap, #nearCard.empty #nearZone { display: none; }
#appnav .an-title { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,.25); font-size: 22px; }
#where { display: flex; gap: 8px; }
.ico { width: 1.05em; height: 1.05em; vertical-align: -0.15em; margin-right: 6px; }
#searchForm { flex: 1; position: relative; min-width: 0; }
button, input {
  font: 800 18px var(--font); color: var(--ink); border: 0; border-radius: 999px;
  box-shadow: 0 3px 10px rgba(0,0,0,.18); height: 46px;
}
button { background: #ffcf3f; padding: 0 18px; white-space: nowrap; cursor: pointer; min-width: 132px; }
button:active { transform: scale(.97); }
input { width: 100%; padding: 0 18px; background: var(--panel); font-weight: 600; }
input:focus { outline: 3px solid var(--sea); }
#suggest {
  position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 6px);
  background: #fff; border-radius: 18px; overflow: hidden; box-shadow: 0 6px 24px rgba(0,0,0,.25);
}
#suggest div { padding: 10px 16px; cursor: pointer; }
#suggest div[data-i]:nth-child(odd) { background: #f1f6fd; }
#suggest div.label { padding: 8px 16px 4px; font-size: 13px; color: var(--muted); cursor: default; }
#suggest div.on, #suggest div:hover { background: #d9ecff; }

main { max-width: 720px; margin: 0 auto; padding: 4px 16px calc(env(safe-area-inset-bottom) + 24px); }
.card {
  display: block; background: var(--panel); border-radius: 26px; padding: 18px 20px; margin: 14px 0;
  box-shadow: 0 6px 24px rgba(0,0,0,.14); border: 6px solid transparent;
}
.card h3 { margin: 0 0 4px; font-size: 24px; font-weight: 800; }
.sub { margin: 0 0 10px; color: var(--muted); font-size: 16px; }
.loading { color: var(--muted); padding: 8px 0; }

/* Levels. Every colored thing on both pages uses these four (plus gray). */
.card.lv-green { border-color: var(--green); }
.card.lv-yellow { border-color: var(--yellow); background: #fffbe6; }
.card.lv-orange { border-color: var(--orange); background: #fff2e4; }
.card.lv-red { border-color: var(--red); background: #ffe8e8; }
.chip {
  display: inline-block; border-radius: 999px; padding: 1px 10px; font-size: 15px; font-weight: 800;
  color: #fff; background: var(--none); line-height: 1.5; vertical-align: 1px;
}
.chip.green { background: var(--green); }
.chip.yellow { background: var(--yellow); color: #3a2f00; }
.chip.orange { background: var(--orange); }
.chip.red { background: var(--red); }
.chip.blue { background: #2f6fe0; }

/* The answer. Fixed height so the result replacing "Checking…" moves nothing. */
#hero { text-align: center; padding: 22px 20px; min-height: 262px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
#hero .dot {
  width: 76px; height: 76px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 44px; font-weight: 800; color: #fff; background: var(--none); line-height: 1;
}
#hero.lv-green .dot { background: var(--green); }
#hero.lv-yellow .dot { background: var(--yellow); }
#hero.lv-orange .dot { background: var(--orange); }
#hero.lv-red .dot { background: var(--red); }
#hero h2 { margin: 8px 0 2px; font-size: 32px; font-weight: 800; line-height: 1.1; }
#hero.lv-green h2 { color: #1d8f52; }
#hero.lv-red h2 { color: #c41d1d; }
#hero.lv-red { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px rgba(229,50,45,.35); } }
@media (prefers-reduced-motion: reduce) { #hero.lv-red { animation: none; } }
#hero p { margin: 4px 0; font-size: 19px; }
#hero .place { font-size: 16px; color: var(--muted); }
#hero .alert { text-align: left; background: rgba(255,255,255,.75); border-radius: 16px; padding: 10px 14px; margin-top: 10px; font-size: 16px; width: 100%; }
#hero .updated { font-size: 13px; color: var(--muted); margin-top: 6px; }

/* Is this spot safe ground: sea, NOAA's 100 ft line, and you. */
#height { display: flex; gap: 16px; align-items: center; min-height: 196px; }
#height .meter { flex: 0 0 74px; height: 150px; position: relative; border-radius: 16px; overflow: hidden; background: linear-gradient(#e4f2ff, #f4f9ff); }
#height .meter .sea { position: absolute; left: 0; right: 0; bottom: 0; background: linear-gradient(#3aa6f2, #1269b3); }
#height .meter .line { position: absolute; left: 0; right: 0; border-top: 3px dashed var(--green); }
#height .meter .line span { position: absolute; right: 4px; top: 0; font-size: 11px; color: #1d8f52; }
#height .meter .me { position: absolute; left: 50%; width: 18px; height: 18px; margin-left: -9px; transform: translateY(50%); border-radius: 50%; background: var(--ink); border: 3px solid #fff; }
#height .txt { flex: 1; min-width: 0; }
#height .chip { font-size: 18px; padding: 2px 12px; }
#height .txt p { margin: 6px 0 0; font-size: 17px; }
#height .facts { font-size: 19px !important; }

.linkcard { text-decoration: none; color: inherit; min-height: 150px; }
.linkcard .go { display: inline-block; margin-top: 4px; color: var(--sea); font-weight: 800; }

.map { height: 260px; border-radius: 18px; margin-bottom: 10px; z-index: 0; background: #cfe6f7; }
.row {
  display: block; padding: 10px 12px; border-radius: 14px; margin: 6px 0; text-decoration: none; color: inherit;
  background: #f4f7fb; border-left: 8px solid var(--none);
}
.row.lv-green { border-left-color: var(--green); }
.row.lv-yellow { border-left-color: var(--yellow); }
.row.lv-orange { border-left-color: var(--orange); }
.row.lv-red { border-left-color: var(--red); }
.row.lv-blue { border-left-color: #2f6fe0; }
.row b { display: block; font-size: 18px; line-height: 1.25; }
.row span { color: var(--muted); font-size: 15px; }
.row .chip { color: #fff; }
.row .chip.yellow { color: #3a2f00; }
.row .note { white-space: pre-line; font-size: 14px; color: var(--muted); margin-top: 4px; }

/* Placeholders the same size as what replaces them. */
.skel { background: linear-gradient(90deg, #edf2f8 25%, #f7f9fc 50%, #edf2f8 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; border-radius: 14px; }
@keyframes shimmer { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skel { animation: none; } }
.skel.row { height: 62px; border-left-color: #e3e9f1; }
.skel.line { height: 18px; margin: 6px 0; }
/* Extra notes under a section */
.fact { background: #eef7ff; border-radius: 16px; padding: 10px 14px; margin-top: 12px; font-size: 16px; }

.steps { padding-left: 24px; margin: 8px 0 0; }
.steps li { padding: 5px 0; font-size: 18px; }

footer { text-align: center; font-size: 13px; color: var(--muted); margin: 18px 0; }
footer a.home { display: inline-block; margin-bottom: 8px; font-weight: 800; }
.leaflet-container { font: 600 14px var(--font); }

@media (max-width: 420px) {
  button { padding: 0 12px; font-size: 16px; min-width: 116px; }
  #hero h2 { font-size: 28px; }
  #hero { min-height: 280px; }
}

/* Shaking zones under a map; height reserved so the caption arriving moves nothing. */
.zone-cap { min-height: 64px; font-size: 15px; color: var(--muted); margin: -2px 0 8px; }
.zone-cap b { color: var(--ink); }
.zone-key { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.zone-key .chip { font-size: 13px; }
.row.pickable { cursor: pointer; }
.row.pickable:hover { background: #e9f1fb; }
.row.picked { background: #dcebfb; box-shadow: inset 0 0 0 2px #9cc4ee; }
.home-pin div { width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 4px solid var(--ink); box-shadow: 0 1px 4px rgba(0,0,0,.4); }

/* Fixed, so showing it moves nothing. */
#toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 20px); transform: translate(-50%, 20px);
  background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 999px; font-size: 16px;
  opacity: 0; pointer-events: none; user-select: text; overflow-wrap: anywhere; transition: opacity .2s, transform .2s; z-index: 2000; max-width: calc(100% - 32px);
}
#toast.on { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
