video#player-video,
audio#player-audio {
  pointer-events: none !important;
  user-select: none !important;
}

.player > iframe#yt-iframe {
  width: 100%;
  height: 100%;
  background: #000;
  display: block;
  border: none;
}
:root{
  --bg:#120a12;
  --panel:#1a0f1f;
  --panel2:#140b17;
  --text:#f7e9f2;
  --muted:#d7b4c6;
  --accent:#ff7ec8;
  --accent-2:#ffb3d9;
  --danger:#ff6b88;
  --ok:#7ee8b1;
  --border:#2b1a2b;
  --shadow: 0 10px 30px rgba(0,0,0,.35);
  --radius: 14px;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --sans: system-ui, -apple-system, Segoe UI, Roboto, Apple SD Gothic Neo, "Noto Sans KR", sans-serif;
}

*{ box-sizing:border-box; }
html,body{ height:100%; }
body{
  margin:0;
  background:
    linear-gradient(180deg, rgba(18,10,18,.82), rgba(18,10,18,.92)),
    url("/imgs/theme.jpg") center/cover no-repeat fixed;
  color:var(--text);
  font-family:var(--sans);
}

/* Loading overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.loading-overlay.hidden {
  opacity: 0;
  pointer-events: none;
}

.loading-content {
  text-align: center;
}

.loading-spinner {
  width: 50px;
  height: 50px;
  margin: 0 auto 20px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--muted);
  font-size: 14px;
}

button, input{
  font:inherit;
}

.app{
  height:100%;
  display:flex;
  flex-direction:column;
}

.top{
  display:flex;
  gap:16px;
  align-items:center;
  padding:14px 16px;
  border-bottom:1px solid var(--border);
  background: rgba(20,11,23,.75);
  backdrop-filter: blur(10px);
}

.top-left{
  display:flex;
  flex-direction:column;
  gap:4px;
  min-width:240px;
}
.brand{
  font-weight:800;
  letter-spacing:.2px;
}
.room{ color:var(--muted); font-size:12px; }

.search{
  flex:1;
  display:flex;
  gap:10px;
  align-items:center;
}
.search input{
  flex:1;
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background: var(--panel2);
  color:var(--text);
  outline:none;
}
.search button{
  padding:10px 14px;
  border-radius:10px;
  border:1px solid var(--border);
  background: linear-gradient(180deg, rgba(255,126,200,.25), rgba(255,126,200,.12));
  color:var(--text);
  cursor:pointer;
}

.middle{
  flex:1;
  display:grid;
  grid-template-columns: 1.2fr .8fr;
  gap:16px;
  padding:16px;
  overflow:hidden;
}

.player-section{
  background: rgba(26,15,31,.72);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:14px;
  display:flex;
  flex-direction:column;
  gap:12px;
  overflow:hidden;
}

.player-wrap{
  position:relative;
  width:100%;
  aspect-ratio: 16/9;
  background:#000;
  border-radius: 12px;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.05);
}
.player{ width:100%; height:100%; }

.player-audio-screen,
.player-missing{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:8px;
  color:rgba(255,255,255,.85);
  text-align:center;
  pointer-events:none;
  padding:16px;
}

.player-audio-screen{
  background: radial-gradient(900px 500px at 50% 30%, rgba(255,255,255,.04), rgba(0,0,0,.55));
  font-weight:800;
  letter-spacing:.2px;
}

.player-missing{
  background: radial-gradient(900px 500px at 50% 30%, rgba(255,255,255,.04), rgba(0,0,0,.70));
}

.player-missing-title{
  font-weight:900;
}
.player-missing-sub{
  font-family:var(--mono);
  font-size:12px;
  color:rgba(255,255,255,.65);
  word-break: break-all;
}

.player-overlay{
  position:absolute;
  inset:0;
  display:flex;
  flex-direction:column;
  align-items:center;
  justify-content:center;
  gap:10px;
  background: radial-gradient(900px 500px at 50% 30%, rgba(0,0,0,.35), rgba(0,0,0,.75));
}
.player-overlay.hidden{ display:none; }
.player-overlay button{
  padding:12px 14px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.08);
  color:var(--text);
  cursor:pointer;
}
.player-overlay .hint{
  color:var(--muted);
  font-size:12px;
}

.player-blocker{
  position:absolute;
  inset:0;
  background: transparent;
  pointer-events: none;
}
.player-blocker.active{
  pointer-events: auto;
}

.now-title{ color: #ffd6eb; }
.now-sub{ color: var(--muted); font-size:13px; display:flex; gap:8px; align-items:center; }
.dot{ opacity:.6; }

.controls{
  display:flex;
  gap:10px;
  align-items:center;
  flex-wrap:wrap;
}
.controls button{
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
}
.controls button:disabled{ opacity:.4; cursor:not-allowed; }
.seek{
  margin-left:auto;
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--muted);
  position: relative;
}

.seek-slider-wrapper {
  position: relative;
  display: inline-block;
}

.seek label{ font-size:12px; }
.seek input{
  width:220px;
}

.seek input[type="range"]{
  accent-color: var(--accent);
  transition: opacity 0.2s ease;
}

.seek input[type="range"]:disabled{
  opacity: 0.3;
  cursor: not-allowed;
}

.seek.loading::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  margin: -7px 0 0 -7px; /* Center using margin instead of transform */
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255, 126, 200, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  pointer-events: none;
  z-index: 100;
  will-change: transform;
}

