:root {
  --accent: #00e5ff;
  --accent-soft: rgba(0, 229, 255, 0.16);
}

.theme-youtube {
  --accent: #ff3b30;
  --accent-soft: rgba(255, 59, 48, 0.16);
}

.theme-spotify {
  --accent: #1db954;
  --accent-soft: rgba(29, 185, 84, 0.16);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Pretendard", "Segoe UI", Roboto, sans-serif;
}

body {
  background-color: #0e1015;
  color: #f2f4f8;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  padding: 24px 16px;
}

#app-container {
  width: 100%;
  max-width: 760px;
}

.hidden {
  display: none !important;
}

/* 로비 화면 */
.logo-area {
  text-align: center;
  margin: 40px 0 32px;
}

.logo-area h1 {
  font-size: 32px;
  font-weight: 800;
  margin-bottom: 8px;
}

.logo-area p {
  color: #9aa3b2;
  font-size: 15px;
}

.lobby-actions {
  max-width: 440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.primary-btn,
.secondary-btn {
  width: 100%;
  padding: 15px 18px;
  border-radius: 12px;
  border: none;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.12s ease, opacity 0.15s ease;
}

.primary-btn {
  background: #00e5ff;
  color: #091016;
}

.secondary-btn {
  background: #232733;
  color: #f2f4f8;
  border: 1px solid #323848;
}

.primary-btn:hover,
.secondary-btn:hover {
  opacity: 0.92;
}

.sub-box {
  background: #171a23;
  border: 1px solid #282d3b;
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.box-guide {
  font-size: 13px;
  color: #aeb6c4;
  text-align: center;
}

.platform-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.platform-choice-btn {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  padding: 14px;
  border-radius: 12px;
  border: 1px solid #303646;
  background: #1f2430;
  color: #fff;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.platform-choice-btn strong {
  font-size: 15px;
}

.platform-choice-btn span {
  font-size: 12px;
  color: #9aa3b2;
}

.platform-choice-btn.youtube:hover {
  border-color: #ff3b30;
  background: rgba(255, 59, 48, 0.12);
}

.platform-choice-btn.spotify:hover {
  border-color: #1db954;
  background: rgba(29, 185, 84, 0.12);
}

.code-input-row {
  display: flex;
  gap: 8px;
}

#room-code-input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid #323848;
  background: #10131a;
  color: #fff;
  font-size: 15px;
  text-transform: uppercase;
}

.join-submit-btn {
  padding: 0 18px;
  border-radius: 10px;
  border: none;
  background: #00e5ff;
  color: #091016;
  font-weight: 700;
  cursor: pointer;
}

.divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: #6d7687;
  font-size: 12px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid #282d3b;
}

.divider span {
  padding: 0 10px;
}

.qr-scan-btn {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #323848;
  background: #202532;
  color: #f2f4f8;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.qr-reader-box {
  width: 100%;
  border-radius: 10px;
  overflow: hidden;
  background: #000;
}

/* 방 내부 헤더 */
.room-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #171a23;
  border: 1px solid #282d3b;
  border-radius: 14px;
  padding: 12px 16px;
  margin-bottom: 16px;
}

.room-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.badge,
.platform-badge {
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge {
  background: #262b38;
  color: #e4e8f0;
}

.platform-badge {
  background: var(--accent-soft);
  color: var(--accent);
}

.room-code-text {
  font-size: 14px;
  color: #aeb6c4;
}

.room-code-text strong {
  color: #fff;
  letter-spacing: 1px;
}

.leave-btn {
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid #353b4b;
  background: transparent;
  color: #cfd6e3;
  font-size: 13px;
  cursor: pointer;
}

/* Spotify 로그인 배너 */
.spotify-auth-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  background: rgba(29, 185, 84, 0.12);
  border: 1px solid rgba(29, 185, 84, 0.35);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
}

.sp-auth-info {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: #e4f8eb;
}

.sp-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff9800;
  flex-shrink: 0;
}

.sp-dot.connected {
  background: #1db954;
  box-shadow: 0 0 8px #1db954;
}

.spotify-login-btn {
  padding: 7px 14px;
  border: none;
  border-radius: 20px;
  background: #1db954;
  color: #000;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.spotify-login-btn:disabled {
  background: #2e3440;
  color: #888;
  cursor: default;
}

/* 방장 상단 그리드 (QR + 턴테이블) */
.host-top-grid {
  display: grid;
  grid-template-columns: 210px 1fr;
  gap: 16px;
  margin-bottom: 18px;
}

.qr-invite-card {
  background: #171a23;
  border: 1px solid #282d3b;
  border-radius: 16px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
}

.qr-box {
  background: #ffffff;
  padding: 10px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.qr-invite-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: 100%;
}

.qr-label {
  font-size: 12px;
  color: #9aa3b2;
}

#host-big-code {
  font-size: 24px;
  letter-spacing: 3px;
  color: var(--accent);
}

.copy-link-btn {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid #323848;
  background: #222734;
  color: #e4e8f0;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* 턴테이블 카드 */
.turntable-card {
  background: #171a23;
  border: 1px solid #282d3b;
  border-radius: 16px;
  padding: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.play-type-badge {
  align-self: flex-start;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--accent-soft);
  color: var(--accent);
}

.play-type-badge.recommended {
  background: #252a37;
  color: #a9b2c3;
}

.turntable-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 6px 0;
}

