body {
  font-family: sans-serif;
  padding: 20px;
  background: #f5f5f5;
  color: #222;
  transition: background 0.3s, color 0.3s;
}
input[type="text"], #search {
  padding: 5px 7px;
  font-size: 16px;
  border-radius: 10px;
  border: 2px solid #ddd;
  box-sizing: border-box;
  background: #fff;
  color: #222;
  width: 90%;
  max-width: 400px;
  margin: 0 auto 20px;
  display: block;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}
table {
  border-collapse: collapse;
  background: #fff;
  color: #222;
  margin: 0 auto;
  width: 100%;
  min-width: 1200px;
  max-width: 1200px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
  transition: background 0.3s, color 0.3s;
}
th, td {
  border: 1px solid #ccc;
  padding: 8px;
  text-align: center;
  background: #fff;
  color: #222;
}
th {
  background: #e8e8e8;
  color: #222;
  font-weight: bold;
}
tr:nth-child(even) td { background: #fafafa; }
tr:nth-child(odd) td { background: #fff; }
.simple-btn {
  padding: 7px 18px;
  border-radius: 12px;
  font-size: 16px;
  color: #222;
  background: #ededed;
  border: none;
  margin: 5px 5px 5px 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.2s, color 0.2s;
  outline: none;
}
.simple-btn:hover, .simple-btn:focus {
  background: #d6d6d6;
  color: #111;
}
.loop-area {
  margin: 18px auto 24px auto;
  max-width: 400px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 32px;
}
.loop-label {
  font-size: 1.2em;
  padding: 7px 16px;
  background: #f5f5f5;
  border-radius: 8px;
  border: 1.5px solid #007bff;
  color: #007bff;
  display: flex;
  align-items: center;
  gap: 10px;
  user-select: none;
  box-shadow: 0 2px 8px rgba(0,123,255,0.08);
}
.song-title { text-align:left !important; 
}
.search-area {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  max-width: 420px;
  margin: 0 auto 20px;
  gap: 10px;
}
.search-box {
  position: relative;
  flex: 1;
}
.search-box input[type="text"] {
  width: 100%;
  padding: 14px 16px; 
  font-size: 18px;              
  border-radius: 14px;
  border: 2.5px solid #888;     
  background: #f7f7f7;
  color: #222;
  box-sizing: border-box;
  transition: border-color 0.2s, background 0.2s;
}
.search-box input[type="text"]:focus {
  border-color: #007bff;
  background: #fff;
}
.search-box input::placeholder {
  color: #aaa;
  font-size: 17px;
}
.table-scroll {
  overflow-x: auto;
  display: block;
  -webkit-overflow-scrolling: touch;
}
.dark-toggle .icon.sun {
  filter: brightness(1.2) saturate(1.2);
}
.dark-toggle .icon.moon {
  filter: grayscale(0.5);
}
.dark-toggle.active {
  background: #888;
}
.dark-toggle .icon.sun {
  background: #fff;
  border-radius: 50%;
}
.dark-toggle.active .icon.moon {
  background: #fff;
  border-radius: 50%;
}
.dark-toggle .indicator {
  position: absolute;
  left: 4px;
  top: 3px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  transition: left 0.25s;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}
.dark-toggle.active .indicator {
  left: 30px;
  background: #444;
}

body.dark-mode {
  background: #222;
  color: #fff;
}
body.dark-mode input[type="text"],
body.dark-mode #search {
  background: #222;
  color: #eee;
  border-color: #333;
}
body.dark-mode table {
  border-collapse: collapse;
  background: #222 !important;
  color: #fff !important;
  box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;
}
body.dark-mode th, body.dark-mode td {
  border: 1px solid #444 !important;
  padding: 8px !important;
  text-align: center !important;
  background: #222 !important;
  color: #fff !important;
}
body.dark-mode th {
  background: #444 !important;
  color: #fff !important;
  font-weight: bold !important;
}
body.dark-mode tr:nth-child(even) td {
  background: #2a2a2a !important;
}
body.dark-mode tr:nth-child(odd) td {
  background: #222 !important;
}
body.dark-mode .loop-label {
  background: #222;
  border-color: #2884ff;
  color: #2884ff;
}
body.dark-mode .simple-btn {
  background: #444;
  color: #eee;
}
body.dark-mode .simple-btn:hover, body.dark-mode .simple-btn:focus {
  background: #666;
  color: #fff;
}
body.dark-mode .song-title { text-align:left !important; 
}

body.dark-mode .search-box input[type="text"] {
  background: #222;
  color: #eee;
  border-color: #2884ff;
}
body.dark-mode .search-box input[type="text"]:focus {
  border-color: #82b1ff;
  background: #222;
}
.dark-toggle {
  position: fixed;
  left: 18px;
  bottom: 18px;
  z-index: 100;
  width: 58px;
  height: 30px;
  background: #bbb;
  border-radius: 18px;
  display: flex;
  align-items: center;
  box-shadow: 0 2px 8px rgba(0,0,0,0.10);
  cursor: pointer;
  transition: background 0.2s;
}
.dark-toggle .icon {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 2px;
  transition: filter 0.2s;
}

@media (prefers-color-scheme: dark) {
  body {
    background: #222;
    color: #fff;
  }

  input[type="text"],
  #search {
    background: #222;
    color: #eee;
    border-color: #333;
  }

  table {
    border-collapse: collapse;
    background: #222 !important;
    color: #fff !important;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5) !important;
  }

  th, td {
    border: 1px solid #444 !important;
    background: #222 !important;
    color: #fff !important;
  }

  th {
    background: #444 !important;
    font-weight: bold !important;
  }

  tr:nth-child(even) td {
    background: #2a2a2a !important;
  }

  tr:nth-child(odd) td {
    background: #222 !important;
  }

  .loop-label {
    background: #222;
    border-color: #2884ff;
    color: #2884ff;
  }

  .simple-btn {
    background: #444;
    color: #eee;
  }

  .simple-btn:hover, .simple-btn:focus {
    background: #666;
    color: #fff;
  }

  .song-title { text-align:left !important; }

  .search-box input[type="text"] {
    background: #222;
    color: #eee;
    border-color: #2884ff;
  }

  .search-box input[type="text"]:focus {
    border-color: #82b1ff;
    background: #222;
  }
}

