/* 알림, 좁은 화면(휴대폰), 채팅 새 창, 미니 플레이어, 곡 켜기·끄기 (화면 스타일은 public/css/의 파일 여러 개를 index.html이 이 순서로 불러온다: theme.css → base.css → stage.css → playlist.css → side.css → dialogs.css → misc.css) */
/* ---------- 알림 ---------- */
.conn, .toast {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  max-width: calc(100% - 2 * var(--gutter));
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 13px;
}
.conn { top: calc(12px + env(safe-area-inset-top, 0px)); background: var(--meh); color: #1a0509; font-weight: 600; }
/* popover의 브라우저 기본 모양(가운데 정렬·테두리)을 지우고 아래 가운데에 둔다. 알림이 버튼을 가려도 눌리게 pointer-events는 끈다 */
.toast {
  inset: auto;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom, 0px));
  margin: 0;
  border: 0;
  overflow: visible;
  background: var(--fg);
  color: var(--bg);
  font-weight: 500;
  pointer-events: none;
}

.dialog {
  width: min(calc(100% - 2 * var(--gutter)), 320px);
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--fg);
}
.dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.dialog form { display: flex; flex-direction: column; gap: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.btn-logout { margin-right: auto; color: var(--muted); }

/* ---------- 좁은 화면 ---------- */
@media (max-width: 900px) {
  /* 아래쪽 여백: 삼성 인터넷처럼 주소·도구 막대가 아래에 있고 스크롤하면 숨었다 나타나는 브라우저에서,
     막대가 나타나도 페이지 맨 끝의 채팅 입력창이 막대 밑으로 가려지지 않게 한다 */
  .app { height: auto; min-height: 100%; padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px)); }
  .main { grid-template-columns: minmax(0, 1fr); }
  .stage-wrap { display: block; flex: none; min-height: 0; container-type: normal; }
  .stage { width: 100%; margin-inline: auto; }
  .floor { height: 210px; }
  /* 휴대폰: 채팅창 너비 손잡이는 숨기고, 영상·플로어·채팅창 아래쪽 경계를 위아래로 끌어 높이를 바꾼다.
     손가락으로 잡기 쉽게 잡는 영역을 24px로 넓힌다(앞뒤 칸 사이 간격에 걸치게 음수 여백) */
  /* 휴대폰: 화면 아래쪽은 키보드·브라우저 아래 막대에 가리기 쉬워서 알림을 위쪽에 띄운다 */
  .toast { top: calc(12px + env(safe-area-inset-top, 0px)); bottom: auto; }
  .resizer-col { display: none; }
  .resizer-mobile { display: block; }
  .resizer-row { height: 24px; margin-block: -18px; }
  #side-resizer-m { margin-block: -12px 0; }
  /* svh: 브라우저 막대가 보일 때의 화면 높이. vh는 막대가 숨었을 때 기준이라, 막대가 보이면 채팅 영역이 화면보다 커졌다 */
  .side { border-left: 0; border-top: 1px solid var(--line); height: 70vh; height: 70svh; }
  .top { flex-wrap: wrap; gap: 8px 16px; }
  .now { order: 3; flex-basis: 100%; }
  /* 휴대폰: 화면 아래쪽에 붙는 창. 꽉 차면 예전처럼 화면 전체, 줄이면 위쪽 영상·플로어가 보인다 */
  .pl-panel {
    position: fixed;
    inset: auto 0 0;
    height: calc(100% * var(--pl-frac, 1));
    border-radius: 12px 12px 0 0;
    padding-top: calc(16px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  }
  .pl-panel.is-sheet { padding-top: 18px; }
}
@media (max-width: 520px) {
  .actions { flex-direction: column; align-items: stretch; }
  .actions-left > .btn { flex: 1; }
  .votes .vote { flex: 1; justify-content: center; }
  .vol input { width: 70px; }
  .pl-item { grid-template-columns: 14px 1.6em 48px minmax(0, 1fr); }
  .pl-thumb { width: 48px; }
  .pl-tools { grid-column: 4; }
}

/* ---------- 채팅 새 창 ---------- */
/* 큰 창: 채팅을 새 창으로 빼 둔 동안 채팅 칸을 접고 무대를 넓게 쓴다 */
.app.chat-popped .side, .app.chat-popped #side-resizer-m { display: none; }
.app.chat-popped .main { grid-template-columns: minmax(0, 1fr); }
/* 새 창(?pop=chat): 채팅 칸만 창 가득. 창이 좁아도 휴대폰 배치(위아래로 쌓기)를 쓰지 않는다 */
:root.is-pop .top, :root.is-pop .stage-col, :root.is-pop .resizer { display: none; }
:root.is-pop .app { height: 100%; min-height: 0; padding-bottom: 0; grid-template-rows: minmax(0, 1fr); }
:root.is-pop .main { grid-template-columns: minmax(0, 1fr); }
:root.is-pop .side { height: auto; border: 0; }

