:root {
  --bg: #fafaf8;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e8e6e1;
  --accent: #fdbb30;
  --accent-dark: #e5a520;
  --available: #9ca3af;
  --claimed: #d97706;
  --completed: #059669;
  --danger: #dc2626;
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  --radius: 14px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 16px;
}

a {
  color: inherit;
  text-decoration: none;
}

img {
  max-width: 100%;
  display: block;
}

.container {
  width: min(960px, 100% - 2rem);
  margin: 0 auto;
}

.site-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header .inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.9rem 0;
}

.brand {
  font-weight: 700;
  font-size: 1.05rem;
}

.brand span {
  color: var(--muted);
  font-weight: 500;
  font-size: 0.85rem;
  display: block;
}

.nav {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.nav a,
.nav button {
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  font-size: 0.92rem;
}

.nav a:hover,
.nav a.active {
  background: #fff4d6;
}

main {
  padding: 1.5rem 0 3rem;
}

h1 {
  margin: 0 0 0.35rem;
  font-size: 1.65rem;
  line-height: 1.2;
}

.lead {
  color: var(--muted);
  margin: 0 0 1.25rem;
}

.flash {
  padding: 0.85rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
}

.flash.success {
  background: #ecfdf5;
  color: #065f46;
}

.flash.error {
  background: #fef2f2;
  color: #991b1b;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
}

.card-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 640px) {
  .card-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 900px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.stat-chips {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.chip {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.45rem 0.85rem;
  font-size: 0.9rem;
}

.chip strong {
  color: var(--text);
}

.filters {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.pill {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  font-size: 0.88rem;
}

.pill.active {
  background: var(--accent);
  border-color: var(--accent-dark);
  font-weight: 600;
}

.area-card {
  display: grid;
  gap: 0.75rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.area-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
}

.area-card .thumb {
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: #f3f4f6;
}

.area-card .thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.area-card h3 {
  margin: 0;
  font-size: 1rem;
}

.meta {
  color: var(--muted);
  font-size: 0.88rem;
}

.status {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.status.available {
  background: #f3f4f6;
  color: #4b5563;
}

.status.claimed {
  background: #fff7ed;
  color: var(--claimed);
}

.status.completed {
  background: #ecfdf5;
  color: var(--completed);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.7rem 1.2rem;
  border: none;
  border-radius: 999px;
  background: var(--accent);
  color: var(--text);
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.btn:hover {
  background: var(--accent-dark);
}

.btn.secondary {
  background: var(--surface);
  border: 1px solid var(--border);
}

.btn.danger {
  background: #fee2e2;
  color: var(--danger);
}

.btn-block {
  width: 100%;
}

.form-group {
  margin-bottom: 1rem;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 0.35rem;
  font-size: 0.92rem;
}

input,
textarea,
select {
  width: 100%;
  padding: 0.75rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--surface);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.auth-card {
  max-width: 420px;
  margin: 2rem auto;
}

.detail-hero {
  border-radius: var(--radius);
  overflow: hidden;
  cursor: zoom-in;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
}

.detail-grid {
  display: grid;
  gap: 1rem;
}

@media (min-width: 768px) {
  .detail-grid {
    grid-template-columns: 1.2fr 1fr;
  }
}

.detail-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin: 1rem 0;
}

.stat-box {
  background: #fffdf7;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem;
}

.stat-box .label {
  color: var(--muted);
  font-size: 0.82rem;
}

.stat-box .value {
  font-size: 1.35rem;
  font-weight: 700;
}

.collapsible summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.5rem 0;
}

.addresses {
  white-space: pre-wrap;
  color: var(--muted);
  font-size: 0.92rem;
}

.leaderboard-list {
  display: grid;
  gap: 0.65rem;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.leaderboard-row.top {
  background: #fffbeb;
  border-color: #fde68a;
}

.leaderboard-row.you {
  outline: 2px solid var(--accent);
}

.rank {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: 700;
  background: #f3f4f6;
  flex-shrink: 0;
}

.leaderboard-row.top .rank {
  background: var(--accent);
}

.lb-name {
  font-weight: 700;
  font-size: 1.05rem;
}

.lb-stats {
  margin-left: auto;
  color: var(--muted);
  font-size: 0.88rem;
  text-align: right;
}

.lightbox {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 100;
}

.lightbox.open {
  display: flex;
}

.lightbox-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 100%;
}

.lightbox img {
  max-height: 80vh;
  max-width: 100%;
  border-radius: 8px;
}

.lightbox-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  background: white;
  border: none;
  border-radius: 999px;
  width: 44px;
  height: 44px;
  font-size: 1.4rem;
  cursor: pointer;
}

.admin-links {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 1.25rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--muted);
}

.table {
  width: 100%;
  border-collapse: collapse;
}

.table th,
.table td {
  text-align: left;
  padding: 0.65rem 0.5rem;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.inline-form {
  display: inline;
}

.leaflet-delivery-fieldset {
  border: none;
  margin: 1.25rem 0;
  padding: 0;
}

.radio-card {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 0.65rem;
  cursor: pointer;
  background: var(--surface);
}

.radio-card:has(input:checked) {
  border-color: var(--accent-dark);
  background: #fffdf7;
}

.radio-card input {
  width: auto;
  margin-top: 0.2rem;
}

.radio-card strong {
  display: block;
}

.radio-card .meta {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.88rem;
}

.site-footer {
  border-top: 1px solid var(--border);
  padding: 1.25rem 0 2rem;
  margin-top: 1rem;
}

.site-footer .container {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.88rem;
  color: var(--muted);
}

.site-footer a {
  color: var(--text);
  text-decoration: underline;
}

.legal-page h2 {
  margin: 1.5rem 0 0.5rem;
  font-size: 1.1rem;
}

.legal-page ul {
  padding-left: 1.25rem;
}

.legal-page li {
  margin-bottom: 0.35rem;
}

.legal-page a {
  color: var(--text);
}

.save-status {
  font-size: 0.82rem;
  color: var(--muted);
  min-width: 4.5rem;
}

.save-status--ok {
  color: var(--completed);
  font-weight: 600;
}

.save-status--error {
  color: var(--danger);
  font-weight: 600;
}

.ajax-toast {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  background: #ecfdf5;
  color: #065f46;
  border: 1px solid #a7f3d0;
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
  box-shadow: var(--shadow);
  z-index: 50;
  font-size: 0.92rem;
  font-weight: 600;
}

.ajax-toast--error {
  background: #fef2f2;
  color: #991b1b;
  border-color: #fecaca;
}

tr.row-saved {
  background: #ecfdf5 !important;
  transition: background 0.3s ease;
}
