:root {
  --primary: #6366f1;
  --primary-glow: rgba(99, 102, 241, 0.4);
  --accent: #38bdf8;
  --danger: #f43f5e;
  --danger-glow: rgba(244, 63, 94, 0.35);
  
  --bg-dark: #090d16;
  --panel-bg: rgba(255, 255, 255, 0.94);
  --panel-border: rgba(255, 255, 255, 0.6);
  
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-light: #94a3b8;
  
  --tr-fast: 0.15s cubic-bezier(0.4, 0, 0.2, 1);
  --tr-smooth: 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: 'Prompt', -apple-system, BlinkMacSystemFont, Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  background-color: var(--bg-dark);
  color: var(--text-main);
  overflow: hidden;
}

.navbar {
  position: absolute;
  top: 18px;
  left: 24px;
  right: 24px;
  height: 54px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 0 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.5),
              0 0 0 1px rgba(255, 255, 255, 0.05) inset;
  z-index: 1000;
  transition: transform var(--tr-smooth), box-shadow var(--tr-smooth);
}

.navbar:hover {
  box-shadow: 0 14px 35px -8px rgba(0, 0, 0, 0.6),
              0 0 0 1px rgba(255, 255, 255, 0.1) inset;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(56, 189, 248, 0.2));
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  font-size: 1.15rem;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.25);
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: 0.4px;
  background: linear-gradient(135deg, #ffffff 0%, #cbd5e1 100%);
  background-clip: text;
  -webkit-text-fill-color: transparent;
  line-height: 1.2;
}

.brand-subtitle {
  font-size: 0.65rem;
  font-weight: 600;
  color: #94a3b8;
  letter-spacing: 0.6px;
  text-transform: uppercase;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.pool-badge {
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  backdrop-filter: blur(8px);
}

.status-indicator {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #10b981;
  box-shadow: 0 0 8px #10b981;
}

.main-container {
  display: flex;
  flex: 1;
  position: relative;
  width: 100%;
  height: 100vh;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

.custom-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  background: linear-gradient(135deg, #6366f1, #3b82f6);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.45);
  border: 2px solid #ffffff;
  cursor: pointer;
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.25s ease;
}

.custom-pin-inner {
  transform: rotate(45deg);
  font-size: 14px;
  line-height: 1;
}

.custom-pin:hover {
  transform: rotate(-45deg) scale(1.25);
  box-shadow: 0 6px 18px rgba(99, 102, 241, 0.6);
  z-index: 9999 !important;
}

.custom-pin.active-pin {
  background: linear-gradient(135deg, #f43f5e, #fb7185);
  box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.35), 0 8px 20px rgba(244, 63, 94, 0.5);
  transform: rotate(-45deg) scale(1.35);
  z-index: 10000 !important;
  animation: pulseGlow 1.8s infinite;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow: 0 0 0 4px rgba(244, 63, 94, 0.35), 0 8px 20px rgba(244, 63, 94, 0.5);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(244, 63, 94, 0.15), 0 10px 24px rgba(244, 63, 94, 0.7);
  }
}

.sidebar {
  position: absolute;
  bottom: 24px;
  left: 24px;
  width: 410px;
  max-width: calc(100vw - 48px);
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--panel-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-radius: 22px;
  padding: 24px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.25),
              0 0 0 1px var(--panel-border) inset;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: slideUp 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar::-webkit-scrollbar {
  width: 5px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 10px;
}

.tag-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.badge {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 5px 12px;
  border-radius: 9999px;
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge-category {
  background: #e0e7ff;
  color: #4338ca;
}

.badge-prefecture {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid rgba(0, 0, 0, 0.05);
}

.badge-rating {
  background: #fef3c7;
  color: #b45309;
  font-weight: 700;
}

.title-container {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.place-title {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.3;
}

.place-subtitle {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-muted);
}

.place-desc {
  font-size: 0.88rem;
  line-height: 1.6;
  color: #334155;
  background: rgba(250, 250, 250, 0.8);
  padding: 12px 14px;
  border-radius: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.03);
  border-right: 1px solid rgba(0, 0, 0, 0.03);
  border-bottom: 1px solid rgba(0, 0, 0, 0.03);
}

.place-coords {
  font-size: 0.8rem;
  color: var(--text-light);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 18px;
  border-radius: 12px;
  font-size: 0.95rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  border: none;
  transition: transform var(--tr-fast), box-shadow var(--tr-fast), background-color var(--tr-fast);
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.btn-primary:hover:not(:disabled) {
  background: #4f46e5;
  box-shadow: 0 6px 20px var(--primary-glow);
  transform: translateY(-1px);
}

.btn-primary:disabled {
  background: #cbd5e1;
  color: #94a3b8;
  cursor: not-allowed;
}

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--danger-glow);
}

.btn-danger:hover {
  background: #e11d48;
  box-shadow: 0 6px 20px var(--danger-glow);
  transform: translateY(-1px);
}

