/**
 * Cesium Heatbox Playground - スタイルシート
 * スマホ対応レスポンシブデザイン + Liquid Glass UI + 統一ナビゲーション
 */

/* === CSS Variables === */
:root {
  --hb-nav-height: 45px;
  --hb-nav-offset: 55px;
}

/* === 統一ナビゲーションバー === */
.hb-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--hb-nav-height);
  z-index: 1000;
  
  /* Liquid Glass navigation styling */
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
}

.hb-nav-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  height: 100%;
}

.hb-nav-left {
  display: flex;
  align-items: center;
}

.hb-nav-logo {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: white;
  font-weight: 600;
  transition: all 0.3s ease;
}

.hb-nav-logo:hover {
  color: #64b5f6;
}

.hb-nav-icon {
  font-size: 1.5rem;
  margin-right: 8px;
}

.hb-nav-title {
  font-size: 1.1rem;
}

.hb-nav-center {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hb-nav-link {
  color: rgba(255, 255, 255, 0.8);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: 20px;
  transition: all 0.3s ease;
  font-size: 0.9rem;
  font-weight: 500;
}

.hb-nav-link:hover {
  color: white;
  background: rgba(255, 255, 255, 0.1);
}

.hb-nav-link.active {
  color: #64b5f6;
  background: rgba(100, 181, 246, 0.15);
}

/* Nav dropdown stats visibility improvements */
.hb-dropdown .nav-stat-label,
.hb-dropdown .nav-stat-value,
.hb-dropdown .nav-ext-row span,
.hb-dropdown .nav-ext-row strong {
  color: #ffffff !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.hb-dropdown .nav-stats-header { color: #ffffff; }
.hb-dropdown .nav-ext-row { line-height: 1.3; }

.hb-nav-right {
  display: flex;
  align-items: center;
  position: relative;
}

/* Hide dropdown toggle by default (desktop) */
#navDropdownToggle { display: none; }
#navStats { display: none; }
.hb-nav-mobile-title { display: none; }

/* モバイル対応 */
@media (max-width: 768px) {
  .hb-nav-center {
    display: none;
  }
  
  .hb-nav-title {
    font-size: 1rem;
  }
  
  .hb-nav-content {
    padding: 0 15px;
  }
  
  /* Hide right-side spans except for navigation dropdown label */
  .hb-nav-right span:not(#navDropdownLabel) {
    display: none;
  }
  /* Hide right-side GitHub link entirely on mobile */
  .hb-nav-right .hb-nav-link {
    display: none;
  }
  
  .hb-nav-right .hb-nav-link:after {
    content: '';
  }

  /* Mobile dropdown toggle (right-top) */
  #navDropdownToggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between; /* テキストと三角印を両端に配置 */
    height: 36px;
    border-radius: 18px;
    margin-left: 8px;
    cursor: pointer;
    z-index: 1200;
    color: #ffffff !important; /* 白色で現在のモードを表示（!important追加） */
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.15); /* より見やすい背景 */
    backdrop-filter: blur(6px) saturate(120%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
    font-size: 13px !important;
    font-weight: 600 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    padding: 0 12px;
    white-space: nowrap;
    min-width: 100px;
    max-width: 140px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); /* テキストを際立たせる */
  }
  
  #navDropdownToggle:hover { 
    color: #ffffff !important; 
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.6);
  }
  
  /* ラベルとキャレットのスタイル */
  #navDropdownLabel {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
  }

  /* Mobile nav stats pill - REMOVED */
  
  /* モバイルタイトルを非表示（ドロップダウントグルに統合） */
  .hb-nav-mobile-title {
    display: none;
  }
}

