:root {
  --bg0: #110807;
  --bg1: #1d0d0a;
  --bg2: #2a1410;
  --ink: #f8eee6;
  --muted: #cbb3a4;
  --faint: #8e7368;
  --line: rgba(255, 214, 180, 0.16);
  --cool: #7ad4ff;
  --cool-deep: #1d6d88;
  --heat-1: #2fb9a3;
  --heat-2: #e2c35a;
  --heat-3: #f08a3a;
  --heat-4: #e24b2e;
  --heat-5: #c21655;
  --glass: rgba(22, 10, 8, 0.72);
  --shadow: 0 24px 60px rgba(0, 0, 0, 0.38);
  --sans: "Outfit", "Segoe UI", sans-serif;
  --serif: "Fraunces", "Times New Roman", serif;
  --radius: 22px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--bg0); }
body {
  font-family: var(--sans);
  color: var(--ink);
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(255, 120, 40, 0.22), transparent 55%),
    radial-gradient(900px 500px at -10% 20%, rgba(40, 140, 160, 0.16), transparent 50%),
    linear-gradient(180deg, var(--bg0), var(--bg1) 40%, #140a08);
  overflow-x: hidden;
}

#atmosphere {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}
.grain {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='.7'/%3E%3C/svg%3E");
}

.skip {
  position: absolute;
  left: -999px;
  top: 0;
  background: var(--ink);
  color: var(--bg0);
  padding: 8px 12px;
  z-index: 20;
}
.skip:focus { left: 8px; top: 8px; }

header, main, footer { position: relative; z-index: 2; }
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 28px 8px;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand img { width: 44px; height: 44px; border-radius: 12px; box-shadow: 0 0 0 1px var(--line), 0 8px 20px rgba(0,0,0,.35); }
.logo {
  font-family: var(--serif);
  font-size: 1.55rem;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.03em;
  background: linear-gradient(120deg, #fff6ea, #ffd19a 40%, #ff8a4a);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.tag { margin: 0; color: var(--muted); font-size: 0.86rem; }
.header-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }

.pill, button, .chip {
  border: 1px solid var(--line);
  background: var(--glass);
  color: var(--ink);
  border-radius: 999px;
  font: inherit;
}
.pill {
  padding: 8px 14px;
  font-size: 0.88rem;
  color: var(--muted);
  backdrop-filter: blur(10px);
  user-select: none;
}
.pill.hot { color: #ffd2c0; border-color: rgba(255, 110, 60, 0.45); background: rgba(90, 20, 10, 0.55); }
.pill.ok { color: #cfefff; }
button {
  cursor: pointer;
  padding: 9px 14px;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
button:hover, button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(255, 214, 180, 0.4);
  background: rgba(60, 24, 16, 0.8);
  outline: none;
}
#mute-btn[aria-pressed="true"] { color: var(--faint); }

main { padding: 8px 28px 64px; max-width: 1240px; margin: 0 auto; }

.search-wrap { position: relative; margin: 10px 0 22px; }
.search-wrap label {
  display: block;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.search-row { display: flex; gap: 10px; }
#q {
  flex: 1;
  border: 1px solid var(--line);
  background: rgba(20, 8, 6, 0.65);
  color: var(--ink);
  border-radius: 16px;
  padding: 16px 18px;
  font: inherit;
  font-size: 1.05rem;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02), var(--shadow);
}
#q:focus { outline: 2px solid rgba(122, 212, 255, 0.55); outline-offset: 2px; }
#suggest {
  list-style: none;
  margin: 8px 0 0;
  padding: 8px;
  position: absolute;
  left: 0; right: 90px;
  background: #24110d;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  z-index: 6;
}
#suggest li button {
  width: 100%;
  text-align: left;
  border-radius: 12px;
  border: 0;
  background: transparent;
  padding: 10px 12px;
}
#suggest li button[aria-selected="true"], #suggest li button:hover { background: rgba(255, 140, 70, 0.16); }

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 20px;
  align-items: start;
}
.panel {
  background: linear-gradient(180deg, rgba(48, 22, 16, 0.78), rgba(16, 8, 7, 0.86));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  backdrop-filter: blur(16px);
}
.no-select, .gauge, .metric, .place-card, .buddy-card, .hvi-dial, .map-frame {
  user-select: none;
  -webkit-user-select: none;
}

