:root {
  color-scheme: dark;
  --bg: #0B0C0E;
  --panel: #131417;
  --raised: #1C1E22;
  --line: rgba(255, 255, 255, .08);
  --text: #ECEAE6;
  --muted: #8C9099;
  --faint: #5A5F68;
  --accent: #FF6B4A;
  --ocean: #09141F;
  --glass: rgba(20, 22, 26, .78);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Roboto, "Segoe UI", system-ui, sans-serif;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { height: 100%; margin: 0; background: var(--ocean); color: var(--text); font: 15px/1.45 var(--font); -webkit-font-smoothing: antialiased; overflow: hidden; }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.label { margin: 0; font-size: 13px; font-weight: 600; color: var(--muted); }

#map { position: fixed; inset: 0; background: var(--ocean); }
.leaflet-container { background: var(--ocean); font-family: var(--font); }
.leaflet-control-attribution { background: rgba(8, 10, 12, .6) !important; color: var(--faint) !important; font-size: 10px; }
.leaflet-control-attribution a { color: var(--muted) !important; }
.leaflet-control-container .leaflet-top { top: calc(var(--sat) + 70px); }

.glass { background: var(--glass); backdrop-filter: blur(22px) saturate(1.3); -webkit-backdrop-filter: blur(22px) saturate(1.3); border: 1px solid var(--line); }

/* search */
.top { position: fixed; left: 12px; right: 12px; top: calc(var(--sat) + 8px); z-index: 1000; display: flex; flex-direction: column; gap: 10px; max-width: 560px; margin: 0 auto; }
.search { height: 50px; border-radius: 25px; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 16px; }
.search .ico { color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--text); font: 16px var(--font); outline: none; }
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.iconbtn { width: 38px; height: 38px; border-radius: 19px; border: 0; background: none; display: grid; place-items: center; cursor: pointer; flex: none; }
.iconbtn.small { width: 28px; height: 28px; }
.textbtn { border: 0; background: none; font-weight: 500; padding: 0 8px; cursor: pointer; }
button:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.results { border-radius: 22px; max-height: min(62vh, 480px); overflow: auto; }
.results button { display: grid; grid-template-columns: 22px 1fr auto; gap: 12px; align-items: center; width: 100%; min-height: 60px; padding: 8px 16px; border: 0; border-top: 1px solid var(--line); background: none; text-align: left; cursor: pointer; }
.results button:first-child { border-top: 0; }
.results button:active { background: var(--raised); }
.results b { display: block; font-weight: 500; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.results small { display: block; color: var(--muted); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.results .empty { padding: 16px; color: var(--muted); margin: 0; }
.results .try { padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.pill { height: 32px; padding: 0 12px; border-radius: 16px; border: 0; background: var(--raised); font-weight: 500; font-size: 14px; cursor: pointer; }
.dot { width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 1.5px #0A0B0D; display: inline-block; }
.check { color: var(--accent); font-weight: 700; }

/* bottom panel */
.panel { position: fixed; left: 12px; right: 12px; bottom: calc(var(--sab) + 10px); z-index: 1000; border-radius: 26px; padding: 14px 16px; display: flex; flex-direction: column; gap: 12px; max-width: 560px; margin: 0 auto; }
.progress-row { display: flex; justify-content: space-between; align-items: baseline; border: 0; background: none; padding: 0; cursor: pointer; }
.progress-row .right { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.progress-row svg { color: var(--faint); }
.bar { height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .3s; }
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid transparent; background: var(--raised); display: inline-flex; align-items: center; gap: 7px; font-weight: 500; font-size: 14px; cursor: pointer; }
.chip .n { color: var(--faint); font-size: 13px; }
.chip[aria-pressed="false"] { background: transparent; border-color: var(--line); color: var(--faint); }
.chip[aria-pressed="false"] .dot { opacity: .35; }

/* place sheet */
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1100; max-height: 78vh; overflow: auto; background: var(--panel); border-radius: 26px 26px 0 0; border-top: 1px solid var(--line); padding: 10px 0 calc(var(--sab) + 22px); box-shadow: 0 -20px 60px rgba(0, 0, 0, .5); animation: up .28s cubic-bezier(.2, .9, .3, 1); max-width: 620px; margin: 0 auto; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.grab { width: 38px; height: 5px; border-radius: 3px; background: rgba(255, 255, 255, .18); margin: 0 auto 12px; }
.photos { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding: 0 16px 4px; scrollbar-width: none; }
.photos::-webkit-scrollbar { display: none; }
.photos figure { margin: 0; flex: 0 0 calc(100% - 8px); scroll-snap-align: center; position: relative; border-radius: 18px; overflow: hidden; background: var(--raised); aspect-ratio: 16 / 10; }
.photos img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photos figcaption { position: absolute; left: 0; right: 0; bottom: 0; padding: 26px 14px 12px; background: linear-gradient(transparent, rgba(0, 0, 0, .6)); font-size: 13px; font-weight: 600; }
.sheet-body { padding: 16px 20px 0; display: flex; flex-direction: column; gap: 16px; }
.sheet h2 { margin: 0; font-size: 26px; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; }
.sub { margin: 4px 0 0; color: var(--muted); font-size: 15px; }
.note { margin: 2px 0 0; color: var(--faint); font-size: 13px; }
.primary { height: 52px; border-radius: 16px; border: 0; background: var(--accent); color: #000; font-weight: 600; font-size: 16px; cursor: pointer; display: flex; align-items: center; justify-content: center; gap: 8px; }
.primary.done { background: var(--raised); color: var(--accent); }
.kv p { margin: 0; }
.kv .v { font-size: 16px; font-weight: 500; }
.kv .s { color: var(--faint); font-size: 13px; }
.copyrow { display: flex; justify-content: space-between; align-items: center; border: 0; background: none; padding: 0; text-align: left; cursor: pointer; }
.sheet .close { position: absolute; top: 10px; right: 12px; background: rgba(0, 0, 0, .35); }

/* progress */
.full { position: fixed; inset: 0; z-index: 1200; background: var(--panel); overflow: auto; }
.full-inner { max-width: 560px; margin: 0 auto; padding: calc(var(--sat) + 28px) 22px calc(var(--sab) + 40px); display: flex; flex-direction: column; gap: 14px; position: relative; }
.full .close { position: absolute; right: 14px; top: calc(var(--sat) + 16px); background: var(--raised); }
.big { margin: 0; font-size: 17px; font-weight: 500; }
.big .num { font-size: 56px; font-weight: 600; margin-right: 6px; }
.pcats { display: flex; flex-direction: column; margin-top: 10px; }
.pcat { display: grid; grid-template-columns: 16px 1fr auto; gap: 12px; align-items: center; padding: 11px 0; }
.pcat .name { font-weight: 500; }
.pcat .n { color: var(--muted); font-size: 14px; }
.pcat .bar { grid-column: 2 / 4; height: 4px; }
.about { margin: 18px 0 0; color: var(--muted); font-size: 14px; }
.about a { color: var(--text); }

/* install toast */
.toast { position: fixed; left: 12px; right: 12px; top: calc(var(--sat) + 68px); z-index: 1050; border-radius: 18px; padding: 10px 10px 10px 16px; display: flex; align-items: center; gap: 10px; max-width: 560px; margin: 0 auto; font-size: 14px; }
.toast span { flex: 1; }
.toast #installBtn { height: 34px; padding: 0 14px; border-radius: 17px; border: 0; background: var(--accent); color: #000; font-weight: 600; cursor: pointer; }

@media (prefers-reduced-motion: reduce) { .sheet { animation: none; } .bar i { transition: none; } }

/* send a screenshot */
.send { margin-top: 18px; padding: 16px; border-radius: 18px; background: var(--raised); display: flex; flex-direction: column; gap: 12px; }
.send .stitle { margin: 0; font-weight: 600; font-size: 16px; }
.send .ssub { margin: 4px 0 0; color: var(--muted); font-size: 14px; }
.send label.primary { cursor: pointer; }
.send .note { margin: 0; min-height: 1em; }

/* live finds */
.find { display: block; width: 13px; height: 13px; transform: rotate(45deg); border: 2px solid rgba(255, 255, 255, .95); margin: 2px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
.find.done { opacity: .4; }
.find.big { width: 20px; height: 20px; margin: 6px 10px 0 4px; flex: none; }
.find.small { width: 9px; height: 9px; border-width: 1.5px; margin: 0 2px 0 0; background: var(--accent); }
.findhead { display: flex; align-items: flex-start; gap: 10px; }
.stats2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stats2 > div { background: var(--raised); border-radius: 16px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.stats2 b { font-size: 18px; }
.stats2 span { color: var(--muted); font-size: 13px; }
.chip.live { background: rgba(255, 107, 74, .14); border-color: rgba(255, 107, 74, .35); }
.chip.live[aria-pressed="false"] { background: transparent; border-color: var(--line); }

a.reallink { display: block; color: inherit; text-decoration: none; }
a.reallink .v span { color: var(--muted, #8C9099); font-size: 0.9em; }

/* cheats */
.ctitle { font-size: 28px; margin: 0; }
.seg { display: flex; background: var(--raised); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { flex: 1; height: 34px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; }
.seg button[aria-pressed="true"] { background: #3A3D44; color: var(--text); }
.ctop { margin: 8px 0 -4px; }
.cgroup { background: var(--raised); border-radius: 18px; overflow: hidden; }
.cheat { padding: 14px 16px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.cheat:first-child { border-top: 0; }
.chead { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.cname { font-weight: 600; margin: 0; }
.pin { background: none; border: 0; color: var(--faint); font-size: 20px; cursor: pointer; padding: 0 4px; min-width: 44px; min-height: 44px; }
.pin[aria-pressed="true"] { color: var(--accent, #FF6B4A); }
.seq { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; }
.key { min-width: 28px; height: 28px; padding: 0 7px; border: 1.5px solid var(--faint); border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; }
.phone { margin: 0; font-weight: 600; }
.chead p { margin: 0; }
.chead .s { margin-top: 3px; }
.cheat > .s { margin: 0; }

/* launch-day message */
.news { margin-top: 10px; border-radius: 18px; padding: 10px 6px 10px 14px; display: flex; align-items: flex-start; gap: 10px; font-size: 14px; font-weight: 500; }
.news a, .news span { color: var(--text); text-decoration: none; flex: 1; line-height: 1.35; }
.news .dia { flex: none; width: 8px; height: 8px; margin-top: 6px; background: var(--accent); transform: rotate(45deg); }
.news .x { flex: none; background: none; border: 0; color: var(--faint); font-size: 13px; width: 44px; height: 44px; margin: -11px -8px -11px 0; cursor: pointer; }
.results:not([hidden]) ~ .news { display: none; }

a.chip.early { background: var(--accent); color: #000; text-decoration: none; font-weight: 600; }
.getapp { display: block; text-align: center; background: var(--raised); color: var(--text); text-decoration: none; border-radius: 14px; padding: 13px; font-weight: 600; }
.sharelink { width: 100%; box-sizing: border-box; height: 44px; margin-top: -4px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--raised); color: var(--text); font-family: inherit; font-size: 15px; }

/* move progress to the iPhone app (#51) */
#openExport { border: 0; cursor: pointer; font: inherit; font-weight: 600; width: 100%; }
.exportbox { display: flex; flex-direction: column; gap: 12px; }
.qr { width: min(100%, 280px); aspect-ratio: 1; margin: 6px auto 0; border-radius: 14px; overflow: hidden; background: #fff; }
.qr svg { display: block; width: 100%; height: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row2 a.primary { text-decoration: none; }
#exportTitle { padding-right: 48px; }
