:root {
  --bg-color: #0b0c10;
  --panel-bg: rgba(15, 22, 36, 0.75);
  --border-color: rgba(0, 255, 204, 0.2);
  --border-focus: rgba(0, 255, 204, 0.6);
  --text-primary: #ffffff;
  --text-secondary: #c5c6c7;
  --accent-color: #00ffcc;
  --accent-glow: 0 0 10px rgba(0, 255, 204, 0.5);
  
  /* 国別カラー */
  --color-jpn: #ff2d55;
  --color-usa: #007aff;
  --color-fra: #ffcc00;
  --color-gbr: #af52de;
  --color-chn: #ff9500;
  --color-deu: #4cd964;
  --color-aus: #5ac8fa;
  --color-default: #8e8e93;
}

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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Noto Sans JP', sans-serif;
  background-color: var(--bg-color);
  color: var(--text-primary);
}

/* 地図全画面表示 */
#map {
  width: 100%;
  height: 100%;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1;
}

/* Leafletのオーバーライド（ダークテーマに馴染ませる） */
.leaflet-container {
  background: #0d0f12 !important;
}

.leaflet-bar {
  border: 1px solid var(--border-color) !important;
  box-shadow: var(--accent-glow) !important;
}

.leaflet-bar a {
  background-color: rgba(15, 22, 36, 0.9) !important;
  color: var(--accent-color) !important;
  border-bottom: 1px solid var(--border-color) !important;
}

.leaflet-bar a:hover {
  background-color: var(--accent-color) !important;
  color: #000 !important;
}

/* UIレイヤー */
#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  pointer-events: none; /* マップの操作を妨げない */
}

/* UI配下のインタラクティブ要素はクリック可能に */
#ui-layer > * {
  pointer-events: auto;
}

/* ガラスモルフィズムパネル共通 */
.glass-panel {
  background: var(--panel-bg);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 15px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.5), inset 0 0 10px rgba(255, 255, 255, 0.05);
  transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.glass-panel:hover {
  border-color: var(--border-focus);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.6), 0 0 15px rgba(0, 255, 204, 0.15);
}

/* 右側統合サイドバー */
#right-sidebar {
  position: absolute;
  top: 20px;
  right: 20px;
  bottom: 20px;
  width: 380px;
  z-index: 1010;
  display: flex;
  flex-direction: column;
  transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.7);
  overflow: visible; /* トグルボタンをはみ出させるため */
}

/* 折りたたみ状態 */
#right-sidebar.collapsed {
  transform: translateX(calc(100% + 20px));
}

/* 開閉トグルボタン */
.sidebar-toggle-btn {
  position: absolute;
  top: 50%;
  left: -32px;
  transform: translateY(-50%);
  width: 32px;
  height: 64px;
  background: var(--panel-bg);
  border: 1px solid var(--border-color);
  border-right: none;
  border-radius: 8px 0 0 8px;
  color: var(--accent-color);
  font-size: 0.8rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  outline: none;
  z-index: 1015;
  box-shadow: -5px 5px 15px rgba(0, 0, 0, 0.3);
  transition: background-color 0.2s, border-color 0.2s;
}

.sidebar-toggle-btn:hover {
  background: rgba(0, 255, 204, 0.1);
  border-color: var(--border-focus);
}

/* ヘッダータイトル（元の左上配置） */
#game-header {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 1010;
  background: rgba(11, 12, 16, 0.85);
  padding: 10px 20px;
  border-radius: 8px;
  border-left: 4px solid var(--accent-color);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  pointer-events: auto;
  min-width: 250px;
}

#game-header h1 {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.4rem;
  letter-spacing: 2px;
  color: var(--accent-color);
  text-shadow: var(--accent-glow);
  font-weight: 900;
  line-height: 1.2;
}

#game-header .subtitle {
  font-size: 0.7rem;
  color: var(--text-secondary);
  letter-spacing: 1px;
  font-weight: bold;
}

/* メインタブナビゲーション */
.main-tabs {
  display: flex;
  gap: 4px;
  margin: 0 0 12px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 8px;
}

