:root {
  --paper: #f6efe4;
  --paper-2: #fffaf2;
  --ink: #2a1814;
  --muted: #5e463c;
  --burgundy: #7a2e38;
  --burgundy-deep: #3c1c24;
  --pine: #1e4636;
  --gold: #b6893a;
  --gold-soft: #f0d48a;
  --line: rgba(122, 46, 56, 0.12);
  --shadow: 0 10px 28px rgba(80, 48, 24, 0.08);
  --serif: "Fraunces", "Iowan Old Style", Palatino, Georgia, serif;
  --sans: "Outfit", "Avenir Next", "Segoe UI", sans-serif;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--burgundy-deep);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
}

body.is-locked {
  overflow: hidden;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
  -webkit-tap-highlight-color: transparent;
}

a {
  -webkit-tap-highlight-color: transparent;
}

:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

::selection {
  background: var(--gold-soft);
  color: var(--ink);
}

[hidden] {
  display: none !important;
}

html.is-unlocked #gate {
  display: none !important;
}

html.is-unlocked #app[hidden] {
  display: block !important;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.boot-error {
  max-width: 28rem;
  margin: 20vh auto;
  padding: 0 24px;
  color: var(--paper);
  text-align: center;
}

/* Gate */

.gate {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: calc(28px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom));
  background:
    radial-gradient(ellipse at 50% -10%, rgba(240, 212, 138, 0.28), transparent 52%),
    radial-gradient(ellipse at 110% 110%, rgba(122, 46, 56, 0.55), transparent 46%),
    var(--burgundy-deep);
  color: var(--paper);
}

.gate-card {
  width: min(440px, 100%);
  text-align: center;
}

.mark {
  width: 64px;
  height: 64px;
  color: var(--gold-soft);
}

.mark-small {
  width: 52px;
  height: 52px;
  color: var(--burgundy);
}

.gate-kicker,
.celebrate-kicker {
  margin: 14px 0 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--gold-soft);
}

.gate h1,
.app h1,
.sheet-card h2,
.celebrate-card h2 {
  font-family: var(--serif);
  font-weight: 560;
  letter-spacing: -0.03em;
  line-height: 1.08;
}

.gate h1 {
  margin: 0;
  font-size: clamp(2rem, 9vw, 2.7rem);
  color: #fffaf2;
}

.gate-lede {
  margin: 14px auto 0;
  max-width: 28rem;
  color: rgba(255, 250, 242, 0.86);
  font-size: 1.02rem;
}

.gate-form {
  margin-top: 22px;
  text-align: left;
}

.gate-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.82rem;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gold-soft);
}

.gate input {
  width: 100%;
  min-height: 52px;
  padding: 12px 16px;
  border: 0;
  border-radius: 14px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
  text-align: center;
  text-transform: uppercase;
}

.gate input:not(:placeholder-shown) {
  letter-spacing: 0.14em;
}

.gate input::placeholder {
  color: #8a7368;
  letter-spacing: 0;
  text-transform: none;
  font-weight: 500;
}

.hint {
  margin: 10px 0 0;
  text-align: center;
  color: var(--gold-soft);
  font-size: 0.95rem;
}

.gate-error {
  min-height: 1.3em;
  margin: 8px 0 12px;
  text-align: center;
  color: #ffd2c4;
  font-weight: 650;
}

.gate-submit {
  width: 100%;
  min-height: 52px;
  border-radius: 14px;
  background: var(--paper);
  color: #6e2430;
  font-weight: 700;
}

.gate-submit:active {
  transform: translateY(1px);
}

.gate-sign {
  margin: 22px 0 0;
  color: rgba(240, 212, 138, 0.8);
  font-family: var(--serif);
  font-style: italic;
  font-size: 0.98rem;
}

.is-shaking {
  animation: shake 0.35s ease;
}

@keyframes shake {
  0%,
  100% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  75% { transform: translateX(6px); }
}

/* App shell */

.app {
  width: min(560px, 100%);
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    linear-gradient(180deg, rgba(255, 250, 242, 0.7), rgba(246, 239, 228, 0) 280px),
    var(--paper);
  box-shadow: 0 0 0 1px rgba(42, 24, 20, 0.05);
}

.top {
  padding: calc(18px + env(safe-area-inset-top)) 20px 4px;
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 8px;
  color: var(--burgundy);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.spark {
  width: 14px;
  height: 14px;
  color: var(--gold);
  flex: none;
}

.app h1 {
  margin: 0;
  font-size: clamp(1.7rem, 7vw, 2.25rem);
}

.lede {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 1rem;
}

.progress {
  padding: 14px 20px 8px;
}

.progress p {
  margin: 0 0 8px;
  font-weight: 650;
}

.bar {
  display: grid;
  grid-template-columns: repeat(10, 1fr);
  gap: 4px;
  height: 8px;
}

.bar i {
  display: block;
  border-radius: 99px;
  background: #e4d3bc;
}

.bar i.is-on {
  background: var(--pine);
}

.bar.is-complete i {
  background: var(--gold);
}

.dad-note {
  width: 100%;
  min-height: 44px;
  margin-top: 12px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--gold);
  background: #f8efd8;
  color: #6e4318;
  font-weight: 650;
}

