:root {
  --bg: #f4f1ea;
  --card: #ffffff;
  --text: #2b2b2b;
  --muted: #6b6b6b;
  --accent: #d9534f;
  --accent-dark: #b8433f;
  --success: #3f9142;
  --success-bg: #e6f4e6;
  --warn: #c98a12;
  --border: #e2ddd0;
  --radius: 14px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header.topbar {
  padding: 14px 16px;
  background: var(--accent);
  color: white;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 500;
}

header.topbar h1 {
  font-size: 18px;
  margin: 0;
}

header.topbar .penalties {
  font-size: 13px;
  opacity: 0.95;
  text-align: right;
}

#map {
  height: 240px;
  width: 100%;
  border-bottom: 1px solid var(--border);
}

main {
  flex: 1;
  padding: 12px 14px 90px;
}

.hidden { display: none !important; }

/* Login screen */
#login-screen {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  padding: 24px;
  text-align: center;
}

#login-screen h1 {
  margin-bottom: 4px;
}

#login-screen p {
  color: var(--muted);
  margin-top: 0;
}

.login-form {
  width: 100%;
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

input, select, textarea {
  font-size: 16px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: white;
  width: 100%;
}

button {
  font-size: 16px;
  font-weight: 600;
  padding: 13px 18px;
  border-radius: 10px;
  border: none;
  background: var(--accent);
  color: white;
  cursor: pointer;
}

button:active { background: var(--accent-dark); }
button.secondary {
  background: white;
  color: var(--accent);
  border: 1px solid var(--accent);
}
button:disabled {
  opacity: 0.5;
  cursor: default;
}

.error-msg {
  color: var(--accent-dark);
  font-size: 14px;
  min-height: 18px;
}

/* Location list */
.loc-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  cursor: pointer;
}

.loc-card.completed {
  border-color: var(--success);
  background: var(--success-bg);
}

.loc-card .row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.loc-card h3 {
  margin: 0 0 4px;
  font-size: 16px;
}

.loc-card .clue {
  color: var(--muted);
  font-size: 14px;
  margin: 4px 0 0;
}

.badge {
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge.not_visited { background: #eee; color: #777; }
.badge.checked_in { background: #fdf0d5; color: var(--warn); }
.badge.completed { background: var(--success); color: white; }

/* Detail / modal */
.sheet-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: flex-end;
  z-index: 1000;
}

.sheet {
  background: white;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  border-radius: 18px 18px 0 0;
  padding: 20px 18px 28px;
  max-height: 85vh;
  overflow-y: auto;
}

.sheet h2 {
  margin-top: 0;
}

.sheet .close-btn {
  float: right;
  background: none;
  color: var(--muted);
  font-size: 22px;
  padding: 0 6px;
  line-height: 1;
}

.mission-box {
  background: var(--bg);
  border-radius: 12px;
  padding: 14px;
  margin: 14px 0;
}

.mission-box .equip {
  color: var(--warn);
  font-weight: 600;
  margin-top: 8px;
}

.feedback {
  margin-top: 10px;
  font-weight: 600;
}
.feedback.ok { color: var(--success); }
.feedback.fail { color: var(--accent-dark); }

.progress-bar-outer {
  width: 100%;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
  margin-top: 10px;
}
.progress-bar-inner {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s;
}

.status-line {
  font-size: 13px;
  color: var(--muted);
  margin-top: 8px;
}

footer.hint {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 10px;
}

.leaflet-div-icon {
  background: transparent;
  border: none;
}
.pin {
  width: 26px;
  height: 26px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: var(--accent);
  border: 2px solid white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.4);
}
.pin.completed { background: var(--success); }
.pin.checked_in { background: var(--warn); }
.you-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #2b7cff;
  border: 3px solid white;
  box-shadow: 0 0 0 3px rgba(43,124,255,0.3);
}