/* Broaden mobile rule for tablets (landscape) */
@media (max-width: 1024px) {
  .hb-nav-center {
    display: none;
  }
  
  .hb-nav-title {
    font-size: 1rem;
  }
  
  .hb-nav-content {
    padding: 0 15px;
  }
  
  /* Hide right-side spans except for navigation dropdown label */
  .hb-nav-right span:not(#navDropdownLabel) {
    display: none;
  }
  /* Hide right-side GitHub link on tablet widths too */
  .hb-nav-right .hb-nav-link {
    display: none;
  }
  
  .hb-nav-right .hb-nav-link:after {
    content: '';
  }

  /* Tablet dropdown toggle (same as mobile) */
  #navDropdownToggle {
    display: inline-flex;
    align-items: center;
    justify-content: space-between; /* テキストと三角印を両端に配置 */
    height: 36px;
    border-radius: 18px;
    margin-left: 8px;
    cursor: pointer;
    z-index: 1200;
    color: #ffffff !important; /* 白色で現在のモードを表示（!important追加） */
    border: 1px solid rgba(255,255,255,0.4);
    background: rgba(255,255,255,0.15); /* より見やすい背景 */
    backdrop-filter: blur(6px) saturate(120%);
    -webkit-backdrop-filter: blur(6px) saturate(120%);
    font-size: 13px !important;
    font-weight: 600 !important;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    padding: 0 12px;
    white-space: nowrap;
    min-width: 100px;
    max-width: 140px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    text-shadow: 0 1px 2px rgba(0,0,0,0.5); /* テキストを際立たせる */
  }
  
  #navDropdownToggle:hover { 
    color: #ffffff !important; 
    background: rgba(255,255,255,0.25);
    border-color: rgba(255,255,255,0.6);
  }
  
  /* ラベルとキャレットのスタイル */
  #navDropdownLabel {
    flex: 1;
    text-align: left;
    overflow: hidden;
    text-overflow: ellipsis;
    color: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
  }

  /* Tablet nav stats pill - REMOVED */
  
  /* タブレットでもモバイルタイトルを非表示（ドロップダウントグルに統合） */
  .hb-nav-mobile-title {
    display: none;
  }
  /* Hide desktop info panel on mobile/tablet */
  #info { display: none; }
}

/* Hide right stats sidebar on tablet/mobile (<=1024px) */
@media (max-width: 1024px) {
  #info { display: none !important; }
  .nav-extended-stats { display: block; }
}

/* Extended stats default hidden on large screens */
@media (min-width: 1025px) {
  .nav-extended-stats { display: none !important; }
}

/* Extended stats layout */
.nav-extended-stats {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,0.18);
  font-size: 11px;
  line-height: 1.35;
}
.nav-extended-stats .nav-ext-section {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 10px;
  padding: 8px 10px;
  margin-top: 8px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.2);
}
.nav-extended-stats .nav-ext-row { 
  margin: 4px 0; 
  display: flex; 
  justify-content: space-between; 
  gap: 8px; 
}
.nav-extended-stats .nav-ext-row span,
.nav-extended-stats .nav-ext-row strong {
  color: #ffffff;
}
.nav-extended-stats strong { font-weight: 700; }
/* Subheader inside extended stats */
.nav-ext-subheader {
  font-size: 11px;
  letter-spacing: 0.4px;
  color: #ffffff;
  margin: 0 0 6px;
  font-weight: 700;
}

/* Ensure desktop shows the info panel */
@media (min-width: 1025px) {
  #info { display: block; }
}

/* Liquid Glass dropdown menu */
.hb-dropdown {
  position: absolute;
  top: calc(var(--hb-nav-height) + 6px);
  right: 10px;
  min-width: 220px;
  max-height: 400px;
  overflow-y: auto;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.08);
  backdrop-filter: blur(10px) saturate(120%);
  -webkit-backdrop-filter: blur(10px) saturate(120%);
  display: none;
  z-index: 1400;
  scrollbar-width: none; /* Firefox */
}
.hb-dropdown::-webkit-scrollbar { width: 0; height: 0; }
.hb-dropdown.open { display: block; }
.hb-dropdown a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: #e0e0e0;
  text-decoration: none;
  font-size: 14px;
}
.hb-dropdown a:hover {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
}