.main-tab-btn {
  flex: 1;
  padding: 8px 4px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(0, 255, 204, 0.15);
  border-radius: 6px;
  color: var(--text-secondary);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.75rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.main-tab-btn:hover {
  background: rgba(0, 255, 204, 0.08);
  color: var(--text-primary);
  border-color: rgba(0, 255, 204, 0.4);
}

.main-tab-btn.active {
  background: rgba(0, 255, 204, 0.15);
  color: var(--accent-color);
  border-color: var(--accent-color);
  box-shadow: inset 0 0 8px rgba(0, 255, 204, 0.2), var(--accent-glow);
}

/* サイドバーコンテンツ */
.sidebar-content {
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
  margin-top: 5px;
}

.sidebar-content::-webkit-scrollbar {
  width: 6px;
}

.sidebar-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 204, 0.2);
  border-radius: 3px;
}

.sidebar-content::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 204, 0.4);
}

.tab-pane {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

/* 旧ランキングパネルのサイドバー内表示の最適化 */
#ranking-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

/* ランキングタブスタイル */
.ranking-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 12px;
  transition: opacity 0.3s ease, max-height 0.3s ease, margin-bottom 0.3s ease;
  opacity: 1;
  max-height: 40px;
}

#ranking-panel.collapsed .ranking-tabs {
  opacity: 0;
  max-height: 0;
  margin-bottom: 0;
  pointer-events: none;
  overflow: hidden;
}

.tab-btn {
  flex: 1;
  padding: 6px 2px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(0, 255, 204, 0.15);
  border-radius: 4px;
  color: var(--text-secondary);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.72rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-btn:hover:not(:disabled) {
  background: rgba(0, 255, 204, 0.08);
  color: var(--text-primary);
  border-color: rgba(0, 255, 204, 0.4);
}

.tab-btn.active {
  background: rgba(0, 255, 204, 0.15);
  color: var(--accent-color);
  border-color: var(--accent-color);
  box-shadow: inset 0 0 8px rgba(0, 255, 204, 0.2), var(--accent-glow);
}

.tab-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  border-color: rgba(255, 255, 255, 0.05);
}

#ranking-list {
  list-style: none;
  overflow-y: auto;
  flex-grow: 1;
  transition: opacity 0.3s ease, max-height 0.3s ease;
  opacity: 1;
  max-height: 380px;
}

#ranking-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  margin-bottom: 6px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  font-family: 'Orbitron', sans-serif;
  font-size: 0.9rem;
  transition: transform 0.2s ease;
}

#ranking-list li:hover {
  transform: translateX(-5px);
  background: rgba(255, 255, 255, 0.08);
}

/* 自分自身の行をハイライト */
#ranking-list li.highlight-self {
  background: rgba(0, 255, 204, 0.12);
  border: 1px solid rgba(0, 255, 204, 0.6) !important;
  box-shadow: 0 0 10px rgba(0, 255, 204, 0.25);
}

#ranking-list li.highlight-self .rank-num {
  color: var(--accent-color);
  text-shadow: var(--accent-glow);
}

#ranking-list li.highlight-self .rank-team {
  color: #ffffff;
}

#ranking-list li.highlight-self .rank-score {
  color: var(--accent-color);
  text-shadow: var(--accent-glow);
  font-weight: bold;
}

.rank-num {
  font-weight: bold;
  width: 25px;
  color: var(--text-secondary);
}

.rank-team {
  flex-grow: 1;
  margin-left: 10px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 110px;
}

.rank-score {
  font-weight: 400;
  color: var(--accent-color);
  white-space: nowrap;
  flex-shrink: 0;
  margin-left: auto;
}

/* ステータスセクション (カード調背景) */
.status-section {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px 15px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.02);
}

/* コントロールセクション (薄いアクセントカラー背景) */
.control-section {
  background: rgba(0, 255, 204, 0.015);
  border: 1px solid rgba(0, 255, 204, 0.08);
  border-radius: 8px;
  padding: 12px 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: inset 0 0 10px rgba(0, 255, 204, 0.01);
}

.player-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.player-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.country-badge {
  padding: 4px 12px;
  border-radius: 20px;
  font-weight: bold;
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 1px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.1);
}