.playlist-controls {
  display: flex;
  gap: 10px;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.playlist-controls input[type="text"] {
  width: auto;
  max-width: 500px;
  margin: 0;
}

.saved-playlists {
  margin: 20px auto;
  max-width: 600px;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 8px;
  border: 1px solid #ddd;
}

.saved-playlists h3 {
  margin-top: 0;
  margin-bottom: 15px;
  text-align: center;
}

.saved-playlist-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  margin-bottom: 8px;
  background: #fff;
  border-radius: 6px;
  border: 1px solid #ccc;
}

.saved-playlist-name {
  flex: 1;
}

.saved-playlist-name small {
  color: #888;
}

.saved-playlist-actions {
  display: flex;
  gap: 5px;
}

.saved-playlist-actions .simple-btn {
  padding: 4px 10px;
  font-size: 14px;
  margin: 0;
}
body.dark-mode .saved-playlists {
  background: #2a2a2a;
  border-color: #444;
}

body.dark-mode .saved-playlist-item {
  background: #333;
  border-color: #555;
}

body.dark-mode .saved-playlist-name small {
  color: #aaa;
}

/* ダークモード自動判定対応 */
@media (prefers-color-scheme: dark) {
  .saved-playlists {
    background: #2a2a2a;
    border-color: #444;
  }

  .saved-playlist-item {
    background: #333;
    border-color: #555;
  }

  .saved-playlist-name small {
    color: #aaa;
  }
}
@media (max-width: 768px) {
  h1 {
    font-size: 18px;
    margin-bottom: 9px;
  }

  input[type="text"], #search {
    font-size: 14px;
    padding: 8px 12px;
    max-width: 100%;
  }

  .search-box input[type="text"] {
    font-size: 14px;
    padding: 10px 12px;
  }

  .simple-btn {
    font-size: 13px;
    padding: 8px 14px;
  }

  .loop-label {
    font-size: 1.0em;
    padding: 8px 14px;
  }

  .loop-area {
    margin: 16px auto 16px auto;
    gap: 20px;
  }

  .table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
  }

  table {
    zoom: 0.45;
    width: 100%;
    margin: 0;
  }
}
/* --- サイト内プレイヤーUI 改良版 --- */
body {
  /* プレイヤーの高さ分だけ余白を確保 */
  padding-bottom: 130px !important; 
}

.player-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(255, 255, 255, 0.8);
  border-top: 1px solid #ddd;
  padding: 12px 0;
  box-shadow: 0 -3px 15px rgba(0,0,0,0.15);
  z-index: 1000;
  backdrop-filter: blur(8px);
}

.player-inner {
  max-width: 600px; /* PCでも広がりすぎず、スマホと同じような中央配置にする */
  margin: 0 auto;
  padding: 0 15px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px; /* 縦の隙間 */
}

.now-playing {
  font-size: 14px;
  font-weight: bold;
  text-align: center;
  width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #333;
}

.seek-wrapper {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

#seek-bar {
  flex: 1;
  height: 6px;
  cursor: pointer;
}

.time-display {
  font-family: monospace;
  font-size: 12px;
  min-width: 40px;
  text-align: center;
  color: #555;
}

.playback-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 20px; /* ボタン同士の隙間を適度に開ける */
  width: 100%;
}

.playback-controls .simple-btn {
  padding: 8px 20px;
  font-size: 16px;
  margin: 0;
}
/* 自動判定時 (OS設定に合わせる場合) */
@media (prefers-color-scheme: dark) {
  .player-container {
    background: rgba(30, 30, 30, 0.8);
    border-top: 1px solid #444;
  }
  .now-playing,
  .time-display {
    color: #eee;
  }
}