:root {
  --bg: #0d0d10;
  --surface: #1a1b20;
  --surface-2: #24262c;
  --line: #2f323a;
  --red: #ce1126;
  --red-bright: #e8253a;
  --text: #ffffff;
  --muted: #9aa0ab;
  --header-h: 58px;
}

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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overscroll-behavior: none;
}

/* ===== TOP BAR ===== */
#topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 1200;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 14px 0;
  background: #0a0a0c;
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
}

.brand { display: flex; align-items: center; gap: 10px; }

.brand-mark {
  width: 30px; height: 30px; background: var(--red);
  display: flex; align-items: center; justify-content: center;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

#topbar h1 {
  font-family: 'Oswald', sans-serif;
  font-size: 21px; font-weight: 700; letter-spacing: 2.5px;
}

.live-badge {
  font-family: 'Oswald', sans-serif; font-size: 10px; font-weight: 600;
  letter-spacing: 1.2px; color: #fff; background: var(--red);
  padding: 3px 7px; border-radius: 2px;
}

nav { display: flex; gap: 4px; }

.nav-btn {
  font-family: 'Oswald', sans-serif; font-size: 13px; font-weight: 600;
  letter-spacing: 1.5px; color: var(--muted);
  background: none; border: none; padding: 10px 12px;
  border-bottom: 3px solid transparent; cursor: pointer;
}
.nav-btn.active { color: #fff; border-bottom-color: var(--red); }

/* ===== MAP ===== */
main { position: fixed; inset: 0; padding-top: calc(var(--header-h) + env(safe-area-inset-top)); }

#map {
  width: 100%; height: 100%;
  background: var(--bg);
}

/* dark-mode map: invert keyless OSM tiles into the NHL dark palette */
#map .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) saturate(0.55) brightness(0.82) contrast(1.05);
}

.leaflet-control-attribution { background: rgba(10,10,12,.7) !important; color: var(--muted) !important; font-size: 9px !important; }
.leaflet-control-attribution a { color: var(--muted) !important; }

/* Leaflet zoom controls → NHL dark */
.leaflet-bar { border: 1px solid var(--line) !important; box-shadow: 0 4px 14px rgba(0,0,0,.45) !important; }
.leaflet-bar a {
  background: var(--surface) !important; color: #fff !important;
  border-bottom: 1px solid var(--line) !important; width: 44px !important; height: 44px !important;
  line-height: 42px !important; font-size: 20px !important;
}
.leaflet-bar a:first-child { border-radius: 3px 3px 0 0 !important; }
.leaflet-bar a:last-child { border-radius: 0 0 3px 3px !important; }
.leaflet-bar a:active, .leaflet-bar a:hover { background: var(--red) !important; }

.map-controls {
  position: absolute; right: 14px; bottom: 120px; z-index: 1000;
  display: flex; flex-direction: column; gap: 10px;
}

.map-btn {
  width: 48px; height: 48px;
  background: var(--surface); color: #fff;
  border: 1px solid var(--line); border-radius: 4px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; box-shadow: 0 4px 14px rgba(0,0,0,.45);
}
.map-btn:active { background: var(--red); }

/* custom pin */
.art-pin {
  width: 30px; height: 30px; border-radius: 50% 50% 50% 0;
  background: var(--red); border: 2px solid #fff;
  transform: rotate(-45deg);
  box-shadow: 0 3px 10px rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center;
}
.art-pin::after {
  content: ''; width: 9px; height: 9px; border-radius: 50%;
  background: #fff; transform: rotate(45deg);
}
.art-pin.sel { background: var(--red-bright); box-shadow: 0 0 0 6px rgba(206,17,38,.35), 0 3px 10px rgba(0,0,0,.6); }

