:root {
  --bg: #0C1214;
  --surface: #151D21;
  --surface-2: #1B2529;
  --line: #243036;
  --line-strong: #31414A;
  --ink: #F2F6F6;
  --sub: #92A3AB;
  --faint: #6B7B83;
  --teal: #4CAE93;
  --teal-bright: #5FC3A8;
  --teal-ink: #07120E;
  --amber: #E0B45C;
  --danger: #F08A80;

  --head: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;

  color-scheme: dark;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
}

*, *::before, *::after { box-sizing: inherit; }

html { scroll-padding-top: env(safe-area-inset-top, 0px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16.5px/1.5 var(--body);
  letter-spacing: 0.005em;
  -webkit-text-size-adjust: 100%;
}

body::before {
  content: "";
  position: fixed;
  inset: 0 0 auto;
  height: env(safe-area-inset-top, 0px);
  background: var(--bg);
  z-index: 30;
}

a { color: inherit; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

:focus-visible { outline: 2.5px solid var(--teal-bright); outline-offset: 2px; border-radius: 4px; }

.visually-hidden {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

/* ---------- Header ---------- */

.board {
  position: sticky;
  top: env(safe-area-inset-top, 0px);
  z-index: 10;
  background: rgba(12, 18, 20, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px 12px;
}

.board-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: 680px;
  margin: 0 auto 10px;
}

.wordmark {
  font: 800 20px/1 var(--head);
  letter-spacing: -0.01em;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.wordmark::before {
  content: "";
  width: 22px; height: 22px;
  background: var(--teal);
  -webkit-mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8 12 3 3 8v8l9 5 9-5Z"/><path d="M3 8l9 5 9-5M12 13v8"/></svg>') center / contain no-repeat;
  mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path d="M21 8 12 3 3 8v8l9 5 9-5Z"/><path d="M3 8l9 5 9-5M12 13v8"/></svg>') center / contain no-repeat;
}

.board-link {
  font: 600 14px/1 var(--body);
  color: var(--sub);
  text-decoration: none;
  padding: 8px 2px;
}

.search { max-width: 680px; margin: 0 auto; }

.search input {
  width: 100%;
  font-size: 17px;
  padding: 13px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

.search input::placeholder { color: var(--faint); }
.search input:focus { border-color: var(--teal); outline: none; }

/* ---------- Layout ---------- */

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 16px 16px calc(96px + env(safe-area-inset-bottom, 0px));
  outline: none;
}

h1, h2, h3 { font-family: var(--head); line-height: 1.15; margin: 0; letter-spacing: -0.015em; }
h1 { font-size: 27px; font-weight: 800; }
h2 { font-size: 13px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--sub); margin: 26px 0 10px; }
h3 { font-size: 18px; font-weight: 700; }

.lede { color: var(--sub); margin: 6px 0 0; }
.muted { color: var(--sub); }
.small { font-size: 14px; }

/* ---------- Location chips ---------- */

.tape-row { display: flex; flex-wrap: wrap; gap: 5px 7px; align-items: center; margin: 6px 0 2px; }

.tape {
  display: inline-block;
  background: var(--surface-2);
  color: var(--ink);
  font: 600 12.5px/1.1 var(--body);
  letter-spacing: 0.02em;
  padding: 5px 9px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  text-decoration: none;
}

a.tape:hover, a.tape:active { border-color: var(--teal); color: var(--teal-bright); }

.tape-sep { color: var(--faint); font-size: 13px; }

.spot { margin: 2px 0 0; font-size: 15.5px; }

/* ---------- Shortcuts ---------- */

.shortcuts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }

.shortcut {
  font: 600 14.5px/1.1 var(--body);
  padding: 11px 14px;
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  color: var(--ink);
  cursor: pointer;
}

.shortcut:active { border-color: var(--teal); color: var(--teal-bright); }

/* ---------- Lists ---------- */

.list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 9px; }

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  text-decoration: none;
}

.row:active { border-color: var(--teal); }

.row-main { flex: 1; min-width: 0; }
.row-title { font-weight: 650; font-size: 16px; letter-spacing: -0.005em; }

.row::after {
  content: "";
  width: 16px; height: 16px;
  flex: none;
  background: var(--faint);
  -webkit-mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="m9 5 7 7-7 7"/></svg>') center / contain no-repeat;
  mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="m9 5 7 7-7 7"/></svg>') center / contain no-repeat;
}

.thumb {
  width: 58px; height: 58px;
  flex: none;
  object-fit: cover;
  border-radius: 9px;
  background: var(--surface-2);
}

.badge {
  display: inline-block;
  font: 600 11.5px/1 var(--body);
  letter-spacing: 0.02em;
  padding: 4px 7px;
  border-radius: 6px;
  margin-left: 7px;
  vertical-align: 2px;
  border: 1px solid var(--teal);
  color: var(--teal-bright);
}

.badge-warn { border-color: var(--amber); color: var(--amber); }

.count { color: var(--sub); font-size: 13.5px; margin-top: 2px; }

