* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body {
  margin: 0;
  height: 100%;
  background: #111318;
  color: #f2f2f2;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", sans-serif;
}
main {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
  text-align: center;
}
h1 {
  font-size: 22px;
  font-weight: 600;
  margin: 0;
  color: #cfd3da;
}
.status {
  font-size: 15px;
  color: #9aa0ab;
  min-height: 20px;
}
.play-mode-row {
  display: flex;
  gap: 8px;
}
.play-mode-btn {
  background: #1c1f26;
  color: #9aa0ab;
  border: 2px solid transparent;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.play-mode-btn.active {
  background: #232a3d;
  color: #f2f2f2;
  border-color: #3a7bff;
}
.transport-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.toggle-btn {
  width: 160px;
  height: 160px;
  border-radius: 50%;
  border: none;
  background: #3a7bff;
  color: white;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.05em;
  box-shadow: 0 8px 24px rgba(58, 123, 255, 0.35);
}
.toggle-btn:disabled {
  background: #3a3f4a;
  box-shadow: none;
}
.toggle-btn.playing {
  background: #ff4d4f;
  box-shadow: 0 8px 24px rgba(255, 77, 79, 0.35);
}
.skip-btn {
  background: #1c1f26;
  color: #cfd3da;
  border: 1px solid #3a3f4a;
  border-radius: 999px;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.skip-btn:disabled {
  color: #4a4f59;
  border-color: #2a2e37;
}
.volume-row {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 240px;
}
.volume-row input {
  flex: 1;
}
.playlist-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.playlist-label {
  font-size: 13px;
  color: #9aa0ab;
}
.playlist-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
  max-width: 420px;
  max-height: 40vh;
  overflow-y: auto;
}
.playlist-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #1c1f26;
  border: 2px solid transparent;
  border-radius: 12px;
  padding: 10px 14px;
  text-align: left;
  width: 100%;
}
.playlist-card.active {
  border-color: #3a7bff;
  background: #232a3d;
}
.playlist-card-art {
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.85);
}
.playlist-card-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.playlist-card-name {
  font-size: 15px;
  font-weight: 600;
  color: #f2f2f2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.playlist-card-sub {
  font-size: 12px;
  color: #9aa0ab;
}
.playlist-card-check {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px solid #3a3f4a;
  display: flex;
  align-items: center;
  justify-content: center;
}
.playlist-card.active .playlist-card-check {
  background: #3a7bff;
  border-color: #3a7bff;
  color: white;
  font-size: 13px;
}
.now-playing {
  font-size: 14px;
  font-weight: 600;
  color: #cfd3da;
  min-height: 18px;
  max-width: 320px;
}
.track-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  width: 100%;
  max-width: 320px;
  max-height: 22vh;
  overflow-y: auto;
  text-align: left;
  border-top: 1px solid #2a2e37;
  padding-top: 8px;
}
.track-row {
  font-size: 12px;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 6px;
}
.track-row.current {
  color: #3a7bff;
  font-weight: 700;
  background: rgba(58, 123, 255, 0.12);
}
.detail {
  font-size: 12px;
  color: #5c6270;
  max-width: 320px;
}

/* --- ログイン画面 --- */
.login-screen {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 24px;
}
.login-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 320px;
}
.login-form .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #9aa0ab;
  text-align: left;
}
.login-form input {
  background: #1c1f26;
  color: #f2f2f2;
  border: 1px solid #3a3f4a;
  border-radius: 8px;
  padding: 12px 14px;
  font-size: 16px;
}
.login-btn {
  background: #3a7bff;
  color: white;
  border: none;
  border-radius: 8px;
  padding: 14px;
  font-size: 16px;
  font-weight: 600;
}
.login-error {
  min-height: 18px;
  font-size: 13px;
  color: #ff6b6b;
}

/* --- 横向き設置対応 --- */
@media (orientation: landscape) and (min-width: 700px) {
  .player-screen {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 40px;
    row-gap: 10px;
    align-items: start;
    justify-items: center;
    max-width: 920px;
    margin: 0 auto;
  }
  .player-screen h1,
  .player-screen .status {
    grid-column: 1 / 3;
  }
  .player-screen .playlist-section,
  .player-screen .track-list {
    grid-column: 1;
  }
  .player-screen .play-mode-row,
  .player-screen .transport-row,
  .player-screen .now-playing,
  .player-screen .volume-row,
  .player-screen .detail {
    grid-column: 2;
  }
  .player-screen .playlist-cards {
    max-height: 32vh;
  }
  .player-screen .track-list {
    max-height: 26vh;
    border-top: none;
    padding-top: 0;
  }
}