/* Navigation dropdown statistics section */
.nav-dropdown-divider {
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
  margin: 8px 4px;
}

.nav-dropdown-stats {
  padding: 12px;
  margin: 4px 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1) !important;
  border: 1px solid rgba(255, 255, 255, 0.3) !important;
  /* Debug: make it more visible */
  min-height: 80px;
  display: block !important;
}

.nav-stats-header {
  font-size: 12px;
  font-weight: 600;
  color: #b0b0b0;
  margin-bottom: 8px;
  text-align: center;
  display: block;
}

.nav-stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  min-height: 60px;
}

.nav-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  min-height: 35px;
  justify-content: center;
}

.nav-stat-label {
  font-size: 10px;
  color: #ffffff;
  margin-bottom: 2px;
  text-align: center;
  display: block;
  line-height: 1.2;
}

.nav-stat-value {
  font-size: 12px;
  font-weight: 600;
  color: #ffffff;
  text-align: center;
  display: block;
  line-height: 1.2;
}

/* Force visibility for debugging */
.nav-dropdown-divider,
.nav-dropdown-stats,
.nav-stats-header,
.nav-stats-grid,
.nav-stat-item,
.nav-stat-label,
.nav-stat-value {
  display: block !important;
  visibility: visible !important;
  opacity: 1 !important;
}

.nav-stats-grid {
  display: grid !important;
}

/* Environment and Outline grids */
.nav-env-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 4px;
  margin-top: 6px;
}

.nav-outline-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin-top: 6px;
}

.nav-stat-range {
  font-size: 11px !important;
}

.nav-stat-item {
  display: flex !important;
}

/* === Liquid Glass Base === */
.liquid-glass-element {
  background: rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 20px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.12);
  transition: all 0.25s ease;
}

.liquid-glass-element:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  transform: translateY(-1px);
}

/* Dark variant for better contrast */
.liquid-glass-dark {
  background: rgba(0, 0, 0, 0.25);
  backdrop-filter: blur(6px) saturate(115%);
  -webkit-backdrop-filter: blur(6px) saturate(115%);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.liquid-glass-dark:hover {
  background: rgba(0, 0, 0, 0.4);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Subtle glass buttons - Light Theme */
.liquid-glass-button {
  background: rgba(76, 175, 80, 0.20);
  backdrop-filter: blur(6px) saturate(120%) brightness(1.02);
  -webkit-backdrop-filter: blur(6px) saturate(120%) brightness(1.02);
  border: 1px solid rgba(76, 175, 80, 0.5);
  border-radius: 18px;
  color: rgba(0, 0, 0, 0.8);
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.4);
  box-shadow:
    0 2px 10px rgba(76, 175, 80, 0.12),
    0 1px 6px rgba(0, 0, 0, 0.04),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.liquid-glass-button:hover {
  background: rgba(76, 175, 80, 0.35);
  border-color: rgba(76, 175, 80, 0.8);
  box-shadow: 
    0 6px 20px rgba(76, 175, 80, 0.25),
    0 3px 12px rgba(0, 0, 0, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.8);
  transform: translateY(-2px) scale(1.02);
}

.liquid-glass-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.1);
}

.liquid-glass-button:disabled {
  background: rgba(200, 200, 200, 0.2);
  border-color: rgba(200, 200, 200, 0.4);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  color: rgba(0, 0, 0, 0.4);
  cursor: not-allowed;
  transform: none;
}

