/* ============ Material Design-ish Colors ============ */
:root {
  --md-primary: #fdb2b2;
  --md-on-primary: #ffffff;
  --md-secondary: #03dac6;
  --md-bg: #f28282;
  /* 背景色 */
}

/* 全体 */
body {
  margin: 0;
  padding: 0;
  font-family: "Roboto", sans-serif;
  background-color: var(--md-bg);
}

/* メンテナンス通知バー */
#maintenance-notice-bar {
  position: sticky;
  top: 0;
  background: linear-gradient(135deg, #FF5722, #FF7043);
  color: white;
  padding: 12px 20px;
  text-align: center;
  font-weight: 600;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(255, 87, 34, 0.3);
  z-index: 1000;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  border-bottom: 3px solid #D84315;
}

#maintenance-notice-bar .admin-link-btn {
  background: rgba(255, 255, 255, 0.2);
  color: white;
  padding: 6px 12px;
  border-radius: 6px;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  border: 1px solid rgba(255, 255, 255, 0.3);
  transition: all 0.2s;
}

#maintenance-notice-bar .admin-link-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-1px);
}

/* モバイル対応 */
@media (max-width: 768px) {
  #maintenance-notice-bar {
    flex-direction: column;
    gap: 8px;
    padding: 10px 16px;
    font-size: 0.85rem;
  }

  #maintenance-notice-bar .admin-link-btn {
    padding: 8px 16px;
    font-size: 0.8rem;
  }
}

/* ローディングオーバーレイ */
#loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
  flex-direction: column;
  gap: 20px;
}

#loading-progress {
  width: 80%;
  max-width: 400px;
  appearance: none;
  height: 30px;
  border-radius: 3px;
}

#loading-overlay span {
  color: #FFF;
  font-size: 1.2rem;
  text-align: center;
}

/* メインコンテンツ */
#main-content {
  max-width: 1140px;
  margin: 0 auto 30px auto;
  padding: 0 10px;
}

/* ヘッダー情報 */
h1 {
  font-size: 30px;
  font-weight: 700 !important;
}

header {
  color: #ffffff;
  max-width: 1140px;
  margin: 20px auto;
  padding: 0 10px;
}

#recent-date::before {
  content: '';
  display: inline-block;
  width: 12px;
  height: 12px;
  background-color: #ff0000;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: baseline;
}

/* ヘッダーを横並びに */
#main-header {
  display: flex;
  justify-content: space-between;
  margin: 10px auto;
  gap: 20px;
}

/* 左側のタイトル・情報 */
.header-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* お知らせ枠を右側に */
#announcement-box {
  min-width: 300px;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #F3B2B2;
  border-radius: 10px;
  margin: 10px;
  padding: 12px 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  min-height: 100px;
}

#announcement-box .announcement-content {
  font-size: 14px;
  line-height: 1.6;
  color: #5b2a2a;
  flex: 1;
}

#announcement-box .announcement-updated {
  margin-top: 4px;
  font-size: 11px;
  color: #9c6d6d;
  text-align: right;
  align-self: flex-end;
}

/* スマホ時は縦並び */
@media (max-width: 768px) {
  #main-header {
    flex-direction: column;
    align-items: flex-start;
  }

  #announcement-box {
    width: 100%;
    margin: 10px auto;
  }
}

/* 右クリックメニューのスタイル */
.context-menu {
  position: fixed;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1000;
  min-width: 180px;
  display: none;
}

.context-menu-item {
  padding: 10px 16px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #333;
  border: none;
  border-radius: 8px;
  background: none;
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 8px;
}

.context-menu-item:hover {
  background: #f5f5f5;
}

.context-menu-item:active {
  background: #e9ecef;
}

.context-menu-separator {
  height: 1px;
  background: #eee;
  margin: 4px 0;
}

/* タッチデバイス用のメニューアイテム改善 */
@media (pointer: coarse) {
  .context-menu {
    /* タッチしやすいサイズに調整 */
    min-width: 220px;
    /* タッチ時の誤作動を防ぐ */
    touch-action: manipulation;
  }

  .context-menu-item {
    /* タッチしやすい高さに調整 */
    min-height: 48px;
    padding: 14px 20px;
    font-size: 1rem;
    /* タップ時の視覚フィードバック */
    transition: background-color 0.1s;
  }

  .context-menu-item:active {
    background-color: #007bff;
    color: white;
  }
}

/* 右クリックメニュー全般の改善 */
.context-menu {
  /* メニューのタッチ操作を改善 */
  touch-action: manipulation;
  /* より明確な境界線 */
  border: 2px solid #ddd;
  /* より強い影 */
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
}

.context-menu-item {
  /* タッチ時の選択を防止 */
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  /* タップハイライトを調整 */
  -webkit-tap-highlight-color: rgba(0, 123, 255, 0.2);
}

/* 一時メッセージのアニメーション */
@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideOutRight {
  from {
    transform: translateX(0);
    opacity: 1;
  }

  to {
    transform: translateX(100%);
    opacity: 0;
  }
}

.temporary-message {
  animation: slideInRight 0.3s ease-out;
}