.kicker {
  margin: 0 0 6px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  color: var(--muted);
}
.place-title {
  font-family: var(--serif);
  font-size: clamp(2rem, 4vw, 3.15rem);
  line-height: 0.95;
  margin: 0 0 6px;
  letter-spacing: -0.03em;
}
.subhead { margin: 0 0 18px; color: var(--muted); }

.score-row { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; }
.hvi-dial {
  width: 168px;
  height: 168px;
  position: relative;
  flex: 0 0 auto;
}
.hvi-dial svg { width: 100%; height: 100%; overflow: visible; }
.dial-label {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.dial-label strong {
  font-family: var(--serif);
  font-size: 3.1rem;
  line-height: 1;
}
.dial-label span { color: var(--muted); font-size: 0.8rem; letter-spacing: 0.06em; text-transform: uppercase; }
.score-copy h3 { margin: 0 0 6px; font-size: 1.35rem; }
.score-copy p { margin: 0; color: var(--muted); max-width: 36ch; }
.note-diff {
  margin-top: 10px;
  padding: 8px 10px;
  border-left: 3px solid var(--heat-3);
  color: #f3d7c6;
  font-size: 0.9rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 20px;
  align-items: stretch;
}
.metric {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 12px 12px 10px;
  min-height: 138px;
  transition: transform 0.2s ease, border-color 0.2s ease, background 0.2s ease;
}
.metric:hover, .metric:focus-visible {
  transform: translateY(-3px) rotate(-0.2deg);
  border-color: rgba(255, 200, 150, 0.35);
  background: rgba(255, 255, 255, 0.05);
}
.metric b { display: block; font-family: var(--serif); font-size: 1.45rem; margin: 4px 0 2px; }
.metric span, .metric small { color: var(--muted); }
.metric small { display: block; font-size: 0.7rem; line-height: 1.3; }
.metric .bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(255,255,255,0.08);
  margin-top: 8px;
  overflow: hidden;
}
.metric .bar i { display: block; height: 100%; width: 0; border-radius: inherit; transition: width 0.8s cubic-bezier(.16,1,.3,1); }

.related { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
  padding: 6px 10px;
  font-size: 0.82rem;
  cursor: pointer;
}
.chip.active { border-color: rgba(122, 212, 255, 0.5); color: var(--cool); }

.map-panel { padding: 14px; position: sticky; top: 12px; }
.map-frame {
  position: relative;
  height: 520px;
  border-radius: 18px;
  overflow: hidden;
  background: #140c0a;
  border: 1px solid var(--line);
}
#map { width: 100%; height: 100%; display: block; cursor: pointer; }
#map-tip {
  position: absolute;
  pointer-events: none;
  background: rgba(16, 8, 6, 0.92);
  border: 1px solid var(--line);
  color: var(--ink);
  padding: 7px 10px;
  border-radius: 10px;
  font-size: 0.82rem;
  transform: translate(12px, -18px);
  white-space: nowrap;
  z-index: 3;
}
.legend {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 10px 4px 2px;
  font-size: 0.75rem;
  color: var(--muted);
}
.legend i {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 3px;
  margin-right: 4px;
}

