/* Base reset */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* Layout: a split screen. Left is the list and place sheet, right is a hand-drawn map of the island; on phones the map sits on top. */
:root {
  --bg: #eef2ef;
  --surface: #ffffff;
  --sunk: #e4ebe7;
  --ink: #12302a;
  --muted: #5b6f68;
  --line: #d3ddd8;
  --chili: #d4421c;
  --chili-soft: #fbe4dc;
  --kaya: #d99a1a;
  --kaya-soft: #f8ecd0;
  --water: #d8e6e8;
  --land: #fbfcfa;
  --border: #c9d6d0;
  --pin-saved: #9aaba4;
  --focus: #1f6f61;
  --c-both: #1d7a55;
  --c-none: #a3b2ac;
  --display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --body: "Instrument Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --cjk: "Noto Sans SC", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1513; --surface: #16201d; --sunk: #1c2824; --ink: #e4ede8; --muted: #93a59e; --line: #2a3833;
    --chili: #ff6b45; --chili-soft: #3b1f17; --kaya: #eab44a; --kaya-soft: #3a2f16;
    --water: #0a1113; --land: #1b2622; --border: #31413b; --pin-saved: #61756d; --focus: #6fd0bd;
    --c-both: #43c08d; --c-none: #5d7069;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0e1513; --surface: #16201d; --sunk: #1c2824; --ink: #e4ede8; --muted: #93a59e; --line: #2a3833;
  --chili: #ff6b45; --chili-soft: #3b1f17; --kaya: #eab44a; --kaya-soft: #3a2f16;
  --water: #0a1113; --land: #1b2622; --border: #31413b; --pin-saved: #61756d; --focus: #6fd0bd;
  --c-both: #43c08d; --c-none: #5d7069;
  color-scheme: dark;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--body); font-size: 15px; line-height: 1.45; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.cjk { font-family: var(--cjk); }

.app { display: grid; grid-template-columns: minmax(340px, 420px) 1fr; height: 100%; }
.panel { display: flex; flex-direction: column; min-height: 0; min-width: 0; border-right: 1px solid var(--line); background: var(--bg); }
.gut { padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: 16px; }
.mapwrap { position: relative; min-width: 0; min-height: 0; background: var(--water); overflow: hidden; }
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; grid-template-rows: minmax(220px, 40%) 1fr; }
  .mapwrap { order: -1; border-bottom: 1px solid var(--line); }
  .panel { border-right: 0; }
  .gut { padding-right: max(16px, env(safe-area-inset-right, 0px)); }
}

/* header */
.top { padding-block: 16px 10px; display: flex; flex-direction: column; gap: 12px; border-bottom: 1px solid var(--line); }
.brandrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 26px; letter-spacing: -0.02em; line-height: 1.05; }
.brand h1 .cjk { font-weight: 700; letter-spacing: 0; }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: 13px; }
.who { display: flex; align-items: center; gap: -6px; }
.av { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--bg); background: var(--sunk); object-fit: cover; display: block; }
.who .av + .av { margin-left: -8px; }
.tabs { display: flex; gap: 4px; background: var(--sunk); padding: 3px; border-radius: 10px; }
.tabs button { flex: 1; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px; font-weight: 600; font-size: 14px; color: var(--muted); }
.tabs button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }

.scroll { flex: 1; overflow-y: auto; min-height: 0; -webkit-overflow-scrolling: touch; }
.section { padding-block: 14px; display: flex; flex-direction: column; gap: 12px; }

.notice { margin: 12px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--kaya-soft); font-size: 13px; color: var(--ink); }

