* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100%;
  height: 100%;
  height: 100dvh; /* iOS Safari用 - UIバーを考慮した動的な高さ */
  background: #000;
  color: #fff;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  overflow: hidden;
  display: flex; /* 左1:中央8:右1 を flex 比率で配置 */
}

/* サイドスペース */
.spacing-panel {
  width: 100%;
  height: 100%;
  background: #1a1a1a;
  min-width: 0;
  flex: 1 1 0;
}

#game-container {
  position: relative;
  width: 100%;
  flex: 8 1 0;
  height: 100vh;
  height: 100dvh; /* iOS Safari用 - UIバーを考慮した動的な高さ */
  overflow: hidden;
  background: radial-gradient(circle at top, #333 0, #000 60%);
  min-width: 0;
}

/* 背景動画 */
#video-player {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 0;
  background: #000;
}

#video-layers {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #000;
}

.video-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  opacity: 0;
  transition: opacity 0.35s linear; /* クロスフェード時間 */
}

/* 表示中のレイヤー */
.video-layer.visible {
  opacity: 1;
}

/* 画面共通 */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  z-index: 1;
}

.screen.active {
  display: flex;
}

#loading-screen {
  position: fixed;
  inset: 0;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999; /* 他の画面より前面 */
}

/* 全画面表示時の調整 */
body:fullscreen .spacing-panel,
body:-webkit-full-screen .spacing-panel,
body:-moz-full-screen .spacing-panel,
body:-ms-fullscreen .spacing-panel {
  display: none;
}

body:fullscreen #game-container,
body:-webkit-full-screen #game-container,
body:-moz-full-screen #game-container,
body:-ms-fullscreen #game-container {
  width: 100vw;
  height: 100vh;
  flex: 1 1 auto;
}

body:fullscreen #video-player,
body:-webkit-full-screen #video-player,
body:-moz-full-screen #video-player,
body:-ms-fullscreen #video-player {
  object-fit: cover;
}

body:fullscreen .video-layer,
body:-webkit-full-screen .video-layer,
body:-moz-full-screen .video-layer,
body:-ms-fullscreen .video-layer {
  object-fit: cover;
}

/* タイトル画面 */
#title-screen {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(0, 0, 0, 0.6);
  text-align: center;
  cursor: pointer;
}

.title-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2rem;
}

.title-image {
  max-width: 90%;
  max-height: 70vh;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

/* メディア数表示 */
.media-count {
  font-size: 1.5rem;
  font-weight: bold;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  letter-spacing: 0.05em;
}

.count-red {
  color: #ff3333;
  font-size: 1.8rem;
  text-shadow: 0 0 10px rgba(255, 51, 51, 0.8);
}

.count-yellow {
  color: #ffcc00;
  font-size: 1.8rem;
  text-shadow: 0 0 10px rgba(255, 204, 0, 0.8);
}

#title-screen .hint {
  font-size: 1.1rem;
  opacity: 0.8;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

/* ゲーム画面 */
#game-screen {
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  pointer-events: auto; /* タッチイベントを受け取る（v4.2 スマホ対応） */
}

#timer {
  margin-left: auto;
  font-size: 1.4rem;
  font-weight: bold;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
  pointer-events: none; /* タイマー自体はクリック不可 */
  font-family: "Roboto Mono", "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

#game-message-wrapper {
  width: 100%;
  text-align: center;
  margin-bottom: 10vh;
  pointer-events: none; /* メッセージ自体はクリック不可 */
}

#game-message {
  font-size: 1.1rem;
  color: #fff;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.9);
  animation: fadeInOut 3s ease-in-out infinite;
  transition: opacity 0.3s ease-in-out;
  display: none; /* デフォルトは非表示 */
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
  }
  25% {
    opacity: 1;
  }
  75% {
    opacity: 1;
  }
  100% {
    opacity: 0;
  }
}

/* フィニッシュ画面 */
#finish-screen {
  align-items: center;
  justify-content: center;
  background: #000;
}

.finish-video {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.1s ease-in;
}

.finish-video.ready {
  opacity: 1;
}