/* ========== 期間限定ボイスエリア ========== */
#limited-sounds-area {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
  border: 2px solid #FF9800;
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 16px;
  box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2);
  animation: limitedGlow 3s ease-in-out infinite;
}

@keyframes limitedGlow {

  0%,
  100% {
    box-shadow: 0 2px 8px rgba(255, 152, 0, 0.2);
  }

  50% {
    box-shadow: 0 2px 16px rgba(255, 152, 0, 0.4);
  }
}

@keyframes iconBounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-3px);
  }
}

.limited-sounds-title {
  font-size: 1.1rem;
  font-weight: 700;
  color: #E65100;
}

#limited-sounds-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.limited-sound-button {
  background: linear-gradient(135deg, #FF9800, #FFB74D) !important;
  color: #fff !important;
  border: 1px solid #F57C00 !important;
  font-weight: 600;
}

.limited-sound-button:hover {
  background: linear-gradient(135deg, #F57C00, #FF9800) !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 152, 0, 0.4);
}

.limited-sound-button:active {
  transform: scale(0.98);
}

.limited-sound-button.selected,
.limited-sound-button:focus {
  box-shadow: 0 0 0 3px #E65100 !important;
  background: linear-gradient(135deg, #E65100, #FF9800) !important;
}

@media (prefers-color-scheme: dark) {
  #limited-sounds-area {
    background: linear-gradient(135deg, #3e2723, #4e342e);
    border-color: #FF9800;
  }

  .limited-sounds-title {
    color: #FFB74D;
  }

  .limited-sound-button {
    background: linear-gradient(135deg, #E65100, #FF8F00) !important;
    border-color: #BF360C !important;
  }

  .limited-sound-button:hover {
    background: linear-gradient(135deg, #BF360C, #E65100) !important;
  }
}

@media (max-width: 600px) {
  #limited-sounds-area {
    padding: 12px 14px;
    margin-bottom: 12px;
  }

  .limited-sounds-title {
    font-size: 1rem;
  }

  #limited-sounds-buttons {
    gap: 8px;
  }
}


/* メインタブ */
#main-tabs {
  display: flex;
  gap: 10px;
}

.main-tab-button {
  font-size: 15px;
  flex: 1;
  padding: 10px 16px;
  background-color: #ffcfcf;
  border-top: solid 1px #DEE2E6;
  border-right: solid 1px #DEE2E6;
  border-left: solid 1px #DEE2E6;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
}

.main-tab-button.active {
  font-size: 15px;
  background-color: rgba(255, 255, 255, 0.95);
  padding: 10px 20px;
  border-radius: 8px 8px 0 0;
  border-top: solid 1px #DEE2E6;
  border-right: solid 1px #DEE2E6;
  border-left: solid 1px #DEE2E6;
  border-bottom: none;
}

/* メインタブセクション切り替え */
.main-tab-section {
  display: none;
}

.main-tab-section.active {
  display: block;
  background-color: rgba(255, 255, 255, 0.95);
  padding: 10px;
  border-radius: 0 0 8px 8px;
  border-top: none;
  border-right: solid 1px #DEE2E6;
  border-left: solid 1px #DEE2E6;
  border-bottom: solid 1px #DEE2E6;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
}

/* カテゴリタブとボタンの左右レイアウト */
#category-layout {
  display: flex;
}

#category-tabs {
  flex: 0 0 200px;
  /* 左側：固定幅200px */
  display: block;
}

#category-buttons {
  flex: 1;
  /* 右側：残りの幅を使用 */
  background-color: #ffffff;
  padding: .5rem !important;
  border-top: solid 1px #DEE2E6;
  border-right: solid 1px #DEE2E6;
  border-bottom: solid 1px #DEE2E6;
}

#category-buttons .sound-button {
  margin: 0 10px 10px 0;
}

/* カテゴリタブ */
.category-tab {
  color: #000;
  padding: 10px 16px;
  background-color: var(--md-primary);
  border: none;
  cursor: pointer;
  transition: background-color 0.15s, box-shadow 0.15s;
}

.category-tab:hover {
  background-color: #f28282;
}

.category-tab.active {
  background-color: #ffffff;
  color: #000;
  border-top: solid 1px #DEE2E6;
  border-left: solid 1px #DEE2E6;
  border-bottom: solid 1px #DEE2E6;
}

/* 検索ボックス */
#search-container,
#category-search-container {
  margin-bottom: 20px;
}

#search-box,
#category-search-box {
  display: block;
  width: 100%;
  padding: 8px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* 重複再生設定のスタイル */
#duplicate-play-container {
  margin-bottom: 20px;
}

#duplicate-play-container label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #333;
  cursor: pointer;
  user-select: none;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  transition: all 0.2s;
}

#duplicate-play-container label:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

#duplicate-play-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--md-primary);
}

/* チェックボックスがオンの時の特別なスタイル */
#duplicate-play-container label:has(#duplicate-play-checkbox:checked) {
  background: #fff3cd;
  border-color: #ffeaa7;
  color: #856404;
}

/* ボタンサイズ選択のスタイル */
#button-size-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

