:root {
  color-scheme: light;
  --paper: #f7f3ea;
  --surface: #fffdf8;
  --ink: #17211b;
  --muted: #69736c;
  --line: #dedbd1;
  --accent: #ef6c3e;
  --accent-dark: #b83e1f;
  --green: #245d45;
  --green-soft: #dbe9df;
  --yellow: #f1c75b;
  --shadow: 0 18px 45px rgba(28, 42, 34, 0.12);
  --radius-lg: 28px;
  --radius-md: 20px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 8% -5%, rgba(239, 108, 62, 0.14), transparent 28rem),
    radial-gradient(circle at 95% 8%, rgba(36, 93, 69, 0.12), transparent 30rem),
    var(--paper);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.app-shell {
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 22px 34px 48px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 62px;
}

.brand {
  display: inline-flex;
  gap: 11px;
  align-items: center;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 14px 14px 14px 4px;
  background: var(--ink);
  color: white;
  font-family: Georgia, serif;
  font-size: 24px;
  font-style: italic;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-family: Georgia, serif;
  font-size: 23px;
  line-height: 1;
}

.brand small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  gap: 10px;
}

.location-button,
.points-pill,
.account-button,
.surprise-button {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.82);
  cursor: pointer;
}

.location-button {
  max-width: 300px;
  padding: 0 17px;
}

.location-button span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.points-pill {
  padding: 0 15px;
  border-color: #d9bb65;
  background: #fff4cb;
}

.points-pill > span:first-child {
  color: #a26b00;
}

.account-button {
  max-width: 150px;
  overflow: hidden;
  padding: 0 17px;
  border-color: var(--green);
  background: var(--green);
  color: white;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 30px;
  padding: 68px 0 32px;
}

.eyebrow {
  margin: 0 0 11px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.hero h1 {
  max-width: 780px;
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(42px, 6vw, 78px);
  font-weight: 500;
  letter-spacing: -0.045em;
  line-height: 0.97;
}

.hero-copy {
  max-width: 620px;
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.6;
}

.surprise-button {
  flex: 0 0 auto;
  padding: 0 20px;
  border-color: var(--ink);
  background: var(--ink);
  color: white;
}

.surprise-button span {
  font-size: 20px;
}

.controls {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
}

.search-field,
.radius-field {
  display: flex;
  align-items: center;
  min-height: 58px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 8px 28px rgba(28, 42, 34, 0.05);
}

.search-field {
  gap: 12px;
  padding: 0 19px;
}

.search-field > span {
  color: var(--muted);
  font-size: 26px;
}

.search-field input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-size: 16px;
}

.radius-field {
  gap: 8px;
  padding: 0 14px 0 18px;
  color: var(--muted);
}

.radius-field select {
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
  font-weight: 700;
}

.category-strip {
  display: flex;
  gap: 9px;
  overflow-x: auto;
  padding: 16px 2px 26px;
  scrollbar-width: none;
}

.category-strip::-webkit-scrollbar {
  display: none;
}

.category-chip {
  display: inline-flex;
  flex: 0 0 auto;
  gap: 8px;
  align-items: center;
  min-height: 42px;
  padding: 0 15px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  cursor: pointer;
  transition: 160ms ease;
}

.category-chip:hover,
.category-chip.is-active {
  border-color: var(--green);
  background: var(--green);
  color: white;
  transform: translateY(-1px);
}

.discovery-layout {
  display: grid;
  grid-template-columns: minmax(420px, 0.88fr) minmax(500px, 1.12fr);
  gap: 22px;
  min-height: 700px;
}

.results-panel,
.map-panel {
  min-width: 0;
}

.results-header,
.map-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 52px;
}

.view-tabs {
  display: flex;
  gap: 4px;
}

.view-tab {
  padding: 9px 13px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 700;
}

.view-tab.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 4px 15px rgba(28, 42, 34, 0.07);
}

.result-count {
  color: var(--muted);
  font-size: 13px;
}

.feed {
  display: grid;
  gap: 13px;
  max-height: calc(100vh - 300px);
  overflow-y: auto;
  padding: 3px 7px 34px 2px;
  scrollbar-color: #c9c6bc transparent;
  scrollbar-width: thin;
}

.recommendation-card {
  position: relative;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  min-height: 168px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: 0 7px 22px rgba(28, 42, 34, 0.055);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.recommendation-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
}

.card-visual {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--green-soft);
  font-size: 43px;
}

.card-visual::after {
  position: absolute;
  right: -18px;
  bottom: -26px;
  width: 86px;
  height: 86px;
  border: 16px solid rgba(255, 255, 255, 0.26);
  border-radius: 50%;
  content: "";
}