.finish-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0);
  z-index: 2;
  pointer-events: none;
  transition: background 3s ease-out;
}

.finish-overlay.grayscale-active {
  background: rgba(0, 0, 0, 0.4);
}

/* リザルト画面 */
#result-screen {
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: transparent;
  padding: 20px;
  overflow: hidden;
  z-index: 10;
}

.result-container {
  display: flex;
  gap: 2rem;
  max-width: 95%;
  width: 100%;
  max-height: 90vh;
  align-items: flex-start;
}

/* リザルト情報エリア（左側） */
.result-info {
  flex: 0 0 300px;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  text-align: center;
}

#result-screen .result-text {
  font-size: 1.6rem;
  margin-bottom: 1.5rem;
  text-shadow: 0 0 10px rgba(0, 0, 0, 0.8);
  font-family: "Roboto Mono", "SFMono-Regular", "Menlo", "Consolas", monospace;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* 動画履歴エリア（右側） */
.video-history-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-height: 90vh;
}

.video-history-title {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  text-align: left;
  opacity: 0.9;
  flex-shrink: 0;
}

/* ページネーション */
.pagination-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  padding: 0.5rem;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

.page-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1rem;
}

.page-input {
  width: 50px;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: #fff;
  text-align: center;
  font-size: 1rem;
}

.page-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.15);
}

.page-nav-btn {
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  color: #fff;
  cursor: pointer;
  font-size: 1.2rem;
  transition: all 0.2s;
  user-select: none;
}

.page-nav-btn:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}

.page-nav-btn.disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* サムネイルコンテナ（グリッド表示） */
.thumbnails-grid-wrapper {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
}

#video-thumbnails-container {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 12px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  min-height: 400px;
}

/* サムネイルアイテム */
.thumbnail-item {
  position: relative;
  aspect-ratio: 16 / 9;
  background: rgba(0, 0, 0, 0.8);
  border-radius: 4px;
  overflow: hidden; /* 通常時は切り抜き */
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: all 0.3s ease;
}

/* 仮想スクロールモード時のサムネイルアイテム */
#video-thumbnails-container.virtual-scroll .thumbnail-item {
  margin-bottom: 12px; /* gap の代わり */
}

.thumbnail-item:hover {
  border-color: rgba(255, 255, 255, 0.6);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

/* サムネイル動画 */
.thumbnail-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}

/* ローディングスピナー */
.thumbnail-spinner {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.7);
  pointer-events: none;
}

.thumbnail-spinner::after {
  content: "";
  width: 30px;
  height: 30px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* 動画ファイル名 */
.thumbnail-filename {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), transparent);
  color: #fff;
  font-size: 0.7rem;
  padding: 8px 4px 4px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

/* 好きボタン */
.like-button {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(0, 0, 0, 0.7);
  border: none;
  border-radius: 50%;
  width: 32px;
  height: 32px;
  font-size: 1.2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
}

.like-button:hover {
  background: rgba(255, 0, 0, 0.8);
  transform: scale(1.1);
}

.like-button.liked {
  background: rgba(255, 0, 0, 0.9);
}

/* サムネイルコンテナのスクロールバー */
#video-thumbnails-container::-webkit-scrollbar {
  width: 8px;
}

#video-thumbnails-container::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

#video-thumbnails-container::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.3);
  border-radius: 4px;
}

#video-thumbnails-container::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.5);
}

#result-screen .result-sub {
  font-size: 1rem;
  opacity: 0.8;
  margin-top: 1rem;
}

/* 右下のコントロール（全画面 & ボリューム） */
#controls {
  position: absolute;
  right: 16px;
  bottom: 16px;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  z-index: 2;
  pointer-events: auto;
}

.control-button {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.6);
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: background 0.2s, transform 0.1s, border-color 0.2s;
  user-select: none;
}

.control-button:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: #fff;
  transform: translateY(-1px);
}

.control-button:active {
  transform: translateY(1px) scale(0.97);
}

#setlist-btn {
  display: none; /* セットリスト機能を一時無効化 */
}

