/* ── 共通リセット ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── トグルスイッチ ── */
.toggle-container {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #ccc;
}
.toggle-label {
  font-weight: 600;
  white-space: nowrap;
}
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 22px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0; left: 0; right: 0; bottom: 0;
  background-color: #333;
  transition: .3s;
  border-radius: 22px;
  border: 1px solid #444;
}
.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: #aaa;
  transition: .3s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: rgba(167, 139, 250, 0.3);
  border-color: #a78bfa;
}
input:checked + .slider:before {
  transform: translateX(22px);
  background-color: #a78bfa;
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.6);
}

/* ── 星空解説モーダル ── */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(10, 10, 12, 0.75);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 3000;
  display: flex;
  justify-content: center;
  align-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}
.modal-content {
  background: rgba(22, 27, 34, 0.9);
  border: 1px solid rgba(240, 246, 252, 0.1);
  border-radius: 24px;
  width: 90%;
  max-width: 620px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 30px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  animation: zoomIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
@keyframes zoomIn {
  from { transform: scale(0.95); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(240, 246, 252, 0.1);
  padding-bottom: 14px;
  margin-bottom: 20px;
}
.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 800;
  color: #a78bfa;
}
.modal-close {
  background: transparent;
  border: none;
  color: #8b949e;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}
.modal-close:hover { color: #f0f6fc; }
.modal-body {
  font-size: 0.85rem;
  line-height: 1.6;
  color: #c9d1d9;
  text-align: left;
}
.modal-body h3 {
  font-size: 0.95rem;
  margin: 18px 0 8px;
  color: #f0f6fc;
  border-left: 3px solid #a78bfa;
  padding-left: 8px;
}
.modal-body p { margin-bottom: 12px; }
.bortle-table {
  width: 100%;
  border-collapse: collapse;
  margin: 15px 0;
  font-size: 0.78rem;
}
.bortle-table th, .bortle-table td {
  border: 1px solid rgba(240, 246, 252, 0.1);
  padding: 8px 10px;
  text-align: left;
}
.bortle-table th {
  background: rgba(167, 139, 250, 0.1);
  color: #a78bfa;
}
.bortle-table tr:nth-child(even) {
  background: rgba(240, 246, 252, 0.02);
}
.bortle-badge {
  display: inline-block;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: bold;
}
.credit-box {
  background: rgba(240, 246, 252, 0.04);
  border: 1px dashed rgba(240, 246, 252, 0.15);
  border-radius: 12px;
  padding: 15px;
  margin-top: 20px;
  font-size: 0.78rem;
  color: #8b949e;
}
.credit-box a { color: #58a6ff; text-decoration: none; }
.credit-box a:hover { text-decoration: underline; }

/* ── 星空ボタン（Leaflet コントロール内で使用） ── */
.sky-info-btn {
  background: rgba(167, 139, 250, 0.2);
  border: 1px solid rgba(167, 139, 250, 0.4);
  color: #a78bfa;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.sky-info-btn:hover {
  background: rgba(167, 139, 250, 0.35);
  border-color: #a78bfa;
  transform: translateY(-2px);
}

/* ── ローディング共通 ── */
#loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 2000;
  background: rgba(22, 27, 34, 0.96);
  border: 1px solid rgba(240, 246, 252, 0.1);
  border-radius: 20px;
  padding: 30px 45px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0,0,0,0.6);
  backdrop-filter: blur(12px);
}
#loading .spinner {
  width: 45px; height: 45px;
  border: 3px solid rgba(240, 246, 252, 0.1);
  border-top-color: #a78bfa;
  border-radius: 50%;
  animation: spin .8s linear infinite;
  margin: 0 auto 16px;
}
#loading p { font-size: 0.95rem; color: #c9d1d9; font-weight: 400; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Leaflet ポップアップ ── */
.leaflet-popup-content-wrapper {
  background: #18181b;
  color: #f0f0f0;
  border: 1px solid #333;
  border-radius: 10px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  padding: 0;
}
.leaflet-popup-tip { background: #18181b; }

/* スマホ：テーブルをスクロール可能に */
@media (max-width: 640px) {
  .modal-content { padding: 20px 16px; }
  .modal-header h2 { font-size: 0.95rem; }
  .bortle-table { display: block; overflow-x: auto; white-space: nowrap; }
}