/* ---------- Item / place pages ---------- */

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: 600 14.5px/1 var(--body);
  margin-bottom: 14px;
  color: var(--sub);
  text-decoration: none;
  background: none; border: 0; padding: 6px 0; cursor: pointer;
}

.back::before {
  content: "";
  width: 15px; height: 15px;
  background: currentColor;
  -webkit-mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round"><path d="M15 5l-7 7 7 7"/></svg>') center / contain no-repeat;
  mask: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="black" stroke-width="2.6" stroke-linecap="round" stroke-linejoin="round"><path d="M15 5l-7 7 7 7"/></svg>') center / contain no-repeat;
}

.where {
  margin: 14px 0;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
}

.where .spot { font-size: 18px; font-weight: 650; margin-top: 8px; }

.hero-photo {
  width: 100%;
  max-height: 58vh;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  background: var(--surface-2);
}

.photo-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x mandatory;
}

.photo-strip img {
  height: 136px; width: auto; max-width: none;
  border-radius: 10px;
  border: 1px solid var(--line);
  scroll-snap-align: start;
  cursor: zoom-in;
}

.facts { margin: 14px 2px; display: grid; grid-template-columns: auto 1fr; gap: 7px 16px; font-size: 15.5px; }
.facts dt { color: var(--sub); }
.facts dd { margin: 0; }

.actions { display: flex; flex-wrap: wrap; gap: 9px; margin: 18px 0; }

.btn {
  font: 650 15.5px/1 var(--body);
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  display: inline-block;
  text-align: center;
}

.btn:active { border-color: var(--teal); }
.btn-primary { background: var(--teal); border-color: var(--teal); color: var(--teal-ink); }
.btn-primary:active { background: var(--teal-bright); }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-wide { flex: 1 1 100%; }

.status-note {
  border: 1px solid var(--line);
  border-left: 3px solid var(--amber);
  border-radius: 10px;
  padding: 11px 13px;
  background: var(--surface);
  margin: 12px 0;
  font-size: 15px;
}

/* ---------- Forms ---------- */

.field { margin: 15px 0; }
.field label { display: block; font: 600 14px/1.2 var(--body); color: var(--sub); margin-bottom: 7px; }
.field .hint { font-size: 13.5px; color: var(--faint); margin-top: 5px; }

.field input, .field select, .field textarea {
  width: 100%;
  padding: 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  background: var(--surface);
  color: var(--ink);
  font-size: 17px;
}

.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--teal); outline: none; }
.field textarea { min-height: 90px; resize: vertical; }

.check { display: flex; gap: 10px; align-items: center; margin: 16px 0; font-size: 15.5px; }
.check input { width: 21px; height: 21px; accent-color: var(--teal); }

.error { color: var(--danger); margin: 10px 0; }

/* ---------- PIN ---------- */

.pin-wrap { max-width: 330px; margin: 48px auto; text-align: center; }
.pin-wrap h1 { font-size: 24px; }
.pin-wrap input {
  text-align: center;
  font: 600 18px/1.3 var(--body);
  letter-spacing: 0.02em;
  padding: 14px;
}
.pin-wrap .check { justify-content: center; }
.pin-wrap .btn { width: 100%; }

/* ---------- Bottom navigation ---------- */

.tabs {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  background: rgba(14, 20, 23, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  padding: 8px 6px calc(10px + env(safe-area-inset-bottom, 0px));
  display: none;
}

body.authed .tabs { display: block; }

.tabs-inner {
  max-width: 680px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 5px 0 2px;
  font: 600 11px/1 var(--body);
  letter-spacing: 0.015em;
  color: var(--sub);
  text-decoration: none;
  border-radius: 10px;
}

.tab svg { width: 22px; height: 22px; }
.tab.active { color: var(--teal-bright); }

/* ---------- Photo viewer ---------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(5, 8, 9, 0.96);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(env(safe-area-inset-top, 0px) + 56px) 8px calc(env(safe-area-inset-bottom, 0px) + 56px);
}

.viewer[hidden] { display: none; }
.viewer img { max-height: 100%; object-fit: contain; border-radius: 6px; }

.viewer-close, .viewer-full {
  position: absolute;
  font: 600 15px/1 var(--body);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.12);
  border: 0;
  border-radius: 9px;
  padding: 10px 14px;
  text-decoration: none;
  cursor: pointer;
}

.viewer-close { top: calc(env(safe-area-inset-top, 0px) + 10px); right: 10px; }
.viewer-full { bottom: calc(env(safe-area-inset-bottom, 0px) + 12px); }

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 86px);
  transform: translate(-50%, 16px);
  background: var(--teal);
  color: var(--teal-ink);
  padding: 11px 18px;
  border-radius: 10px;
  font-weight: 650;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s, transform 0.18s;
  z-index: 60;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

details.todo { border: 1px solid var(--line); border-radius: 14px; background: var(--surface); margin-top: 10px; padding: 0 14px; }
details.todo summary {
  cursor: pointer;
  padding: 14px 0;
  font: 650 16px/1.25 var(--body);
}
details.todo .list { padding-bottom: 12px; }
details.todo .row { background: var(--surface-2); }

@media (prefers-reduced-motion: reduce) {
  .toast { transition: none; }
}