.modal.hidden {
  display: none;
}
.modal {
  position: fixed;
  inset: 0;
  z-index: 999;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(1200px, 90vw);
  height: min(750px, 90vh);
  background: #111;
  color: #f5f5f5;
  border: 1px solid #444;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  border-bottom: 1px solid #333;
}
.modal-body {
  flex: 1;
  overflow: hidden;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.modal-close {
  background: #333;
  color: #fff;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
}
.setlist-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  height: 100%;
}
.setlist-column {
  background: #181818;
  border: 1px solid #333;
  border-radius: 8px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.setlist-dropzone,
.setlist-source-list {
  background: #0f0f0f;
  border: 1px dashed #444;
  border-radius: 6px;
  padding: 6px;
  flex: 1;
  overflow: auto;
  min-height: 200px;
}
.setlist-dropzone.small,
.setlist-source-list.small {
  min-height: 120px;
}
.setlist-item,
.source-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid #333;
  border-radius: 6px;
  margin-bottom: 6px;
  background: #1f1f1f;
  cursor: grab;
}
.setlist-item.drag-over {
  border-color: #4fd1c5;
  background: #123;
}
.source-item video {
  width: 80px;
  height: 45px;
  object-fit: cover;
  border-radius: 4px;
  background: #000;
}
.item-title {
  flex: 1;
  font-size: 0.9rem;
}
.setlist-actions,
.setlist-footer,
.setlist-save,
.setlist-io {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.setlist-footer {
  border-top: 1px solid #333;
  padding-top: 8px;
}
.setlist-save input {
  width: 220px;
}
.setlist-save select {
  min-width: 160px;
}
.setlist-source-list button {
  background: #333;
  color: #fff;
  border: none;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
}
.modal h3 {
  margin: 0;
  font-size: 1rem;
}
.modal h2 {
  margin: 0;
}

/* ボリュームスライダー */
.volume-wrapper {
  position: relative;
}

.volume-slider-wrapper {
  position: absolute;
  bottom: calc(100% + 48px);
  left: 50%;
  transform: translateX(-50%);
  padding: 8px;
  display: none;
}

/* クリックで開閉しているので :hover はあっても大勢に影響なし（inline style が優先される） */
.volume-wrapper:hover .volume-slider-wrapper {
  display: block;
}

.volume-slider {
  width: 120px;
  transform: rotate(-90deg); /* 縦スライダー風 */
  transform-origin: center;
}

input[type="range"] {
  accent-color: #ffffff;
}

/* スマホ横向き向け（高さ600px以下） */
@media (max-height: 600px) {
  #title-screen h1 {
    font-size: 2.2rem;
  }
  #game-message {
    font-size: 0.9rem;
  }
  #timer {
    font-size: 1.1rem;
  }
  .control-button {
    width: 34px;
    height: 34px;
    font-size: 0.9rem;
  }

  /* リザルト画面: PCと同じ横並びレイアウトを維持、サイズ調整 */
  .result-container {
    gap: 1rem; /* PCは2rem、スマホは1rem */
  }

  .result-info {
    flex: 0 0 180px; /* PCは300px、スマホは180px */
    font-size: 0.85rem; /* 文字サイズを少し小さく */
  }

  #result-screen .result-text {
    font-size: 1.1rem; /* PCは1.6rem、スマホは1.1rem */
    margin-bottom: 0.8rem;
  }

  .video-history-title {
    font-size: 0.9rem; /* PCは1.1rem、スマホは0.9rem */
  }

  /* サムネイルグリッドを3列x4行に（PCは4列x3行） */
  #video-thumbnails-container {
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(4, 1fr);
    gap: 4px; /* PCは8px */
  }

  .thumbnail-item {
    font-size: 0.7rem; /* ファイル名を小さく */
  }

  .thumbnail-filename {
    font-size: 0.65rem; /* ファイル名をさらに小さく */
  }

  .like-button {
    font-size: 1rem; /* いいねボタンを少し小さく */
  }

  /* ページネーション */
  .pagination-controls {
    font-size: 0.85rem;
  }

  .page-nav-btn {
    font-size: 0.85rem;
    padding: 4px 8px;
  }

  .page-input {
    font-size: 0.85rem;
    width: 40px;
  }

  /* ランキング登録エリア */
  .ranking-register {
    font-size: 0.85rem;
  }

  .ranking-title {
    font-size: 1rem;
  }

  #player-name-input {
    font-size: 0.85rem;
    padding: 6px;
  }

  .ranking-submit-btn {
    font-size: 0.85rem;
    padding: 6px 12px;
  }
}