.button-size-label {
  font-size: 0.9rem;
  color: #333;
  font-weight: 500;
  margin-right: 4px;
}

.size-btn {
  padding: 8px 16px;
  background: white;
  border: 2px solid #dee2e6;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 500;
  color: #495057;
  transition: all 0.2s;
  min-width: 50px;
}

.size-btn:hover {
  background: #e9ecef;
  border-color: #adb5bd;
}

.size-btn.active {
  background: var(--md-primary);
  border-color: var(--md-primary);
  color: white;
  font-weight: 600;
}

/* ボタンサイズクラス */
.sound-button.size-small {
  padding: 6px 10px;
  font-size: 0.8rem;
}

.sound-button.size-medium {
  padding: 8px 12px;
  font-size: 1rem;
}

.sound-button.size-large {
  padding: 12px 18px;
  font-size: 1.2rem;
}

/* カテゴリタブのボタンサイズも適用 */
#category-buttons .sound-button.size-small {
  padding: 6px 10px;
  font-size: 0.8rem;
}

#category-buttons .sound-button.size-medium {
  padding: 8px 12px;
  font-size: 1rem;
}

#category-buttons .sound-button.size-large {
  padding: 12px 18px;
  font-size: 1.2rem;
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
  #duplicate-play-container label {
    background: #363636;
    border-color: #555;
    color: #e0e0e0;
  }

  #duplicate-play-container label:hover {
    background: #404040;
    border-color: #666;
  }

  #duplicate-play-container label:has(#duplicate-play-checkbox:checked) {
    background: #3a3020;
    border-color: #6a5a30;
    color: #f4d774;
  }

  #button-size-container {
    background: #363636;
    border-color: #555;
  }

  .button-size-label {
    color: #e0e0e0;
  }

  .size-btn {
    background: #2d2d2d;
    border-color: #555;
    color: #b0b0b0;
  }

  .size-btn:hover {
    background: #404040;
    border-color: #666;
  }

  .size-btn.active {
    background: var(--md-primary);
    border-color: var(--md-primary);
    color: white;
  }
}

/* モバイル対応 */
@media (max-width: 600px) {
  #duplicate-play-container label {
    font-size: 0.85rem;
    padding: 10px 12px;
  }

  #duplicate-play-checkbox {
    width: 14px;
    height: 14px;
  }

  #button-size-container {
    padding: 10px 12px;
    gap: 6px;
  }

  .button-size-label {
    font-size: 0.85rem;
  }

  .size-btn {
    padding: 6px 12px;
    font-size: 0.8rem;
    min-width: 40px;
  }
}

/* ========= ここからサウンドボタン関連 ========= */

/* 「全一覧」ボタン群を横並び＋折り返し */
#all-sounds-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  /* ボタン間のスペース */
}

/* ボタンラッパー */
.sound-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  margin: 0;
  /* gap で余白管理するためマージン削除 */
}

/* サウンドボタン (MD風) */
.sound-button {
  margin: 0;
  padding: 8px 12px;
  background-color: var(--md-primary);
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  color: #333;
  transition: background-color 0.2s, transform 0.1s;
}

.sound-button:hover {
  background-color: #f2bbbb;
}

.sound-button:active {
  transform: scale(0.98);
}

.sound-button.selected,
.sound-button:focus {
  box-shadow: 0 0 0 3px #2196f3;
  background-color: #e3f2fd;
}

/* 最新追加インジケーター */
.recent-indicator {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 10px;
  height: 10px;
  background-color: red;
  border-radius: 50%;
  z-index: 10;
}

/* 日付表示は非表示 */
.sound-date {
  display: none;
}

/* プレイリスト機能のスタイル */
#playlist-layout {
  display: flex;
  gap: 20px;
  min-height: 400px;
  max-height: calc(100vh - 350px);
  height: auto;
  position: relative;
}

#playlist-sound-list {
  position: relative;
  flex: 1;
  background: #ffffff;
  border-radius: 8px;
  padding: 10px;
  border: 1px solid #DEE2E6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#playlist-sound-list,
#playlist-queue {
  display: flex;
  flex-direction: column;
}

#playlist-available-sounds,
#playlist-items {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-bottom: 0;
}

#playlist-sound-list #playlist-preview-settings,
#playlist-queue #playlist-queue-preview-settings,
#playlist-queue #playlist-queue-clear {
  position: static !important;
}

#playlist-sound-list #playlist-preview-settings {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  margin: 0;
  z-index: 20;
  /* 右パネルの並び替えUIなど(z=10)より前 */
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid #dee2e6;
  border-radius: 6px;
}

#playlist-queue {
  flex: 1;
  background: #ffffff;
  border-radius: 8px;
  padding: 10px;
  border: 1px solid #DEE2E6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  position: relative;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

#playlist-queue #playlist-queue-clear {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  z-index: 20;
}

#playlist-queue #playlist-queue-preview-settings {
  position: absolute;
  right: 10px;
  bottom: 70px;
  margin: 0;
  z-index: 21;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

