:root {
  color-scheme: dark;
  font-family: "Avenir Next", "Trebuchet MS", "PingFang SC", sans-serif;
  --cream: #fff7e4;
  --ink: #102a2b;
  --teal: #0c3435;
  --gold: #f2c451;
  --red: #a72d26;
  --cyan: #8ce7e9;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background: #0b2426;
  user-select: none;
  -webkit-user-select: none;
}

body {
  touch-action: pan-y;
}

button,
a {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

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

button:focus-visible,
a:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

#home-app {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100%;
  overflow: hidden;
  color: var(--cream);
  background: #bad9e3;
  isolation: isolate;
}

.scene {
  position: absolute;
  inset: 0;
  z-index: -3;
  background-image: url("./media/weekend.jpg");
  background-size: cover;
  background-position: 50% 52%;
  transform: scale(1.02);
}

.scene-shade {
  position: absolute;
  inset: 0;
  z-index: -2;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(3, 18, 22, 0.43), transparent 22%),
    linear-gradient(90deg, transparent 44%, rgba(3, 18, 22, 0.08) 60%, rgba(3, 18, 22, 0.5)),
    linear-gradient(0deg, rgba(3, 18, 21, 0.9), rgba(3, 18, 21, 0.22) 35%, transparent 55%);
}

.topbar {
  position: absolute;
  inset: max(16px, env(safe-area-inset-top)) max(18px, env(safe-area-inset-right)) auto max(18px, env(safe-area-inset-left));
  z-index: 6;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 13px 6px 6px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  background: rgba(4, 25, 28, 0.72);
  backdrop-filter: blur(12px);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #3d1d08;
  background: linear-gradient(145deg, #ffe797, #cb8b2f);
  box-shadow: inset 0 0 0 3px var(--red);
  font-weight: 900;
}

.brand-copy strong {
  display: block;
  font-size: 15px;
  line-height: 1.05;
}

.brand-copy small {
  display: block;
  margin-top: 2px;
  color: #bcecef;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.quiet-link {
  display: grid;
  place-items: center;
  min-width: 64px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(4, 25, 28, 0.66);
  font-size: 12px;
  font-weight: 800;
  backdrop-filter: blur(10px);
}

.offline-banner {
  position: absolute;
  top: max(72px, calc(env(safe-area-inset-top) + 62px));
  left: 50%;
  z-index: 8;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border: 1px solid rgba(255, 234, 165, 0.32);
  border-radius: 13px;
  color: #36220a;
  background: #ffe7a0;
  box-shadow: 0 9px 22px rgba(0, 0, 0, 0.2);
  font-size: 11px;
  font-weight: 800;
  transform: translateX(-50%);
  white-space: nowrap;
}

.offline-banner[hidden] {
  display: none;
}

.offline-banner a {
  padding: 5px 8px;
  border-radius: 8px;
  color: #fff6db;
  background: var(--red);
}

.swipe-surface {
  position: absolute;
  inset: 0;
  z-index: 2;
  overflow: hidden;
  touch-action: pan-y;
}

.mode-track {
  display: flex;
  width: 300%;
  height: 100%;
  transform: translate3d(0, 0, 0);
  transition: transform 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
  will-change: transform;
}

.mode-track.is-dragging {
  transition: none;
}

.mode-panel {
  position: relative;
  width: 33.333333%;
  height: 100%;
  flex: 0 0 33.333333%;
}

.dialogue-bubble {
  position: absolute;
  top: 16%;
  right: 4.5%;
  width: min(48%, 640px);
  padding: clamp(15px, 2vw, 22px) clamp(17px, 2.2vw, 26px);
  border-radius: 25px 25px 7px 25px;
  color: var(--ink);
  background: rgba(255, 248, 232, 0.96);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.24);
}

.dialogue-bubble::before {
  content: "";
  position: absolute;
  left: -24px;
  bottom: 28px;
  width: 30px;
  height: 32px;
  background: rgba(255, 248, 232, 0.96);
  clip-path: polygon(100% 0, 100% 100%, 0 100%);
}

.bubble-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 9px;
  color: #755316;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.ai-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #45b4ba;
  box-shadow: 0 0 0 4px rgba(69, 180, 186, 0.17);
}