/* ================================================
   回転促進画面（v4.6 横向き推奨）
   ================================================ */
#rotate-screen {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.rotate-message {
  text-align: center;
  color: #fff;
  padding: 40px 20px;
}

.rotate-icon {
  font-size: 5rem;
  margin-bottom: 20px;
  animation: rotatePhone 2s ease-in-out infinite;
}

@keyframes rotatePhone {
  0%, 100% {
    transform: rotate(0deg);
  }
  50% {
    transform: rotate(90deg);
  }
}

.rotate-message p {
  font-size: 1.5rem;
  margin: 10px 0;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
}

.rotate-hint {
  font-size: 1rem !important;
  color: rgba(255, 255, 255, 0.7);
  margin-top: 20px !important;
}

/* モバイルデバイスで縦向きの時のみ表示 */
/* タップで閉じた後は再表示されない（!important削除） */
@media only screen and (max-width: 768px) and (orientation: portrait) {
  #rotate-screen {
    display: flex;
  }
}

/* ================================================
   オンラインランキング（リザルト画面）
   ================================================ */
.ranking-register {
  margin: 20px 0;
  padding: 15px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ranking-title {
  font-size: 1.1rem;
  color: #ffd700;
  margin-bottom: 10px;
  font-weight: bold;
}

.ranking-input-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}

#player-name-input {
  padding: 8px 12px;
  font-size: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.3);
  color: #fff;
}

#player-name-input:focus {
  outline: none;
  border-color: #ffd700;
}

.ranking-submit-btn {
  padding: 10px 20px;
  font-size: 1rem;
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #000;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
  transition: transform 0.2s;
}

.ranking-submit-btn:hover {
  transform: scale(1.05);
}

.ranking-submit-btn:disabled {
  background: #666;
  cursor: not-allowed;
  transform: none;
}

.ranking-message {
  font-size: 0.9rem;
  margin: 5px 0;
  min-height: 20px;
}

.ranking-message.success {
  color: #4caf50;
}

.ranking-message.error {
  color: #f44336;
}

.ranking-position {
  font-size: 1.2rem;
  color: #ffd700;
  font-weight: bold;
  margin: 10px 0;
  text-align: center;
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.view-ranking-link {
  display: inline-block;
  margin-top: 10px;
  color: #4fc3f7;
  text-decoration: none;
  font-size: 0.95rem;
  transition: color 0.3s;
}

.view-ranking-link:hover {
  color: #81d4fa;
  text-decoration: underline;
}

/* ================================================
   ランキングモーダル
   ================================================ */
.ranking-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 10000;
  justify-content: center;
  align-items: center;
}

.ranking-modal.show {
  display: flex;
}

.ranking-modal-content {
  background: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
  border-radius: 12px;
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.ranking-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.ranking-modal-header h2 {
  margin: 0;
  color: #ffd700;
  font-size: 1.5rem;
}

.ranking-modal-close {
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.3s;
}

.ranking-modal-close:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ranking-modal-body {
  padding: 20px;
  overflow-y: auto;
  max-height: calc(90vh - 80px);
}

.ranking-period-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.ranking-tab {
  flex: 1;
  min-width: 80px;
  padding: 10px 15px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #fff;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.3s;
}

.ranking-tab:hover {
  background: rgba(255, 255, 255, 0.1);
}

.ranking-tab.active {
  background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
  color: #000;
  border-color: #ffd700;
  font-weight: bold;
}

.ranking-table-wrapper {
  overflow-x: auto;
}

.ranking-table {
  width: 100%;
  border-collapse: collapse;
  background: rgba(0, 0, 0, 0.3);
  border-radius: 8px;
  overflow: hidden;
}

.ranking-table thead {
  background: rgba(255, 215, 0, 0.1);
}

.ranking-table th {
  padding: 12px;
  text-align: left;
  color: #ffd700;
  font-weight: bold;
  border-bottom: 2px solid rgba(255, 215, 0, 0.3);
}

.ranking-table td {
  padding: 10px 12px;
  color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.ranking-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.05);
}