.map-section {
  margin-top: 8px;
}

.map-wrap {
  position: relative;
  z-index: 1;
  isolation: isolate;
}

#map {
  height: clamp(240px, 36vh, 400px);
  width: 100%;
  background: #e7dccb;
}

.map-chip {
  position: absolute;
  z-index: 500;
  top: 10px;
  left: 10px;
  min-height: 44px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--paper-2);
  color: var(--ink);
  font-size: 0.9rem;
  font-weight: 650;
  box-shadow: 0 6px 16px rgba(42, 24, 20, 0.16);
}

.map-caption,
.map-credit,
.map-error {
  margin: 8px 20px 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.map-credit {
  margin-top: 2px;
  font-size: 0.75rem;
}

.map-credit a {
  color: inherit;
}

.map-error {
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--paper-2);
}

.leaflet-marker-icon.pin-wrap {
  background: transparent !important;
  border: 0 !important;
  overflow: visible;
}

.pin {
  width: 36px;
  height: 36px;
  margin: 4px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--paper-2);
  color: var(--burgundy);
  border: 2px solid var(--burgundy);
  box-shadow: 0 6px 14px rgba(42, 24, 20, 0.25);
  font-family: var(--serif);
  font-weight: 650;
  font-size: 0.95rem;
}

.pin.is-done {
  background: var(--pine);
  color: var(--paper);
  border-color: var(--gold-soft);
}

.pin.is-active {
  transform: scale(1.1);
  box-shadow: 0 0 0 4px rgba(182, 137, 58, 0.5), 0 8px 16px rgba(42, 24, 20, 0.28);
}

.pin-home {
  width: 48px;
  height: 48px;
  margin: 0;
  background: var(--burgundy);
  color: var(--gold-soft);
  border: 2px solid var(--gold-soft);
  box-shadow: 0 0 0 3px rgba(255, 250, 242, 0.92), 0 8px 18px rgba(42, 24, 20, 0.28);
}

.pin-home svg {
  width: 22px;
  height: 22px;
  display: block;
}

.leaflet-top.leaflet-right {
  margin-top: 8px;
  margin-right: 8px;
}

.leaflet-control-zoom {
  border: 0 !important;
  border-radius: 12px !important;
  overflow: hidden;
  box-shadow: 0 6px 16px rgba(42, 24, 20, 0.16) !important;
}

.leaflet-control-zoom a {
  width: 36px !important;
  height: 36px !important;
  line-height: 36px !important;
  color: var(--ink) !important;
  background: var(--paper-2) !important;
  border: 0 !important;
}

.leaflet-popup-content-wrapper {
  border-radius: 14px;
  background: var(--paper-2);
  color: var(--ink);
  box-shadow: 0 10px 30px rgba(42, 24, 20, 0.2);
}

.leaflet-popup-tip {
  background: var(--paper-2);
}

.leaflet-popup-content {
  margin: 12px 14px;
  font-family: var(--sans);
  line-height: 1.35;
}

.leaflet-popup-content strong {
  font-family: var(--serif);
  font-size: 1.02rem;
}

.leaflet-popup-content p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

main {
  padding: 16px 16px calc(28px + env(safe-area-inset-bottom));
}

.list-heading {
  margin: 6px 4px 0;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 560;
  letter-spacing: -0.02em;
}

.list-note {
  margin: 4px 4px 12px;
  color: var(--muted);
  font-size: 0.92rem;
}

.list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.card.is-active {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(182, 137, 58, 0.45);
}

.card.is-done {
  background: #f4f7f2;
}

.card-main {
  display: flex;
  gap: 12px;
  width: 100%;
  padding: 0;
  text-align: left;
  background: transparent;
  min-width: 0;
}

.badge {
  flex: none;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--burgundy);
  color: var(--paper-2);
  font-family: var(--serif);
  font-weight: 650;
}

.card.is-done .badge {
  background: var(--pine);
}

.card-copy {
  min-width: 0;
}

.card-name {
  display: block;
  font-weight: 650;
  font-size: 1.02rem;
  line-height: 1.25;
}

.card-meta {
  display: block;
  margin-top: 2px;
  color: #6e4318;
  font-size: 0.86rem;
  font-weight: 650;
}

.card-blurb {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.35;
}

.went {
  align-self: flex-end;
  min-height: 44px;
  min-width: 108px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1.5px solid var(--pine);
  background: var(--paper-2);
  color: var(--pine);
  font-weight: 700;
}

.went.is-on,
.btn-go.is-on {
  background: var(--pine);
  color: var(--paper);
  border-color: var(--pine);
}

.foot {
  margin: 22px 8px 0;
  text-align: center;
  color: #6e5648;
  font-family: var(--serif);
  font-style: italic;
  font-size: 1.02rem;
}