/* Form elements with glass effect - Light Theme */
.liquid-glass-input {
  background: rgba(255, 255, 255, 0.22);
  backdrop-filter: blur(6px) saturate(115%) brightness(1.02);
  -webkit-backdrop-filter: blur(6px) saturate(115%) brightness(1.02);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 15px;
  color: rgba(0, 0, 0, 0.8);
  box-shadow: 
    0 2px 8px rgba(255, 255, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.liquid-glass-input:focus {
  background: rgba(255, 255, 255, 0.35);
  border-color: rgba(76, 175, 80, 0.7);
  box-shadow: 
    0 4px 16px rgba(255, 255, 255, 0.15),
    0 0 0 2px rgba(76, 175, 80, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.7);
  outline: none;
  transform: translateY(-1px);
}

/* Glass hamburger menu button */
.liquid-glass-hamburger {
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 24px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.liquid-glass-hamburger:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* === 基本レイアウト === */
html, body, #cesiumContainer {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  font-family: 'Noto Sans JP', sans-serif;
  background-color: #111;
  /* 横スクロール防止 */
  overflow-x: hidden;
  /* タッチデバイスでのズーム制御 */
  touch-action: manipulation;
}

/* 基本レイアウトの改善 */
* {
  box-sizing: border-box;
}

/* セレクト要素でのズーム防止（iOS Safari対策）*/
select, input, textarea {
  font-size: 16px; /* 16px未満だとiOSでズームが発生 */
}

#cesiumContainer {
  background-color: #0e1b22 !important;
}

/* === デスクトップ向けツールバー === */
#toolbar {
  position: absolute;
  top: var(--hb-nav-offset);
  left: 10px;
  /* Liquid Glass effect applied */
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  
  padding: 15px;
  border-radius: 20px;
  color: white;
  z-index: 50; /* Cesium UIより低く設定 */
  max-width: 380px;
  max-height: calc(100% - 80px - var(--hb-nav-height)); /* ナビゲーションとの重複を避ける */
  overflow-y: auto;
  /* Hide scrollbars visually */
  scrollbar-width: none; /* Firefox */
  transition: all 0.3s ease;
}

/* Hide scrollbars for WebKit */
#toolbar::-webkit-scrollbar { width: 0; height: 0; }

/* デスクトップ時の折りたたみ用アニメーション（transform使用） */
@media screen and (min-width: 769px) {
  #toolbar,
  #info {
    will-change: transform, opacity;
    transition: transform 0.25s ease, opacity 0.25s ease;
  }

  body.left-collapsed #toolbar {
    transform: translateX(calc(-100% - 40px));
    opacity: 0;
    pointer-events: none;
  }

  body.right-collapsed #info {
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    pointer-events: none;
  }
}

/* モバイル向けハンバーガーメニューボタン */
#mobileMenuToggle {
  display: none;
  position: fixed;
  top: calc(var(--hb-nav-offset) + env(safe-area-inset-top));
  left: calc(10px + env(safe-area-inset-left));
  z-index: 1200; /* ナビゲーション(1000)より上にして常に操作可能に */
  /* Liquid Glass mobile button style applied */
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(15px) saturate(150%);
  -webkit-backdrop-filter: blur(15px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  
  color: white;
  font-size: 20px;
  width: 48px;
  height: 48px;
  border-radius: 24px;
  cursor: pointer;
  transition: all 0.3s ease;
}

#mobileMenuToggle:hover {
  background: rgba(0, 0, 0, 0.5);
  border-color: rgba(255, 255, 255, 0.3);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
}

/* === ボタンスタイル === */
#toolbar button {
  /* Liquid Glass button style applied */
  background: rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(4px) saturate(120%);
  -webkit-backdrop-filter: blur(4px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  
  margin: 5px;
  padding: 8px 12px;
  border-radius: 15px;
  color: white;
  cursor: pointer;
  font-size: 12px;
  font-weight: 500;
  transition: all 0.3s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#toolbar button:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  transform: translateY(-1px) scale(1.02);
}

#toolbar button:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2), inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

#toolbar button:disabled {
  background: rgba(128, 128, 128, 0.3);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.5);
  cursor: not-allowed;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transform: none;
}

