@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&family=Inter:wght@400;600;700&display=swap");

:root {
  --grass: #5b8a2c;
  --grass-dark: #446b1f;
  --dirt: #7a5230;
  --stone: #6b6b5f;
  --stone-dark: #46463d;
  --sky: #8fd0ea;
  --ink: #1c1c19;
  --panel: #f4efe1;
  --gold: #f2b632;
  --red: #c1432f;
  --amber: #d98c2b;
  font-family: "Inter", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--panel);
  min-height: 100vh;
}

.pixel-heading {
  font-family: "Press Start 2P", monospace;
  letter-spacing: 0.5px;
  line-height: 1.6;
}

/* ── Header sign ─────────────────────────────────────────── */
.park-header {
  background: var(--dirt);
  border-bottom: 6px solid var(--stone-dark);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.park-header h1 {
  font-size: 14px;
  color: var(--gold);
  margin: 0;
  text-shadow: 2px 2px 0 var(--ink);
}

.park-status-pill {
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  background: var(--grass);
  color: #fff;
}

.park-status-pill.closed {
  background: var(--red);
}

.park-status-pill.extended {
  background: var(--gold);
  color: var(--ink);
}

.park-status-pill.closing-soon {
  background: var(--amber);
  color: var(--ink);
}

.park-status-pill.private-event {
  background: var(--sky);
  color: var(--ink);
}

/* ── Map ─────────────────────────────────────────────────── */
.map-wrap {
  padding: 18px;
}

.map-canvas {
  position: relative;
  width: 100%;
  max-width: 1000px;
  aspect-ratio: 16 / 10;
  margin: 0 auto;
  border: 6px solid var(--stone-dark);
  background-color: var(--grass);
  background-image:
    linear-gradient(90deg, var(--grass-dark) 2px, transparent 2px),
    linear-gradient(var(--grass-dark) 2px, transparent 2px);
  background-size: 40px 40px;
  overflow: hidden;
  cursor: default;
}

.map-canvas.has-image {
  background-image: none;
  background-size: contain;
  background-repeat: no-repeat;
  background-position: center;
}

.map-placeholder-note {
  position: absolute;
  bottom: 10px;
  left: 10px;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  font-size: 11px;
  padding: 6px 10px;
  border: 2px solid var(--ink);
}

/* ── Pins ────────────────────────────────────────────────── */
.pin {
  position: absolute;
  transform: translate(-50%, -100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  cursor: pointer;
  user-select: none;
}

.pin-marker {
  width: 26px;
  height: 26px;
  background: var(--gold);
  border: 3px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.4);
}

.pin-marker.status-engineering { background: var(--amber); }
.pin-marker.status-closed { background: var(--stone); }
.pin-marker.status-temp_shut { background: var(--red); }
.pin-marker.status-park_closed { background: var(--stone-dark); }
.pin-marker.status-ride_opening_soon { background: var(--amber); }
.pin-marker.status-ride_closed_today { background: var(--stone); }

.pin-label {
  margin-top: 4px;
  background: var(--panel);
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  padding: 3px 6px;
  border: 2px solid var(--ink);
  white-space: nowrap;
}

.pin-queue {
  font-size: 10px;
  font-weight: 400;
  color: var(--stone-dark);
}

.pin.dragging { opacity: 0.7; z-index: 50; }

/* ── Legend ──────────────────────────────────────────────── */
.legend {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  padding: 0 18px 18px;
  font-size: 13px;
  max-width: 1000px;
  margin: 0 auto;
}

.legend-item { display: flex; align-items: center; gap: 6px; }
.legend-swatch { width: 14px; height: 14px; border: 2px solid var(--ink); }

/* ── Admin ───────────────────────────────────────────────── */
.admin-shell { max-width: 1100px; margin: 0 auto; padding: 18px; }

.panel {
  background: var(--panel);
  color: var(--ink);
  border: 4px solid var(--stone-dark);
  padding: 18px;
  margin-bottom: 18px;
}

.panel h2 {
  font-size: 12px;
  font-family: "Press Start 2P", monospace;
  margin-top: 0;
}

.field-row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
  margin-bottom: 12px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  font-weight: 600;
}

input, select, button {
  font-family: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 3px solid var(--ink);
  background: #fff;
}

button {
  background: var(--grass);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.3);
}

button:hover { filter: brightness(1.08); }
button:active { transform: translate(2px, 2px); box-shadow: none; }

button.secondary { background: var(--stone); }
button.danger { background: var(--red); }

.ride-row {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px;
  border-bottom: 2px solid #ddd6c4;
}

.ride-row:last-child { border-bottom: none; }

.msg {
  font-size: 13px;
  padding: 8px 10px;
  margin-top: 8px;
}

.msg.error { background: #fbe0da; border: 2px solid var(--red); color: #7a2415; }
.msg.ok { background: #e3f0d8; border: 2px solid var(--grass-dark); color: #2f4c17; }

a.token-help { color: var(--ink); }

/* ── Map-only embed layout (no header/legend) ────────────── */
html.map-only-html, body.map-only {
  margin: 0;
  background: var(--ink);
  height: auto;
  min-height: 0;
}

.map-wrap-tight {
  padding: 12px;
}

.map-wrap-tight .map-canvas {
  max-width: 1400px;
}

.map-status-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  font-family: "Press Start 2P", monospace;
  font-size: 10px;
  padding: 8px 12px;
  border: 3px solid var(--ink);
  background: var(--grass);
  color: #fff;
  z-index: 10;
}

.map-status-badge.closed { background: var(--red); }
.map-status-badge.extended { background: var(--gold); color: var(--ink); }
.map-status-badge.closing-soon { background: var(--amber); color: var(--ink); }
.map-status-badge.private-event { background: var(--sky); color: var(--ink); }

@media (max-width: 600px) {
  .map-status-badge {
    font-size: 8px;
    padding: 6px 9px;
    top: 8px;
    right: 8px;
  }

  .park-header {
    flex-direction: column;
    align-items: flex-start;
    padding: 10px 12px;
  }

  .park-header h1 {
    font-size: 11px;
  }

  .park-status-pill {
    font-size: 9px;
    padding: 6px 10px;
  }

  .map-wrap {
    padding: 10px;
  }

  .pin-marker {
    width: 20px;
    height: 20px;
    border-width: 2px;
  }

  .pin-label {
    font-size: 10px;
    padding: 2px 5px;
    max-width: 100px;
    white-space: normal;
    text-align: center;
  }

  .pin-queue {
    font-size: 9px;
  }

  .legend {
    padding: 0 10px 12px;
    font-size: 11px;
    gap: 8px;
  }

  .admin-shell {
    padding: 10px;
  }

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

  input, select, button {
    font-size: 16px;
  }
}