.dialogue-bubble h1 {
  margin: 0;
  font-size: clamp(25px, 3.2vw, 43px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.compact {
  top: 20%;
}

.line-copy {
  margin: 12px 0 0;
  color: #38534f;
  font-size: clamp(14px, 1.6vw, 20px);
  font-weight: 700;
  line-height: 1.3;
}

.hero-action {
  position: absolute;
  left: 5%;
  bottom: 22%;
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 230px;
  min-height: 82px;
  padding: 10px 22px 10px 10px;
  border-radius: 22px;
  color: #3b2306;
  background: linear-gradient(135deg, #ffe697, #e1a238);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.3),
    0 12px 28px rgba(0, 0, 0, 0.24);
  text-align: left;
}

.action-icon {
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  flex: 0 0 auto;
  border-radius: 50%;
  color: #ffe9a7;
  background: var(--red);
  box-shadow: inset 0 0 0 4px rgba(255, 232, 164, 0.18);
}

.action-icon svg {
  width: 27px;
  height: 27px;
}

.hero-action b,
.hero-action small {
  display: block;
}

.hero-action b {
  font-size: 20px;
}

.hero-action small {
  margin-top: 3px;
  color: #70480f;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.object-token {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 88px;
  min-height: 46px;
  padding: 0 15px 0 10px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  color: #102a2b;
  background: rgba(238, 255, 253, 0.92);
  box-shadow: 0 9px 22px rgba(0, 0, 0, 0.2);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  backdrop-filter: blur(10px);
}

.object-token::before {
  content: "";
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background:
    radial-gradient(circle, #fff 0 23%, transparent 26%),
    linear-gradient(145deg, #8ce6e9, #2d9499);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.75);
}

.object-token.is-found {
  background: #ffe18b;
  box-shadow: 0 0 0 6px rgba(255, 214, 96, 0.21), 0 10px 25px rgba(0, 0, 0, 0.22);
}

.token-park {
  left: 8%;
  top: 62%;
}

.token-family {
  right: 14%;
  top: 57%;
}

.token-bike {
  right: 6%;
  top: 73%;
}

.tap-tip {
  position: absolute;
  left: 41%;
  bottom: 24%;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}

.act-button {
  position: absolute;
  left: 5%;
  bottom: 23%;
  min-width: 190px;
  min-height: 64px;
  padding: 0 24px;
  border-radius: 18px;
  color: #3b2306;
  background: linear-gradient(135deg, #ffe697, #e1a238);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.25);
  font-size: 16px;
  font-weight: 900;
}

.act-button:active {
  transform: scale(0.98);
}

.ride-trail {
  position: absolute;
  left: 5%;
  right: 5%;
  bottom: 34%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.25);
  opacity: 0;
}

.ride-trail.is-running {
  opacity: 1;
}

.trail-bike {
  position: absolute;
  top: 50%;
  left: 0;
  padding: 6px 9px;
  border-radius: 999px;
  color: #143031;
  background: #b9f4ef;
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.08em;
  transform: translateY(-50%);
}

.ride-trail.is-running .trail-bike {
  animation: ride 1200ms ease-out forwards;
}

@keyframes ride {
  from { left: 0; }
  to { left: calc(100% - 50px); }
}

.bottom-dock {
  position: absolute;
  left: max(2.5%, env(safe-area-inset-left));
  right: max(2.5%, env(safe-area-inset-right));
  bottom: max(2.5%, env(safe-area-inset-bottom));
  z-index: 7;
  display: grid;
  grid-template-columns: minmax(280px, 1.7fr) auto minmax(54px, 0.28fr);
  align-items: center;
  gap: 14px;
  min-height: 78px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 235, 184, 0.18);
  border-radius: 23px;
  background: linear-gradient(180deg, rgba(17, 54, 53, 0.94), rgba(5, 29, 31, 0.98));
  box-shadow: 0 15px 38px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(18px);
}

.mode-switcher {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
}

.mode-button {
  min-height: 52px;
  padding: 0 12px;
  border-radius: 14px;
  color: #d9f5f1;
  background: rgba(255, 255, 255, 0.06);
  font-size: 13px;
  font-weight: 800;
}

.mode-button.is-active {
  color: #163031;
  background: #b8efea;
}

.mode-dots {
  display: flex;
  gap: 7px;
}

.mode-dots span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.25);
}

.mode-dots span.is-active {
  background: var(--gold);
  box-shadow: 0 0 10px rgba(242, 196, 81, 0.6);
}

.pocket-link {
  display: grid;
  place-items: center;
  min-width: 54px;
  min-height: 54px;
  border: 1px dashed rgba(255, 246, 219, 0.35);
  border-radius: 15px;
  color: #dff9f4;
  background: rgba(255, 255, 255, 0.04);
  font-size: 11px;
  font-weight: 900;
}

.status {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@media (max-width: 700px), (orientation: portrait) {
  .dialogue-bubble {
    top: 13%;
    left: 7%;
    right: 7%;
    width: auto;
  }

  .dialogue-bubble::before {
    display: none;
  }

  .compact {
    top: 16%;
  }

  .hero-action {
    left: 7%;
    bottom: 22%;
  }

  .object-token {
    min-width: 80px;
  }

  .token-park {
    left: 5%;
    top: 48%;
  }

  .token-family {
    right: 6%;
    top: 44%;
  }

  .token-bike {
    right: 5%;
    top: 55%;
  }

  .tap-tip {
    left: 8%;
    bottom: 26%;
  }

  .bottom-dock {
    grid-template-columns: 1fr auto;
    gap: 8px;
  }

  .mode-switcher {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .mode-dots {
    justify-self: center;
  }
}

@media (max-width: 440px) {
  .brand-copy strong {
    font-size: 13px;
  }

  .hero-action {
    min-width: 0;
    max-width: calc(100% - 14%);
  }

  .line-copy {
    font-size: 14px;
  }
}

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