/* === 情報パネル === */
#info {
  /* デスクトップでは初期表示にしたいので display:none を外す */
  display: block; /* default visible; desktop override below maintains visibility */
  position: absolute;
  top: calc(var(--hb-nav-offset) + 10px); /* ナビゲーションの下、右上のCesium UIボタンを避けるため */
  right: 10px;
  /* Liquid Glass effect applied */
  background: rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  
  padding: 15px;
  border-radius: 20px;
  color: white;
  z-index: 50; /* Cesium UIより低く設定 */
  max-width: 250px;
  font-size: 12px;
  transition: all 0.3s ease;
  /* Hide scrollbars visually */
  scrollbar-width: none; /* Firefox */
}

/* Hide scrollbars for WebKit */
#info::-webkit-scrollbar { width: 0; height: 0; }

/* 折りたたみトグルボタン（デスクトップのみ表示） */
@media screen and (min-width: 769px) {
  .collapse-toggle {
    position: fixed;
    z-index: 220; /* Cesium標準UI(200)より少し上、パネルより上 */
    width: 32px;
    height: 32px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(0, 0, 0, 0.4);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    backdrop-filter: blur(10px) saturate(140%);
    -webkit-backdrop-filter: blur(10px) saturate(140%);
    transition: transform 0.2s ease, background 0.2s ease;
  }

  .collapse-toggle:hover {
    background: rgba(0, 0, 0, 0.55);
    transform: translateY(-1px);
  }

  #collapseLeft {
    top: 12px;
    left: 12px;
  }

  #collapseRight {
    top: 62px; /* 右上Cesiumツールバーを避ける */
    right: 12px;
  }

  /* 折りたたみ時のアイコン向き（あくまで視覚的ヒント用） */
  body.left-collapsed #collapseLeft::after { content: '▶'; }
  body:not(.left-collapsed) #collapseLeft::after { content: '◀'; }
  body.right-collapsed #collapseRight::after { content: '◀'; }
  body:not(.right-collapsed) #collapseRight::after { content: '▶'; }
}

#info:hover {
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

/* === フォーム要素 === */
#fileInput {
  /* Liquid Glass input style applied */
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px) saturate(110%);
  -webkit-backdrop-filter: blur(4px) saturate(110%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 15px;
  color: white;
  padding: 10px 15px;
  margin: 10px 0;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
  
  /* ファイル入力の帯を完全に除去 */
  width: 100%;
  box-sizing: border-box;
  display: block;
  font-family: inherit;
  font-size: 13px;
  line-height: 1.4;
  
  /* ブラウザデフォルトスタイルをリセット */
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  
  /* ファイル選択時の「ファイルが選択されていません」テキストのスタイル */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#fileInput:focus {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.4);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  outline: none;
}

/* ファイル選択ボタンの「参照」ボタンスタイル */
#fileInput::-webkit-file-upload-button {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  color: white;
  padding: 6px 12px;
  margin-right: 10px;
  cursor: pointer;
  font-size: 12px;
  transition: all 0.3s ease;
}

#fileInput::-webkit-file-upload-button:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.4);
}

/* === セクション共通スタイル === */
/* div/.section と details.section を両対応 */
.section {
  /* Liquid Glass section style applied */
  background: rgba(255, 255, 255, 0.07);
  backdrop-filter: blur(6px) saturate(110%);
  -webkit-backdrop-filter: blur(6px) saturate(110%);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 18px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  
  margin: 10px 0;
  padding: 15px;
  transition: all 0.3s ease;
}

.section:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.section h3, .section > summary {
  margin: 0 0 10px 0;
  font-size: 14px;
}

details.section > summary {
  cursor: pointer;
  list-style: none;
  outline: none;
}

details.section > summary::-webkit-details-marker {
  display: none;
}

details.section > summary::before {
  content: '▸';
  display: inline-block;
  margin-right: 6px;
  transform: translateY(-1px);
  opacity: 0.9;
}

details.section[open] > summary::before {
  content: '▾';
}

.section-content {
  margin-top: 8px;
}