.seek-time{
  min-width:52px;
  text-align:center;
  font-family:var(--mono);
  font-size:12px;
  color:var(--muted);
}

.volume{
  display:flex;
  align-items:center;
  gap:8px;
  color:var(--muted);
}
.volume label{ font-size:16px; }
.volume input{
  width:120px;
}

.volume input[type="range"]{
  accent-color: var(--accent);
}

.volume-value{
  min-width:42px;
  text-align:right;
  font-family:var(--mono);
  font-size:12px;
  color:var(--muted);
}

.skip{
  display:flex;
  align-items:center;
  gap:10px;
}
.skip button{
  padding:10px 12px;
  border-radius:10px;
  border:1px solid var(--border);
  background: rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
}
.skip button:disabled{ opacity:.4; cursor:not-allowed; }
.skip-status{
  color:var(--muted);
  font-family:var(--mono);
}

.side{
  display:flex;
  flex-direction:column;
  gap:16px;
  overflow:auto;
  padding-right:4px;
}
.panel{
  background: rgba(26,15,31,.72);
  border:1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding:12px;
}
.panel-title{
  font-weight:800;
  margin-bottom:8px;
}

.list{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.item{
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.04);
  border-radius:12px;
  padding:10px;
  display:flex;
  gap:10px;
  align-items:flex-start;
}
.item .thumb{
  width:86px;
  height:48px;
  border-radius:10px;
  background:#000;
  flex:0 0 auto;
  overflow:hidden;
  border:1px solid rgba(255,255,255,.06);
}
.item .thumb img{ width:100%; height:100%; object-fit:cover; }

.item .info{
  flex:1;
  display:flex;
  flex-direction:column;
  gap:3px;
  min-width:0;
}
.item .title{ font-weight:800; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.item .sub{ color:var(--muted); font-size:12px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.item .actions{
  display:flex;
  gap:6px;
  flex-wrap:wrap;
  justify-content:flex-end;
}
.item .actions button{
  padding:8px 10px;
  border-radius:10px;
  border:1px solid rgba(255,255,255,.08);
  background: rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
}
.item .actions button.danger{
  background: rgba(255,92,116,.12);
  border-color: rgba(255,92,116,.25);
}
.item .actions button.ok{
  background: rgba(78,234,157,.10);
  border-color: rgba(78,234,157,.22);
}
.item .badge{
  font-family:var(--mono);
  color:rgba(255,255,255,.7);
  font-size:11px;
}

.bottom{
  padding:12px 16px;
  border-top:1px solid var(--border);
  background: rgba(20,11,23,.75);
  backdrop-filter: blur(10px);
  display:grid;
  grid-template-columns: 280px 260px 1fr;
  gap:16px;
  align-items:center;
}

.me, .dj{
  display:flex;
  align-items:center;
  gap:10px;
}

.avatar{
  width:42px; height:42px;
  border-radius:50%;
  background: rgba(255,255,255,.08);
  border:1px solid rgba(255,255,255,.10);
  overflow:hidden;
}
.avatar.small{ width:34px; height:34px; }

.avatar img{
  width:100%;
  height:100%;
  object-fit:cover;
}

.meta .name{ font-weight:900; }
.meta .role{ color:var(--muted); font-size:12px; }

.dj-title, .members-title{
  font-weight:800;
  margin-bottom:6px;
}
.dj{
  flex-direction:column;
  align-items:flex-start;
  gap:6px;
}
.dj-box{
  display:flex; align-items:center; gap:10px;
  width:100%;
}
.dj-meta .name{ font-weight:900; }
.dj-meta .sub{ color:var(--muted); font-size:12px; }

.members{ min-width:0; }
.members-list{
  display:flex;
  gap:8px;
  overflow:auto;
  padding-bottom:4px;
}
.member{
  display:flex;
  align-items:center;
  gap:8px;
  border:1px solid rgba(255,255,255,.06);
  background: rgba(255,255,255,.04);
  padding:8px 10px;
  border-radius: 999px;
  white-space:nowrap;
}
.member .name{ font-weight:800; font-size:13px; }
.member .tag{ font-family:var(--mono); font-size:11px; color:var(--muted); }
.member button{
  padding:6px 8px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,.10);
  background: rgba(255,255,255,.06);
  color:var(--text);
  cursor:pointer;
}
.member button:disabled{ opacity:.35; cursor:not-allowed; }

@media (max-width: 1100px){
  .middle{ grid-template-columns: 1fr; }
  .bottom{ grid-template-columns: 1fr; grid-auto-rows: auto; }
}