/* 中央の追加ボタン */
#playlist-add-button {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
  border: none;
  border-radius: 50%;
  width: 60px;
  height: 60px;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
  transition: all 0.3s;
  z-index: 100;
  opacity: 0.7;
}

#playlist-add-button:hover {
  transform: translate(-50%, -50%) scale(1.1);
  opacity: 1;
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.6);
}

#playlist-add-button:disabled {
  background: #ccc;
  cursor: not-allowed;
  opacity: 0.3;
}

#playlist-add-button:disabled:hover {
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

#playlist-sound-list h3,
#playlist-queue h3 {
  margin: 0 0 15px 0;
  color: #333;
  font-size: 1.1rem;
  border-bottom: 2px solid var(--md-primary);
  padding-bottom: 8px;
}

#playlist-available-sounds {
  max-height: calc(100vh - 400px);
  height: auto;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  margin-bottom: 10px;
}

#playlist-items {
  overflow-y: auto;
  overflow-x: hidden;
  max-height: calc(100vh - 400px);
  height: auto;
  border-radius: 8px;
  margin-right: 50px;
  width: calc(100% - 50px);
  max-width: calc(100% - 50px);
  min-width: 0;
  margin-bottom: 10px;
}

.playlist-sound-item {
  background: transparent;
  border: none;
  border-bottom: 1px solid #eee;
  padding: 12px 8px;
  cursor: pointer;
  font-size: 0.9rem;
  color: #333;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
  margin-bottom: 0;
  border-radius: 0;
  white-space: nowrap;
}

.playlist-sound-item:hover {
  background: #f5f5f5;
  transform: none;
  border-left: 3px solid var(--md-primary);
  padding-left: 12px;
}

.playlist-sound-item.selected {
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  padding-left: 12px;
  font-weight: 500;
}

.playlist-sound-item:last-child {
  border-bottom: none;
}

.playlist-queue-item {
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  padding: 12px;
  margin-bottom: 8px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s;
  overflow: hidden;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

.playlist-queue-item:hover {
  background: #e9ecef;
}

.playlist-queue-item.selected {
  background: #cce5ff;
  border-color: #007bff;
  box-shadow: 0 0 0 2px rgba(0, 123, 255, 0.25);
}

.playlist-queue-item.playing {
  background: #d4edda;
  border-color: #4caf50;
  animation: pulse-playing 1.5s infinite;
}

.playlist-queue-item.playing.selected {
  background: #b8e6c1;
  border-color: #28a745;
}

@keyframes pulse-playing {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.8;
  }
}

.playlist-queue-item-content {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  overflow: hidden;
  width: calc(100% - 40px);
  max-width: calc(100% - 40px);
}

/* 番号を削除 */
.playlist-queue-item-index {
  display: none;
}

.playlist-queue-item-name {
  font-weight: 500;
  color: #333;
  white-space: nowrap;
}

.playlist-queue-item-remove {
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 3px;
  width: 20px;
  height: 20px;
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  min-width: 20px;
  max-width: 20px;
}

.playlist-queue-item-remove:hover {
  background: #c82333;
}

#playlist-queue-clear {
  padding: 0;
  margin-bottom: 10px;
}

#playlist-queue-clear .playlist-control-btn {
  width: 100%;
  background: linear-gradient(135deg, #757575, #616161);
  color: white;
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.3s;
}

#playlist-queue-clear .playlist-control-btn:hover {
  background: linear-gradient(135deg, #616161, #424242);
  transform: translateY(-2px);
}

/* プレビュー設定 */
#playlist-preview-settings,
#playlist-queue-preview-settings {
  margin-top: 15px;
  padding: 10px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
}

#playlist-preview-settings label,
#playlist-queue-preview-settings label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: #495057;
  cursor: pointer;
  user-select: none;
}

#playlist-preview-checkbox,
#playlist-queue-preview-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

#playlist-preview-settings label:hover,
#playlist-queue-preview-settings label:hover {
  color: #007bff;
}

/* 並び替えボタン */
.playlist-sort-controls {
  position: absolute;
  right: 10px;
  /* パネル内の右側 */
  top: 50%;
  /* 上端を50%の位置に */
  transform: translateY(-50%);
  /* 縦方向の中央に配置 */
  display: flex;
  flex-direction: column;
  /* 縦並び */
  gap: 6px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 6px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  border: 1px solid #dee2e6;
  z-index: 10;
}

/* インポート・エクスポートボタン */
.playlist-import-export-controls {
  position: absolute;
  right: 10px;
  /* パネル内の右側 */
  top: 40%;
  /* 並び替えボタンより上に配置 */
  transform: translateY(-100%);
  /* 上に配置 */
  display: flex;
  flex-direction: column;
  /* 縦並び */
  gap: 4px;
  background: rgba(255, 255, 255, 0.95);
  border-radius: 6px;
  padding: 4px;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.15);
  border: 1px solid #dee2e6;
  z-index: 10;
}

.playlist-import-btn,
.playlist-export-btn {
  background: #17a2b8;
  color: white;
  border: none;
  border-radius: 4px;
  width: 32px;
  height: 24px;
  cursor: pointer;
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-weight: bold;
}

