:root {
  --gold: #C8963E;
  --gold-light: #E8C06A;
  --gold-dark: #A07830;
  --bg-dark: #0f1923;
  --bg-panel: rgba(12, 20, 30, 0.92);
  --bg-card: rgba(20, 32, 48, 0.95);
  --text: #e8e8e8;
  --text-muted: #8899aa;
  --accent-red: #d44040;
  --radius: 10px;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: var(--bg-dark);
  color: var(--text);
  overflow: hidden;
}

/* ─── Header ─── */
#header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1100;
  height: 56px;
  background: linear-gradient(180deg, rgba(12,20,30,0.95) 0%, rgba(12,20,30,0.8) 80%, transparent 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  pointer-events: none;
}
#header > * { pointer-events: auto; }

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

.header-logo {
  flex-shrink: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
}

.header-text h1 {
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.05em;
  color: #fff;
  line-height: 1.2;
}
.header-text p {
  font-size: 11px;
  color: var(--gold-light);
  letter-spacing: 0.08em;
}

.header-stats {
  font-size: 13px;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 6px 14px;
  border-radius: 20px;
  border: 1px solid rgba(200,150,62,0.2);
}
.stat-count, .stat-mountains {
  color: var(--gold-light);
  font-weight: 700;
}

/* ─── Map ─── */
#map {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
}

/* ─── Custom Marker ─── */
.marker-pin {
  width: 32px !important;
  height: 32px !important;
  margin-left: -16px !important;
  margin-top: -16px !important;
  cursor: pointer;
}
.marker-pin svg {
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.4));
  transition: transform 0.2s ease;
}
.marker-pin:hover svg {
  transform: scale(1.2);
}

/* ─── Cluster ─── */
.marker-cluster-small,
.marker-cluster-medium,
.marker-cluster-large {
  background: rgba(200,150,62,0.25) !important;
}
.marker-cluster-small div,
.marker-cluster-medium div,
.marker-cluster-large div {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%) !important;
  color: #fff !important;
  font-weight: 700;
  font-size: 13px;
  box-shadow: 0 2px 8px rgba(200,150,62,0.4);
}

/* ─── Sidebar ─── */
#sidebar {
  position: fixed;
  top: 64px;
  right: 12px;
  z-index: 1000;
  width: 280px;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: var(--radius);
  padding: 16px;
  border: 1px solid rgba(200,150,62,0.15);
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  transition: transform 0.3s ease, opacity 0.3s ease;
}

.sidebar-section {
  margin-bottom: 14px;
}

.section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--gold-light);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 8px;
}

.input-wrapper {
  display: flex;
  align-items: center;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px 12px;
  transition: border-color 0.2s;
}
.input-wrapper:focus-within {
  border-color: var(--gold);
}

.input-icon {
  color: var(--text-muted);
  margin-right: 8px;
  flex-shrink: 0;
}

#search-input {
  background: transparent;
  border: none;
  outline: none;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  width: 100%;
}
#search-input::placeholder {
  color: rgba(255,255,255,0.3);
}

#mountain-select {
  width: 100%;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.06);
  color: var(--text);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238899aa' stroke-width='2' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  transition: border-color 0.2s;
}
#mountain-select:focus {
  border-color: var(--gold);
  outline: none;
}
#mountain-select option {
  background: #1a2a3a;
  color: var(--text);
}

.filter-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.filter-btn {
  padding: 5px 12px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.15);
  background: transparent;
  color: var(--text-muted);
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}
.filter-btn:hover {
  background: rgba(200,150,62,0.15);
  border-color: rgba(200,150,62,0.4);
  color: var(--text);
}
.filter-btn.active {
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  border-color: var(--gold);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(200,150,62,0.3);
}

#reset-btn {
  width: 100%;
  padding: 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}
#reset-btn:hover {
  background: rgba(200,150,62,0.1);
  border-color: rgba(200,150,62,0.3);
  color: var(--text);
}