/* 国コードごとのクラス */
.country-JPN { background-color: var(--color-jpn); color: #fff; }
.country-USA { background-color: var(--color-usa); color: #fff; }
.country-FRA { background-color: var(--color-fra); color: #000; }
.country-GBR { background-color: var(--color-gbr); color: #fff; }
.country-CHN { background-color: var(--color-chn); color: #fff; }
.country-DEU { background-color: var(--color-deu); color: #000; }
.country-AUS { background-color: var(--color-aus); color: #000; }
.country-UNKNOWN { background-color: var(--color-default); color: #fff; }

.cooldown-container {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
}

.cooldown-timer {
  position: relative;
  width: 70px;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.progress-ring {
  position: absolute;
  top: 0;
  left: 0;
  transform: rotate(-90deg);
}

.progress-ring__circle {
  transition: stroke-dashoffset 0.1s linear;
  transform-origin: 50% 50%;
}

.cooldown-text {
  font-family: 'Orbitron', sans-serif;
  font-weight: 900;
  font-size: 0.8rem;
  color: #ffffff;
  text-shadow: 0 0 5px var(--accent-color), 0 0 10px var(--accent-color), 0 0 15px var(--accent-color);
  z-index: 10;
  letter-spacing: 0.5px;
  text-align: center;
}

.btn {
  flex-grow: 1;
  padding: 10px 15px;
  background: linear-gradient(135deg, rgba(0, 255, 204, 0.2), rgba(0, 128, 255, 0.2));
  border: 1px solid var(--accent-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'Noto Sans JP', sans-serif;
  font-weight: bold;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: var(--accent-glow);
}

.btn:hover:not(.disabled) {
  background: linear-gradient(135deg, rgba(0, 255, 204, 0.4), rgba(0, 128, 255, 0.4));
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(0, 255, 204, 0.6);
}

.btn:active:not(.disabled) {
  transform: translateY(0);
}

.btn.disabled, .btn:disabled {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.3);
  cursor: not-allowed;
  box-shadow: none;
}

/* 操作アクションボタン行 */
.action-buttons-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}

/* アクションボタン (ジャンプ, HELP) のデザイン最適化 */
.glass-btn {
  width: 100%;
  padding: 10px 15px;
  background: rgba(15, 22, 36, 0.5);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  color: var(--accent-color);
  font-weight: bold;
  font-size: 0.85rem;
  cursor: pointer;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.glass-btn:hover {
  border-color: var(--border-focus);
  box-shadow: 0 6px 20px rgba(0, 255, 204, 0.3);
  color: #fff;
  transform: scale(1.03) translateY(-2px);
}

/* マイクロアニメーション (パルス効果) */
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(0, 255, 204, 0.4); }
  70% { box-shadow: 0 0 0 12px rgba(0, 255, 204, 0); }
  100% { box-shadow: 0 0 0 0 rgba(0, 255, 204, 0); }
}

.pulse-effect {
  animation: pulse 2s infinite;
}

/* 左下コントロールコンテナ */
.left-controls-container {
  position: absolute;
  bottom: 20px;
  left: 20px;
  z-index: 1010;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: auto;
  width: 280px;
  transition: bottom 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* デバッグパネル */
#debug-panel {
  width: 100%;
}

#debug-panel h3 {
  font-size: 0.85rem;
  color: #ff3b30;
  margin-bottom: 10px;
  letter-spacing: 1px;
}

#debug-panel select {
  width: 100%;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-family: inherit;
  font-size: 0.9rem;
  outline: none;
  cursor: pointer;
}

#debug-panel select:focus {
  border-color: var(--border-focus);
}

/* 広告モーダル */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.85);
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.modal-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.modal-content {
  width: 500px;
  max-width: 90%;
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: scaleUp 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes scaleUp {
  from { transform: scale(0.8); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.ad-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
}

.ad-timer {
  font-family: 'Orbitron', sans-serif;
  font-size: 1.5rem;
  font-weight: bold;
  color: var(--accent-color);
  background: rgba(255, 255, 255, 0.05);
  width: 45px;
  height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 2px solid var(--accent-color);
  box-shadow: var(--accent-glow);
}

.ad-video-placeholder {
  background: linear-gradient(135deg, #1f2833 0%, #0b0c10 100%);
  border: 1px dashed var(--border-color);
  border-radius: 8px;
  height: 250px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 15px;
  text-align: center;
  padding: 20px;
}

.ad-hint {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* スピナー */
.spinner {
  width: 50px;
  height: 50px;
  border: 4px solid rgba(0, 255, 204, 0.1);
  border-top-color: var(--accent-color);
  border-radius: 50%;
  animation: spin 1s infinite linear;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* スマホ・レスポンシブ対応 */
@media (max-width: 768px) {
  #right-sidebar {
    top: auto;
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 50vh;
    border-radius: 16px 16px 0 0;
    border: 1px solid var(--border-color);
    border-bottom: none;
    transform: translateY(100%);
    box-shadow: 0 -8px 32px 0 rgba(0, 0, 0, 0.8);
  }

  #right-sidebar.collapsed {
    transform: translateY(100%);
  }

  .sidebar-toggle-btn {
    top: -32px;
    left: 50%;
    transform: translateX(-50%) rotate(90deg);
    width: 64px;
    height: 32px;
    border: 1px solid var(--border-color);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    box-shadow: 0 -5px 15px rgba(0, 0, 0, 0.3);
  }

  /* スマホでのトグル回転の補正用（PCとスマホでスライドアニメーションの向きが違うため） */
  #right-sidebar.collapsed .sidebar-toggle-btn {
    transform: translateX(-50%) rotate(-90deg);
  }

  #notification-container {
    bottom: calc(50vh + 20px) !important;
    right: 50% !important;
    transform: translateX(50%) !important;
    max-width: 90% !important;
  }
  
  #right-sidebar.collapsed ~ #notification-container {
    bottom: 20px !important;
  }

  /* スマホ向けのヘッダーコンパクト化 */
  #game-header {
    top: 10px !important;
    left: 10px !important;
    right: 10px !important;
    min-width: 0 !important;
    padding: 6px 12px !important;
    text-align: center;
    border-radius: 6px !important;
  }

  #game-header h1 {
    font-size: 1.1rem !important;
    letter-spacing: 1px !important;
  }

  #game-header .subtitle {
    font-size: 0.6rem !important;
    letter-spacing: 0.5px !important;
  }

  /* スマホ向けの左下コントロール連動＆デバッグ非表示 */
  #left-controls {
    left: 10px !important;
    right: 10px !important;
    width: auto !important;
    bottom: calc(50vh + 20px) !important;
  }

  #right-sidebar.collapsed ~ #left-controls {
    bottom: 20px !important;
  }

  #left-controls #debug-panel {
    display: none !important;
  }
}

