/* Full-screen satellite map; floating header, side tools, coordinate readout, bottom card and right-hand drawers. */
:root {
  --sea: #0a1c21;
  --ink: #e9f1ec;
  --muted: #92aaa6;
  --panel: rgba(12, 30, 35, .92);
  --panel-solid: #10262c;
  --field: #0b1f24;
  --line: #2a474d;
  --quartz: #7fe0ff;
  --quartz-ink: #04202a;
  --citrine: #ffc55c;
  --amethyst: #c3a1ff;
  --mine: #5cf2a0;
  --danger: #ff8a7a;
  --shadow: 0 10px 34px rgba(0, 0, 0, .45);
  --font-display: "Huninn", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --font-body: -apple-system, "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --sea: #d7e6e3; --ink: #13292b; --muted: #587170; --panel: rgba(255, 253, 248, .95); --panel-solid: #fffdf8;
    --field: #f3f1ea; --line: #d7e0dc; --quartz: #0a7fa6; --quartz-ink: #ffffff; --citrine: #b57400; --amethyst: #7a4fd6;
    --mine: #0d8a4f; --danger: #c0392b; --shadow: 0 10px 30px rgba(20, 50, 50, .2); color-scheme: light;
  }
}
:root[data-theme="light"] {
  --sea: #d7e6e3; --ink: #13292b; --muted: #587170; --panel: rgba(255, 253, 248, .95); --panel-solid: #fffdf8;
  --field: #f3f1ea; --line: #d7e0dc; --quartz: #0a7fa6; --quartz-ink: #ffffff; --citrine: #b57400; --amethyst: #7a4fd6;
  --mine: #0d8a4f; --danger: #c0392b; --shadow: 0 10px 30px rgba(20, 50, 50, .2); color-scheme: light;
}

html, body { height: 100%; margin: 0; }
[hidden] { display: none !important; }
body { background: var(--sea); color: var(--ink); font-family: var(--font-body); overflow: hidden; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--quartz); }
:focus-visible { outline: 2px solid var(--quartz); outline-offset: 2px; }

