:root {
  --bg: #f1eee6;
  --paper: rgba(255, 251, 244, 0.72);
  --paper-strong: rgba(255, 250, 240, 0.92);
  --ink: #172026;
  --muted: #5e635f;
  --line: rgba(23, 32, 38, 0.1);
  --accent: #b74d2c;
  --accent-deep: #7f3119;
  --accent-soft: #f2d7b2;
  --olive: #35574f;
  --gold: #d0a559;
  --shadow: 0 20px 60px rgba(65, 38, 18, 0.14);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(208, 165, 89, 0.35), transparent 28%),
    radial-gradient(circle at right 10%, rgba(183, 77, 44, 0.16), transparent 22%),
    linear-gradient(180deg, #efe5d4 0%, #f8f4ec 38%, #ece6db 100%);
  font-family: "Space Grotesk", sans-serif;
}

button,
input {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 120px;
}

.topbar,
.hero-panel,
.panel,
.tabbar {
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
  margin-bottom: 20px;
}

.topbar h1,
.hero-copy h2,
.panel h3,
.tour-card h4,
.mode-card h4 {
  font-family: "Fraunces", serif;
  letter-spacing: -0.03em;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: clamp(2.2rem, 4vw, 4.3rem);
  line-height: 0.95;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.topbar-actions .ghost-button {
  background: rgba(255, 255, 255, 0.7);
}

.hero-panel,
.panel {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 28px;
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  grid-template-columns: 1.3fr 0.9fr;
  gap: 24px;
  padding: 28px;
  overflow: hidden;
  position: relative;
}

.hero-panel::after {
  content: "";
  position: absolute;
  inset: auto -8% -16% auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(53, 87, 79, 0.22) 0%, rgba(53, 87, 79, 0) 68%);
  pointer-events: none;
}

.hero-copy h2 {
  margin: 8px 0 12px;
  font-size: clamp(2rem, 3vw, 3.2rem);
  line-height: 1;
  max-width: 12ch;
}

.hero-text,
.lede,
.panel p,
.stop-row p,
.profile-list p {
  color: var(--muted);
  line-height: 1.5;
}

.hero-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.metric-card {
  background: var(--paper-strong);
  border: 1px solid rgba(53, 87, 79, 0.12);
  border-radius: 22px;
  padding: 18px;
  min-height: 132px;
}

.metric-card span {
  display: block;
  font-size: clamp(2rem, 3vw, 3rem);
  font-weight: 700;
  color: var(--accent-deep);
  margin-bottom: 8px;
}

.metric-card p {
  margin: 0;
  color: var(--muted);
}

.section-grid {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.home-grid,
.route-grid,
.ar-grid,
.progress-grid,
.profile-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  padding: 22px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.panel h3 {
  margin: 4px 0 0;
  font-size: 1.9rem;
  line-height: 1;
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  font-size: 0.76rem;
  color: var(--olive);
  font-weight: 700;
}

.status-pill,
.chip,
.check-badge,
.filter-chip,
.ghost-button,
.primary-button {
  border-radius: 999px;
}

.status-pill,
.chip,
.check-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 0.82rem;
  background: rgba(23, 32, 38, 0.06);
  border: 1px solid rgba(23, 32, 38, 0.08);
}

.status-pill.is-live {
  background: rgba(53, 87, 79, 0.14);
  border-color: rgba(53, 87, 79, 0.2);
  color: var(--olive);
}

.chip-row,
.filter-row,
.button-row,
.route-legend,
.stop-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.stats-row.compact {
  margin-top: 12px;
}

.stats-row div,
.profile-list div,
.readiness-list div {
  padding: 16px;
  background: var(--paper-strong);
  border: 1px solid rgba(23, 32, 38, 0.08);
  border-radius: 20px;
}

.stats-row strong,
.profile-list strong,
.readiness-list strong {
  display: block;
  margin-bottom: 6px;
  font-size: 1.1rem;
}

.stats-row span,
.progress-copy span {
  color: var(--muted);
  font-size: 0.92rem;
}

.primary-button,
.ghost-button,
.filter-chip,
.tour-card,
.stop-row,
.route-dot,
.tabbar button {
  transition:
    transform 180ms ease,
    background-color 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    box-shadow 180ms ease;
}

.primary-button,
.ghost-button,
.filter-chip {
  padding: 12px 18px;
  border: 1px solid transparent;
}