.card-visual.restaurant { background: #f6d5bf; }
.card-visual.nightlife { background: #d8d3ea; }
.card-visual.activity { background: #cfe7e8; }
.card-visual.hike,
.card-visual.outdoors { background: #d7e8cf; }
.card-visual.culture { background: #f0d9e4; }
.card-visual.event { background: #f4e1a9; }

.score-badge {
  position: absolute;
  top: 9px;
  left: 9px;
  display: grid;
  width: 35px;
  height: 35px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  background: rgba(23, 33, 27, 0.88);
  color: white;
  font-size: 11px;
  font-weight: 800;
}

.card-body {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding: 17px 17px 14px;
}

.card-kicker,
.card-meta {
  color: var(--muted);
  font-size: 12px;
}

.card-kicker {
  color: var(--accent-dark);
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.card-title-row {
  display: flex;
  gap: 10px;
  align-items: start;
  justify-content: space-between;
  margin-top: 5px;
}

.card-title {
  overflow: hidden;
  margin: 0;
  font-family: Georgia, serif;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.12;
  text-overflow: ellipsis;
}

.save-button {
  display: grid;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: white;
  cursor: pointer;
  font-size: 19px;
}

.save-button.is-saved {
  border-color: var(--accent);
  background: #fff0e9;
  color: var(--accent-dark);
}

.card-meta {
  margin: 7px 0 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reason-list {
  display: flex;
  gap: 6px;
  overflow: hidden;
  margin-top: auto;
  padding-top: 12px;
}

.reason-pill {
  flex: 0 1 auto;
  overflow: hidden;
  padding: 5px 8px;
  border-radius: 999px;
  background: #f1efe8;
  color: #59645c;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.card-open {
  position: absolute;
  inset: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.card-open:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -4px;
}

.save-button {
  position: relative;
  z-index: 2;
}

.map-panel {
  position: sticky;
  top: 16px;
  height: calc(100vh - 32px);
  min-height: 640px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #dce7df;
  box-shadow: var(--shadow);
}

.map-header {
  position: absolute;
  z-index: 500;
  top: 14px;
  right: 14px;
  left: 14px;
  min-height: 45px;
  padding: 0 16px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  background: rgba(255, 253, 248, 0.88);
  box-shadow: 0 8px 24px rgba(28, 42, 34, 0.12);
  backdrop-filter: blur(14px);
  font-size: 13px;
  font-weight: 750;
}

.live-indicator {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.live-indicator i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #37a46e;
  box-shadow: 0 0 0 4px rgba(55, 164, 110, 0.13);
}

#map {
  width: 100%;
  height: 100%;
}

.map-unavailable {
  display: grid;
  height: 100%;
  padding: 40px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.map-pin {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 3px solid white;
  border-radius: 50% 50% 50% 14%;
  background: var(--ink);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.25);
  color: white;
  font-size: 15px;
  transform: rotate(-45deg);
}

.map-pin > span {
  transform: rotate(45deg);
}

.user-pin {
  width: 18px;
  height: 18px;
  border: 4px solid white;
  border-radius: 50%;
  background: #3978f6;
  box-shadow: 0 0 0 8px rgba(57, 120, 246, 0.18);
}

.skeleton-card {
  height: 168px;
  border-radius: var(--radius-md);
  background: linear-gradient(100deg, #e9e5dc 20%, #f8f5ed 40%, #e9e5dc 60%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
}

.empty-state {
  padding: 60px 25px;
  border: 1px dashed #cbc7bc;
  border-radius: var(--radius-md);
  color: var(--muted);
  text-align: center;
}

.empty-state strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-family: Georgia, serif;
  font-size: 24px;
}

.detail-dialog {
  width: min(620px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(17, 28, 22, 0.32);
}

.auth-dialog {
  width: min(480px, calc(100% - 28px));
  max-height: calc(100vh - 32px);
  padding: 0;
  overflow: auto;
  border: 0;
  border-radius: 28px;
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(17, 28, 22, 0.32);
}

.auth-dialog::backdrop {
  background: rgba(16, 24, 20, 0.58);
  backdrop-filter: blur(5px);
}

.auth-content {
  padding: 38px 32px 32px;
}

.auth-content h2 {
  margin: 0 0 10px;
  font-family: Georgia, serif;
  font-size: 36px;
}

.auth-copy {
  margin: 0 0 22px;
  color: var(--muted);
  line-height: 1.55;
}

.auth-content form {
  display: grid;
  gap: 14px;
}

.auth-content label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.auth-content input {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  color: var(--ink);
  outline: 0;
}

.auth-content input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(36, 93, 69, 0.12);
}

.auth-submit {
  width: 100%;
  margin-top: 4px;
}

.auth-status {
  min-height: 20px;
  margin: 14px 0 0;
  color: var(--accent-dark);
  font-size: 13px;
  line-height: 1.45;
}

.auth-links {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
}

.auth-links button {
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--green);
  cursor: pointer;
  font-size: 13px;
  font-weight: 750;
}

.detail-dialog::backdrop {
  background: rgba(16, 24, 20, 0.58);
  backdrop-filter: blur(5px);
}

.dialog-close {
  position: sticky;
  z-index: 3;
  top: 15px;
  float: right;
  width: 38px;
  height: 38px;
  margin: 15px 15px -53px 0;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.92);
  cursor: pointer;
  font-size: 26px;
  line-height: 1;
}

.detail-hero {
  display: grid;
  min-height: 210px;
  place-items: center;
  background: var(--green-soft);
  font-size: 70px;
}

.detail-copy {
  padding: 28px;
}

.detail-copy h2 {
  margin: 6px 0 8px;
  font-family: Georgia, serif;
  font-size: 38px;
  line-height: 1.05;
}

.detail-meta {
  color: var(--muted);
  line-height: 1.55;
}

.detail-reasons {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 18px 0;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 24px 0;
}

.primary-button,
.secondary-button {
  min-height: 48px;
  padding: 0 17px;
  border-radius: 14px;
  cursor: pointer;
  font-weight: 750;
}

.primary-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: white;
}

.secondary-button {
  border: 1px solid var(--line);
  background: white;
}

.community-section {
  margin: 24px 0;
  padding: 20px;
  border-radius: 18px;
  background: #f3efe5;
}

.community-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.community-heading h3 {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 22px;
}

.community-heading span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.community-review {
  padding: 12px 0;
  border-top: 1px solid rgba(105, 115, 108, 0.18);
}

.community-review strong {
  color: #d3920c;
  letter-spacing: 0.05em;
}

.community-review p {
  margin: 5px 0 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}

.review-section {
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.review-section h3 {
  margin: 0 0 4px;
  font-family: Georgia, serif;
  font-size: 24px;
}

.review-note {
  margin: 0 0 15px;
  color: var(--muted);
  font-size: 12px;
}

.star-row {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}

.star-button {
  border: 0;
  background: transparent;
  color: #b7b3a8;
  cursor: pointer;
  font-size: 27px;
}

.star-button.is-active {
  color: #e4a817;
}

.review-section textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: white;
  outline: 0;
}

.review-submit {
  width: 100%;
  margin-top: 9px;
}

.toast {
  position: fixed;
  z-index: 1000;
  right: 24px;
  bottom: 24px;
  max-width: min(360px, calc(100% - 32px));
  padding: 13px 17px;
  border-radius: 14px;
  background: var(--ink);
  box-shadow: var(--shadow);
  color: white;
  opacity: 0;
  pointer-events: none;
  transform: translateY(15px);
  transition: 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.mobile-nav {
  display: none;
}

@keyframes shimmer {
  to { background-position-x: -200%; }
}

@media (max-width: 980px) {
  .app-shell {
    padding-right: 20px;
    padding-left: 20px;
  }

  .discovery-layout {
    grid-template-columns: 1fr;
  }

  .map-panel {
    position: relative;
    top: auto;
    display: none;
    height: calc(100vh - 180px);
    min-height: 520px;
  }

  body.map-mode .results-panel {
    display: none;
  }

  body.map-mode .map-panel {
    display: block;
  }

  .feed {
    max-height: none;
    overflow: visible;
    padding-bottom: 100px;
  }

  .mobile-nav {
    position: fixed;
    z-index: 800;
    right: 16px;
    bottom: 14px;
    left: 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    min-height: 64px;
    padding: 7px;
    border: 1px solid rgba(255, 255, 255, 0.7);
    border-radius: 20px;
    background: rgba(255, 253, 248, 0.9);
    box-shadow: 0 16px 50px rgba(22, 33, 27, 0.22);
    backdrop-filter: blur(18px);
  }

  .mobile-nav-button {
    display: grid;
    gap: 2px;
    place-items: center;
    border: 0;
    border-radius: 14px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
  }

  .mobile-nav-button span {
    font-size: 20px;
  }

  .mobile-nav-button.is-active {
    background: var(--green);
    color: white;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 14px 14px 100px;
  }

  .topbar {
    align-items: start;
  }

  .location-button {
    width: 44px;
    padding: 0;
    justify-content: center;
  }

  .location-button span:last-child {
    display: none;
  }

  .points-pill {
    min-width: 74px;
  }

  .account-button {
    max-width: 86px;
    padding: 0 12px;
  }

  .hero {
    display: block;
    padding: 54px 0 25px;
  }

  .hero h1 {
    font-size: 48px;
  }

  .hero-copy {
    font-size: 15px;
  }

  .surprise-button {
    margin-top: 22px;
  }

  .controls {
    grid-template-columns: 1fr;
  }

  .radius-field {
    display: none;
  }

  .recommendation-card {
    grid-template-columns: 92px minmax(0, 1fr);
    min-height: 158px;
  }

  .card-body {
    padding: 15px 13px 13px;
  }

  .card-title {
    font-size: 19px;
  }

  .reason-list .reason-pill:nth-child(n+3) {
    display: none;
  }

  .detail-copy {
    padding: 22px;
  }

  .detail-copy h2 {
    font-size: 32px;
  }

  .detail-actions {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