#app { position: relative; height: 100%; }
#map { position: absolute; inset: 0; background: #0b1416; }
.leaflet-container { font-family: var(--font-body); }
.leaflet-control-attribution { font-size: 10px; background: rgba(0, 0, 0, .45) !important; color: #dfe9e6 !important; }
.leaflet-control-attribution a { color: #bfe9ff !important; }
.leaflet-control-scale { margin-left: 16px !important; margin-bottom: calc(76px + env(safe-area-inset-bottom, 0px)) !important; }
.leaflet-control-scale-line { background: rgba(0, 0, 0, .5); color: #fff; border-color: #fff; }

/* Header */
.top { position: absolute; top: calc(10px + env(safe-area-inset-top, 0px)); left: 16px; right: 16px; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; pointer-events: none; z-index: 1000; }
.top > * { pointer-events: auto; }
.brand { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 8px 14px; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.brand h1 { margin: 0; font-family: var(--font-display); font-size: 20px; font-weight: 400; letter-spacing: .12em; display: flex; align-items: center; gap: 8px; }
.brand .gem { width: 14px; height: 14px; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.search { position: relative; flex: 1 1 220px; max-width: 360px; }
.search input { width: 100%; box-sizing: border-box; background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 9px 16px; font-size: 14px; box-shadow: var(--shadow); backdrop-filter: blur(8px); }
.q-results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--panel-solid); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); max-height: 50vh; overflow: auto; padding: 4px; }
.q-results button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 10px; font-size: 14px; }
.q-results button:hover, .q-results button:focus-visible { background: color-mix(in srgb, var(--quartz) 14%, transparent); }
.q-results small { color: var(--muted); display: block; font-size: 12px; }
.controls { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill-btn { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; font-size: 13px; box-shadow: var(--shadow); backdrop-filter: blur(8px); white-space: nowrap; }
.pill-btn[aria-pressed="true"] { background: var(--ink); color: var(--panel-solid); border-color: var(--ink); }
.pill-btn.primary { background: var(--quartz); color: var(--quartz-ink); border-color: var(--quartz); font-weight: 600; }
.pill-btn.icon { width: 36px; padding: 8px 0; text-align: center; }

/* Right-side tools */
.side-tools { position: absolute; right: 16px; bottom: calc(96px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 6px; z-index: 900; }
.side-tools button { width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); box-shadow: var(--shadow); font-size: 18px; display: grid; place-items: center; }
.side-tools svg { width: 20px; height: 20px; }
.side-tools button[aria-pressed="true"] { color: #3aa0ff; }

/* Coordinate readout */
.readout { position: absolute; left: 16px; bottom: calc(22px + env(safe-area-inset-bottom, 0px)); z-index: 900; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; padding: 6px 10px; box-shadow: var(--shadow); backdrop-filter: blur(8px); font-family: var(--font-mono); font-size: 12px; line-height: 1.55; cursor: copy; max-width: calc(100% - 92px); box-sizing: border-box; }
.readout .k { display: inline-block; min-width: 46px; color: var(--muted); font-family: var(--font-body); font-size: 11px; }
@media (max-width: 560px) { .readout .more { display: none; } }

/* Pick mode */
.crosshair { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; transform: translate(-50%, -50%); z-index: 950; pointer-events: none; }
.crosshair i { position: absolute; background: #fff; box-shadow: 0 0 0 1px rgba(0, 0, 0, .6); }
.crosshair i:first-child { left: 21px; top: 0; width: 2px; height: 44px; }
.crosshair i:last-child { top: 21px; left: 0; height: 2px; width: 44px; }
.pickbar { position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(96px + env(safe-area-inset-bottom, 0px)); width: min(440px, calc(100% - 32px)); box-sizing: border-box; background: var(--panel-solid); border: 1px solid var(--quartz); border-radius: 16px; padding: 12px 14px; z-index: 1100; box-shadow: var(--shadow); }
.pickbar p { margin: 0 0 10px; font-size: 13px; line-height: 1.6; color: var(--muted); }
.pickbar b { color: var(--ink); display: block; font-size: 15px; }

/* Markers */
.pin { width: 16px; height: 16px; transform: rotate(45deg); border-radius: 3px 50% 50% 50%; background: var(--c); border: 2px solid rgba(0, 0, 0, .65); box-shadow: 0 0 0 2px rgba(255, 255, 255, .55), 0 2px 6px rgba(0, 0, 0, .5); }
.pin.sel { box-shadow: 0 0 0 3px #fff, 0 0 14px 4px var(--c); }
.find-pin { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--mine); background: #123 center/cover no-repeat; box-shadow: 0 2px 8px rgba(0, 0, 0, .6); display: grid; place-items: center; color: var(--mine); font-size: 16px; font-weight: 700; }
.find-pin.sel { box-shadow: 0 0 0 3px #fff, 0 0 16px 4px var(--mine); }
.find-pin.private { border-style: dashed; }
.gps-dot { width: 16px; height: 16px; border-radius: 50%; background: #3aa0ff; border: 3px solid #fff; box-shadow: 0 0 0 2px rgba(58, 160, 255, .4), 0 1px 4px rgba(0, 0, 0, .5); box-sizing: border-box; }
.pending-pin { width: 22px; height: 22px; border-radius: 50%; background: var(--mine); border: 3px solid #fff; box-shadow: 0 0 0 2px #000, 0 0 18px var(--mine); box-sizing: border-box; }
.zone-label { background: rgba(0, 0, 0, .55); color: #fff; border: 0; box-shadow: none; font-size: 12px; padding: 2px 6px; border-radius: 6px; }
.zone-label::before { display: none; }

/* Card */
.card { position: absolute; left: 16px; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); width: min(400px, calc(100% - 32px)); max-height: 66%; overflow: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); backdrop-filter: blur(10px); padding: 16px 18px; z-index: 1001; box-sizing: border-box; }
.card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.card h2 { font-family: var(--font-display); font-weight: 400; font-size: 21px; margin: 8px 0 2px; letter-spacing: .04em; text-wrap: balance; }
.card .en { color: var(--muted); font-size: 12px; margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 10px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c, currentColor); }
.minerals { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.minerals span { font-size: 13px; padding: 3px 10px; border-radius: 8px; background: color-mix(in srgb, var(--c, var(--quartz)) 18%, transparent); border: 1px solid color-mix(in srgb, var(--c, var(--quartz)) 45%, transparent); }
.close { border: 0; background: none; width: 32px; height: 32px; border-radius: 10px; font-size: 20px; color: var(--muted); flex: none; }
.coordbox { margin-top: 12px; border: 1px dashed var(--line); border-radius: 12px; padding: 8px 10px; font-family: var(--font-mono); font-size: 12px; line-height: 1.7; }
.coordbox .k { color: var(--muted); font-family: var(--font-body); font-size: 11px; display: inline-block; min-width: 46px; }
.coordbox .prec { font-family: var(--font-body); color: var(--muted); font-size: 12px; margin-top: 4px; line-height: 1.5; }
.coordbox .prec b { color: var(--citrine); font-weight: 600; }
dl.facts { margin: 12px 0 0; display: grid; grid-template-columns: 64px 1fr; gap: 6px 10px; font-size: 14px; line-height: 1.6; }
dl.facts dt { color: var(--muted); font-size: 12px; padding-top: 2px; }
dl.facts dd { margin: 0; }
.legal { margin-top: 12px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 13%, transparent); font-size: 13px; line-height: 1.6; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 6px; margin-top: 12px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 10px; cursor: zoom-in; display: block; }
.photos .ph { position: relative; }
.photos .ph button { position: absolute; top: 4px; right: 4px; width: 24px; height: 24px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .7); color: #fff; font-size: 14px; line-height: 1; }
.card-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sources { margin-top: 10px; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* Buttons */
.btn { border: 1px solid var(--line); background: none; border-radius: 10px; padding: 8px 14px; font-size: 14px; text-decoration: none; color: inherit; display: inline-flex; align-items: center; gap: 6px; }
.btn.primary { background: var(--quartz); color: var(--quartz-ink); border-color: var(--quartz); font-weight: 600; }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 50%, transparent); }
.btn.small { padding: 5px 10px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }
.row-btns { display: flex; flex-wrap: wrap; gap: 8px; }

/* Drawers */
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(360px, 100%); background: var(--panel-solid); border-left: 1px solid var(--line); box-shadow: var(--shadow); z-index: 1200; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); box-sizing: border-box; }
.drawer.wide { width: min(440px, 100%); }
.drawer header { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px 10px; border-bottom: 1px solid var(--line); gap: 10px; }
.drawer header h3 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 19px; letter-spacing: .08em; }
.drawer .body { overflow: auto; padding: 12px 16px 24px; display: flex; flex-direction: column; gap: 12px; min-height: 0; flex: 1; }
.group h4 { margin: 4px 0 6px; font-size: 12px; letter-spacing: .12em; color: var(--muted); font-weight: 500; }
.opt { display: grid; grid-template-columns: 22px 1fr; gap: 4px 8px; align-items: start; padding: 7px 8px; border-radius: 10px; cursor: pointer; font-size: 14px; }
.opt:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.opt input { margin: 3px 0 0; accent-color: var(--quartz); }
.opt small { grid-column: 2; color: var(--muted); font-size: 12px; line-height: 1.45; }
.opt input[type="range"] { grid-column: 2; width: 100%; margin: 4px 0 0; }
.legend { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; font-size: 12px; padding: 4px 8px; }
.legend span { display: flex; align-items: center; gap: 6px; }
.legend i { width: 11px; height: 11px; transform: rotate(45deg); border-radius: 2px 50% 50% 50%; background: var(--c); flex: none; border: 1px solid rgba(0, 0, 0, .5); }
.help { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 0; }
.mode-banner { font-size: 12px; line-height: 1.6; padding: 8px 10px; border-radius: 10px; border: 1px dashed var(--line); color: var(--muted); }
.mode-banner b { color: var(--ink); }

/* List */
.filters { display: flex; flex-wrap: wrap; gap: 6px; }
.filters select, .filters input { background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; font-size: 14px; }
.filters input { flex: 1 1 140px; min-width: 0; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 999px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 12px; border-radius: 999px; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--quartz); color: var(--quartz-ink); }
.items { display: flex; flex-direction: column; gap: 6px; }
.item { display: grid; grid-template-columns: 40px 1fr; gap: 10px; align-items: center; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: none; text-align: left; }
.item .th { width: 40px; height: 40px; border-radius: 10px; background: var(--c, var(--line)) center/cover no-repeat; display: grid; place-items: center; font-size: 12px; color: #000; }
.item .th.loc { width: 16px; height: 16px; justify-self: center; transform: rotate(45deg); border-radius: 3px 50% 50% 50%; }
.item b { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item span { color: var(--muted); font-size: 12px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Form */
form { display: flex; flex-direction: column; gap: 12px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > label, .field > .lbl { font-size: 12px; color: var(--muted); letter-spacing: .06em; }
.field input, .field select, .field textarea { background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; font-size: 15px; width: 100%; box-sizing: border-box; }
.field textarea { min-height: 76px; resize: vertical; line-height: 1.6; }
.field input.mono { font-family: var(--font-mono); font-size: 14px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.locbox { border: 1px solid var(--line); border-radius: 14px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.locbox .status { font-size: 12px; color: var(--muted); line-height: 1.6; }
.locbox .status b { color: var(--mine); font-weight: 600; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags button { border: 1px solid var(--line); background: none; border-radius: 999px; padding: 4px 10px; font-size: 13px; }
.tags button[aria-pressed="true"] { background: var(--mine); color: #04220f; border-color: var(--mine); }
.err { color: var(--danger); font-size: 13px; }
.switch { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.switch input { accent-color: var(--quartz); width: 18px; height: 18px; }

/* Toast, lightbox, login */
.toast { position: absolute; left: 50%; transform: translateX(-50%); top: calc(80px + env(safe-area-inset-top, 0px)); background: var(--panel-solid); border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; box-shadow: var(--shadow); z-index: 1500; font-size: 14px; max-width: calc(100% - 32px); box-sizing: border-box; }
.lightbox { position: absolute; inset: 0; z-index: 2000; background: rgba(0, 0, 0, .9); display: grid; place-items: center; padding: 16px; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 8px; }
.lightbox button { position: absolute; top: calc(12px + env(safe-area-inset-top, 0px)); right: 12px; width: 40px; height: 40px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .15); color: #fff; font-size: 20px; }

/* Hidden owner login */
.secret-spot { cursor: grab; }
.pw-box { width: min(300px, 100%); background: var(--panel-solid); border: 1px solid var(--line); border-radius: 16px; padding: 18px; display: flex; flex-direction: column; gap: 10px; color: var(--ink); }
.pw-box label { font-size: 13px; color: var(--muted); }
.pw-box input { background: var(--field); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 18px; letter-spacing: .2em; }
.lightbox .pw-box button { position: static; width: auto; height: auto; border-radius: 10px; font-size: 14px; border: 1px solid var(--line); background: none; color: inherit; }
.lightbox .pw-box button.primary { background: var(--quartz); color: var(--quartz-ink); border-color: var(--quartz); }

@media (max-width: 560px) {
  .drawer, .drawer.wide { top: auto; height: 82%; width: 100%; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; }
  .card { left: 16px; right: 16px; width: auto; bottom: calc(76px + env(safe-area-inset-bottom, 0px)); max-height: 58%; }
  .brand { display: none; }
  .search { flex-basis: 100%; max-width: none; }
  .pill-btn { padding: 7px 12px; }
}

/* 列表打開時像捲軸一樣由上往下展開，項目依序出現 */
@keyframes ck-unroll { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes ck-item { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.unroll { animation: ck-unroll .55s cubic-bezier(.3, .7, .2, 1) both; }
.unroll > * { animation: ck-item .35s ease both; animation-delay: .62s; }
.unroll > :nth-child(1) { animation-delay: 0.080s; }
.unroll > :nth-child(2) { animation-delay: 0.125s; }
.unroll > :nth-child(3) { animation-delay: 0.170s; }
.unroll > :nth-child(4) { animation-delay: 0.215s; }
.unroll > :nth-child(5) { animation-delay: 0.260s; }
.unroll > :nth-child(6) { animation-delay: 0.305s; }
.unroll > :nth-child(7) { animation-delay: 0.350s; }
.unroll > :nth-child(8) { animation-delay: 0.395s; }
.unroll > :nth-child(9) { animation-delay: 0.440s; }
.unroll > :nth-child(10) { animation-delay: 0.485s; }
.unroll > :nth-child(11) { animation-delay: 0.530s; }
.unroll > :nth-child(12) { animation-delay: 0.575s; }
#list:not([hidden]) { animation: ck-unroll .55s cubic-bezier(.3, .7, .2, 1) both; }
