* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f0f1a;
  --panel: #1a1a2e;
  --card: #22223b;
  --accent: #7c3aed;
  --accent2: #a855f7;
  --text: #f1f0ff;
  --muted: #8b8ba7;
  --success: #10b981;
  --danger: #ef4444;
  --border: #2d2d4e;
}

body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; min-height: 100vh; }

.logo {
  font-size: 1.4rem; font-weight: 800;
  background: linear-gradient(135deg, var(--accent2), #60a5fa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}

/* ── LANDING ── */
.landing-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1.5rem; }

.landing-wrap { width: 100%; max-width: 400px; text-align: center; }

.landing-logo { font-size: 3.5rem; margin-bottom: 0.5rem; }

.landing-title {
  font-size: 2rem; font-weight: 900; letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent2), #60a5fa);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: 0.4rem;
}

.landing-sub { color: var(--muted); font-size: 0.9rem; margin-bottom: 2rem; }

.landing-card {
  background: var(--panel); border-radius: 18px; border: 1px solid var(--border);
  padding: 1.8rem; display: flex; flex-direction: column; gap: 1rem; text-align: left;
}

.form-group { display: flex; flex-direction: column; gap: 0.4rem; }

.form-group label { font-size: 0.8rem; font-weight: 600; color: var(--muted); letter-spacing: 0.5px; }

.opt { font-weight: 400; font-size: 0.75rem; }

.form-group input {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 0.95rem; padding: 0.75rem 1rem; outline: none;
  transition: border-color 0.15s; width: 100%;
}
.form-group input:focus { border-color: var(--accent); }
.form-group input::placeholder { color: #4a4a6a; }

.landing-card button, button#createBtn {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white; border: none; border-radius: 12px; padding: 0.85rem;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.15s;
  margin-top: 0.25rem;
}
.landing-card button:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.landing-card button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── HOST LAYOUT ── */
.host-body { overflow: hidden; height: 100vh; }

.host-layout { display: grid; grid-template-columns: 400px 1fr; height: 100vh; }

.player-panel {
  background: var(--panel); border-right: 1px solid var(--border);
  padding: 1.3rem; display: flex; flex-direction: column; gap: 1rem; overflow-y: auto;
}

/* 채널 알림판 */
.channel-board {
  background: var(--card); border-radius: 14px; border: 1px solid var(--border);
  padding: 1rem 1.2rem;
}

.board-row { display: flex; align-items: center; gap: 1rem; }

.board-item { flex: 1; }

.board-label {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 1.5px;
  text-transform: uppercase; color: var(--muted); margin-bottom: 0.25rem;
}

.board-value { font-size: 1.1rem; font-weight: 800; color: var(--text); }

.board-pin.has-pin {
  font-size: 1.4rem; letter-spacing: 6px; color: var(--accent2);
  font-family: 'Courier New', monospace;
}

.board-divider { width: 1px; height: 36px; background: var(--border); flex-shrink: 0; }

/* 플레이어 */
.now-playing { background: var(--card); border-radius: 14px; overflow: hidden; border: 1px solid var(--border); }

.now-label {
  font-size: 0.62rem; font-weight: 700; letter-spacing: 2px;
  color: var(--accent2); padding: 0.7rem 1rem 0.3rem;
}

#ytPlayer { width: 100%; background: #000; }

.current-info { padding: 0.7rem 1rem; }
.current-title { font-size: 0.9rem; font-weight: 600; line-height: 1.4; }
.current-by { font-size: 0.72rem; color: var(--muted); margin-top: 0.15rem; }

.empty-state { padding: 1.5rem 1rem; text-align: center; color: var(--muted); font-size: 0.88rem; }
.empty-icon { font-size: 1.8rem; margin-bottom: 0.4rem; }
.empty-sub { font-size: 0.73rem; margin-top: 0.3rem; color: #4a4a6a; }

/* 컨트롤 */
.controls { display: flex; gap: 0.6rem; }
.controls button {
  flex: 1; padding: 0.65rem; border: none; border-radius: 10px;
  font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
  background: var(--accent); color: white;
}
.controls button:hover:not(:disabled) { background: var(--accent2); transform: translateY(-1px); }
.controls button:disabled { opacity: 0.3; cursor: not-allowed; }

/* QR 섹션 */
.qr-section {
  background: var(--card); border-radius: 14px; padding: 1rem 1.2rem;
  border: 1px solid var(--border); text-align: center;
}
.qr-label { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.5px; margin-bottom: 0.5rem; }
.guest-url { font-size: 0.72rem; color: var(--accent2); word-break: break-all; margin-bottom: 0.75rem; font-family: monospace; }
#qrBox canvas, #qrBox img { border-radius: 8px; }

/* ── 큐 패널 (host) ── */
.queue-panel { display: flex; flex-direction: column; overflow: hidden; }

.queue-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 1.1rem 1.4rem; font-weight: 700; font-size: 0.95rem;
  border-bottom: 1px solid var(--border); background: var(--panel);
  flex-shrink: 0;
}

