﻿:root {
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #17211b;
  background: #f5f7f5;
}

* { box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body { overflow: hidden; }

button, select, input { font: inherit; }

.topbar {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 24px;
  background: #fff;
  border-bottom: 1px solid #dfe5e0;
  position: relative;
  z-index: 1000;
}

.brand {
  color: #143d26;
  font-weight: 800;
  text-decoration: none;
  font-size: 1.2rem;
}

.topbar nav {
  display: flex;
  gap: 16px;
  align-items: center;
}

.topbar nav a {
  color: #35433a;
  text-decoration: none;
  font-size: .92rem;
}

.topbar nav a.active {
  color: #116530;
  font-weight: 800;
}

.layout {
  display: grid;
  grid-template-columns: minmax(320px, 390px) minmax(0, 1fr);
  height: calc(100vh - 64px);
}

.panel {
  overflow-y: auto;
  padding: 22px;
  background: #f8faf8;
  border-right: 1px solid #dfe5e0;
}

.eyebrow {
  margin: 0 0 6px;
  color: #487358;
  font-size: .75rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }

h1 {
  margin-bottom: 8px;
  line-height: 1.1;
  font-size: 1.8rem;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.description {
  color: #55635a;
  line-height: 1.45;
}

.panel > label {
  display: block;
  margin: 14px 0 7px;
  font-size: .85rem;
  font-weight: 750;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 9px 12px;
  border: 1px solid #cdd7cf;
  border-radius: 10px;
  background: #fff;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 14px 0;
}

.meta-pill {
  padding: 5px 9px;
  border-radius: 999px;
  background: #e7f2e9;
  color: #365340;
  font-size: .76rem;
  font-weight: 700;
}

.card,
.surprise-card,
.reward-card {
  margin-bottom: 14px;
  padding: 15px;
  border-radius: 14px;
}

.card {
  background: #fff;
  border: 1px solid #dfe5e0;
}

.surprise-card {
  display: flex;
  gap: 12px;
  background: linear-gradient(135deg, #fff8d8, #fff1b8);
  border: 1px solid #ead47c;
}

.reward-card {
  display: flex;
  gap: 12px;
  background: linear-gradient(135deg, #e1f7e7, #f7fbda);
  border: 1px solid #b7dfc1;
}

.gift { font-size: 1.8rem; }

.surprise-card p,
.reward-card p {
  margin: 5px 0 0;
  line-height: 1.4;
}

.heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.badge {
  padding: 4px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 800;
}

.badge-idle { background: #eef1ef; }
.badge-active { background: #dff5e5; color: #0a5524; }
.badge-warning { background: #fff0cf; color: #7a4b00; }
.badge-complete { background: #116530; color: #fff; }

.live-data {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
  margin-top: 12px;
}

.live-data > div {
  padding: 10px;
  border-radius: 10px;
  background: #f5f8f5;
}

.live-data span,
.live-data strong {
  display: block;
}

.live-data span {
  margin-bottom: 3px;
  color: #667169;
  font-size: .72rem;
}

.live-data strong { font-size: .87rem; }

.checkpoint-list {
  display: grid;
  gap: 8px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.checkpoint-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 9px;
  border-radius: 10px;
  background: #f7f9f7;
}

.checkpoint-item.current {
  outline: 2px solid #74bd89;
  background: #f1faf3;
}

.checkpoint-name { font-weight: 750; font-size: .86rem; }
.checkpoint-state { color: #68726b; font-size: .72rem; }

.actions {
  display: grid;
  grid-template-columns: 1fr .55fr;
  gap: 9px;
}

.actions button {
  min-height: 42px;
  border-radius: 10px;
  border: 1px solid #b9c7bc;
  background: #fff;
  cursor: pointer;
}

.actions .primary {
  color: #fff;
  font-weight: 800;
  background: #116530;
  border-color: #116530;
}

.actions .link-button {
  grid-column: 1 / -1;
  min-height: 34px;
  border: 0;
  background: transparent;
  color: #5a655d;
}

.actions button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

.tools {
  margin-top: 14px;
  padding: 12px;
  border-radius: 12px;
  background: #eef2ef;
  font-size: .82rem;
}

.tools summary { font-weight: 800; cursor: pointer; }

.toggle {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

#debug-tools { margin-top: 10px; }

.safety {
  margin: 14px 0 0;
  color: #6b5b32;
  font-size: .78rem;
}

.admin-banner {
  margin-bottom: 14px;
  padding: 10px 12px;
  border-radius: 10px;
  color: #6b3f00;
  background: #fff0cf;
  border: 1px solid #edc67e;
  font-size: .78rem;
  font-weight: 750;
}

.map {
  width: 100%;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  position: relative;
  background: #dfe8df;
}

#surprise-map .leaflet-tile,
#surprise-map img {
  max-width: none !important;
  max-height: none !important;
}

.checkpoint-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #5f6f64;
  border: 3px solid #fff;
  font-size: .78rem;
  font-weight: 900;
  box-shadow: 0 3px 10px rgb(0 0 0 / 28%);
}

.checkpoint-icon.current { background: #e88d16; }
.checkpoint-icon.complete { background: #188443; }
.checkpoint-icon.reward { background: #ffc744; color: #442c00; }

.user-location {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #1f6fff;
  border: 4px solid #fff;
  box-shadow: 0 2px 10px rgb(31 111 255 / 55%);
}

[hidden] { display: none !important; }

@media (max-width: 820px) {
  body { overflow: auto; }

  .topbar {
    min-height: 58px;
    height: auto;
    padding: 12px 16px;
  }

  .topbar nav {
    overflow-x: auto;
  }

  .topbar nav a {
    white-space: nowrap;
    font-size: .77rem;
  }

  .layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: calc(100vh - 58px);
  }

  .map {
    min-height: 46vh;
    order: 1;
  }

  .panel {
    order: 2;
    overflow: visible;
    border-right: 0;
    border-top: 1px solid #dfe5e0;
  }
}