/* === コントロール要素 === */
.controls {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

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

.control-group label {
  flex: 1;
  font-size: 11px;
}

.control-group input, .control-group select {
  flex: 1;
  padding: 2px;
  border: 1px solid #666;
  border-radius: 2px;
  background: #333;
  color: white;
}

/* === ローディング表示 === */
#loading {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 20px;
  border-radius: 5px;
  z-index: 2000;
  display: none;
}

/* === モバイル・タブレット向けレスポンシブデザイン === */
@media screen and (max-width: 768px) {
  /* ハンバーガーメニューボタンを表示 */
  #mobileMenuToggle {
    display: block;
    /* ボトムシートと重ならないよう左上に配置 */
    top: calc(var(--hb-nav-offset) + 10px + env(safe-area-inset-top));
    bottom: auto;
    left: calc(10px + env(safe-area-inset-left));
    right: auto;
    z-index: 1200; /* ナビゲーションの上で確実にタップ可能に */
  }
  
  /* ツールバーをボトムシートに調整 */
  #toolbar {
    position: fixed;
    top: auto;
    left: 0;
    bottom: 0;
    width: 100%;
    max-width: 100%;
    height: min(55vh, calc(100% - 120px)); /* 画面の約半分を覆う */
    max-height: 80vh;
    z-index: 1100; /* ナビより下、ハンバーガーより下、Cesium UIより上 */
    /* ボトムシート用 Liquid Glass */
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(8px) saturate(120%) brightness(1.02);
    -webkit-backdrop-filter: blur(8px) saturate(120%) brightness(1.02);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    
    /* セーフエリア考慮（ノッチ等） */
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-right: calc(15px + env(safe-area-inset-right));
    padding-bottom: calc(15px + env(safe-area-inset-bottom));
    padding-left: calc(15px + env(safe-area-inset-left));
    box-sizing: border-box;
    transform: translateY(100%);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* ツールバーが開いているとき（ボトムシート展開） */
  #toolbar.open {
    transform: translateY(0);
  }

  /* ボトムシートのドラッグハンドル風デコレーション */
  #toolbar::before {
    content: '';
    position: absolute;
    top: 6px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.5);
  }
  
  /* セクションの調整 */
  .section {
    margin: 8px 0;
    padding: 12px;
    border-radius: 15px;
    /* Mobile section enhanced liquid glass with better visibility */
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(10px) saturate(130%);
    -webkit-backdrop-filter: blur(10px) saturate(130%);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
  }
  
  /* ボタンをモバイル向けに調整 */
  #toolbar button {
    margin: 3px 0;
    padding: 12px 16px;
    font-size: 14px;
    width: 100%;
    min-height: 44px; /* Appleのタッチターゲット最小サイズ */
    border-radius: 15px;
    /* Enhanced button glass effect for mobile with better visibility */
    background: rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(10px) saturate(160%);
    -webkit-backdrop-filter: blur(10px) saturate(160%);
    border: 1px solid rgba(255, 255, 255, 0.25);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
  }
  
  /* コントロールグループの調整 */
  .control-group {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  
  .control-group label {
    font-size: 12px;
    margin-bottom: 4px;
  }
  
  .control-group input, 
  .control-group select {
    min-height: 40px;
    font-size: 16px; /* ズーム防止 */
    border-radius: 4px;
  }
  
  /* 情報パネルを中央上部に移動（タイムラインと被らないように） */
  #info {
    position: fixed;
    top: calc(var(--hb-nav-offset) + env(safe-area-inset-top));
    bottom: auto;
    right: calc(50% - 150px); /* 中央に配置 */
    left: auto;
    max-width: 300px;
    max-height: 60vh;
    font-size: 11px;
    z-index: 1100; /* ナビやCesium UIより前面にしてタップ可能に */
    /* Enhanced mobile info panel glass */
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(8px) saturate(120%) brightness(1.02);
    -webkit-backdrop-filter: blur(8px) saturate(120%) brightness(1.02);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.08);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }
  
  /* 小さなセクションは折りたたんで表示 */
  #info .section {
    margin: 2px 0;
    padding: 6px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
  }
  
  /* 詳細なセクションはデフォルトで閉じる */
  details.section[open] {
    margin-bottom: 12px;
  }
}