.places-panel, .plan-grid { margin-top: 20px; }
.places-head, .plan-head {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters button[aria-pressed="true"] {
  background: rgba(122, 212, 255, 0.12);
  border-color: rgba(122, 212, 255, 0.45);
  color: var(--cool);
}
.place-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.place-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  border-radius: 18px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--line);
  color: inherit;
  width: 100%;
  text-decoration: none;
  transition: transform 0.18s ease, border-color 0.18s ease;
}
.place-card:hover, .place-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(122, 212, 255, 0.45);
}
.place-card h3 { margin: 0; font-size: 1.05rem; }
.place-meta, .place-card p { margin: 0; color: var(--muted); font-size: 0.9rem; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.badge .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 0 rgba(80, 200, 140, 0.6);
}
.badge.open { color: #9be7c3; }
.badge.open .dot { background: #3dd68c; animation: pulse 1.6s ease-out infinite; }
.badge.closed { color: #e2b3a6; }
.badge.closed .dot { background: #c16950; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 214, 140, 0.55); }
  100% { box-shadow: 0 0 0 10px rgba(61, 214, 140, 0); }
}

.plan-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 20px;
}
.factors { display: grid; gap: 8px; }
.factor {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid transparent;
  cursor: pointer;
  user-select: none;
}
.factor:hover { background: rgba(255,255,255,0.03); }
.factor:has(input:checked) {
  border-color: rgba(240, 138, 58, 0.45);
  background: rgba(240, 138, 58, 0.08);
}
.factor input { margin-top: 3px; accent-color: var(--heat-3); }
.factor small { display: block; color: var(--muted); }

.plan-result h3 { font-family: var(--serif); font-size: 2rem; margin: 0 0 8px; }
.plan-result ol { margin: 8px 0 0; padding-left: 18px; color: #f0ddd2; }
.plan-result li { margin: 8px 0; }
.tier-aware .plan-result h3 { color: var(--heat-1); }
.tier-plan .plan-result h3 { color: var(--heat-3); }
.tier-high .plan-result h3 { color: var(--heat-4); }
.tier-highest .plan-result h3 { color: #ff6d8a; }

.buddy-card {
  margin-top: 8px;
  padding: 22px;
  border-radius: 22px;
  background:
    radial-gradient(400px 160px at 100% 0%, rgba(122, 212, 255, 0.16), transparent 50%),
    linear-gradient(160deg, #2a1712, #140c0b 60%, #1a2a32);
  border: 1px solid rgba(122, 212, 255, 0.25);
  box-shadow: var(--shadow);
  min-height: 260px;
}
.buddy-card h3 { font-family: var(--serif); font-size: 1.8rem; margin: 0 0 8px; }
.buddy-card label { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 10px; }
.buddy-card input {
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(0,0,0,0.25);
  color: var(--ink);
  font: inherit;
}
.signs { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.signs ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 0.88rem; }
#print-card {
  margin-top: 14px;
  background: rgba(122, 212, 255, 0.12);
  border-color: rgba(122, 212, 255, 0.4);
}

footer {
  padding: 12px 28px 40px;
  max-width: 1240px;
  margin: 0 auto;
  color: var(--muted);
  font-size: 0.86rem;
}
footer a { color: #9fdcff; }
footer ul { padding-left: 18px; }

@media (max-width: 980px) {
  header, main, footer { padding-left: 16px; padding-right: 16px; }
  .hero-grid, .plan-grid, .place-list, .metrics, .signs { grid-template-columns: 1fr; }
  .map-panel { position: static; }
  .map-frame { height: 360px; }
  #suggest { right: 0; }
  .metrics { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 640px) {
  .search-row { flex-direction: column; }
  .place-title { font-size: 2.1rem; }
  .hvi-dial { width: 140px; height: 140px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  .badge.open .dot { animation: none; }
}

@media print {
  #atmosphere, .grain, header, .search-wrap, .map-panel, .places-panel, .plan-grid, footer, #print-card, #geo-btn, #mute-btn { display: none !important; }
  body { background: #fff; color: #111; }
  .buddy-card {
    background: #fff;
    color: #111;
    border: 2px solid #222;
    box-shadow: none;
    user-select: text;
  }
  .buddy-card input { border: 0; border-bottom: 1px solid #333; background: transparent; color: #111; }
  main { padding: 0; }
}

body.demo header { padding: 10px 22px 4px; }
body.demo main { padding: 4px 22px 32px; }
body.demo .map-frame { height: 420px; }
body.demo .search-wrap { margin: 6px 0 14px; }
body.demo #q { padding: 12px 16px; }

body.demo #q::selection,
body.demo #q::-moz-selection {
  background: transparent;
  color: inherit;
}