.playlist-import-btn:hover,
.playlist-export-btn:hover {
  background: #138496;
  transform: translateY(-1px);
}

.playlist-import-btn:active,
.playlist-export-btn:active {
  transform: translateY(0);
}

.playlist-sort-btn {
  background: #6c757d;
  color: white;
  border: none;
  border-radius: 4px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  font-weight: bold;
}

.playlist-sort-btn:hover:not(:disabled) {
  background: #5a6268;
  transform: translateY(-1px);
}

.playlist-sort-btn:disabled {
  background: #ced4da;
  cursor: not-allowed;
  opacity: 0.6;
}

.playlist-sort-btn:active:not(:disabled) {
  transform: translateY(0);
}

#playlist-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  padding: 20px;
  margin-top: 20px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #DEE2E6;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.playlist-control-btn {
  padding: 12px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s;
}

#playlist-play-btn {
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
  flex: 1;
}

#playlist-play-btn:hover {
  background: linear-gradient(135deg, #45a049, #3d8b40);
  transform: translateY(-2px);
}

#playlist-stop-btn {
  background: linear-gradient(135deg, #f44336, #d32f2f);
  color: white;
  flex: 1;
}

#playlist-stop-btn:hover {
  background: linear-gradient(135deg, #d32f2f, #b71c1c);
  transform: translateY(-2px);
}

/* ループ再生設定 */
#playlist-loop-settings {
  margin-left: 20px;
  padding: 12px 16px;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #dee2e6;
  white-space: nowrap;
}

#playlist-loop-settings label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: #495057;
  cursor: pointer;
  user-select: none;
  margin: 0;
}

#playlist-loop-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
}

#playlist-loop-settings label:hover {
  color: #007bff;
}

.playlist-empty-message {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 40px 20px;
}

/* プレイリスト検索ボックス */
#playlist-search-container {
  margin-bottom: 10px;
}

#playlist-search-box {
  display: block;
  width: 100%;
  padding: 8px;
  font-size: 16px;
  border: 1px solid #ccc;
  border-radius: 4px;
}

/* インポート・エクスポート用モーダル */
.import-export-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  backdrop-filter: blur(4px);
}

.import-export-modal.show {
  display: flex;
}

.import-export-modal-content {
  background: #ffffff;
  border-radius: 16px;
  width: 500px;
  max-width: 90vw;
  max-height: 80vh;
  padding: 32px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  transform: scale(0.9);
  transition: transform 0.3s ease-out;
  overflow-y: auto;
}

.import-export-modal.show .import-export-modal-content {
  transform: scale(1);
}

.import-export-modal h3 {
  margin: 0 0 24px 0;
  font-size: 1.5rem;
  color: #2196F3;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.import-export-textarea {
  width: 100%;
  min-height: 200px;
  max-height: 300px;
  padding: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-family: 'Courier New', monospace;
  font-size: 0.9rem;
  resize: vertical;
  background: #f8f9fa;
  color: #333;
  line-height: 1.4;
  box-sizing: border-box;
}

.import-export-textarea:focus {
  border-color: #2196F3;
  background: #fff;
  outline: none;
  box-shadow: 0 0 0 3px rgba(33, 150, 243, 0.1);
}

.import-export-textarea::placeholder {
  color: #999;
  font-style: italic;
}

.import-export-info {
  margin: 16px 0;
  padding: 12px;
  background: #e3f2fd;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #1565c0;
  border-left: 4px solid #2196f3;
}

.import-export-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.import-export-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s;
}

.import-export-btn.cancel {
  background: linear-gradient(135deg, #757575, #616161);
  color: white;
}

.import-export-btn.cancel:hover {
  background: linear-gradient(135deg, #616161, #424242);
}

.import-export-btn.copy {
  background: linear-gradient(135deg, #ff9800, #f57c00);
  color: white;
}

.import-export-btn.copy:hover {
  background: linear-gradient(135deg, #f57c00, #ef6c00);
}

.import-export-btn.import {
  background: linear-gradient(135deg, #4caf50, #45a049);
  color: white;
}

.import-export-btn.import:hover {
  background: linear-gradient(135deg, #45a049, #3d8b40);
}

/* ========== サイト情報タブのスタイル ========== */
#info-section {
  padding: 20px;
}

.info-content h2 {
  color: #333;
  font-size: 1.8rem;
  margin-bottom: 30px;
  text-align: center;
  border-bottom: 3px solid var(--md-primary);
  padding-bottom: 10px;
}

.info-block h3 {
  padding-bottom: 10px;
}

.info-block p {
  color: #666;
  line-height: 1.8;
  margin-bottom: 10px;
}

.info-block ul {
  list-style: none;
  padding-bottom: 10px;
}

p.copyright {
  text-align: center;
  margin-top: 10px;
}

/* ダークモード対応 */
@media (prefers-color-scheme: dark) {
  .info-content h2 {
    color: #e0e0e0;
    border-bottom-color: var(--md-primary);
  }

  .info-block {
    background: #363636;
  }

  .info-block h3 {
    color: #b0b0b0;
  }

  .info-block p,
  .reference-list li,
  .tech-list li {
    color: #b0b0b0;
  }

  .reference-list a {
    color: #64b5f6;
  }

  .reference-list a:hover {
    color: #90caf9;
  }

}

/* モバイル対応 */
@media (max-width: 600px) {
  #info-section {
    padding: 15px;
  }

  .info-content h2 {
    font-size: 1.5rem;
  }

  .info-block {
    padding: 15px;
  }

  .info-block h3 {
    font-size: 1.1rem;
  }
}

/* 確認用モーダル */
.confirm-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 10001;
  backdrop-filter: blur(4px);
}

.confirm-modal.show {
  display: flex;
}

.confirm-modal-content {
  background: #ffffff;
  border-radius: 16px;
  width: 400px;
  max-width: 90vw;
  padding: 32px;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.2);
  transform: scale(0.9);
  transition: transform 0.3s ease-out;
  text-align: center;
}

.confirm-modal.show .confirm-modal-content {
  transform: scale(1);
}

.confirm-modal h3 {
  margin: 0 0 20px 0;
  font-size: 1.3rem;
  color: #2196F3;
  line-height: 1.4;
}

.confirm-modal #confirm-message {
  margin: 20px 0;
  font-size: 1rem;
  color: #333;
  line-height: 1.5;
  white-space: pre-line;
  text-align: left;
}

.confirm-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

.confirm-btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s;
  min-width: 100px;
}