/* === より小さな画面向け調整 === */
@media screen and (max-width: 480px) {
  /* より小さな画面向け調整 */
  #toolbar {
    padding-top: calc(50px + env(safe-area-inset-top));
    padding-right: calc(10px + env(safe-area-inset-right));
    padding-bottom: calc(10px + env(safe-area-inset-bottom));
    padding-left: calc(10px + env(safe-area-inset-left));
  }
  
  .section {
    padding: 8px;
  }
  
  #toolbar button {
    font-size: 13px;
    padding: 10px 12px;
  }
  
  .control-group label {
    font-size: 11px;
  }
  
  /* 情報パネルをさらにコンパクトに */
  #info {
    font-size: 10px;
    padding: 8px;
    max-height: 50vh;
    max-width: calc(100% - 20px);
    right: 10px;
  }
  
  /* 小さな画面でのドロップダウンボタン調整 */
  #navDropdownToggle {
    height: 32px !important;
    font-size: 12px !important;
    min-width: 80px;
    max-width: 100px;
    padding: 0 8px !important;
    color: #ffffff !important;
    font-weight: 600 !important;
  }
  
  #navDropdownLabel {
    color: #ffffff !important;
    font-size: 12px !important;
    font-weight: 600 !important;
  }
}

/* === タッチデバイス向け調整 === */
@media (hover: none) and (pointer: coarse) {
  /* タッチデバイス専用スタイル */
  #toolbar button:hover {
    background: #4CAF50; /* hoverエフェクトを無効化 */
  }
  
  #toolbar button:active {
    background: #45a049;
    transform: scale(0.98);
  }
  
  /* スクロール改善 */
  #toolbar, #info {
    -webkit-overflow-scrolling: touch;
  }
}

/* === 画面の向き変更に対応 === */
@media screen and (orientation: landscape) and (max-height: 500px) {
  /* 横向きの小さな画面（スマホ横向き等）*/
  #info {
    display: none; /* 情報パネルを隠す */
  }
  
  #toolbar {
    padding: 40px 10px 10px 10px;
  }
}

/* Ensure desktop shows the info panel even if previously hidden */
@media (min-width: 1025px) {
  #info {
    display: block !important;
    opacity: 1;
    pointer-events: auto;
  }
  body.right-collapsed #info {
    transform: translateX(calc(100% + 40px));
    opacity: 0;
    pointer-events: none;
  }
  body:not(.right-collapsed) #info {
    transform: translateX(0);
    opacity: 1;
    pointer-events: auto;
  }
}

/* === Cesium UI要素の表示確保 === */
/* CesiumのデフォルトUI要素が確実に表示されるように調整 */
.cesium-viewer-toolbar,
.cesium-viewer-fullscreenContainer,
.cesium-viewer-vrContainer,
.cesium-viewer-geocoderContainer,
.cesium-widget-credits,
.cesium-timeline-main,
.cesium-animation-container,
.cesium-navigation-help-wrapper,
.cesium-selection-wrapper,
.cesium-performance-watchdog-wrapper {
  z-index: 100 !important; /* 我々のカスタムパネルより高く設定 */
}

/* タイムラインは特に重要なので少し高めに */
.cesium-timeline-main {
  z-index: 150 !important;
}

/* ホームボタンとフルスクリーンボタンなど右上UI */
.cesium-viewer-toolbar {
  z-index: 200 !important;
}

/* 下部のCesium Ionクレジット */
.cesium-widget-credits {
  z-index: 100 !important;
  pointer-events: auto !important; /* クリック可能にする */
}

/* VRボタンとフルスクリーンボタン */
.cesium-viewer-fullscreenContainer,
.cesium-viewer-vrContainer {
  z-index: 200 !important;
}
