/* SporeTracker: SporeQuest's 8-bit look. Pixel Operator type, thick black outlines, hard drop shadows,
   rounded rectangles (never pills), cream ink on night forest, gold and the logo's orange for actions. */
@font-face { font-family: 'Pixel'; src: url('fonts/PixelOperatorHB.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'PixelMono'; src: url('fonts/PixelOperatorMonoHB.woff') format('woff'); font-display: swap; }
@font-face { font-family: 'SQ Pixel'; src: url('fonts/PixelOperatorHB.woff') format('woff'); }
@font-face { font-family: 'SQ Pixel Small'; src: url('fonts/PixelOperatorMonoHB.woff') format('woff'); }
@font-face { font-family: 'SQ Pixel Display'; src: url('fonts/PixelOperatorHB.woff') format('woff'); }
:root {
  --bg: #0d1a12; --bg-2: #13261a; --panel: #1b3323; --panel-2: #244330; --ink: #f1e6c8; --ink-2: #d6c9a4; --dim: #a39a7c;
  --gold: #ffd84a; --gold-2: #e8a92a; --orange: #f08a1c; --cream: #fff4dc; --red: #d9453a; --line: #000;
  --hard: 0 4px 0 rgba(0, 0, 0, .55); --r: 8px; --display: 'Pixel', monospace;
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 18px/1.3 'Pixel', monospace; -webkit-font-smoothing: none; min-height: 100vh; padding-bottom: calc(76px + var(--safe-b));
  background: radial-gradient(120% 60% at 50% 0%, #1d3a26 0%, var(--bg) 60%) fixed; }
img.px, .wordmark { image-rendering: pixelated; }
a { color: var(--gold); }
button, input, select, textarea { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.small { font-size: 15px; } .dim { color: var(--dim); } .center { text-align: center; }
h2, h3 { font-family: var(--display); color: var(--gold); text-shadow: 0 2px 0 #000; margin: 0 0 10px; line-height: 1.1; letter-spacing: .02em; }
h2 { font-size: 26px; } h3 { font-size: 21px; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: center; gap: 12px; padding: 10px 14px 8px;
  background: linear-gradient(#0d1a12 70%, rgba(13, 26, 18, 0)); }
.wordmark { height: 40px; width: auto; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, .6)); }
.top .iconbtn { position: absolute; right: 12px; top: 12px; }
.iconbtn { min-width: 40px; height: 40px; padding: 0 8px; display: inline-grid; place-items: center; background: var(--panel); color: var(--ink); border: 3px solid var(--line);
  border-radius: 7px; box-shadow: var(--hard); cursor: pointer; font-size: 22px; line-height: 1; }
.iconbtn svg { width: 20px; height: 20px; }
.iconbtn[aria-pressed="false"] .w { display: none; }
.iconbtn:active, .btn:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(0, 0, 0, .55); }

main { max-width: 620px; margin: 0 auto; padding: 4px 14px 20px; }
.view { display: flex; flex-direction: column; gap: 14px; }
.panel { background: var(--panel); border: 3px solid var(--line); border-radius: 10px; box-shadow: var(--hard); padding: 16px; }
.panel.narrow { max-width: 420px; width: 100%; margin: 20px auto 0; }
.banner { max-width: 620px; margin: 4px auto 6px; padding: 10px 14px; background: var(--gold); color: #1c1a16; border: 3px solid var(--line); border-radius: 8px; box-shadow: var(--hard); text-align: center; font-size: 16px; width: calc(100% - 28px); }
.banner a, .banner button { color: #1c1a16; font-weight: bold; text-decoration: underline; background: none; border: 0; padding: 0; cursor: pointer; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 50px; padding: 10px 18px; background: var(--panel-2); color: var(--ink);
  border: 3px solid var(--line); border-radius: var(--r); box-shadow: var(--hard); cursor: pointer; font-size: 20px; text-decoration: none; text-align: center; }
.btn.gold { background: var(--gold-2); color: #1c1a16; }
.btn.go { background: #4f9a3c; color: var(--cream); }
.btn.stop { background: var(--red); color: var(--cream); }
.btn.find { background: var(--orange); color: #1c1a16; min-height: 58px; font-size: 22px; }
.btn.find svg { width: 22px; height: 22px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: default; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.actions .btn:only-child { grid-column: 1 / -1; min-height: 64px; font-size: 24px; }

.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 0; border: 3px solid var(--line); border-radius: 9px; overflow: hidden; box-shadow: var(--hard); }
.seg button { background: var(--panel); border: 0; padding: 10px; cursor: pointer; color: var(--ink-2); }
.seg button + button { border-left: 3px solid var(--line); }
.seg button[aria-selected="true"] { background: var(--gold-2); color: #1c1a16; }

.fld { display: block; margin: 0 0 12px; color: var(--ink-2); text-align: center; }
.fld input, .fld textarea { text-align: left; }
.fld small, .chk small { color: var(--dim); font-size: 14px; }
.fld input, .fld select, .fld textarea, .row input, .row select { display: block; width: 100%; margin-top: 5px; padding: 10px 12px; background: #0b140e; border: 3px solid var(--line);
  border-radius: 7px; color: var(--cream); font-size: 18px; }
.fld textarea { min-height: 80px; resize: vertical; }
.row { display: flex; gap: 8px; } .row input { flex: 1; } .row select { width: 90px; flex: none; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .btn:focus-visible, .iconbtn:focus-visible, .seg button:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.chk { display: flex; gap: 10px; align-items: flex-start; justify-content: center; margin: 0 0 12px; }
.chk input { width: 22px; height: 22px; margin: 0; accent-color: var(--gold-2); flex: none; }
.err { color: #ff9b8a; min-height: 1em; margin: 0 0 10px; }
.adv summary { cursor: pointer; color: var(--dim); margin: 6px 0; }

.mapbox { position: relative; border: 3px solid var(--line); border-radius: 10px; box-shadow: var(--hard); overflow: hidden; background: #36552c; }
.map { display: block; width: 100%; height: min(46vh, 380px); image-rendering: pixelated; touch-action: none; cursor: grab; }
.mapbox.tall .map { height: min(62vh, 560px); }
.mapctl { position: absolute; right: 8px; top: 8px; display: flex; flex-direction: column; gap: 8px; }
.osm { position: absolute; left: 6px; bottom: 4px; margin: 0; font-size: 12px; color: #fff; text-shadow: 0 1px 0 #000; }
.gps { margin: -4px 0 0; text-align: center; color: var(--dim); font-size: 15px; }
.gps.good { color: #9fe07a; } .gps.weak { color: var(--gold); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--panel); border: 3px solid var(--line); border-radius: 9px; box-shadow: var(--hard); padding: 10px 8px 8px; text-align: center; }
.stat b { display: block; font: 34px/1 'PixelMono', monospace; color: var(--cream); text-shadow: 0 2px 0 #000; }
.stat span { color: var(--dim); font-size: 15px; }

.cards { display: grid; gap: 12px; }
.fcard { display: grid; grid-template-columns: 84px 1fr; gap: 12px; align-items: center; text-align: left; background: var(--panel); border: 3px solid var(--line); border-radius: 10px;
  box-shadow: var(--hard); padding: 8px; cursor: pointer; width: 100%; }
.fcard img, .fcard .noimg { width: 84px; height: 84px; object-fit: cover; border-radius: 6px; border: 2px solid var(--line); background: #0b140e; }
.fcard b { display: block; color: var(--cream); font-size: 19px; }
.badge { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 5px; border: 2px solid var(--line); font-size: 14px; background: var(--panel-2); color: var(--ink-2); }
.badge.ok { background: #4f9a3c; color: var(--cream); } .badge.fix { background: var(--gold-2); color: #1c1a16; } .badge.no { background: #7a2c22; color: var(--cream); }
.badge.wait { background: #2e4a5a; color: var(--cream); } .badge.q { background: #3a3a3a; color: var(--cream); }
.empty { text-align: center; color: var(--dim); padding: 24px 10px; }
.list { display: grid; gap: 8px; }
.hrow { display: flex; justify-content: space-between; gap: 10px; align-items: center; width: 100%; background: var(--panel-2); border: 3px solid var(--line); border-radius: 8px;
  padding: 10px 12px; cursor: pointer; text-align: left; }
.hrow b { color: var(--cream); } .hrow span { color: var(--dim); font-size: 15px; }

.bar { height: 16px; border: 3px solid var(--line); border-radius: 6px; background: #0b140e; overflow: hidden; margin: 6px 0 10px; }
.bar i { display: block; height: 100%; width: 0; background: repeating-linear-gradient(90deg, var(--gold) 0 6px, var(--gold-2) 6px 12px); }
.dexgrid { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px; }
.dexgrid > .dexslot { width: calc(50% - 7px); max-width: 220px; }
.dexslot { container-type: inline-size; cursor: pointer; background: none; border: 0; padding: 0; text-align: center; color: var(--ink-2); }
.dexslot .mcard, .bigcard .mcard { width: 100% !important; font-size: 4.8cqw !important; margin: 0 auto; text-align: left; }
.dexslot .when { display: block; margin-top: 8px; font-size: 14px; }
.bigcard { container-type: inline-size; width: min(88vw, 380px); margin: 0 auto; position: relative; }
.stamp { position: absolute; right: 7%; top: 36%; transform: rotate(-8deg); padding: 5px 10px; border: 3px solid #7a2c0c; border-radius: 6px; background: rgba(255, 244, 220, .92);
  color: #7a2c0c; font: 15px/1.1 'Pixel', monospace; text-align: center; white-space: nowrap; box-shadow: 0 3px 0 rgba(0, 0, 0, .5); z-index: 3; }
/* stand-in card when SporeQuest's card file can't be reached */
.mcard.plain { aspect-ratio: 63 / 88; border: 3px solid #000; border-radius: 10px; background: linear-gradient(145deg, #a8dc6e, #2e7a3a 55%, #0d1a12); color: #1c1408; padding: 8%; display: flex;
  flex-direction: column; justify-content: flex-end; gap: 4px; box-shadow: 0 6px 0 rgba(0, 0, 0, .5); }
.mcard.plain b { color: #fff4dc; text-shadow: 0 2px 0 #000; font-size: 1.4em; } .mcard.plain i { color: #fff4dc; }

.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 8px 10px calc(8px + var(--safe-b));
  background: linear-gradient(rgba(13, 26, 18, 0), #0d1a12 30%); max-width: 640px; margin: 0 auto; }
.tabs button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 7px 2px 5px; background: var(--panel); border: 3px solid var(--line);
  border-radius: 9px; box-shadow: var(--hard); color: var(--ink-2); cursor: pointer; font-size: 14px; }
.tabs button svg { width: 24px; height: 24px; }
.tabs button[aria-current="page"] { background: var(--gold-2); color: #1c1a16; }
.tabs .dot { position: absolute; top: -6px; right: -4px; width: 14px; height: 14px; border-radius: 3px; background: var(--red); border: 2px solid #000; }
body.signed-out .tabs { display: none; }

.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(4, 8, 5, .82); overflow-y: auto; padding: 12px 12px calc(20px + var(--safe-b)); }
.sheet-in { max-width: 560px; margin: 0 auto; background: var(--bg-2); border: 3px solid var(--line); border-radius: 12px; box-shadow: 0 6px 0 rgba(0, 0, 0, .6); padding: 16px; display: flex; flex-direction: column; gap: 14px; }
.sheet-in .x { align-self: flex-end; margin: -6px -6px -10px 0; }
.sheet-in h2, .sheet-in h3, .sheet-in > p, .sheet-in > div > b, .gps, .note { text-align: center; }
.sheet-in > div > b { display: block; margin-bottom: 6px; }
.shots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.shot { position: relative; aspect-ratio: 3 / 4; border: 3px dashed #4c6a52; border-radius: 8px; background: #0b140e; display: grid; place-items: center; text-align: center; padding: 6px;
  font-size: 14px; color: var(--dim); cursor: pointer; overflow: hidden; }
.shot.has { border-style: solid; border-color: #000; }
.shot img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.shot .n { display: block; font-size: 26px; color: var(--gold); }
.pick { max-height: 260px; overflow-y: auto; display: grid; gap: 6px; margin-top: 8px; }
.opt { display: block; width: 100%; text-align: left; padding: 8px 10px; background: var(--panel); border: 2px solid var(--line); border-radius: 7px; cursor: pointer; }
.opt i { display: block; color: var(--dim); font-size: 14px; }
.opt[aria-selected="true"] { background: var(--gold-2); color: #1c1a16; } .opt[aria-selected="true"] i { color: #3a2a10; }
.chosen { padding: 10px 12px; border: 3px solid var(--line); border-radius: 8px; background: var(--gold-2); color: #1c1a16; display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.loc { padding: 10px 12px; border-radius: 8px; background: #0b140e; border: 2px solid #2a3d2e; font-size: 16px; }
.cam { position: relative; background: #000; border: 3px solid #000; border-radius: 10px; overflow: hidden; }
.cam video { display: block; width: 100%; max-height: 60vh; object-fit: cover; }
.photos { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; }
.photos img { width: 100%; aspect-ratio: 3 / 4; object-fit: cover; border-radius: 8px; border: 3px solid #000; }
.kv { display: grid; grid-template-columns: auto auto; gap: 4px 12px; width: fit-content; margin: 0 auto; } .kv dt { color: var(--dim); } .kv dd { margin: 0; color: var(--cream); }
.note { background: #0b140e; border: 2px solid #2a3d2e; border-radius: 8px; padding: 10px 12px; }
.toast { position: fixed; left: 50%; bottom: calc(92px + var(--safe-b)); transform: translateX(-50%); z-index: 60; max-width: calc(100% - 28px); padding: 10px 16px; background: var(--cream);
  color: #1c1a16; border: 3px solid #000; border-radius: 8px; box-shadow: var(--hard); text-align: center; }
.newcard h2 { text-align: center; font-size: 30px; animation: pop .5s steps(4) both; }
@keyframes pop { from { transform: scale(.4); } to { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .newcard h2 { animation: none; } }
@media (min-width: 700px) { .stats { grid-template-columns: repeat(4, 1fr); } }