/* pick hint */
.pick-hint {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  z-index: 1100; display: flex; align-items: center; gap: 12px;
  background: var(--red); padding: 10px 14px; border-radius: 4px;
  font-family: 'Oswald', sans-serif; font-size: 12px; letter-spacing: 1.4px;
  box-shadow: 0 6px 18px rgba(0,0,0,.5);
}
.pick-hint button {
  background: #fff; color: var(--red); border: none; border-radius: 3px;
  font-family: 'Oswald', sans-serif; font-size: 11px; letter-spacing: 1px;
  padding: 6px 10px; cursor: pointer;
}

/* ===== FAB ===== */
.fab {
  position: fixed; z-index: 1100;
  left: 50%; transform: translateX(-50%);
  bottom: calc(22px + env(safe-area-inset-bottom));
  display: flex; align-items: center; gap: 10px;
  background: var(--red); color: #fff;
  border: none; border-radius: 4px;
  padding: 15px 26px;
  font-family: 'Oswald', sans-serif; font-size: 16px; font-weight: 600;
  letter-spacing: 2px; cursor: pointer;
  box-shadow: 0 8px 24px rgba(206,17,38,.45), 0 4px 12px rgba(0,0,0,.5);
}
.fab:active { background: var(--red-bright); transform: translateX(-50%) scale(.97); }

/* ===== LIST ===== */
#listView {
  position: absolute; inset: 0; overflow-y: auto; z-index: 950;
  background: var(--bg); padding: 18px 16px 120px;
  -webkit-overflow-scrolling: touch;
}

.list-head h2 {
  font-family: 'Oswald', sans-serif; font-size: 24px; letter-spacing: 2.5px;
  padding-bottom: 6px; border-bottom: 3px solid var(--red); display: inline-block;
}
.list-sub { display: block; color: var(--muted); font-size: 13px; margin: 10px 0 18px; }

.list-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 4px; overflow: hidden; margin-bottom: 14px;
  cursor: pointer;
}
.list-card img { width: 100%; height: 190px; object-fit: cover; display: block; }
.list-card .lc-body { padding: 13px 15px; }
.list-card .lc-text {
  font-size: 15px; font-weight: 600; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.list-card .lc-meta { color: var(--muted); font-size: 12px; margin-top: 7px; letter-spacing: .3px; }

.empty-note {
  border: 1px dashed var(--line); border-radius: 4px;
  padding: 40px 20px; text-align: center; color: var(--muted);
  font-family: 'Oswald', sans-serif; letter-spacing: 1.5px; font-size: 14px;
}

/* ===== SHEETS ===== */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 1300;
  background: rgba(0,0,0,.6);
}

.sheet {
  position: fixed; z-index: 1400;
  left: 0; right: 0; bottom: 0;
  background: var(--surface);
  border-top: 3px solid var(--red);
  border-radius: 10px 10px 0 0;
  padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
  max-height: 88vh; overflow-y: auto;
  box-shadow: 0 -10px 40px rgba(0,0,0,.6);
  animation: slideUp .22s ease;
}

@keyframes slideUp { from { transform: translateY(60px); opacity: .5; } to { transform: translateY(0); opacity: 1; } }

.sheet-grip {
  width: 44px; height: 4px; border-radius: 2px;
  background: var(--line); margin: 4px auto 14px;
}