/* ─── Sidebar Toggle (mobile) ─── */
#sidebar-toggle {
  display: none;
  position: fixed;
  top: 64px;
  right: 12px;
  z-index: 1001;
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid rgba(200,150,62,0.2);
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  color: var(--gold-light);
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

/* ─── Modal ─── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  backdrop-filter: blur(4px);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.2s ease;
}
#modal-overlay.hidden {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
@keyframes slideUp {
  from { opacity: 0; transform: translateY(20px) scale(0.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

#modal {
  background: var(--bg-card);
  border: 1px solid rgba(200,150,62,0.2);
  border-radius: 16px;
  max-width: 420px;
  width: 92%;
  padding: 0;
  position: relative;
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
  overflow: hidden;
  animation: slideUp 0.3s ease;
}

#modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  width: 32px;
  height: 32px;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}
#modal-close:hover {
  background: rgba(0,0,0,0.8);
}

#modal-content .modal-thumbnail-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 16/9;
  overflow: hidden;
  cursor: pointer;
}
#modal-content .modal-thumbnail {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.3s ease;
}
#modal-content .modal-thumbnail-wrap:hover .modal-thumbnail {
  transform: scale(1.03);
}
#modal-content .play-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 56px;
  height: 56px;
  background: rgba(200,150,62,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0,0,0,0.3);
  pointer-events: none;
  transition: transform 0.2s;
}
#modal-content .modal-thumbnail-wrap:hover .play-icon {
  transform: translate(-50%, -50%) scale(1.1);
}
#modal-content .play-icon svg {
  margin-left: 3px;
}

#modal-content .modal-body {
  padding: 16px 20px 20px;
}
#modal-content .modal-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.5;
  margin-bottom: 14px;
}
#modal-content .modal-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dark) 100%);
  color: #fff;
  text-decoration: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 12px rgba(200,150,62,0.3);
}
#modal-content .modal-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(200,150,62,0.4);
}

/* ─── Leaflet tooltip ─── */
.leaflet-tooltip {
  background: var(--bg-card) !important;
  color: var(--text) !important;
  border: 1px solid rgba(200,150,62,0.25) !important;
  border-radius: 8px !important;
  padding: 6px 12px !important;
  font-size: 12px !important;
  font-family: 'Noto Sans JP', sans-serif !important;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4) !important;
}
.leaflet-tooltip-left::before {
  border-left-color: var(--bg-card) !important;
}
.leaflet-tooltip-right::before {
  border-right-color: var(--bg-card) !important;
}
.leaflet-tooltip-top::before {
  border-top-color: var(--bg-card) !important;
}
.leaflet-tooltip-bottom::before {
  border-bottom-color: var(--bg-card) !important;
}

/* Leaflet controls style */
.leaflet-control-zoom a {
  background: var(--bg-card) !important;
  color: var(--gold-light) !important;
  border-color: rgba(200,150,62,0.2) !important;
}
.leaflet-control-zoom a:hover {
  background: rgba(200,150,62,0.2) !important;
  color: #fff !important;
}
.leaflet-control-attribution {
  background: rgba(12,20,30,0.7) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
}
.leaflet-control-attribution a {
  color: var(--gold) !important;
}

/* ─── Mobile ─── */
@media (max-width: 640px) {
  #header {
    height: 48px;
    padding: 0 12px;
  }
  .header-text h1 { font-size: 15px; }
  .header-text p { font-size: 10px; }
  .header-stats { display: none; }
  .header-logo { width: 30px; height: 30px; }

  #sidebar-toggle { display: flex; }

  #sidebar {
    top: auto;
    bottom: 12px;
    right: 12px;
    left: 12px;
    width: auto;
    max-height: 50vh;
    overflow-y: auto;
    transform: translateY(120%);
    opacity: 0;
  }
  #sidebar.open {
    transform: translateY(0);
    opacity: 1;
  }

  #modal {
    max-width: 95%;
    border-radius: 14px;
  }
}