.confirm-btn.cancel {
  background: linear-gradient(135deg, #757575, #616161);
  color: white;
}

.confirm-btn.cancel:hover {
  background: linear-gradient(135deg, #616161, #424242);
}

.confirm-btn.ok {
  background: linear-gradient(135deg, #2196F3, #1976D2);
  color: white;
}

.confirm-btn.ok:hover {
  background: linear-gradient(135deg, #1976D2, #1565C0);
}

/* モバイル端末用のスタイル強化 */
@media (max-width: 1024px) {

  /* モバイル確認モーダルの調整 */
  .confirm-modal-content {
    width: 350px;
    padding: 24px;
    margin: 16px;
  }

  .confirm-modal h3 {
    font-size: 1.1rem;
  }

  .confirm-modal #confirm-message {
    font-size: 0.9rem;
  }

  .confirm-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .confirm-btn {
    width: 100%;
    padding: 14px 20px;
  }

  /* ローディングオーバーレイの調整 */
  #loading-overlay span {
    font-size: 1rem;
    padding: 0 20px;
  }

  #loading-progress {
    width: 90%;
    height: 25px;
  }
}

/* ボックスサイジング統一 */
*,
::after,
::before {
  box-sizing: border-box;
}

/* レスポンシブデザイン */
@media (max-width: 600px) {
  .category-tab {
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    -webkit-text-overflow: ellipsis;
    -o-text-overflow: ellipsis;
  }

  #category-layout {
    display: inline-block;
    width: 100%;
  }

  #category-tabs {
    width: 30%;
    float: left;
  }

  #category-buttons {
    width: 70%;
    float: right;
  }

  /* プレイリストのモバイル対応 - 横レイアウト維持 */
  #playlist-layout {
    max-height: calc(100vh - 500px);
    min-height: 400px;
  }

  #playlist-add-button {
    width: 45px;
    height: 45px;
    font-size: 18px;
  }

  #playlist-items {
    margin-right: 40px;
    /* モバイルでも右マージン維持 */
  }

  .playlist-sort-controls {
    right: 5px;
    /* モバイルでもパネル内右側 */
    top: 50%;
    /* 縦方向中央 */
    transform: translateY(-50%);
    /* 縦方向中央配置 */
    gap: 4px;
    padding: 4px;
  }

  .playlist-import-export-controls {
    right: 5px;
    top: 35%;
    /* モバイルでは少し上に */
    transform: translateY(-100%);
    gap: 3px;
    padding: 3px;
  }

  .playlist-import-btn,
  .playlist-export-btn {
    width: 28px;
    height: 20px;
    font-size: 0.6rem;
  }

  .playlist-sort-btn {
    width: 24px;
    height: 24px;
    font-size: 0.7rem;
  }

  #playlist-controls {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  #playlist-loop-settings {
    margin-left: 0;
    margin-top: 8px;
    text-align: center;
  }

  .playlist-control-btn {
    width: 100%;
  }

  .playlist-sound-item,
  .playlist-queue-item {
    font-size: 0.8rem;
    padding: 10px 6px;
  }

  .playlist-sound-item:hover,
  .playlist-sound-item.selected {
    padding-left: 10px;
  }

  /* モーダルのモバイル対応 */
  .import-export-modal-content,
  .confirm-modal-content {
    margin: 16px;
    padding: 24px;
    max-height: 85vh;
  }

  .import-export-textarea {
    min-height: 150px;
    font-size: 0.8rem;
  }

  .import-export-buttons,
  .confirm-buttons {
    flex-direction: column;
    gap: 8px;
  }

  .import-export-btn,
  .confirm-btn {
    width: 100%;
    padding: 14px 20px;
  }

  /* 重複再生設定のスタイル */
  #duplicate-play-container label {
    font-size: 0.85rem;
    padding: 10px 12px;
  }

  #duplicate-play-checkbox {
    width: 14px;
    height: 14px;
  }
}