/* 움직임 줄이기 설정이어도 WOOT 춤은 남긴다: 작은(9px) 움직임이고, 춤 자체가 WOOT을 눌렀다는 표시라서.
   (Windows "애니메이션 효과"를 끈 PC는 브라우저가 움직임 줄이기로 알려서 춤이 통째로 사라졌었다) */
@media (prefers-reduced-motion: reduce) {
  .dancer { transition: none; }
}

/* ---------- 미니 플레이어(작은 창 안). 작은 창은 이 스타일 파일을 그대로 가져다 쓴다 ---------- */
.mp-body { height: 100vh; background: var(--panel); overflow: hidden; }
/* 위에서부터 차례로 쌓고, 남는 높이는 맨 아래 채팅이 가져간다(창을 키우면 채팅이 여러 줄 보인다) */
.mp { display: flex; flex-direction: column; gap: 8px; height: 100%; padding: 12px 14px; box-sizing: border-box; }
.mp > * { flex: none; }
.mp-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; align-items: center; }
.mp-thumb { width: 112px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 4px; background: #000; }
.mp-thumb:not([src]) { visibility: hidden; }
.mp-text { min-width: 0; }
.mp-title { font-size: 14px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.mp-sub { margin-top: 4px; font-size: 12px; color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mp-prog { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.mp-prog span { display: block; width: 0; height: 100%; background: var(--accent); transition: width 0.5s linear; }
.mp-times { display: flex; justify-content: space-between; margin-top: -4px; font-family: var(--font-mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mp-ctrl { display: flex; align-items: center; gap: 6px; }
.mp-ctrl .vote { gap: 6px; padding: 6px 8px; }
.mp-ctrl .vote-label { font-size: 11px; }
.mp-ctrl .vote-n { font-size: 11px; }
.mp-vol { display: flex; align-items: center; gap: 6px; margin-left: auto; color: var(--muted); }
.mp-vol svg { width: 16px; height: 16px; flex: none; }
.mp-vol input { width: 72px; accent-color: var(--accent); }
.mp-next { display: flex; align-items: center; gap: 8px; min-width: 0; padding: 4px 4px 4px 8px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 12px; }
.mp-next-label { flex: none; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--accent); }
.mp-next-thumb { flex: none; width: 32px; aspect-ratio: 16 / 9; object-fit: cover; border-radius: 2px; background: #000; }
.mp-next-thumb:not([src]) { display: none; }
.mp-next-text { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mp-next-text .dur { margin-left: 6px; color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.mp-next.is-empty .mp-next-text { color: var(--muted); }
.mp-next-skip { flex: none; padding: 3px 8px; border: 1px solid var(--line); border-radius: calc(var(--radius) - 2px); background: none; color: var(--muted); font-size: 11px; cursor: pointer; }
.mp-next-skip:hover { color: var(--fg); border-color: var(--line-hover); }
/* 채팅: 남는 자리만큼 줄을 바꿔 보여 주고 넘치면 끝을 …로(줄 수는 fitMiniChat이 창 높이에 맞춰 정한다) */
.mp > .mp-chat { flex: 1 1 auto; min-height: 26px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 12px; line-height: 18px; color: var(--muted); overflow: hidden; }
.mp-chat-text { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; overflow-wrap: anywhere; }
.mp-chat b { margin-right: 6px; color: var(--fg-soft); font-weight: 600; }
/* 채팅·이모티콘 보내기 줄(2026-10-26 친구 건의)과 이모티콘 고르기(보내기 줄 위를 덮는다. 칸 모양은 큰 창 .emo-item) */
.mp { position: relative; }
.mp-say { display: flex; gap: 6px; }
.mp-say .input { flex: 1 1 auto; min-width: 0; padding: 5px 10px; font-size: 12px; }
.mp-say .btn { flex: none; }
.mp-emo-btn { padding: 4px 6px; color: var(--muted); }
.mp-emo-btn svg { display: block; width: 18px; height: 18px; }
.mp-emo-btn:hover, .mp-emo-btn.is-on { color: var(--accent); }
.mp-emo {
  position: absolute;
  inset: 8px 8px 50px;
  z-index: 2;
  overflow-y: auto;
  padding: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
}
.mp-emo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 4px; }
#mini-btn.is-on { color: var(--accent); border-color: var(--accent); }

/* ---------- 플레이리스트 곡 켜기·끄기(2026-10-18) ---------- */
.pl-switch {
  display: inline-flex; align-items: center; gap: 5px; flex: none;
  padding: 2px 8px 2px 4px; border: 1px solid var(--line); border-radius: 999px;
  background: none; color: var(--muted); font-size: 11px; cursor: pointer; white-space: nowrap;
}
.pl-switch::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--dim); }
.pl-switch.is-on { color: var(--woot); border-color: color-mix(in srgb, var(--woot) 45%, transparent); }
.pl-switch.is-on::before { background: var(--woot); }
.pl-switch:hover { border-color: var(--line-hover); }
.pl-item.is-off .pl-thumb, .pl-item.is-off .pl-title, .pl-item.is-off .pl-num { opacity: 0.4; }
.pl-offnote { color: var(--dim); }