/* controls */
.search { display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.search select { padding: 9px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); max-width: 42%; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 500; display: inline-flex; gap: 6px; align-items: center; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip .n { font-family: var(--mono); font-size: 11px; opacity: .7; }

.pickbtn { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; text-align: left; border: 0; border-radius: 12px; padding: 12px 14px; background: var(--chili); color: #fff; }
.pickbtn b { font-family: var(--display); font-size: 17px; font-weight: 700; display: block; }
.pickbtn span { font-size: 12.5px; opacity: .9; }
.pickbtn svg { flex: none; }
.pickbtn:disabled { opacity: .5; cursor: default; }
.near { gap: 10px; }
.from { display: flex; gap: 8px; }
.from input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); }
.from .btn { white-space: nowrap; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
#radius .lbl { font-size: 12.5px; color: var(--muted); font-weight: 600; align-self: center; margin-right: 2px; }
.chip:disabled { opacity: .45; cursor: default; }
.radius { fill: var(--chili); fill-opacity: .07; stroke: var(--chili); stroke-width: 1.5; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.origin { fill: var(--ink); stroke: var(--surface); stroke-width: 2; vector-effect: non-scaling-stroke; pointer-events: none; }
#map.choosing { cursor: crosshair; }
.maphint { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg); font-size: 13px; font-weight: 600; padding: 6px 12px; border-radius: 999px; white-space: nowrap; }

.pick { border: 2px solid var(--chili); border-radius: 14px; padding: 14px; background: var(--surface); display: flex; flex-direction: column; gap: 10px; }
.pick .eyebrow { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--chili); font-weight: 600; }
.pick h3 { margin: 0; font-family: var(--display); font-size: 22px; line-height: 1.1; text-wrap: balance; }
.pick .why { font-size: 13px; color: var(--muted); }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 8px 14px; font-weight: 600; font-size: 14px; }
.btn.primary { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.btn.ghost { background: transparent; }
.btn:disabled { opacity: .5; cursor: default; }

/* list */
.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.item { border-bottom: 1px solid var(--line); }
.item button { width: 100%; text-align: left; background: transparent; border: 0; padding: 12px 0; display: grid; grid-template-columns: 16px 1fr auto; gap: 10px; align-items: start; }
.ico { display: block; flex: none; margin-top: 2px; overflow: visible; }
.ico.inl { display: inline-block; vertical-align: -1px; margin: 0 4px 0 0; }
.ico path { stroke: var(--surface); stroke-width: 1; vector-effect: non-scaling-stroke; }
.st-both { fill: var(--c-both); } .st-one { fill: var(--kaya); } .st-want { fill: var(--chili); } .st-saved { fill: var(--c-none); } .st-ink { fill: var(--ink); }
.sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.bg-both { background: var(--c-both); } .bg-one { background: var(--kaya); } .bg-want { background: var(--chili); } .bg-saved { background: var(--c-none); }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px; background: var(--sunk); padding: 3px; border-radius: 10px; }
.seg button { border: 0; background: transparent; padding: 8px 4px; border-radius: 8px; font-weight: 600; font-size: 13.5px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgb(0 0 0 / 0.08); }
.seg button.want[aria-pressed="true"] { background: var(--chili); color: #fff; }
.seg button.been[aria-pressed="true"] { background: var(--c-both); color: #fff; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.item button:hover .nm { text-decoration: underline; text-underline-offset: 3px; }
.dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; border: 2px solid var(--pin-saved); background: var(--land); }
.dot.both { background: var(--ink); border-color: var(--ink); }
.dot.one { background: var(--kaya); border-color: var(--kaya); }
.dot.want { border-color: var(--chili); background: var(--chili-soft); }
.nm { font-weight: 600; font-size: 15px; line-height: 1.25; }
.nm .cjk { font-weight: 500; color: var(--muted); font-size: 13.5px; margin-left: 4px; }
.meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.unit { font-family: var(--mono); font-size: 11px; padding: 1px 5px; border-radius: 4px; background: var(--sunk); color: var(--ink); letter-spacing: .02em; }
.score { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.badge { font-family: var(--display); font-weight: 700; font-size: 15px; min-width: 36px; text-align: center; padding: 2px 7px; border-radius: 8px; background: var(--ink); color: var(--bg); font-variant-numeric: tabular-nums; }
.badge.lo { background: var(--sunk); color: var(--ink); }
.goog { font-family: var(--mono); font-size: 11px; color: var(--muted); white-space: nowrap; }
.faces { display: flex; }
.faces .av { width: 18px; height: 18px; border-width: 1.5px; }
.faces .av + .av { margin-left: -5px; }
.empty { padding: 28px 0; color: var(--muted); text-align: center; font-size: 14px; }

/* detail */
.back { border: 0; background: transparent; padding: 0; color: var(--muted); font-weight: 600; font-size: 13px; display: inline-flex; align-items: center; gap: 4px; }
.dhead h2 { margin: 6px 0 0; font-family: var(--display); font-weight: 800; font-size: 28px; line-height: 1.05; letter-spacing: -0.02em; text-wrap: balance; }
.dhead .cjkname { font-family: var(--cjk); font-weight: 700; font-size: 18px; color: var(--muted); margin-top: 4px; }
.dhead .paren { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.addr { font-size: 14px; display: flex; flex-direction: column; gap: 6px; }
.addr .postal { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.ext { color: var(--focus); font-weight: 600; font-size: 14px; text-decoration: none; }
.ext:hover { text-decoration: underline; }
.facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; color: var(--muted); }
.gnote { background: var(--kaya-soft); border-radius: 10px; padding: 10px 12px; font-size: 14px; white-space: pre-line; }
.gnote small { display: block; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.h3 { margin: 0; font-family: var(--display); font-weight: 700; font-size: 17px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.h3 .sub { font-family: var(--body); font-weight: 500; font-size: 12.5px; color: var(--muted); }
.divider { height: 1px; background: var(--line); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.toggles { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tog { border: 1.5px solid var(--line); background: var(--bg); border-radius: 10px; padding: 9px 10px; font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 8px; justify-content: center; }
.tog[aria-pressed="true"].been { background: var(--kaya); border-color: var(--kaya); color: #241a05; }
.tog[aria-pressed="true"].want { background: var(--chili); border-color: var(--chili); color: #fff; }
.rate { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.rate button { border: 1.5px solid var(--line); background: var(--bg); border-radius: 10px; padding: 8px 0 6px; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.rate button b { font-family: var(--display); font-size: 18px; line-height: 1; }
.rate button small { font-size: 10.5px; color: var(--muted); line-height: 1.1; text-align: center; }
.rate button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.rate button[aria-pressed="true"] small { color: var(--bg); opacity: .8; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
label.f input, label.f textarea { border: 1px solid var(--line); border-radius: 10px; padding: 9px 11px; background: var(--bg); font-weight: 400; font-size: 14.5px; color: var(--ink); }
label.f textarea { min-height: 76px; resize: vertical; }
.savebar { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.saved { font-size: 12.5px; color: var(--muted); }

.take { display: flex; gap: 10px; }
.take .av { width: 32px; height: 32px; flex: none; }
.take .body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; font-size: 14px; }
.take .who-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-weight: 600; }
.tag { font-size: 11.5px; font-weight: 600; padding: 1px 7px; border-radius: 999px; }
.tag.been { background: var(--kaya-soft); color: var(--ink); }
.tag.want { background: var(--chili-soft); color: var(--chili); }
.take .order { font-size: 13.5px; }
.take .order b { color: var(--muted); font-weight: 600; }
.take .rev { white-space: pre-line; }

.photos { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.ph { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; background: var(--sunk); max-width: 100%; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ph .by { position: absolute; left: 4px; bottom: 4px; }
.ph .by .av { width: 20px; height: 20px; }
.ph .del { position: absolute; top: 4px; right: 4px; border: 0; border-radius: 999px; background: rgb(0 0 0 / .55); color: #fff; font-size: 11px; padding: 2px 8px; }
.upl { border: 1.5px dashed var(--border); border-radius: 10px; aspect-ratio: 1; display: flex; flex-direction: column; gap: 2px; align-items: center; justify-content: center; font-size: 12.5px; color: var(--muted); font-weight: 600; background: transparent; }
.upl input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.visits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.visits li { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; font-size: 14px; }
.vdate { font-family: var(--mono); font-size: 11.5px; background: var(--sunk); padding: 2px 6px; border-radius: 5px; white-space: nowrap; }
.x { border: 0; background: transparent; color: var(--muted); font-size: 12px; padding: 0 2px; }
.vform { display: flex; gap: 8px; flex-wrap: wrap; }
.vform input[type=date] { border: 1px solid var(--line); border-radius: 10px; padding: 7px 9px; background: var(--bg); }
.vform input[type=text] { flex: 1; min-width: 140px; border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; background: var(--bg); }

/* us */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.stat b { display: block; font-family: var(--display); font-size: 26px; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12px; color: var(--muted); }
.match { display: flex; gap: 14px; align-items: center; }
.ring { flex: none; }
.match p { margin: 0; font-size: 14px; }
.vs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.vs li { border-top: 1px solid var(--line); }
.vs li:first-child { border-top: 0; }
.vs button { width: 100%; border: 0; background: transparent; text-align: left; padding: 9px 0; display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; }
.pair { display: flex; gap: 4px; align-items: center; font-family: var(--display); font-weight: 700; font-variant-numeric: tabular-nums; }
.pair i { font-style: normal; font-family: var(--body); font-weight: 500; color: var(--muted); font-size: 12px; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.feed li { display: grid; grid-template-columns: 24px 1fr; gap: 10px; font-size: 14px; align-items: start; }
.feed .av { width: 24px; height: 24px; border-width: 0; }
.feed time { display: block; font-size: 12px; color: var(--muted); }
.feed a, .linkish { color: var(--ink); font-weight: 600; background: none; border: 0; padding: 0; text-align: left; text-decoration: underline; text-decoration-color: var(--line); text-underline-offset: 3px; }
.muted { color: var(--muted); font-size: 13.5px; margin: 0; }

/* map */
#map { width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#map:active { cursor: grabbing; }
.land { fill: var(--land); stroke: var(--border); stroke-width: 1; vector-effect: non-scaling-stroke; }
.area { fill: transparent; }
.border { fill: none; stroke: var(--border); stroke-width: .7; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.alabel { fill: var(--muted); font-family: var(--body); font-weight: 600; text-transform: uppercase; letter-spacing: .12em; pointer-events: none; opacity: .75; }
.alabel.off { display: none; }
.pin path { stroke: var(--surface); stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: pointer; }
.pin.sel path { stroke: var(--ink); stroke-width: 2.5; }
.pin text { font-family: var(--display); font-weight: 700; fill: var(--ink); paint-order: stroke; stroke: var(--land); stroke-width: 3px; stroke-linejoin: round; pointer-events: none; }
.pin.dim { opacity: .25; }
.mapctl { position: absolute; right: max(12px, calc(env(safe-area-inset-right, 0px) + 12px)); bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.mapctl button { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-size: 18px; font-weight: 600; display: grid; place-items: center; box-shadow: 0 1px 3px rgb(0 0 0 / .1); }
.legend { position: absolute; left: max(12px, calc(env(safe-area-inset-left, 0px) + 12px)); bottom: 12px; display: flex; flex-direction: column; gap: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; font-size: 12px; max-width: calc(100% - 80px); }
.legend .lrow { display: flex; gap: 4px 10px; flex-wrap: wrap; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend .ico { margin: 0; }
.maptitle { position: absolute; top: 12px; left: max(12px, calc(env(safe-area-inset-left, 0px) + 12px)); font-family: var(--mono); font-size: 11px; color: var(--muted); letter-spacing: .04em; background: var(--surface); border: 1px solid var(--line); padding: 3px 8px; border-radius: 6px; }
@media (max-width: 760px) { .legend { font-size: 11px; padding: 4px 8px; bottom: 8px; } .maptitle { display: none; } }

.toast { position: fixed; left: 50%; bottom: calc(16px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--bg); padding: 9px 14px; border-radius: 10px; font-size: 14px; z-index: 20; max-width: calc(100% - 32px); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Sign-in screen */
.gate { position: fixed; inset: 0; z-index: 30; background: var(--bg); display: grid; place-items: center; padding: 24px 16px; overflow-y: auto; }
.gatebox { width: 100%; max-width: 380px; display: flex; flex-direction: column; gap: 14px; }
.gatebox h1 { font-family: var(--display); font-weight: 800; font-size: 44px; margin: 0; letter-spacing: -0.03em; line-height: 1; }
.gatebox p { margin: 0; font-size: 15px; }
.gatebox form { display: flex; flex-direction: column; gap: 10px; }
.gatebox .btn { padding: 11px 14px; }
.av.ini { display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 12px; line-height: 1; font-family: var(--body); }
.faces .av.ini { font-size: 9px; }
.acct { display: flex; flex-direction: column; gap: 10px; }
.acct .row input { flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; background: var(--bg); }
.syncline { font-size: 13px; color: var(--muted); }
