:root {
  --bg: #1a2418;
  --bg-2: #243022;
  --cream: #f4ead4;
  --cream-dim: #d9ccb0;
  --gold: #e8b423;
  --gold-2: #f3d36a;
  --stem: #4a6b3c;
  --dirt: #8a6840;
  --danger: #e85d4c;
  --ok: #7dce6a;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

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

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--cream);
  font-family: "Nunito Sans", "Segoe UI", sans-serif;
  overflow: hidden;
}

body {
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  height: 100dvh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(10px + var(--safe-top)) 16px 10px;
  background: linear-gradient(180deg, #141c12 0%, var(--bg) 100%);
  z-index: 3;
}

.eyebrow {
  margin: 0;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-size: 10px;
  color: var(--gold);
  font-weight: 700;
}

h1 {
  margin: 2px 0 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.btn-locate {
  appearance: none;
  border: 0;
  background: var(--gold);
  color: #1a1808;
  font: 700 14px/1 "Nunito Sans", sans-serif;
  padding: 12px 16px;
  border-radius: 999px;
  cursor: pointer;
}

.btn-locate[disabled] {
  opacity: 0.55;
  cursor: default;
}

.btn-locate.live {
  background: var(--ok);
}

.stage {
  position: relative;
  overflow: hidden;
  background: #0e140c;
  touch-action: none;
  cursor: grab;
}

.stage.dragging { cursor: grabbing; }

.world {
  position: absolute;
  left: 0;
  top: 0;
  width: 3840px;
  height: 2160px;
  transform-origin: 0 0;
  will-change: transform;
}

.world img {
  display: block;
  width: 3840px;
  height: 2160px;
  user-select: none;
  pointer-events: none;
}

.world svg {
  position: absolute;
  inset: 0;
  width: 3840px;
  height: 2160px;
  overflow: visible;
}

.field-poly {
  fill: rgba(232, 180, 35, 0.12);
  stroke: rgba(243, 211, 106, 0.75);
  stroke-width: 5;
  stroke-linejoin: round;
  pointer-events: none;
}

.nocut-poly {
  fill: rgba(196, 48, 38, 0.4);
  stroke: none;
  pointer-events: none;
}

.nocut-ring-fill {
  fill: rgba(196, 48, 38, 0.28);
  stroke: none;
  pointer-events: none;
}

.nocut-ring-outline {
  fill: none;
  stroke: rgba(232, 93, 76, 0.9);
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
  pointer-events: none;
}

.waypoint-dot {
  fill: #f4ead4;
  stroke: #1a1808;
  stroke-width: 5;
}

.waypoint-halo {
  fill: rgba(26, 36, 24, 0.55);
}

.waypoint-label {
  font: 700 13px "Nunito Sans", sans-serif;
  fill: #f4ead4;
  paint-order: stroke;
  stroke: #1a1808;
  stroke-width: 4;
}

.gcp {
  fill: #1a2418;
  stroke: var(--gold);
  stroke-width: 4;
}

.gcp-label {
  font: 700 28px "Nunito Sans", sans-serif;
  fill: var(--gold);
  paint-order: stroke;
  stroke: #1a2418;
  stroke-width: 6;
}

.you-accuracy {
  fill: rgba(232, 93, 76, 0.18);
  stroke: rgba(232, 93, 76, 0.45);
  stroke-width: 3;
}

.you-dot {
  fill: var(--danger);
  stroke: #fff;
  stroke-width: 3;
}

.you-pulse {
  fill: none;
  stroke: #fff;
  stroke-width: 2;
  opacity: 0.8;
}

.you-heading {
  fill: #fff;
  stroke: #1a1808;
  stroke-width: 1.5;
  stroke-linejoin: round;
}

.hint {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  background: rgba(20, 28, 18, 0.75);
  color: var(--cream-dim);
  font-size: 12px;
  padding: 6px 12px;
  border-radius: 999px;
  pointer-events: none;
}

.status-card {
  margin: 0 12px calc(8px + var(--safe-bot));
  background: var(--bg-2);
  border: 1px solid rgba(244, 234, 212, 0.08);
  border-radius: 16px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  z-index: 3;
}

.status-row {
  display: flex;
  gap: 12px;
  align-items: center;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #6b7466;
  flex: 0 0 auto;
  box-shadow: 0 0 0 6px rgba(107, 116, 102, 0.15);
}

.dot.locating { background: var(--gold); box-shadow: 0 0 0 6px rgba(232, 180, 35, 0.18); }
.dot.live { background: var(--ok); box-shadow: 0 0 0 6px rgba(125, 206, 106, 0.2); }
.dot.outside { background: var(--gold-2); }
.dot.error { background: var(--danger); box-shadow: 0 0 0 6px rgba(232, 93, 76, 0.18); }

.status-label {
  margin: 0;
  font-weight: 700;
  font-size: 16px;
}

.status-meta {
  margin: 2px 0 0;
  color: var(--cream-dim);
  font-size: 13px;
}

.legend-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(244, 234, 212, 0.1);
}

.legend {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 6px;
  color: var(--cream);
  font-size: 13px;
  font-weight: 600;
}

.legend:last-child { margin-bottom: 0; }

.swatch {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.swatch-nocut {
  background: rgba(196, 48, 38, 0.75);
  box-shadow: inset 0 0 0 1px rgba(232, 93, 76, 0.95);
}

.swatch-cut {
  background: rgba(232, 180, 35, 0.75);
  box-shadow: inset 0 0 0 1px rgba(243, 211, 106, 0.95);
}

.store-block {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(244, 234, 212, 0.1);
}

.store-title {
  margin: 0;
  font-family: Fraunces, Georgia, serif;
  font-size: 15px;
}

.store-link {
  display: inline-block;
  margin-top: 4px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  text-decoration: underline;
}

.hidden { display: none !important; }

@media (min-width: 800px) {
  body { grid-template-columns: 1fr 320px; grid-template-rows: auto 1fr auto; }
  .topbar { grid-column: 1 / -1; }
  .stage { grid-row: 2 / 4; }
  .status-card { margin-right: 16px; }
}