.album-frame {
  width: 168px;
  height: 168px;
  border-radius: 12px;
  overflow: hidden;
  background: #0d0f14;
  border: 1px solid #2e3444;
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.55);
  z-index: 2;
  position: relative;
}

.yt-player-slot,
.sp-cover-slot {
  width: 100%;
  height: 100%;
}

.yt-player-slot iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.sp-album-cover {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 56px;
  background: radial-gradient(circle at 30% 30%, #262c3a, #12151d);
}

.sp-album-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.platter-wrap {
  position: relative;
  width: 156px;
  height: 156px;
  margin-left: -42px;
  z-index: 1;
}

.vinyl-disc {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: radial-gradient(circle, #181818 0%, #0b0b0b 65%, #1d1d1d 100%);
  border: 2px solid #2c2c2c;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6);
  animation: spin 6s linear infinite;
  animation-play-state: paused;
}

.turntable-stage.is-playing .vinyl-disc {
  animation-play-state: running;
}

.vinyl-grooves {
  position: absolute;
  inset: 14px;
  border-radius: 50%;
  border: 1px dashed rgba(255, 255, 255, 0.08);
}

.vinyl-label {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.vinyl-spindle {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #10131a;
}

.tonearm {
  position: absolute;
  top: -6px;
  right: -8px;
  width: 44px;
  height: 92px;
  transform-origin: 32px 12px;
  transform: rotate(-18deg);
  transition: transform 0.4s ease;
  pointer-events: none;
}

.turntable-stage.is-playing .tonearm {
  transform: rotate(12deg);
}

.tonearm-base {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #8e96a4;
  border: 2px solid #2c3240;
}

.tonearm-arm {
  position: absolute;
  top: 14px;
  right: 11px;
  width: 3px;
  height: 64px;
  background: #cfd6e3;
  border-radius: 2px;
}

.tonearm-head {
  position: absolute;
  bottom: 8px;
  right: 8px;
  width: 9px;
  height: 14px;
  background: var(--accent);
  border-radius: 2px;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.track-meta {
  text-align: center;
  width: 100%;
}

.track-meta h2 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.track-meta p {
  font-size: 13px;
  color: #9aa3b2;
}

/* 시크바 및 컨트롤 */
.seek-bar-wrap {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
}

.time-label {
  font-size: 11px;
  color: #8e96a4;
  min-width: 32px;
  text-align: center;
}

.range-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    var(--accent) 0%,
    var(--accent) var(--progress, 0%),
    #2d3342 var(--progress, 0%),
    #2d3342 100%
  );
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
}

.controls-bar {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.transport-btns {
  display: flex;
  gap: 8px;
}

.transport-btns button {
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid #323848;
  background: #222734;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

#play-pause-btn {
  background: var(--accent);
  color: #091016;
  border: none;
}

.volume-control {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 180px;
}

.mute-btn {
  background: transparent;
  border: none;
  color: #cfd6e3;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.volume-value {
  font-size: 12px;
  color: #9aa3b2;
  min-width: 34px;
  text-align: right;
}

/* 게스트 패널 */
.guest-now-playing {
  background: #171a23;
  border: 1px solid #282d3b;
  border-radius: 14px;
  padding: 14px 16px;
  margin-bottom: 14px;
}

.mini-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--accent);
}

.guest-now-playing p {
  margin-top: 4px;
  font-size: 15px;
  font-weight: 600;
}

.search-box {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.search-box input {
  flex: 1;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #323848;
  background: #171a23;
  color: #fff;
  font-size: 14px;
}

.search-box button {
  padding: 0 18px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #091016;
  font-weight: 700;
  cursor: pointer;
}

/* 대기열 및 검색 결과 리스트 */
.queue-section {
  background: #171a23;
  border: 1px solid #282d3b;
  border-radius: 16px;
  padding: 16px;
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  gap: 8px;
  flex-wrap: wrap;
}

.queue-header h3 {
  font-size: 15px;
}

.next-up-hint {
  font-size: 12px;
  color: #8e96a4;
}

.song-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.queue-section .song-list {
  margin-bottom: 0;
}

.song-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: #1e222e;
  border: 1px solid #2b3140;
  border-radius: 10px;
  padding: 10px 12px;
}

.song-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.song-thumb {
  width: 44px;
  height: 44px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.song-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.song-info strong {
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-info span {
  font-size: 12px;
  color: #9aa3b2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.add-btn,
.del-btn {
  padding: 6px 12px;
  border-radius: 8px;
  border: none;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

.add-btn {
  background: var(--accent);
  color: #091016;
}

.del-btn {
  background: #2e3444;
  color: #ff6b6b;
}

.empty-msg {
  text-align: center;
  color: #7d8697;
  font-size: 13px;
  padding: 18px 0;
}

@media (max-width: 640px) {
  .host-top-grid {
    grid-template-columns: 1fr;
  }

  .qr-invite-card {
    flex-direction: row;
    text-align: left;
  }

  .qr-invite-info {
    align-items: flex-start;
  }
}