:root {
  --bg: #f6efe3;
  --bg-2: #fffaf1;
  --ink: #221b14;
  --ink-2: #6b5f52;
  --line: #e4d9c7;
  --accent: #c8771e;
  --accent-ink: #fff;
  --park: #2f7a52;
  --pub: #c8771e; --cafe: #2a8c7a; --restaurant: #d3503c; --bar: #7b5ea7; --bakery: #a0522d;
  --shadow: 0 10px 30px rgba(40, 25, 5, .18);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #17130f; --bg-2: #221c16; --ink: #f3ebdf; --ink-2: #b3a696; --line: #3a3128;
    --accent: #e39a3c; --accent-ink: #17130f; --park: #6fc493;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5);
  }
}
:root[data-theme="dark"] {
  --bg: #17130f; --bg-2: #221c16; --ink: #f3ebdf; --ink-2: #b3a696; --line: #3a3128;
  --accent: #e39a3c; --accent-ink: #17130f; --park: #6fc493;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body);
  font-size: 15px; line-height: 1.45; display: flex; flex-direction: column; min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { font-family: var(--font-display); margin: 0; letter-spacing: -.01em; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }

.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px 6px; }
.top h1 { font-size: 22px; line-height: 1.1; }
.top .sub { margin: 2px 0 0; color: var(--ink-2); font-size: 13px; }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 6px 12px; font-size: 13px; }
.ghost[aria-pressed="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }

.filters { padding: 4px 0 8px; border-bottom: 1px solid var(--line); }
.filters .row { display: flex; align-items: center; gap: 6px; padding: 3px 16px; overflow-x: auto; scrollbar-width: none; }
.filters .row::-webkit-scrollbar { display: none; }
.filters .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); min-width: 46px; flex: none; }
.filters button {
  flex: none; background: var(--bg-2); border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px;
  font-size: 13px; color: var(--ink-2); transition: background .15s, color .15s;
}
.filters button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.filters button.opt.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.stage { position: relative; flex: 1; min-height: 0; }
#map { position: absolute; inset: 0; background: #e8e2d6; }
.leaflet-container { font-family: var(--font-body); }
.leaflet-bottom, .leaflet-top { z-index: 700; }
.home-pin { font-size: 22px; line-height: 1; filter: drop-shadow(0 1px 2px rgba(0,0,0,.4)); }

.card {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 900; background: var(--bg-2); color: var(--ink);
  border-radius: var(--radius) var(--radius) 0 0; box-shadow: var(--shadow); max-height: 72%; overflow: auto;
  animation: up .28s ease-out;
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.card .x { position: absolute; top: 8px; right: 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 50%; width: 30px; height: 30px; font-size: 18px; line-height: 1; }
.card-body { padding: 16px 18px 18px; }
.badges { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.badge { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; padding: 3px 8px; border-radius: 999px; color: #fff; background: var(--accent); }
.badge[data-type="pub"] { background: var(--pub); } .badge[data-type="cafe"] { background: var(--cafe); }
.badge[data-type="restaurant"] { background: var(--restaurant); } .badge[data-type="bar"] { background: var(--bar); } .badge[data-type="bakery"] { background: var(--bakery); }
.area { font-size: 13px; color: var(--ink-2); }
.card h2 { font-size: 26px; line-height: 1.1; margin-right: 34px; }
.card h2.rolling { color: var(--ink-2); }
.card.rolling .card-body > :not(h2):not(.badges) { visibility: hidden; }
.muted { color: var(--ink-2); margin: 4px 0; }
.small { font-size: 13px; }
.why { margin: 8px 0; }
.journey { margin: 10px 0 6px; padding: 10px 12px; background: var(--bg); border-radius: 12px; border: 1px solid var(--line); }
.j-main { display: flex; align-items: baseline; gap: 8px; }
.jicon { font-size: 20px; }
.j-main strong { font-size: 20px; }
.j-main span:last-child { color: var(--ink-2); }
.journey p { margin: 4px 0 0; }
.parks { color: var(--park); margin: 6px 0; font-weight: 500; }
.parks:empty, .why:empty, .muted:empty { display: none; }
.dog { margin: 6px 0; padding-left: 26px; position: relative; }
.dog::before { content: "🐾"; position: absolute; left: 0; top: 1px; }
.dog a { color: var(--ink-2); font-size: 13px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.btn { display: inline-block; text-decoration: none; background: var(--ink); color: var(--bg); border: 1px solid var(--ink); border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 500; }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.ghost.on { background: var(--park); color: #fff; border-color: var(--park); }
.btn[hidden] { display: none; }

.list { position: absolute; inset: 0; z-index: 800; background: var(--bg); overflow: auto; padding: 0 0 20px; }
.list-head { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; position: sticky; top: 0; background: var(--bg); border-bottom: 1px solid var(--line); }
.list ol { list-style: none; margin: 0; padding: 0; }
.list li { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); cursor: pointer; }
.list li:hover { background: var(--bg-2); }
.list li .n { font-weight: 600; }
.list li .m { color: var(--ink-2); font-size: 13px; grid-column: 1; }
.list li .t { text-align: right; font-weight: 600; grid-row: 1 / span 2; align-self: center; white-space: nowrap; }
.list li .t small { display: block; font-weight: 400; color: var(--ink-2); font-size: 12px; }
.list li.been .n::after { content: " ✓"; color: var(--park); }

.dock { border-top: 1px solid var(--line); background: var(--bg); padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
.dock-inner { display: flex; align-items: center; gap: 12px; max-width: 720px; margin: 0 auto; }
.count { color: var(--ink-2); font-size: 13px; flex: 1; }
.roll {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: 999px; padding: 14px 22px;
  font-size: 17px; font-weight: 600; display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 18px rgba(200,119,30,.35);
  transition: transform .1s;
}
.roll:active { transform: scale(.97); }
.roll .die { font-size: 22px; display: inline-block; }
.roll.rolling .die { animation: spin .5s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.roll:disabled { opacity: .5; }

@media (min-width: 900px) {
  .top h1 { font-size: 26px; }
  .card { left: auto; right: 16px; bottom: 16px; width: 420px; border-radius: var(--radius); max-height: calc(100% - 32px); }
  .list { inset: 16px auto 16px 16px; width: 380px; border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--line); }
  .filters .row { flex-wrap: wrap; }
}