/* 通知トーストコンテナ */
#notification-container {
  position: absolute;
  bottom: 20px;
  right: 20px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
  max-width: 360px;
  width: 100%;
  transition: bottom 0.4s cubic-bezier(0.25, 1, 0.5, 1);
}

/* アチーブメントトースト通知 */
.toast-message {
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: bold;
  font-size: 0.88rem;
  display: flex;
  align-items: center;
  gap: 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  pointer-events: auto;
  margin-left: auto;
  width: fit-content;
  max-width: 100%;
  animation: toastSlideIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards, toastFadeOut 0.5s ease-in 3.5s forwards;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  border: 1px solid var(--border-color);
  color: #fff;
}

.toast-message.gold {
  background: rgba(255, 204, 0, 0.15);
  border-color: rgba(255, 204, 0, 0.5);
  box-shadow: 0 0 15px rgba(255, 204, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.5);
  text-shadow: 0 0 5px rgba(255, 204, 0, 0.5);
}

.toast-message.info {
  background: rgba(0, 122, 255, 0.15);
  border-color: rgba(0, 122, 255, 0.5);
  box-shadow: 0 0 15px rgba(0, 122, 255, 0.3), 0 8px 24px rgba(0, 0, 0, 0.5);
  text-shadow: 0 0 5px rgba(0, 122, 255, 0.5);
}

@keyframes toastSlideIn {
  from { transform: translateX(120%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

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

/* アチーブメント履歴ログ */
.activity-log-section {
  margin-top: 15px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  padding: 12px;
}

#activity-log-title {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.85rem;
  color: var(--text-primary);
  margin-bottom: 10px;
  letter-spacing: 1px;
  border-left: 3px solid var(--accent-color);
  padding-left: 8px;
}

.activity-log-list {
  max-height: 180px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.activity-log-list::-webkit-scrollbar {
  width: 4px;
}

.activity-log-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
}

.activity-log-item {
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 0.8rem;
  line-height: 1.4;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: all 0.2s ease;
}

.activity-log-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.activity-log-item.gold {
  border-left: 3px solid #ffcc00;
  background: rgba(255, 204, 0, 0.04);
}

.activity-log-item.info {
  border-left: 3px solid #007aff;
  background: rgba(0, 122, 255, 0.04);
}

.activity-log-time {
  font-family: 'Orbitron', sans-serif;
  font-size: 0.65rem;
  color: var(--text-secondary);
  align-self: flex-end;
}

/* 首都アイコンのアニメーション (SVG) */
@keyframes capitalGlow {
  0% { stroke-width: 3px; stroke: #ffffff; }
  50% { stroke-width: 6px; stroke: #ffcc00; }
  100% { stroke-width: 3px; stroke: #ffffff; }
}

.capital-pulse {
  animation: capitalGlow 2s infinite ease-in-out;
}

/* ステータスパネル (左上) */
#status-panel {
  grid-area: status;
  align-self: start;
  width: 300px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 5px;
}

.status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(0, 255, 204, 0.1);
  font-size: 0.9rem;
}

.status-row:last-child {
  border-bottom: none;
}

.status-label {
  color: var(--text-secondary);
  font-weight: normal;
}

.status-val {
  font-family: 'Orbitron', sans-serif;
  color: var(--accent-color);
  text-shadow: var(--accent-glow);
  font-weight: bold;
}

.name-edit-row {
  justify-content: flex-start;
  gap: 15px;
}

#username-container, #username-edit-container {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-grow: 1;
  justify-content: space-between;
}

#username-display {
  font-weight: bold;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 150px;
}

#username-input {
  flex-grow: 1;
  background: rgba(0, 0, 0, 0.6);
  border: 1px solid var(--border-color);
  border-radius: 4px;
  color: #ffffff;
  padding: 3px 8px;
  font-family: inherit;
  font-size: 0.85rem;
  outline: none;
  max-width: 140px;
}