.status-box {
  margin-top: 2px;
  text-align: center;
}

.status-box p {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.leaflet-top.leaflet-right {
  top: 84px !important;
  right: 24px !important;
}

.leaflet-control-layers {
  background: var(--panel-bg) !important;
  backdrop-filter: blur(16px) !important;
  -webkit-backdrop-filter: blur(16px) !important;
  border-radius: 16px !important;
  border: 1px solid var(--panel-border) !important;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.2) !important;
  overflow: hidden !important;
  transform-origin: top right !important;
  transition: width 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              height 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              padding 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              transform 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              box-shadow 0.35s cubic-bezier(0.16, 1, 0.3, 1),
              border-radius 0.35s cubic-bezier(0.16, 1, 0.3, 1) !important;
}

.leaflet-control-layers:not(.leaflet-control-layers-expanded) {
  width: 44px !important;
  height: 44px !important;
  padding: 0 !important;
  border-radius: 14px !important;
  transform: scale(0.95);
}

.leaflet-control-layers:not(.leaflet-control-layers-expanded):hover {
  transform: scale(1.03);
  box-shadow: 0 12px 28px -4px rgba(99, 102, 241, 0.35) !important;
}

.leaflet-control-layers:not(.leaflet-control-layers-expanded) .leaflet-control-layers-toggle {
  opacity: 1;
  transition: opacity 0.2s ease;
}

.leaflet-control-layers:not(.leaflet-control-layers-expanded) .leaflet-control-layers-list {
  opacity: 0;
  pointer-events: none;
  transform: translateY(-8px) scale(0.95);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.leaflet-control-layers-expanded {
  width: 330px !important;
  height: auto !important;
  max-height: calc(100vh - 180px) !important;
  padding: 16px 18px !important;
  border-radius: 18px !important;
  transform: scale(1) !important;
  box-shadow: 0 20px 45px -10px rgba(0, 0, 0, 0.32),
              0 0 0 1px rgba(255, 255, 255, 0.8) inset !important;
}

.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
  display: none !important;
}

.leaflet-control-layers-expanded .leaflet-control-layers-list {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  transition: opacity 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.08s,
              transform 0.3s cubic-bezier(0.16, 1, 0.3, 1) 0.08s;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}

.leaflet-control-layers-list::-webkit-scrollbar {
  width: 4px;
}

.leaflet-control-layers-list::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.15);
  border-radius: 8px;
}

.leaflet-control-layers-base label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 6px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.leaflet-control-layers-base label:last-child {
  margin-bottom: 0;
}

.leaflet-control-layers-base label:hover {
  background: rgba(99, 102, 241, 0.1);
  color: var(--primary);
  transform: translateX(4px);
}

.leaflet-control-layers-base input[type="radio"] {
  accent-color: var(--primary);
  cursor: pointer;
}

.leaflet-popup-content-wrapper {
  background: rgba(255, 255, 255, 0.96) !important;
  backdrop-filter: blur(10px) !important;
  border-radius: 14px !important;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2) !important;
  padding: 6px !important;
}

.leaflet-popup-tip {
  background: rgba(255, 255, 255, 0.96) !important;
}

.leaflet-control-zoom {
  display: none !important;
}

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

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 768px) {
  .navbar {
    top: 10px;
    left: 10px;
    right: 10px;
    height: 48px;
    padding: 0 14px;
    border-radius: 14px;
  }

  .logo-badge {
    width: 28px;
    height: 28px;
    font-size: 0.95rem;
    border-radius: 8px;
  }

  .brand-title {
    font-size: 0.88rem;
  }

  .brand-subtitle {
    display: none;
  }

  .pool-badge {
    padding: 4px 10px;
    font-size: 0.72rem;
  }

  .leaflet-top.leaflet-right {
    top: 68px !important;
    right: 10px !important;
  }

  .leaflet-control-layers-expanded {
    width: calc(100vw - 32px) !important;
    max-width: 300px !important;
    max-height: calc(100vh - 260px) !important;
    padding: 12px 14px !important;
  }

  .sidebar {
    bottom: 12px;
    left: 10px;
    right: 10px;
    width: auto;
    max-width: none;
    max-height: 46vh;
    border-radius: 18px;
    padding: 16px;
    gap: 10px;
  }

  .place-title {
    font-size: 1.15rem;
  }

  .place-subtitle {
    font-size: 0.8rem;
  }

  .place-desc {
    font-size: 0.82rem;
    line-height: 1.5;
    padding: 10px 12px;
  }

  .btn {
    padding: 11px 14px;
    font-size: 0.88rem;
    border-radius: 10px;
  }
}

@media (max-width: 480px) {
  .tag-row {
    gap: 6px;
  }

  .badge {
    font-size: 0.7rem;
    padding: 3px 8px;
  }

  .action-buttons {
    gap: 8px;
  }

  .status-box p {
    font-size: 0.75rem;
  }
}