.link-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.narration-panel,
.variant-toggle {
  display: grid;
  gap: 12px;
}

.narration-panel {
  margin: 18px 0;
}

.variant-toggle {
  grid-template-columns: repeat(2, minmax(0, max-content));
}

.primary-button {
  background: var(--accent);
  color: #fff7f1;
  box-shadow: 0 12px 30px rgba(183, 77, 44, 0.26);
}

.ghost-button,
.filter-chip {
  background: rgba(255, 255, 255, 0.58);
  color: var(--ink);
  border-color: rgba(23, 32, 38, 0.1);
}

.primary-button:hover,
.ghost-button:hover,
.filter-chip:hover,
.tour-card:hover,
.stop-row:hover,
.tabbar button:hover {
  transform: translateY(-1px);
}

.primary-button:disabled,
.ghost-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.filter-chip.active,
.tabbar button.active {
  background: var(--olive);
  color: #f9f3e9;
  border-color: transparent;
}

.search-field {
  display: grid;
  gap: 8px;
  margin: 14px 0 18px;
  color: var(--muted);
}

.search-field input {
  width: 100%;
  border: 1px solid rgba(23, 32, 38, 0.1);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.7);
  padding: 14px 16px;
  color: var(--ink);
}

.tour-list,
.stop-list,
.progress-list,
.mode-stack,
.profile-list,
.readiness-list {
  display: grid;
  gap: 12px;
}

.tour-card,
.stop-row {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(23, 32, 38, 0.08);
  background: var(--paper-strong);
  padding: 16px;
  border-radius: 22px;
}

.tour-card-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.tour-card h4 {
  margin: 4px 0 10px;
  font-size: 1.4rem;
}

.tour-card p,
.stop-row p,
.profile-list p,
.readiness-list p {
  margin: 0;
}

.tour-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 14px;
  color: var(--muted);
  font-size: 0.9rem;
}

.tour-card-link {
  display: inline-flex;
  margin-top: 14px;
  color: var(--accent-deep);
  font-weight: 700;
}

.ar-live-panel,
.ar-stage {
  position: relative;
}

.ar-stage {
  min-height: 520px;
  margin: 16px 0 18px;
  border-radius: 28px;
  overflow: hidden;
  background:
    radial-gradient(circle at top right, rgba(208, 165, 89, 0.18), transparent 26%),
    linear-gradient(180deg, rgba(40, 43, 56, 0.84), rgba(18, 23, 30, 0.92));
  border: 1px solid rgba(23, 32, 38, 0.08);
}

.ar-camera-feed,
.ar-grid-overlay {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.ar-camera-feed {
  object-fit: cover;
  background: #171b20;
}

.ar-grid-overlay {
  background:
    linear-gradient(rgba(156, 167, 255, 0.12) 1px, transparent 1px),
    linear-gradient(90deg, rgba(156, 167, 255, 0.12) 1px, transparent 1px);
  background-size: 72px 72px;
  pointer-events: none;
}

.ar-reticle {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 110px;
  height: 110px;
  transform: translate(-50%, -50%);
  border: 0;
  box-shadow:
    inset 0 0 0 2px rgba(143, 152, 255, 0.26),
    0 0 0 9999px rgba(0, 0, 0, 0.06);
}

.ar-reticle::before,
.ar-reticle::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 4px solid transparent;
}

.ar-reticle::before {
  border-top-color: #98a1ff;
  border-left-color: #98a1ff;
  width: 34px;
  height: 34px;
}

.ar-reticle::after {
  right: 0;
  bottom: 0;
  left: auto;
  top: auto;
  border-right-color: #98a1ff;
  border-bottom-color: #98a1ff;
  width: 34px;
  height: 34px;
}

.ar-badge,
.ar-status-strip {
  position: absolute;
  z-index: 2;
}

.ar-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(23, 32, 38, 0.62);
  color: #fffaf0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(8px);
}

.ar-badge.top-left {
  left: 18px;
  top: 18px;
}

