/* The Pines phone app. Plain, big touch targets, safe areas for the iPhone notch and home bar. */
:root{ --g: #1f3324; --g2: #2c4733; --ink: #f4f1e8; --dim: #b9c2b4; --acc: #f26a1b; --bad: #ff8a80;
  --st: env(safe-area-inset-top, 0px); --sbm: max(0px, calc(env(safe-area-inset-bottom, 0px) - 20px)); --bar: 52px; }
/* --sbm: only part of the iPhone home-bar zone is kept clear (the labels sit just above the home bar), so the bottom bar is slim */
*{ box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden]{ display: none !important; }
html, body{ margin: 0; height: 100%; overflow: hidden; background: var(--g); color: var(--ink);
  font: 16px/1.35 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
#page{ position: fixed; inset: 0; }
#map{ position: absolute; inset: 0; background: #2b2b2b; }
button{ font: inherit; color: inherit; }
svg{ fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.edit-only{ display: none !important; }
body.can-edit .edit-only{ display: flex !important; }
.dim{ color: var(--dim); }
.small{ font-size: 13px; }

/* bottom bar */
.pa-bar{ position: absolute; left: 0; right: 0; bottom: 0; z-index: 1000; height: calc(var(--bar) + var(--sbm)); display: flex; justify-content: space-around;
  background: var(--g); border-top: 1px solid #3c5a44; padding: 0 4px var(--sbm); }
.pa-bar button{ flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; background: none; border: 0;
  padding: 3px 2px 2px; font-size: 11px; min-height: 0; justify-content: center; line-height: 1.1; }
.pa-bar button svg{ width: 24px; height: 24px; }
.pa-bar button.on{ color: var(--acc); }

/* tool bar (adding a waypoint or drawing a track) replaces the bottom bar */
.pa-tool{ position: absolute; left: 0; right: 0; bottom: 0; z-index: 1001; background: var(--g); border-top: 1px solid #3c5a44;
  padding: 8px 10px calc(6px + var(--sbm)); }
.pa-tool .msg{ font-size: 15px; margin-bottom: 8px; text-align: center; }
.pa-tool .row{ display: flex; gap: 8px; flex-wrap: wrap; }
.pa-tool .row .pa-btn{ flex: 1 1 28%; }

.pa-btn{ display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 8px 12px;
  border-radius: 12px; border: 1px solid #4b6b53; background: var(--g2); font-weight: 600; text-decoration: none; color: var(--ink); cursor: pointer; }
.pa-btn.pri{ background: var(--acc); border-color: var(--acc); color: #fff; }
.pa-btn.bad{ color: var(--bad); }
.pa-btn:disabled{ opacity: .45; }
.pa-btn svg{ width: 20px; height: 20px; }

/* location button and readout */
.pa-fab{ position: absolute; right: 12px; bottom: calc(var(--bar) + var(--sbm) + 16px); z-index: 999; width: 52px; height: 52px;
  border-radius: 50%; border: 0; background: #fff; color: #333; box-shadow: 0 2px 8px rgba(0,0,0,.45); display: grid; place-items: center; }
.pa-fab svg{ width: 26px; height: 26px; }
.pa-fab.on{ color: #1a73e8; }
.pa-fab.follow{ color: #fff; background: #1a73e8; }
.pa-fab.follow svg{ fill: currentColor; }
body.tooling .pa-fab{ bottom: calc(var(--sbm) + 200px); }
.pa-chip{ position: absolute; top: calc(var(--st) + 10px); left: 50%; transform: translateX(-50%); z-index: 999; max-width: calc(100% - 24px);
  background: rgba(20,32,23,.88); padding: 6px 12px; border-radius: 16px; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-note{ position: absolute; top: calc(var(--st) + 54px); left: 12px; right: 12px; z-index: 998; text-align: center;
  background: rgba(20,32,23,.9); padding: 10px; border-radius: 12px; }
.pa-note:empty{ display: none; }
.pa-note.bad{ color: var(--bad); }
.pa-scale{ position: absolute; left: 10px; bottom: calc(var(--bar) + var(--sbm) + 14px); z-index: 998; font-size: 12px; color: #fff; text-shadow: 0 0 3px #000, 0 0 3px #000; pointer-events: none; }
.pa-scale #scaleBar{ height: 6px; border: 2px solid #fff; border-top: 0; box-shadow: 0 1px 2px #000; margin-bottom: 2px; }
body.tooling .pa-scale{ display: none; }

/* cross in the middle of the map while placing */
.pa-cross{ position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px 0 0 -22px; z-index: 990; pointer-events: none; }
.pa-cross::before, .pa-cross::after{ content: ''; position: absolute; background: #fff; box-shadow: 0 0 0 1.5px #000; }
.pa-cross::before{ left: 21px; top: 0; width: 2px; height: 44px; }
.pa-cross::after{ top: 21px; left: 0; height: 2px; width: 44px; }

/* bottom sheet */
/* sits just above the bottom bar, so Maps / Items stay tappable (and close it) */
.pa-sheet{ position: absolute; left: 0; right: 0; bottom: calc(var(--bar) + var(--sbm)); z-index: 1100; max-height: calc(88% - var(--bar) - var(--sbm) - var(--st));
  display: flex; flex-direction: column; background: var(--g); border-radius: 16px 16px 0 0; box-shadow: 0 -4px 18px rgba(0,0,0,.5); border-bottom: 1px solid #3c5a44; }
.pa-sheet .sh{ display: flex; align-items: center; padding: 12px 8px 6px 16px; }
.pa-sheet h2{ flex: 1; margin: 0; font-size: 18px; }
.pa-sheet .x{ width: 44px; height: 44px; border: 0; background: none; font-size: 30px; line-height: 1; color: var(--dim); }
.pa-sheet .sb{ overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 0 16px 16px; }
.pa-sheet h3{ font-size: 14px; text-transform: uppercase; letter-spacing: .04em; color: var(--dim); margin: 16px 0 8px; }
.pa-sheet p{ margin: 6px 0; }
.pa-sheet .row{ display: flex; gap: 8px; flex-wrap: wrap; }
.pa-sheet .row > .pa-btn{ flex: 1 1 40%; }
.msg{ min-height: 1.2em; font-size: 14px; }
.msg.bad{ color: var(--bad); }
label.fld{ display: block; margin: 10px 0 4px; font-size: 14px; color: var(--dim); }
input[type=text], textarea{ width: 100%; font: inherit; font-size: 16px; color: var(--ink); background: #142017; border: 1px solid #4b6b53;
  border-radius: 10px; padding: 10px; }
textarea{ min-height: 70px; resize: vertical; }
.pa-sw{ display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid #34503b; }
.pa-sw input{ width: 24px; height: 24px; accent-color: var(--acc); flex: none; }
.pa-sw span small{ display: block; color: var(--dim); font-size: 13px; }

/* base map choice */
.pa-bases{ display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pa-bases button{ border: 2px solid transparent; border-radius: 12px; background: var(--g2); padding: 0 0 6px; overflow: hidden; font-size: 13px; }
.pa-bases button.on{ border-color: var(--acc); }
.pa-bases button:disabled{ opacity: .4; }
.pa-bases .im{ display: block; aspect-ratio: 1; background: #333; margin-bottom: 4px; }
.pa-bases img{ width: 100%; height: 100%; object-fit: cover; display: block; }

/* item list */
.pa-list{ list-style: none; margin: 0; padding: 0; }
.pa-list li{ display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #34503b; }
.pa-list .ic{ width: 30px; height: 30px; flex: none; display: grid; place-items: center; }
.pa-list .tx{ flex: 1; min-width: 0; }
.pa-list .tx b{ display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pa-list .tx small{ color: var(--dim); }
.pa-list button.it{ all: unset; display: flex; align-items: center; gap: 12px; flex: 1; min-width: 0; cursor: pointer; }

/* the item panel (waypoint, track, area): compact, so the map stays in view */
.pa-sheet.item{ max-height: calc(62% - var(--bar)); }
.pa-ihead{ display: flex; align-items: center; gap: 10px; }
.pa-ihead input{ flex: 1; min-width: 0; font-weight: 600; }
.pa-iname{ font-size: 18px; }
.pa-ico{ width: 36px; height: 36px; flex: none; display: grid; place-items: center; position: relative; }
.pa-ico svg{ width: 30px; height: 30px; }
.pa-ico .b{ width: 34px; height: 34px; }
.pa-meta{ display: flex; align-items: center; gap: 8px; margin: 8px 2px 0; font-size: 15px; font-variant-numeric: tabular-nums; }
.pa-meta .lay{ margin-left: auto; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 45%; }
.pa-link{ background: none; border: 0; color: var(--acc); font-weight: 600; padding: 6px; font-size: 14px; }
.pa-row{ display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.lbl{ width: 54px; flex: none; color: var(--dim); font-size: 14px; }
.pa-cols{ display: flex; gap: 7px; flex-wrap: wrap; }
.pa-cols button{ width: 26px; height: 26px; border-radius: 50%; border: 2px solid #4b6b53; padding: 0; }
.pa-cols button.on{ border: 2px solid #fff; box-shadow: 0 0 0 2px var(--acc); }
.pa-seg{ display: flex; flex: 1; border: 1px solid #4b6b53; border-radius: 10px; overflow: hidden; }
.pa-seg button{ flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; border: 0; background: var(--g2); font-size: 14px; }
.pa-seg button + button{ border-left: 1px solid #4b6b53; }
.pa-seg button.on{ background: var(--acc); color: #fff; }
.pa-seg svg{ width: 26px; height: 8px; stroke-width: 3; }
.pa-pick{ margin-top: 12px; border: 1px solid #34503b; border-radius: 10px; padding: 0 10px; }
.pa-pick summary{ display: flex; align-items: center; gap: 10px; min-height: 44px; list-style: none; cursor: pointer; }
.pa-pick summary::-webkit-details-marker{ display: none; }
.pa-pick summary b{ flex: 1; font-weight: 600; }
.pa-pick .chg{ color: var(--acc); font-weight: 600; font-size: 14px; }
.pa-pick[open] .chg{ visibility: hidden; }
.pa-pick[open]{ padding-bottom: 8px; }
.pa-grp{ font-size: 12px; color: var(--dim); text-transform: uppercase; letter-spacing: .04em; margin: 8px 0 6px; }
.pa-syms{ display: grid; grid-template-columns: repeat(auto-fill, minmax(40px, 1fr)); gap: 6px; }
.pa-syms button{ min-width: 0; width: 100%; aspect-ratio: 1; border-radius: 50%; border: 2px solid transparent; background: #3a5641; padding: 0; display: grid; place-items: center; }
.pa-syms button.on{ border-color: #fff; background: var(--acc); }
.pa-syms svg{ width: 22px; height: 22px; }
#itNotes{ margin-top: 12px; min-height: 46px; }
.pa-acts{ display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.pa-acts .msg{ flex: 1; }
.pa-btn.sm{ min-height: 40px; padding: 6px 12px; font-size: 14px; }
.pa-tool .msg b{ font-size: 17px; }

/* waypoints on the map */
.pa-wp .b{ width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.6); padding: 4px; }
.pa-wp .b.dk{ border-color: #222; }
.pa-wp.sel .b{ box-shadow: 0 0 0 3px var(--acc), 0 1px 4px rgba(0,0,0,.6); }
.pa-wp .b svg{ width: 100%; height: 100%; display: block; }
.pa-wp .l{ position: absolute; left: 34px; top: 5px; white-space: nowrap; font-size: 13px; font-weight: 600; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 2px #000; pointer-events: none; }
.nolabels .pa-wp .l, .nolabels .pa-lbl{ display: none; }
.nonames .pa-wp .l, .nonames .pa-lbl{ display: none; }
.pa-lbl span{ position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-size: 13px; font-weight: 600; color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000, 0 0 2px #000; pointer-events: none; }
.pa-me{ width: 20px; height: 20px; border-radius: 50%; background: #1a73e8; border: 3px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.3), 0 1px 5px rgba(0,0,0,.5); }
.pa-dot{ width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid #111; }

.pa-toast{ position: absolute; left: 12px; right: 12px; top: calc(var(--st) + 50px); z-index: 1200; background: #fff; color: #1b1b1b;
  padding: 12px 14px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.4); font-size: 15px; }
.pa-install{ position: absolute; left: 12px; right: 12px; top: calc(var(--st) + 50px); z-index: 1150; background: #fff; color: #1b1b1b;
  padding: 12px 14px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.4); font-size: 15px; }
.pa-install p{ margin: 0 0 8px; }
.pa-install svg{ width: 18px; height: 18px; vertical-align: -3px; color: #1a73e8; }
.pa-install .pa-btn{ color: #fff; background: var(--g); width: 100%; }
.leaflet-container{ background: #2b2b2b; }

/* item list: an eye per item */
.pa-lh{ display: flex; align-items: baseline; justify-content: space-between; }
.pa-list li.off .tx{ opacity: .5; }
.pa-list li.off .pa-ico{ opacity: .45; }
.pa-list .eye{ flex: none; width: 44px; height: 44px; border: 0; background: none; color: var(--dim); display: grid; place-items: center; }
.pa-list .eye.on{ color: var(--ink); }
.pa-list .eye svg{ width: 24px; height: 24px; }

/* typing a GPS position: a box at the top so the keyboard doesn't cover it */
.pa-gps{ position: absolute; top: calc(var(--st) + 8px); left: 8px; right: 8px; z-index: 1150; background: var(--g); border-radius: 14px;
  padding: 4px 12px 8px; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.pa-gps .fld{ margin-top: 6px; }
#itGpsBox{ margin-top: 10px; }
#itGpsBox .row{ justify-content: flex-end; }
.msg.ok{ color: #9be39b; }