/* レスポンシブブレイクポイント */
@media (min-width: 576px) {

  header,
  #main-content {
    max-width: 540px;
  }
}

@media (min-width: 768px) {

  header,
  #main-content {
    max-width: 720px;
  }
}

@media (min-width: 992px) {

  header,
  #main-content {
    max-width: 960px;
  }
}

@media (min-width: 1200px) {

  header,
  #main-content {
    max-width: 1140px;
  }
}

@media (min-width: 1400px) {

  header,
  #main-content {
    max-width: 1320px;
  }
}

/* ========== ダークモード対応 ========== */
@media (prefers-color-scheme: dark) {
  :root {
    --md-primary: #d48b8b;
    --md-on-primary: #ffffff;
    --md-secondary: #26c6ae;
    --md-bg: #1a1a1a;
  }

  body {
    background-color: var(--md-bg);
    color: #e0e0e0;
  }

  /* ヘッダー */
  header {
    color: #e0e0e0;
  }

  #recent-date::before {
    background-color: #ff5555;
  }

  /* お知らせボックス */
  #announcement-box {
    background: rgba(45, 45, 45, 0.95);
    border-color: #5a3f3f;
  }

  #announcement-box .announcement-content {
    color: #e0b3b3;
  }

  #announcement-box .announcement-updated {
    color: #b88a8a;
  }

  /* メンテナンス通知バー */
  #maintenance-notice-bar {
    background: linear-gradient(135deg, #FF5722, #D84315);
    border-bottom-color: #BF360C;
  }

  #maintenance-notice-bar .admin-link-btn {
    background: rgba(255, 255, 255, 0.15);
    border-color: rgba(255, 255, 255, 0.25);
  }

  #maintenance-notice-bar .admin-link-btn:hover {
    background: rgba(255, 255, 255, 0.25);
  }

  /* ローディングオーバーレイ */
  #loading-overlay {
    background: rgba(0, 0, 0, 0.85);
  }

  #loading-overlay span {
    color: #e0e0e0;
  }

  /* メインタブ */
  .main-tab-button {
    background-color: #3a3a3a;
    border-color: #555;
    color: #b0b0b0;
  }

  .main-tab-button.active {
    background-color: rgba(45, 45, 45, 0.95);
    border-color: #666;
    color: #e0e0e0;
  }

  .main-tab-section.active {
    background-color: rgba(45, 45, 45, 0.95);
    border-color: #555;
  }

  /* カテゴリタブ */
  .category-tab {
    background-color: #3a3a3a;
    color: #b0b0b0;
  }

  .category-tab:hover {
    background-color: #4a4a4a;
  }

  .category-tab.active {
    background-color: #2d2d2d;
    color: #e0e0e0;
    border-color: #555;
  }

  #category-buttons {
    background-color: #2d2d2d;
    border-color: #555;
  }

  /* 検索ボックス */
  #search-box,
  #category-search-box,
  #playlist-search-box {
    background-color: #363636;
    border-color: #555;
    color: #e0e0e0;
  }

  #search-box:focus,
  #category-search-box:focus,
  #playlist-search-box:focus {
    background-color: #404040;
    border-color: var(--md-primary);
  }

  #search-box::placeholder,
  #category-search-box::placeholder,
  #playlist-search-box::placeholder {
    color: #888;
  }

  /* 重複再生設定 */
  #duplicate-play-container label {
    background: #363636;
    border-color: #555;
    color: #e0e0e0;
  }

  #duplicate-play-container label:hover {
    background: #404040;
    border-color: #666;
  }

  #duplicate-play-container label:has(#duplicate-play-checkbox:checked) {
    background: #3a3020;
    border-color: #6a5a30;
    color: #f4d774;
  }

  /* サウンドボタン */
  .sound-button {
    background-color: #4a4a4a;
    color: #e0e0e0;
  }

  .sound-button:hover {
    background-color: #5a5a5a;
  }

  .sound-button.selected,
  .sound-button:focus {
    box-shadow: 0 0 0 3px #64b5f6;
    background-color: #2d4a5f;
  }

  /* 右クリックメニュー */
  .context-menu {
    background: #2d2d2d;
    border-color: #555;
  }

  .context-menu-item {
    color: #e0e0e0;
  }

  .context-menu-item:hover {
    background: #3a3a3a;
  }

  .context-menu-item:active {
    background: #4a4a4a;
  }

  .context-menu-separator {
    background: #555;
  }

  /* 一時メッセージ */
  .temporary-message {
    background: #388e3c;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  }

  /* プレイリストレイアウト */
  #playlist-sound-list,
  #playlist-queue {
    background: #2d2d2d;
    border-color: #555;
  }

  #playlist-sound-list h3,
  #playlist-queue h3 {
    color: #e0e0e0;
    border-bottom-color: var(--md-primary);
  }

  /* 追加ボタン */
  #playlist-add-button {
    background: linear-gradient(135deg, #4caf50, #388e3c);
  }

  #playlist-add-button:hover {
    background: linear-gradient(135deg, #388e3c, #2e7d32);
  }

  #playlist-add-button:disabled {
    background: #555;
  }

  /* プレイリスト音声アイテム */
  .playlist-sound-item {
    color: #e0e0e0;
    border-bottom-color: #555;
  }

  .playlist-sound-item:hover {
    background: #3a3a3a;
  }

  .playlist-sound-item.selected {
    background: #2d4a5f;
    border-left-color: #64b5f6;
  }

  /* プレイリストキューアイテム */
  .playlist-queue-item {
    background: #363636;
    border-color: #555;
  }

  .playlist-queue-item:hover {
    background: #404040;
  }

  .playlist-queue-item.selected {
    background: #2d4a5f;
    border-color: #64b5f6;
    box-shadow: 0 0 0 2px rgba(100, 181, 246, 0.25);
  }

  .playlist-queue-item.playing {
    background: #2d4a3a;
    border-color: #4caf50;
  }

  .playlist-queue-item.playing.selected {
    background: #365a42;
    border-color: #66bb6a;
  }

  .playlist-queue-item-name {
    color: #e0e0e0;
  }

  .playlist-queue-item-remove {
    background: #d32f2f;
  }

  .playlist-queue-item-remove:hover {
    background: #b71c1c;
  }

  /* プレイリストコントロール */
  #playlist-controls {
    background: #2d2d2d;
    border-color: #555;
  }

  #playlist-queue-clear .playlist-control-btn {
    background: linear-gradient(135deg, #616161, #424242);
  }

  #playlist-queue-clear .playlist-control-btn:hover {
    background: linear-gradient(135deg, #424242, #303030);
  }

  /* 並び替えボタン */
  .playlist-sort-controls,
  .playlist-import-export-controls {
    background: rgba(45, 45, 45, 0.95);
    border-color: #555;
  }

  .playlist-sort-btn {
    background: #555;
  }

  .playlist-sort-btn:hover:not(:disabled) {
    background: #666;
  }

  .playlist-sort-btn:disabled {
    background: #3a3a3a;
  }

  .playlist-import-btn,
  .playlist-export-btn {
    background: #138496;
  }

  .playlist-import-btn:hover,
  .playlist-export-btn:hover {
    background: #0f6674;
  }

  /* プレビュー・ループ設定 */
  #playlist-preview-settings,
  #playlist-queue-preview-settings,
  #playlist-loop-settings {
    background: #363636;
    border-color: #555;
  }

  #playlist-preview-settings label,
  #playlist-queue-preview-settings label,
  #playlist-loop-settings label {
    color: #b0b0b0;
  }

  #playlist-preview-settings label:hover,
  #playlist-queue-preview-settings label:hover,
  #playlist-loop-settings label:hover {
    color: #64b5f6;
  }

  /* モーダル */
  .import-export-modal,
  .confirm-modal {
    background: rgba(0, 0, 0, 0.75);
  }

  .import-export-modal-content,
  .confirm-modal-content {
    background: #2d2d2d;
    box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  }

  .import-export-modal h3,
  .confirm-modal h3 {
    color: #64b5f6;
  }

  .import-export-textarea {
    background: #363636;
    border-color: #555;
    color: #e0e0e0;
  }

  .import-export-textarea:focus {
    background: #404040;
    border-color: #64b5f6;
  }

  .import-export-textarea::placeholder {
    color: #888;
  }

  .import-export-info {
    background: #2d4a5f;
    color: #90caf9;
    border-left-color: #64b5f6;
  }

  .confirm-modal #confirm-message {
    color: #e0e0e0;
  }

  /* ボタン（モーダル内） */
  .import-export-btn.cancel,
  .confirm-btn.cancel {
    background: linear-gradient(135deg, #616161, #424242);
  }

  .import-export-btn.cancel:hover,
  .confirm-btn.cancel:hover {
    background: linear-gradient(135deg, #424242, #303030);
  }

  .import-export-btn.copy {
    background: linear-gradient(135deg, #f57c00, #ef6c00);
  }

  .import-export-btn.copy:hover {
    background: linear-gradient(135deg, #ef6c00, #e65100);
  }

  .import-export-btn.import,
  .confirm-btn.ok {
    background: linear-gradient(135deg, #1976d2, #1565c0);
  }

  .import-export-btn.import:hover,
  .confirm-btn.ok:hover {
    background: linear-gradient(135deg, #1565c0, #0d47a1);
  }

  /* プレイリストコントロールボタン */
  #playlist-play-btn {
    background: linear-gradient(135deg, #388e3c, #2e7d32);
  }

  #playlist-play-btn:hover {
    background: linear-gradient(135deg, #2e7d32, #1b5e20);
  }

  #playlist-stop-btn {
    background: linear-gradient(135deg, #d32f2f, #b71c1c);
  }

  #playlist-stop-btn:hover {
    background: linear-gradient(135deg, #b71c1c, #8b0000);
  }
}