.ranking-table tbody tr.rank-1 {
  background: rgba(255, 215, 0, 0.15);
}

.ranking-table tbody tr.rank-2 {
  background: rgba(192, 192, 192, 0.15);
}

.ranking-table tbody tr.rank-3 {
  background: rgba(205, 127, 50, 0.15);
}

.ranking-loading {
  text-align: center !important;
  color: rgba(255, 255, 255, 0.6);
  font-style: italic;
}

/* スマホ横向け向け調整（高さ600px以下） */
@media (max-height: 600px) {
  .ranking-modal-content {
    width: 95%;
    max-height: 95vh;
  }

  .ranking-period-tabs {
    gap: 5px;
  }

  .ranking-tab {
    font-size: 0.85rem;
    padding: 8px 10px;
    min-width: 60px;
  }

  .ranking-table th,
  .ranking-table td {
    padding: 8px 6px;
    font-size: 0.85rem;
  }

  .ranking-input-group {
    gap: 8px;
  }

  .ranking-submit-btn {
    font-size: 0.9rem;
    padding: 8px 16px;
  }
}

/* ====== デバッグモード表示 ====== */
/* 全画面モード対応: game-container内に配置され、z-indexを最上位に */
#debug-indicator {
  position: fixed;
  bottom: 10px;
  left: 10px;
  background-color: rgba(0, 0, 0, 0.7);
  color: #ff0000;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 1rem;
  font-weight: bold;
  z-index: 10000;
  pointer-events: none;
}

/* ====== プレイリストDLボタン（リザルト画面） ====== */
#playlist-dl-btn {
  position: absolute;
  bottom: 20px;
  left: 20px;
  background-color: rgba(255, 0, 0, 0.8);
  color: #fff;
  border: 2px solid #fff;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 1.2rem;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s ease;
  z-index: 100;
}

#playlist-dl-btn:hover {
  background-color: rgba(255, 50, 50, 1);
  transform: scale(1.05);
}

#playlist-dl-btn:active {
  transform: scale(0.95);
}

/* ====== BGM選曲UI（デバッグモード） ====== */
.bgm-info-wrapper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
}

.current-bgm-name {
  background-color: rgba(0, 0, 0, 0.7);
  color: #fff;
  padding: 6px 12px;
  border-radius: 4px;
  font-size: 0.9rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* BGM選曲モーダル */
.bgm-selector-content {
  max-width: 500px;
  max-height: 70vh;
}

.bgm-mode-selector {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}

.bgm-mode-btn {
  flex: 1;
  padding: 10px 16px;
  background-color: rgba(255, 255, 255, 0.1);
  color: #fff;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

.bgm-mode-btn:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.5);
}

.bgm-mode-btn.active {
  background-color: rgba(255, 100, 100, 0.8);
  border-color: rgba(255, 100, 100, 1);
  font-weight: bold;
}

.bgm-list {
  max-height: 400px;
  overflow-y: auto;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 6px;
  padding: 10px;
}

.bgm-list-item {
  padding: 12px 16px;
  margin-bottom: 8px;
  background-color: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.bgm-list-item:hover {
  background-color: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
  transform: translateX(5px);
}

.bgm-list-item.playing {
  background-color: rgba(255, 100, 100, 0.3);
  border-color: rgba(255, 100, 100, 0.8);
  font-weight: bold;
}

.bgm-list-item.playing::before {
  content: '●';
  color: rgba(255, 100, 100, 1);
  font-size: 1.2rem;
}

.bgm-list-item:not(.playing)::before {
  content: '○';
  color: rgba(255, 255, 255, 0.5);
  font-size: 1.2rem;
}