#username-input:focus {
  border-color: var(--border-focus);
  box-shadow: var(--accent-glow);
}

.icon-btn {
  background: transparent;
  border: none;
  color: var(--accent-color);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 2px 4px;
  transition: transform 0.2s ease, text-shadow 0.2s ease;
  outline: none;
}

.icon-btn:hover {
  transform: scale(1.2);
  text-shadow: var(--accent-glow);
}

.hidden {
  display: none !important;
}

/* 言語選択セレクトボックスのスタイル */
.lang-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(0, 255, 204, 0.15) !important;
  padding-bottom: 8px;
  margin-bottom: 4px;
}
.lang-dropdown {
  background: rgba(11, 12, 16, 0.9);
  color: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 4px 10px;
  font-family: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.lang-dropdown:focus {
  border-color: var(--border-focus);
  box-shadow: var(--accent-glow);
}



/* ヘルプモーダル専用スタイル */
.help-modal-content {
  width: 600px;
  max-width: 95%;
  border-color: var(--border-focus);
  box-shadow: 0 0 25px rgba(0, 255, 204, 0.25);
}
.help-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 12px;
  margin-bottom: 15px;
}
.help-header h2 {
  font-size: 1.3rem;
  color: var(--accent-color);
  text-shadow: var(--accent-glow);
  font-family: 'Orbitron', sans-serif;
  letter-spacing: 1px;
}
.close-btn {
  font-size: 1.8rem;
  cursor: pointer;
  color: var(--text-secondary);
  transition: color 0.2s, transform 0.2s;
  line-height: 1;
}
.close-btn:hover {
  color: #ff3b30;
  transform: scale(1.2);
}
.help-body {
  max-height: 420px;
  overflow-y: auto;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--text-secondary);
  padding-right: 10px;
}
.help-body::-webkit-scrollbar {
  width: 6px;
}
.help-body::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 3px;
}
.help-body::-webkit-scrollbar-thumb {
  background: rgba(0, 255, 204, 0.3);
  border-radius: 3px;
}
.help-body::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 255, 204, 0.5);
}
.help-section {
  margin-bottom: 18px;
}
.help-section:last-child {
  margin-bottom: 0;
}
.help-section h3 {
  font-size: 1rem;
  color: var(--text-primary);
  margin-bottom: 6px;
  border-left: 3px solid var(--accent-color);
  padding-left: 8px;
}
.help-section p {
  margin-bottom: 8px;
}
.help-section ul {
  margin-left: 20px;
  margin-bottom: 8px;
}
.help-section li {
  margin-bottom: 6px;
}
.help-body strong {
  color: var(--accent-color);
  font-weight: bold;
}

/* ガード（保護中）マスのシールドアニメーション */
@keyframes shield-pulse {
  0% {
    fill-opacity: 0.15;
    stroke-opacity: 0.4;
  }
  50% {
    fill-opacity: 0.35;
    stroke-opacity: 0.9;
  }
  100% {
    fill-opacity: 0.15;
    stroke-opacity: 0.4;
  }
}

.hexagon-protected {
  animation: shield-pulse 2s infinite ease-in-out;
  stroke: #ffffff !important; /* 白いシールド線 */
  stroke-dasharray: 4, 4;
}
