:root {
  --ink: #0d0d0c; --ink-2: #3a3935; --grey: #85857f; --pill: #efefed; --line: #e6e6e3; --white: #fff;
  --lime: #c3f27a; --lime-ink: #2f4a06; --base: #d4d0c6;
  --shadow: 0 0 0 1px var(--line), 0 18px 36px -20px rgba(0, 0, 0, .25);
  --font: "Inter Tight", system-ui, -apple-system, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #fff; color: var(--ink); font-family: var(--font); }
button { font: inherit; color: inherit; cursor: pointer; }
[hidden] { display: none !important; }

#map { position: fixed; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; }
#map.grabbing { cursor: grabbing; }
#map.pointing { cursor: pointer; }

/* ---------- Top ---------- */
.top {
  position: fixed; top: 0; left: 0; width: min(100%, 460px);
  padding: calc(20px + env(safe-area-inset-top)) 20px 0; pointer-events: none;
}
.top > * { pointer-events: auto; }
.bar { display: flex; align-items: center; justify-content: space-between; }
.brand {
  display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 21px; letter-spacing: -.025em;
  color: var(--ink); text-decoration: none;
}
.brand svg { width: 22px; height: 22px; }
.icon-btn { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--pill); display: grid; place-items: center; }
.icon-btn svg { width: 18px; height: 18px; }
.tagline { margin: 6px 0 0; color: var(--grey); font-size: 15px; font-weight: 400; }

.search-wrap { margin-top: 14px; position: relative; }
.search {
  height: 50px; border-radius: 16px; background: rgba(239, 239, 237, .92); backdrop-filter: blur(12px);
  display: flex; align-items: center; gap: 10px; padding: 0 16px; transition: background .2s, box-shadow .2s;
}
.search:focus-within { background: #fff; box-shadow: var(--shadow); }
.search svg { width: 18px; height: 18px; flex: none; color: var(--grey); }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font: 400 17px var(--font); color: var(--ink); }
.search input::placeholder { color: var(--grey); }
.search input::-webkit-search-cancel-button { display: none; }
.suggest {
  list-style: none; margin: 8px 0 0; padding: 6px; background: #fff; border-radius: 16px; box-shadow: var(--shadow);
  max-height: 50vh; overflow-y: auto;
}
.suggest li { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px; font-size: 16px; cursor: pointer; }
.suggest li[aria-selected="true"] { background: var(--pill); }
.suggest img, .flag-dot { width: 20px; height: 20px; border-radius: 50%; flex: none; object-fit: cover; }
.flag-dot { background: var(--pill); display: inline-block; }
.suggest .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest small { color: var(--grey); font-size: 13px; white-space: nowrap; }
.suggest .empty { color: var(--grey); cursor: default; }