/* Buttons and sheet */

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
  text-decoration: none;
  text-align: center;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--burgundy);
  color: var(--paper-2);
}

.btn-secondary {
  background: transparent;
  color: var(--burgundy);
  border: 1.5px solid var(--burgundy);
}

.btn-go {
  background: var(--pine);
  color: var(--paper);
}

.btn-soon,
.btn:disabled {
  background: #f4ecdf;
  color: #6e5648;
  border: 1.5px dashed #c4b09a;
  cursor: not-allowed;
}

.soon-note {
  margin: 0;
  text-align: center;
  color: #6e5648;
  font-size: 0.88rem;
}

.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: rgba(42, 24, 20, 0.46);
}

.sheet-card {
  width: min(560px, 100%);
  max-height: min(92vh, 92dvh);
  overflow: auto;
  padding: 8px 20px calc(20px + env(safe-area-inset-bottom));
  border-radius: 22px 22px 0 0;
  background: var(--paper-2);
  box-shadow: 0 -12px 40px rgba(42, 24, 20, 0.2);
}

.grab {
  width: 42px;
  height: 4px;
  margin: 4px auto 0;
  border-radius: 99px;
  background: #e0d2c0;
}

.close {
  min-height: 44px;
  padding: 0 2px;
  color: var(--burgundy);
  font-weight: 700;
}

.sheet-num {
  margin: 0;
  color: var(--burgundy);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.sheet-card h2 {
  margin: 2px 0 8px;
  font-size: clamp(1.6rem, 7vw, 2rem);
}

.address {
  margin: 0;
  color: var(--muted);
  font-style: normal;
}


.stop-photo {
  margin: 14px 0 4px;
  padding: 0;
}

.stop-photo img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 240px;
  object-fit: cover;
  object-position: center;
  border-radius: 16px;
  background: #efe4d4;
}

.stop-photo figcaption {
  margin: 8px 2px 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1.35;
}

.blurb {
  margin: 12px 0;
  font-family: var(--serif);
  font-style: italic;
  font-weight: 520;
  font-size: 1.18rem;
  line-height: 1.35;
}

.getting-there {
  margin: 14px 0 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.4;
}

.approx {
  margin: 4px 0 0;
  color: #6e5648;
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.routes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.route-label {
  margin: 0;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.route-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.route-btn {
  flex-direction: column;
  gap: 1px;
  min-height: 52px;
  padding: 8px 10px;
  line-height: 1.15;
}

.route-sub {
  font-size: 0.75rem;
  font-weight: 500;
}

.route-caption {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 0.8rem;
}

.apple-routes {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.apple-routes .route-label {
  margin-right: 4px;
}

.apple-routes a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 8px;
  color: var(--burgundy);
  font-weight: 700;
  text-decoration: none;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 18px;
}

#sheet-card-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  position: fixed;
  z-index: 25;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  width: max-content;
  max-width: calc(100% - 24px);
  padding: 8px 8px 8px 16px;
  border-radius: 18px;
  background: var(--ink);
  color: var(--paper);
  box-shadow: 0 12px 30px rgba(42, 24, 20, 0.28);
}

.toast p {
  margin: 0;
  font-size: 0.92rem;
}

.toast button {
  min-height: 40px;
  padding: 0 12px;
  border-radius: 12px;
  background: var(--gold-soft);
  color: var(--ink);
  font-weight: 750;
}

/* Celebration */

.celebrate {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(18px + env(safe-area-inset-bottom));
  background: #3c1c24;
}

#confetti,
.confetti-still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.confetti-still i {
  position: absolute;
  display: block;
}

.celebrate-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  max-height: min(88vh, 88dvh);
  overflow: auto;
  padding: 26px 22px 18px;
  border-radius: 24px;
  border-top: 6px solid var(--burgundy);
  background: var(--paper-2);
  text-align: center;
  box-shadow: 0 24px 60px rgba(42, 18, 24, 0.35);
}

.celebrate-card .celebrate-kicker {
  color: var(--burgundy);
}

.celebrate-card h2 {
  margin: 0;
  font-size: 2.3rem;
}

.celebrate-count {
  margin: 6px 0 14px;
  color: #6e4318;
  font-weight: 700;
}

.note {
  margin: 0 0 18px;
  text-align: left;
  white-space: pre-line;
  font-family: var(--serif);
  font-weight: 520;
  font-size: 1.12rem;
  line-height: 1.45;
}

.text-btn {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (min-width: 720px) {
  body {
    background:
      radial-gradient(ellipse at 50% -10%, rgba(240, 212, 138, 0.18), transparent 40%),
      #2a1814;
  }

  .sheet {
    align-items: center;
    padding: 24px;
  }

  .sheet-card {
    border-radius: 22px;
    max-height: 86dvh;
    padding-bottom: 22px;
  }
}

@media (hover: hover) {
  .btn-primary:hover:not(:disabled) {
    background: #642530;
  }

  .gate-submit:hover {
    background: #fffaf2;
  }

  .card:hover {
    border-color: rgba(122, 46, 56, 0.28);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