.ar-stop-pill {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  z-index: 2;
  max-width: min(70%, 420px);
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(255, 250, 240, 0.86);
  color: var(--ink);
  border: 1px solid rgba(23, 32, 38, 0.08);
  text-align: center;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.ar-close {
  position: absolute;
  right: 18px;
  top: 18px;
  z-index: 2;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(23, 32, 38, 0.62);
  color: #fffaf0;
  font-size: 2rem;
  line-height: 1;
  backdrop-filter: blur(8px);
}

.ar-status-strip {
  left: 18px;
  right: 18px;
  bottom: 18px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ar-target-card {
  position: absolute;
  left: 18px;
  bottom: 78px;
  z-index: 2;
  max-width: 340px;
  padding: 16px;
  border-radius: 22px;
  background: rgba(23, 32, 38, 0.68);
  color: #fffaf0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  backdrop-filter: blur(10px);
}

.ar-target-card strong,
.ar-target-card p,
.ar-target-card span {
  display: block;
}

.ar-target-card strong {
  margin-bottom: 6px;
}

.ar-target-card p {
  margin: 0 0 8px;
  color: rgba(255, 250, 240, 0.82);
}

.ar-target-card span {
  color: #d8df9b;
  font-weight: 700;
}

.ar-artifact-card {
  position: absolute;
  right: 18px;
  top: 88px;
  z-index: 2;
  width: min(360px, calc(100% - 36px));
  padding: 18px;
  border-radius: 24px;
  background: rgba(255, 250, 240, 0.82);
  color: var(--ink);
  border: 1px solid rgba(23, 32, 38, 0.08);
  box-shadow: 0 20px 40px rgba(23, 32, 38, 0.18);
  backdrop-filter: blur(12px);
}

.ar-artifact-card::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(183, 77, 44, 0.18), rgba(53, 87, 79, 0.12));
}

.ar-artifact-card h4 {
  margin: 6px 0 10px;
  font-family: "Fraunces", serif;
  font-size: 1.6rem;
  line-height: 1;
}

.ar-artifact-card p {
  margin: 0 0 10px;
}

.ar-artifact-card .chip {
  background: rgba(255, 255, 255, 0.82);
}

.ar-artifact-card .drawer-copy {
  margin-top: 10px;
}

.ar-placeholder {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 32px;
  color: #fffaf0;
}

.ar-placeholder h4 {
  margin: 12px 0 10px;
  font-family: "Fraunces", serif;
  font-size: 2rem;
}

.ar-placeholder p {
  max-width: 44ch;
  margin: 0;
  color: rgba(255, 250, 240, 0.8);
}

.ar-icon {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  font-size: 2.5rem;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.route-map {
  position: relative;
  min-height: 360px;
  margin-top: 16px;
  border: 1px solid rgba(23, 32, 38, 0.08);
  border-radius: 28px;
  overflow: hidden;
}

.route-map-shell {
  position: relative;
  margin-top: 16px;
}

.map-fallback {
  position: absolute;
  inset: 16px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 18px;
  background: rgba(255, 250, 240, 0.84);
  border: 1px solid rgba(23, 32, 38, 0.08);
  border-radius: 22px;
  color: var(--muted);
}

.route-highlights,
.planning-grid {
  display: grid;
  gap: 12px;
  margin-top: 16px;
}

.route-highlights {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.highlight-card,
.planning-grid div {
  padding: 16px;
  border-radius: 20px;
  background: var(--paper-strong);
  border: 1px solid rgba(23, 32, 38, 0.08);
}

.highlight-card strong,
.planning-grid strong {
  display: block;
  margin-bottom: 6px;
}

.highlight-card p,
.planning-grid p {
  margin: 0;
  color: var(--muted);
}

.highlight-index {
  display: inline-flex;
  margin-bottom: 10px;
  color: var(--accent-deep);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.legend-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  background: rgba(255, 251, 244, 0.96);
  border: 1px solid rgba(23, 32, 38, 0.16);
  margin-right: 6px;
}

.legend-dot.active {
  background: var(--accent);
  border-color: var(--accent);
}

.legend-dot.done {
  background: var(--olive);
  border-color: var(--olive);
}

.leaflet-container {
  font-family: "Space Grotesk", sans-serif;
  background: #ebe4d7;
}

.leaflet-control-attribution,
.leaflet-control-zoom a {
  background: rgba(255, 250, 240, 0.92) !important;
  color: var(--ink) !important;
  border-color: rgba(23, 32, 38, 0.08) !important;
}

.leaflet-tooltip {
  border: 0;
  border-radius: 999px;
  background: rgba(23, 32, 38, 0.9);
  color: #fffaf0;
  box-shadow: 0 10px 25px rgba(23, 32, 38, 0.2);
}

.stop-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
}

.stop-row.active {
  border-color: rgba(183, 77, 44, 0.4);
  box-shadow: 0 10px 30px rgba(183, 77, 44, 0.12);
}

.check-badge.done {
  background: rgba(53, 87, 79, 0.16);
  color: var(--olive);
}

.mode-card {
  padding: 18px;
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(183, 77, 44, 0.08), rgba(255, 255, 255, 0.72)),
    var(--paper-strong);
  border: 1px solid rgba(23, 32, 38, 0.08);
}