.crumbs { display: flex; gap: 6px; margin-top: 14px; font-size: 14px; flex-wrap: wrap; }
.crumbs button { border: 0; background: var(--pill); border-radius: 999px; padding: 6px 12px; }
.crumbs button[aria-current] { background: var(--ink); color: #fff; cursor: default; }

.story { margin-top: 18px; }
.headline { font-size: clamp(25px, 7.2vw, 30px); font-weight: 600; letter-spacing: -.022em; word-spacing: .04em; line-height: 1.22; margin: 0; }
.headline .a, .headline .b { border-radius: 10px; padding: .02em .28em .06em; margin: 0 .04em; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.headline .a { background: var(--lime); }
.headline .b { background: var(--base); }
.aside { margin: 12px 0 0; color: var(--grey); font-size: 16px; line-height: 1.4; }

/* ---------- Dock ---------- */
.dock {
  position: fixed; left: 0; bottom: 0; width: min(100%, 460px);
  padding: 0 16px calc(16px + env(safe-area-inset-bottom)); pointer-events: none;
  display: flex; flex-direction: column; gap: 10px;
}
.dock > * { pointer-events: auto; }
.status { margin: 0 4px; color: var(--grey); font-size: 14px; }
.btn { border: 0; border-radius: 999px; padding: 11px 16px; font-weight: 500; font-size: 15px; background: var(--pill); white-space: nowrap; }
.btn.go { background: var(--lime); color: var(--lime-ink); font-weight: 600; }
.btn.wide { width: 100%; padding: 14px; }
.x { border: 0; background: none; color: var(--grey); font-size: 22px; line-height: 1; padding: 4px 8px; }

/* slots */
.slots { display: flex; align-items: center; gap: 8px; }
.slot {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; text-align: left;
  background: #fff; border: 0; border-radius: 16px; padding: 10px 8px 10px 12px; box-shadow: var(--shadow);
}
.slot .swatch { width: 14px; height: 14px; border-radius: 5px; flex: none; background: var(--lime); }
.slot-b .swatch { background: var(--base); }
.slot-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.slot-text small { font-size: 12px; color: var(--grey); }
.slot-text b { font-weight: 600; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-b.empty { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.slot-b.empty .swatch { background: transparent; box-shadow: inset 0 0 0 1.5px #c9c6be; }
.slot-b.empty b { color: var(--grey); font-weight: 500; }
.over { color: var(--grey); font-size: 13px; flex: none; }
.prompt { margin: 0 4px; color: var(--grey); font-size: 14px; }
.actions { display: flex; gap: 8px; }
.actions .btn.go { flex: 1; }

/* card */
.card {
  background: #fff; border-radius: 22px; padding: 16px 16px 14px; box-shadow: var(--shadow);
  animation: rise .35s var(--ease);
}
@keyframes rise { from { transform: translateY(12px); opacity: 0; } }
.card-head { display: flex; align-items: flex-start; gap: 12px; }
.card .flag { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; flex: none; box-shadow: 0 0 0 1px var(--line); }
.card-title { flex: 1; min-width: 0; }
.card h3 { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -.02em; line-height: 1.15; }
.card-title p { margin: 3px 0 0; color: var(--grey); font-size: 14px; }
.card-walk { margin: 12px 0 14px; font-size: 16px; color: var(--ink-2); line-height: 1.4; }
.card-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.card-actions .btn.go { flex: 1; }

/* shelf */
.shelf {
  background: rgba(255, 255, 255, .9); backdrop-filter: blur(14px); border-radius: 22px; padding: 14px 14px 12px;
  box-shadow: var(--shadow);
}
.shelf h2 { font-size: 13px; font-weight: 500; color: var(--grey); margin: 0 2px 10px; }
.tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.tab {
  flex: 0 0 auto; border: 0; border-radius: 12px; background: var(--pill); padding: 9px 12px; font-size: 14.5px; font-weight: 500;
  white-space: nowrap;
  transition: background .2s, color .2s;
}
.tab[aria-selected="true"] { background: var(--ink); color: #fff; }
.chips {
  display: flex; gap: 8px; margin: 12px -14px 0; padding: 2px 14px 4px; overflow-x: auto; scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; background: #fff; border-radius: 999px; padding: 6px 14px 6px 6px;
  border: 0; box-shadow: 0 0 0 1px var(--line); font-size: 15px; font-weight: 500; white-space: nowrap; flex: none;
}
.chip img { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; }
.chip:hover { box-shadow: 0 0 0 1px #cfcfca; }

@media (min-width: 900px) {
  .top { padding: 28px 28px 0; }
  .dock { padding: 0 24px 24px; }
  .chips { flex-wrap: wrap; overflow: visible; }
}

/* ---------- Tooltip, toast, credit ---------- */
.tip {
  position: fixed; z-index: 5; background: var(--ink); color: #fff; border-radius: 12px; padding: 8px 12px;
  font-size: 15px; pointer-events: none; transform: translate(-50%, calc(-100% - 14px));
  box-shadow: 0 10px 24px -12px rgba(0, 0, 0, .5); white-space: nowrap;
}
.tip b { font-weight: 600; }
.tip small { display: block; color: #b9b9b4; font-size: 12px; margin-top: 1px; }
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; z-index: 6;
}
.credit { position: fixed; right: 10px; bottom: 6px; margin: 0; font-size: 11px; color: #b4b4ae; }
.credit a { color: inherit; text-decoration: none; }
.credit a.maker { color: var(--ink-2); font-weight: 500; }
.credit a:hover { text-decoration: underline; }
.noscript { position: fixed; inset: 40% 20px auto; text-align: center; color: var(--ink-2); font-size: 16px; }
@media (max-width: 899px) { .credit { bottom: auto; top: calc(4px + env(safe-area-inset-top)); } }