.sheet-title {
  font-family: 'Oswald', sans-serif; font-size: 19px; letter-spacing: 2.2px;
  padding-bottom: 10px; margin-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.loc-row {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: 4px; padding: 10px 12px; margin-bottom: 18px;
}
.loc-info { flex: 1; min-width: 0; }
.loc-label {
  display: block; font-family: 'Oswald', sans-serif;
  font-size: 10px; letter-spacing: 1.4px; color: var(--muted);
}
.loc-value {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block;
}

.btn-outline {
  font-family: 'Oswald', sans-serif; font-size: 11px; letter-spacing: 1.2px;
  background: none; color: #fff; border: 1px solid var(--muted);
  border-radius: 3px; padding: 10px 11px; cursor: pointer; white-space: nowrap;
}
.btn-outline:active { border-color: var(--red); color: var(--red-bright); }

.field-label {
  display: block; font-family: 'Oswald', sans-serif;
  font-size: 11px; letter-spacing: 1.6px; color: var(--muted); margin-bottom: 8px;
}
.optional { color: var(--line); letter-spacing: .5px; }

textarea {
  width: 100%; background: var(--surface-2); color: #fff;
  border: 1px solid var(--line); border-radius: 4px;
  padding: 13px; font-family: 'Inter', sans-serif; font-size: 15px;
  resize: none; margin-bottom: 18px; outline: none;
}
textarea:focus { border-color: var(--red); }

.photo-row { display: flex; gap: 12px; align-items: center; margin-bottom: 22px; }

.photo-pick {
  display: flex; align-items: center; gap: 9px;
  border: 1px dashed var(--muted); border-radius: 4px;
  padding: 15px 18px; cursor: pointer;
  font-family: 'Oswald', sans-serif; font-size: 12px; letter-spacing: 1.5px;
  color: var(--muted);
}
.photo-pick:active { border-color: var(--red); color: #fff; }
.photo-pick input { display: none; }

.photo-preview { position: relative; }
.photo-preview img {
  width: 92px; height: 92px; object-fit: cover;
  border-radius: 4px; border: 1px solid var(--line);
}
.photo-remove {
  position: absolute; top: -7px; right: -7px;
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--red); color: #fff; border: 2px solid var(--surface);
  font-size: 11px; cursor: pointer;
}

.btn-primary {
  width: 100%; background: var(--red); color: #fff;
  border: none; border-radius: 4px; padding: 17px;
  font-family: 'Oswald', sans-serif; font-size: 16px; font-weight: 600;
  letter-spacing: 2.2px; cursor: pointer; margin-bottom: 10px;
}
.btn-primary:disabled { background: var(--surface-2); color: var(--line); cursor: not-allowed; }
.btn-primary:not(:disabled):active { background: var(--red-bright); }

.btn-ghost {
  width: 100%; background: none; color: var(--muted);
  border: 1px solid var(--line); border-radius: 4px; padding: 13px;
  font-family: 'Oswald', sans-serif; font-size: 13px; letter-spacing: 1.8px; cursor: pointer;
}

.btn-danger {
  width: 100%; background: none; color: var(--red-bright);
  border: 1px solid var(--red); border-radius: 4px; padding: 13px;
  font-family: 'Oswald', sans-serif; font-size: 13px; letter-spacing: 1.8px;
  cursor: pointer; margin-top: 4px;
}

.detail-img-wrap { margin: -10px -18px 16px; }
.detail-img-wrap img { width: 100%; max-height: 300px; object-fit: cover; display: block; }

.detail-text { font-size: 15px; line-height: 1.55; margin-bottom: 12px; }
.detail-meta {
  display: flex; justify-content: space-between; gap: 10px;
  color: var(--muted); font-size: 12px; letter-spacing: .4px;
  padding: 12px 0 18px; border-top: 1px solid var(--line); margin-top: 8px;
}

/* toast */
.toast {
  position: fixed; z-index: 2000;
  left: 50%; transform: translateX(-50%);
  top: calc(var(--header-h) + env(safe-area-inset-top) + 16px);
  background: var(--red); color: #fff;
  font-family: 'Oswald', sans-serif; font-size: 13px; letter-spacing: 1.6px;
  padding: 13px 22px; border-radius: 4px;
  box-shadow: 0 8px 24px rgba(0,0,0,.5);
  animation: slideUp .2s ease;
}

.hidden { display: none !important; }

@media (min-width: 700px) {
  .sheet { left: 50%; transform: translateX(-50%); width: 480px; border-radius: 10px; bottom: 24px; }
  .fab { bottom: 30px; }
  .map-controls { bottom: 130px; right: 20px; }
}