.mode-card h4 {
  margin: 0 0 8px;
  font-size: 1.3rem;
}

.mode-card p {
  margin: 0;
}

.progress-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr auto;
  gap: 14px;
  align-items: center;
}

.progress-bar {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(23, 32, 38, 0.08);
}

.progress-bar span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--accent));
  border-radius: inherit;
}

.progress-value {
  font-weight: 700;
  color: var(--accent-deep);
}

.detail-drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  justify-items: end;
  background: rgba(23, 32, 38, 0.34);
  backdrop-filter: blur(8px);
}

.detail-drawer {
  width: min(520px, 100vw);
  height: 100vh;
  overflow-y: auto;
  padding: 28px 22px 120px;
  background:
    radial-gradient(circle at top right, rgba(208, 165, 89, 0.18), transparent 26%),
    linear-gradient(180deg, rgba(255, 251, 244, 0.98), rgba(246, 239, 228, 0.98));
  box-shadow: -24px 0 60px rgba(23, 32, 38, 0.18);
  border-left: 1px solid rgba(23, 32, 38, 0.08);
}

.drawer-topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.drawer-close {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(23, 32, 38, 0.1);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
  font-size: 1.6rem;
  line-height: 1;
}

.drawer-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0;
}

.drawer-stats div,
.drawer-copy {
  padding: 16px;
  border-radius: 20px;
  background: var(--paper-strong);
  border: 1px solid rgba(23, 32, 38, 0.08);
}

.drawer-stats strong,
.drawer-copy strong {
  display: block;
  margin-bottom: 6px;
}

.drawer-stats span,
.drawer-copy p {
  color: var(--muted);
  margin: 0;
}

.drawer-copy + .drawer-copy {
  margin-top: 12px;
}

.drawer-copy.emphasis {
  background: linear-gradient(135deg, rgba(183, 77, 44, 0.08), rgba(255, 255, 255, 0.9));
  border-color: rgba(183, 77, 44, 0.16);
}

.profile-list,
.readiness-list {
  margin-bottom: 18px;
}

.tabbar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 1000;
  width: min(820px, calc(100vw - 24px));
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  padding: 10px;
  border: 1px solid rgba(23, 32, 38, 0.08);
  border-radius: 22px;
  background: rgba(255, 250, 240, 0.86);
  box-shadow: 0 20px 60px rgba(23, 32, 38, 0.18);
}

.tabbar button {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 14px 10px;
  font-weight: 700;
  border-radius: 16px;
}

@media (max-width: 980px) {
  .hero-panel,
  .home-grid,
  .route-grid,
  .ar-grid,
  .progress-grid,
  .profile-grid {
    grid-template-columns: 1fr;
  }

  .hero-metrics,
  .stats-row,
  .route-highlights,
  .planning-grid,
  .drawer-stats {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 1280px);
    padding-top: 16px;
  }

  .topbar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions {
    justify-content: flex-start;
  }

  .topbar-actions > * {
    width: fit-content;
  }

  .hero-panel,
  .panel {
    border-radius: 24px;
    padding: 18px;
  }

  .panel h3 {
    font-size: 1.6rem;
  }

  .route-map {
    min-height: 280px;
  }

  .ar-stage {
    min-height: 420px;
  }

  .ar-stop-pill {
    max-width: calc(100% - 120px);
    font-size: 0.9rem;
  }

  .ar-target-card {
    left: 18px;
    right: 18px;
    max-width: none;
  }

  .ar-artifact-card {
    position: absolute;
    top: auto;
    right: 18px;
    left: 18px;
    bottom: 148px;
    width: auto;
  }

  .ar-status-strip {
    right: 14px;
  }

  .progress-row,
  .stop-row,
  .tour-card-top,
  .panel-header {
    grid-template-columns: 1fr;
    display: grid;
  }

  .tabbar {
    width: calc(100vw - 16px);
    bottom: 8px;
    padding: 8px;
  }

  .tabbar button {
    padding: 12px 6px;
    font-size: 0.8rem;
  }
}