.queue-header-right { display: flex; align-items: center; gap: 0.6rem; }

.queue-count {
  font-size: 0.73rem; background: var(--accent); color: white;
  padding: 0.2rem 0.6rem; border-radius: 20px; font-weight: 600;
}

.btn-clear {
  font-size: 0.73rem; background: rgba(239,68,68,0.15); color: var(--danger);
  border: 1px solid rgba(239,68,68,0.3); border-radius: 8px;
  padding: 0.25rem 0.6rem; cursor: pointer; font-weight: 600; transition: all 0.15s;
}
.btn-clear:hover { background: var(--danger); color: white; }

/* 플레이리스트 추가 영역 */
.playlist-area {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0.5rem;
  background: var(--panel); flex-shrink: 0;
}

.playlist-presets { display: flex; flex-wrap: wrap; gap: 0.4rem; }

.btn-preset {
  font-size: 0.75rem; background: rgba(124,58,237,0.15); color: var(--accent2);
  border: 1px solid rgba(124,58,237,0.35); border-radius: 20px;
  padding: 0.3rem 0.75rem; cursor: pointer; font-weight: 600; transition: all 0.15s;
  white-space: nowrap;
}
.btn-preset:hover { background: var(--accent); color: white; border-color: var(--accent); }

.playlist-input-row { display: flex; gap: 0.5rem; }

