:root {
  --fs: 16px;
  --ink: #0a0a0a;
  --ink-soft: rgba(10, 10, 10, 0.5);
  --ink-faint: rgba(10, 10, 10, 0.18);
  --hairline: rgba(10, 10, 10, 0.08);
  --bg: #ffffff;
  --accent: #1e3a8a;
  --glass-bg: rgba(255, 255, 255, 0.72);
  --shadow: 0 24px 60px -28px rgba(10, 10, 10, 0.2);
  --radius: 24px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
  --nav-h: 64px;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  height: 100%;
  width: 100%;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
}
body {
  font-family:
    "Inter",
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    system-ui,
    sans-serif;
  font-size: var(--fs);
  line-height: 1.45;
  font-weight: 400;
  color: var(--ink);
  background: var(--bg);
  letter-spacing: -0.011em;
  -webkit-font-smoothing: antialiased;
}

#app {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  right: 0;
  background: #fff;
  overflow: hidden;
}

@media (min-width: 800px) {
  body {
    background: #fff;
  }
  #app {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 800px;
  }
}

.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: calc(env(safe-area-inset-bottom) + var(--nav-h));
}
.screen.active {
  display: flex;
  animation: fadeIn 300ms var(--ease);
}
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* ---------- GLOBAL NAV ---------- */
.nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  z-index: 100;
  background: linear-gradient(to top, #fff 60%, rgba(255, 255, 255, 0));
}
.nav-link {
  font: inherit;
  background: none;
  border: 0;
  color: var(--ink);
  opacity: 0.5;
  padding: 10px 6px;
  cursor: pointer;
  letter-spacing: -0.01em;
  font-weight: 500;
  transition: opacity 180ms var(--ease);
}
.nav-link.active {
  opacity: 1;
}
.nav-sep {
  color: var(--ink-faint);
}

/* ---------- MENU ---------- */
.menu-wrap {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18vh 28px 8vh;
}
.brand-eyebrow {
  color: var(--ink-soft);
  font-size: var(--fs);
}
.brand-title {
  font-size: var(--fs);
  margin-top: 6px;
}
.menu-lede {
  color: var(--ink-soft);
}
.menu-lede div + div {
  margin-top: 2px;
}

.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(24px) saturate(140%);
  -webkit-backdrop-filter: blur(24px) saturate(140%);
  border: 1px solid var(--hairline);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  font: inherit;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--hairline);
  padding: 16px 22px;
  border-radius: 999px;
  cursor: pointer;
  font-weight: 500;
  letter-spacing: -0.01em;
  transition:
    opacity 180ms var(--ease),
    background 180ms var(--ease);
}
.btn:active {
  opacity: 0.55;
}
.btn--full {
  width: 100%;
  text-align: center;
}

.link-btn {
  font: inherit;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border: 1px solid var(--hairline);
  color: var(--ink);
  opacity: 1;
  padding: 10px 18px;
  border-radius: 999px;
  cursor: pointer;
  letter-spacing: -0.01em;
  font-weight: 500;
  transition: opacity 180ms var(--ease);
}
.link-btn:active {
  opacity: 0.55;
}

/* ---------- START ---------- */
.screen--start {
  background: #ffffff;
}
#dice-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #ffffff;
}

.top-hud {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 20px);
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  pointer-events: none;
  z-index: 10;
}
.progress {
  display: flex;
  gap: 8px;
}
.progress i {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  border: 1px solid var(--ink-faint);
  background: transparent;
  transition:
    background 200ms var(--ease),
    border-color 200ms var(--ease);
}
.progress i.unlocked {
  background: var(--ink);
  border-color: var(--ink);
}
.hud-hint {
  color: var(--ink-soft);
}

.start-actions {
  position: absolute;
  left: 0;
  right: 0;
  bottom: calc(env(safe-area-inset-bottom) + var(--nav-h) + 8px);
  display: flex;
  justify-content: center;
  gap: 18px;
  z-index: 10;
}

/* ---------- SHEETS ---------- */
.sheet {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 200;
}
.sheet-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(255, 255, 255, 0);
  transition: background 300ms var(--ease);
  pointer-events: none;
}
.sheet.open {
  pointer-events: auto;
}
.sheet.open .sheet-backdrop {
  background: rgba(255, 255, 255, 0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  pointer-events: auto;
}
.sheet-card {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: calc(env(safe-area-inset-bottom) + 14px);
  padding: 22px 22px 24px;
  transform: translateY(120%);
  transition: transform 360ms var(--ease);
  pointer-events: auto;
}
.sheet.open .sheet-card {
  transform: translateY(0);
}

.sheet-handle {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--ink-faint);
  margin: -8px auto 14px;
}

.sheet-eyebrow {
  color: var(--ink-soft);
}
.sheet-title {
  margin-top: 6px;
  font-weight: 600;
  letter-spacing: -0.03em;
}
.sheet-meta {
  color: var(--ink-soft);
  margin-top: 4px;
}
.sheet-score {
  color: var(--ink-soft);
  margin-top: 16px;
}
.sheet-score span {
  color: var(--ink);
  font-weight: 600;
}
.sheet-desc {
  margin-top: 12px;
  color: var(--ink-soft);
}
.sheet-actions {
  margin-top: 20px;
  display: flex;
  gap: 8px;
}

.final-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.final-list .final-item {
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.5);
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: background 180ms var(--ease);
}
.final-list .final-item:active {
  background: rgba(255, 255, 255, 0.9);
}
.final-list .place {
  color: var(--ink-soft);
}

/* ---------- OVERVIEW ---------- */
.screen--overview {
  background: #fff;
}
.overview-title {
  position: absolute;
  top: calc(env(safe-area-inset-top) + 20px);
  left: 0;
  right: 0;
  text-align: center;
  color: var(--ink-soft);
  pointer-events: none;
  z-index: 10;
}
.map-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
  touch-action: none;
}
.map-wrap svg {
  width: 100%;
  height: 100%;
  display: block;
}

/* MapLibre minimal overrides */
.maplibregl-ctrl-attrib {
  background: rgba(255, 255, 255, 0.7) !important;
  font-size: 10px !important;
  color: var(--ink-soft) !important;
}
.maplibregl-ctrl-attrib a {
  color: var(--ink-soft) !important;
}
.maplibregl-canvas {
  outline: none !important;
}

.map-marker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transform: translateY(0);
  cursor: pointer;
  pointer-events: auto;
}
.map-marker-label {
  font-size: var(--fs);
  color: var(--ink);
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--hairline);
  padding: 2px 10px;
  border-radius: 999px;
  letter-spacing: -0.01em;
  font-weight: 500;
  white-space: nowrap;
  transform: translateY(-4px) scale(0.78);
  transform-origin: bottom center;
}
.map-marker-pin {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--ink);
  display: grid;
  place-items: center;
  box-shadow: 0 8px 18px -8px rgba(10, 10, 10, 0.4);
}
.map-marker-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: var(--ink);
}