.input-playlist {
  flex: 1; background: var(--bg); border: 1px solid var(--border); border-radius: 8px;
  color: var(--text); font-size: 0.82rem; padding: 0.5rem 0.75rem; outline: none;
  transition: border-color 0.15s;
}
.input-playlist:focus { border-color: var(--accent); }
.input-playlist::placeholder { color: #4a4a6a; }

.playlist-input-row button {
  background: var(--accent); color: white; border: none; border-radius: 8px;
  padding: 0.5rem 0.9rem; font-size: 0.82rem; font-weight: 700;
  cursor: pointer; white-space: nowrap; transition: all 0.15s;
}
.playlist-input-row button:hover:not(:disabled) { background: var(--accent2); }
.playlist-input-row button:disabled { opacity: 0.45; cursor: not-allowed; }

.playlist-msg {
  font-size: 0.78rem; padding: 0.2rem 0.1rem; display: none;
}
.playlist-msg.show { display: block; }
.playlist-msg.done, .playlist-msg.loading { color: var(--success); }
.playlist-msg.error { color: var(--danger); }

.queue-list {
  flex: 1; overflow-y: auto; padding: 0.75rem;
  display: flex; flex-direction: column; gap: 0.45rem;
}
.queue-list::-webkit-scrollbar { width: 4px; }
.queue-list::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

.queue-item {
  display: flex; align-items: center; gap: 0.7rem;
  background: var(--card); border-radius: 10px; padding: 0.55rem 0.75rem;
  border: 1px solid var(--border); transition: border-color 0.15s;
}
.queue-item:hover { border-color: var(--accent); }

.queue-num { font-size: 0.73rem; color: var(--muted); width: 1.2rem; text-align: center; flex-shrink: 0; }

.queue-thumb { width: 52px; height: 36px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: var(--border); }

.queue-info { flex: 1; min-width: 0; }
.queue-title { font-size: 0.83rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-by { font-size: 0.7rem; color: var(--muted); margin-top: 0.12rem; }

.queue-remove {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-size: 0.78rem; padding: 0.2rem 0.4rem; border-radius: 4px; transition: all 0.1s; flex-shrink: 0;
}
.queue-remove:hover { background: var(--danger); color: white; }

.queue-empty { text-align: center; color: var(--muted); font-size: 0.85rem; padding: 2rem; }

/* ── GUEST ── */
.guest-body { display: flex; justify-content: center; padding: 1.5rem 1rem 3rem; }

.guest-layout { width: 100%; max-width: 520px; display: flex; flex-direction: column; gap: 1.1rem; }

.guest-header { text-align: center; padding: 0.25rem 0; }
.guest-channel-name { font-size: 0.85rem; color: var(--muted); margin-top: 0.2rem; }

.guest-now {
  background: var(--panel); border-radius: 14px; border: 1px solid var(--border); padding: 1rem;
}
.gnow-content { display: flex; align-items: center; gap: 0.75rem; margin-top: 0.5rem; min-height: 48px; }
.gnow-empty { color: var(--muted); font-size: 0.85rem; }
.gnow-thumb { width: 72px; height: 48px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }
.gnow-info { flex: 1; min-width: 0; }
.gnow-title { font-size: 0.9rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gnow-by { font-size: 0.73rem; color: var(--muted); margin-top: 0.15rem; }

/* 추가 폼 */
.add-form {
  background: var(--panel); border-radius: 14px; border: 1px solid var(--border);
  padding: 1.2rem; display: flex; flex-direction: column; gap: 0.7rem;
}
.input-nick, .input-url {
  background: var(--bg); border: 1px solid var(--border); border-radius: 10px;
  color: var(--text); font-size: 0.9rem; padding: 0.7rem 1rem; outline: none;
  transition: border-color 0.15s; width: 100%;
}
.input-nick:focus, .input-url:focus { border-color: var(--accent); }
.input-nick::placeholder, .input-url::placeholder { color: #4a4a6a; }
.url-row { display: flex; gap: 0.5rem; }
.url-row .input-url { flex: 1; }
.url-row button {
  background: var(--accent); color: white; border: none; border-radius: 10px;
  padding: 0.7rem 1.1rem; font-size: 0.9rem; font-weight: 700; cursor: pointer;
  transition: all 0.15s; white-space: nowrap; flex-shrink: 0;
}
.url-row button:hover:not(:disabled) { background: var(--accent2); transform: translateY(-1px); }
.url-row button:disabled { opacity: 0.5; cursor: not-allowed; }

.add-error { font-size: 0.8rem; color: var(--danger); padding: 0.2rem 0.1rem; }
.add-success { font-size: 0.8rem; color: var(--success); padding: 0.2rem 0.1rem; }

/* 게스트 큐 */
.guest-queue { background: var(--panel); border-radius: 14px; border: 1px solid var(--border); overflow: hidden; }
.guest-queue .queue-header { background: transparent; padding: 1rem 1.2rem; }
.guest-queue .queue-list { max-height: 380px; padding: 0.5rem 0.75rem 0.75rem; }

/* ── PIN 오버레이 ── */
.pin-overlay {
  position: fixed; inset: 0; background: rgba(10, 10, 20, 0.92);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; backdrop-filter: blur(6px);
}
.pin-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 20px;
  padding: 2.5rem 2rem; text-align: center; width: 320px;
  display: flex; flex-direction: column; gap: 1rem;
}
.pin-logo { font-size: 2.5rem; }
.pin-title { font-size: 1rem; font-weight: 700; }
.pin-channel { font-size: 0.82rem; color: var(--muted); }
.pin-input {
  background: var(--bg); border: 2px solid var(--border); border-radius: 12px;
  color: var(--text); font-size: 1.8rem; font-weight: 700; letter-spacing: 8px;
  text-align: center; padding: 0.7rem; outline: none; width: 100%;
  transition: border-color 0.15s; font-family: monospace;
}
.pin-input:focus { border-color: var(--accent); }
.pin-card button {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: white; border: none; border-radius: 12px; padding: 0.8rem;
  font-size: 1rem; font-weight: 700; cursor: pointer; transition: all 0.15s;
}
.pin-card button:hover { opacity: 0.88; }

/* ── 알림 ── */
.notification {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--accent); color: white; padding: 0.65rem 1.4rem;
  border-radius: 30px; font-size: 0.85rem; font-weight: 600;
  box-shadow: 0 4px 20px rgba(124, 58, 237, 0.5);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  white-space: nowrap; z-index: 100; pointer-events: none;
}
.notification.show { transform: translateX(-50%) translateY(0); }

.hidden { display: none !important; }
