/* Lineup — 앱 스타일 (1단계 셸 + 2단계 큐 UI)
   원칙(설계문서 §4-4 + 2026-09-27 확정 표준):
     ① 모바일 사용자 환경을 무조건 최우선으로 설계한다.
        아래 스타일은 전부 모바일 기준(unprefixed)이고, 데스크탑/태블릿용 확장은
        하단의 min-width 미디어쿼리로만 "추가"한다 — 절대 그 반대로 하지 않는다.
     ② Lineup은 유튜브 영상을 다루는 서비스이므로, 유튜브를 연상시키는
        레드/화이트/블랙 팔레트를 앞으로도 유지한다(--brand 값은 icons 생성
        스크립트의 BRAND_BG와 반드시 동일하게 맞출 것).
     ③ 터치 조작 기준, 버튼 최소 48px, 한 화면에 핵심 기능 하나 */

:root {
  --brand: #e0201b;        /* 유튜브 연상 레드 */
  --brand-dark: #b8180f;
  --bg: #f9f9f9;            /* 유튜브 라이트 테마와 동일 계열의 옅은 회백색 */
  --surface: #ffffff;
  --text: #0f0f0f;          /* 유튜브 본문 텍스트와 동일한 블랙에 가까운 톤 */
  --text-muted: #606060;
  --border: #e5e5e5;
  --danger: #3c3c3c;        /* 삭제 등 보조 액션은 레드를 아끼고 중립 톤으로 구분 */
  --radius: 14px;
  --pill-radius: 24px;      /* 유튜브 특유의 알약형 버튼 */
  --touch-min: 48px;
  --content-max: 640px;     /* 데스크탑에서 지나치게 늘어나지 않도록 하는 상한 */
}

* {
  box-sizing: border-box;
}

/* HTML hidden 속성이 class의 display 선언에 밀리지 않도록 보장
   (예: .commute-panel { display:flex }와 [hidden]이 동시에 걸리는 경우) */
[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo",
    "Pretendard", "Malgun Gothic", sans-serif;
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* 헤더 */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px; /* 버튼이 나타나도 헤더 높이가 흔들리지 않게 고정 */
  padding: 8px 6px 8px 16px; /* 좁은 폰 기준 — 360px 이상에서 넓힘 */
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}

.help-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 6px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-decoration: none;
  white-space: nowrap;
}

.queue-empty__guide {
  display: inline-block;
  margin-top: 14px;
  padding: 8px 4px;
  color: var(--brand);
  font-size: 0.88rem;
  font-weight: 700;
  text-decoration: none;
}

.share-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text);
  cursor: pointer;
}

.share-btn:active {
  background: #f0f0f0;
}

.install-btn {
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--brand);
  border-radius: var(--pill-radius);
  background: var(--surface);
  color: var(--brand);
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
}

.app-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 워드마크 앞에 붙는 작은 재생 삼각형 배지 — 유튜브 로고 문법(레드 사각/흰 삼각) 차용.
   배지 자신을 positioning context로 삼아 삼각형을 중앙 고정하므로,
   헤더 패딩 값이 바뀌어도(예: 아래 데스크탑 미디어쿼리) 어긋나지 않는다. */
.logo-badge {
  position: relative;
  display: inline-block;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  background: var(--brand);
  border-radius: 6px;
}

.logo-badge::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-35%, -50%); /* 삼각형은 무게중심이 왼쪽으로 치우쳐 보이므로 살짝 보정 */
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent #ffffff;
}

/* 메인 영역 */
.app-main {
  flex: 1;
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 16px 20px 96px; /* 하단 재생버튼에 가리지 않게 여백 확보 */
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* 영상 추가 패널 */
.add-panel form {
  display: flex;
  gap: 8px;
}

#input-url {
  flex: 1;
  min-width: 0; /* 입력창 기본 최소폭 때문에 좁은 화면에서 "담기" 버튼이 찌그러지던 문제 방지 */
  min-height: var(--touch-min);
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--pill-radius);
  font-size: 1rem; /* 16px 미만이면 iOS Safari가 포커스 시 확대해버려 모바일에서 필수 */
  background: var(--surface);
  color: var(--text);
}

#input-url::placeholder {
  color: var(--text-muted);
}

#input-url:focus {
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.btn-primary {
  flex-shrink: 0;
  white-space: nowrap; /* 휴대폰 글자 크기를 키워도 "담기"가 세로로 쪼개지지 않게 */
  min-height: var(--touch-min);
  min-width: var(--touch-min);
  padding: 0 20px;
  border: none;
  border-radius: var(--pill-radius);
  background: var(--brand);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary:active {
  background: var(--brand-dark);
}

/* 클립보드 붙여넣기 버튼 (입력창 아래 보조 동작) */
.paste-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  margin-top: 8px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--pill-radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
}

.paste-btn svg {
  color: var(--brand);
}

.paste-btn:active {
  background: #f0f0f0;
}

/* 클립보드 자동 감지 제안 카드 */
.clip-suggest {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  padding: 8px 4px 8px 8px;
  border: 1.5px solid var(--brand);
  border-radius: var(--radius);
  background: #fff5f5;
  animation: clip-in 0.2s ease-out;
}

@keyframes clip-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: none; }
}

.clip-suggest__thumb {
  flex-shrink: 0;
  width: 64px;
  height: 36px;
  border-radius: 6px;
  object-fit: cover;
  background: #ececec;
}

.clip-suggest__text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.clip-suggest__label {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--brand-dark);
}

.clip-suggest__title {
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.clip-suggest__add {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 16px;
  border: none;
  border-radius: var(--pill-radius);
  background: var(--brand);
  color: #fff;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.clip-suggest__close {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
}

/* 통근시간 맞춤 패널 */
.commute-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 16px;
}

.commute-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--touch-min);
}

.commute-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--brand);
  font-variant-numeric: tabular-nums;
}

.commute-body {
  padding-bottom: 12px;
}

/* 토글 스위치 */
.switch {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: var(--touch-min);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}

.switch input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.switch__track {
  position: relative;
  flex-shrink: 0;
  width: 44px;
  height: 26px;
  border-radius: 13px;
  background: #cfcfcf;
  transition: background 0.18s ease;
}

.switch__track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
  transition: transform 0.18s ease;
}

.switch input:checked + .switch__track {
  background: var(--brand);
}

.switch input:checked + .switch__track::after {
  transform: translateX(18px);
}

.switch input:focus-visible + .switch__track {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}

.switch__label {
  font-size: 0.95rem;
  font-weight: 600;
}

/* 슬라이더 — 채워진 부분 레드, 손잡이는 터치하기 쉽게 크게 */
#commute-slider {
  --fill: 20%;
  display: block;
  width: 100%;
  height: 32px;
  margin: 0;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

#commute-slider::-webkit-slider-runnable-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--brand) var(--fill), #e3e3e3 var(--fill));
}

#commute-slider::-moz-range-track {
  height: 6px;
  border-radius: 3px;
  background: linear-gradient(to right, var(--brand) var(--fill), #e3e3e3 var(--fill));
}

#commute-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 26px;
  height: 26px;
  margin-top: -10px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

#commute-slider::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--brand);
}

#commute-slider:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 4px;
  border-radius: 4px;
}

.commute-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.72rem;
  color: #909090;
  margin-top: 2px;
}

/* "1시간" 눈금은 슬라이더의 60분 위치(5~120 중 60 → 약 48%)에 맞춤 */
.commute-scale span:nth-child(2) {
  position: relative;
  left: -2%;
}

.commute-summary {
  margin: 8px 0 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--text);
}

/* 입력 오류 안내 */
.add-error {
  margin: 8px 4px 0;
  font-size: 0.86rem;
  color: var(--brand-dark);
  font-weight: 600;
}

#input-url[aria-invalid="true"] {
  border-color: var(--brand);
}

/* 큐 목록 */
.queue-panel {
  flex: 1;
}

.queue-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  margin: 0 4px 10px;
}

.queue-heading {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
}

.clear-all-btn {
  min-height: 36px;
  padding: 0 4px 0 8px;
  border: none;
  background: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  white-space: nowrap;
  cursor: pointer;
}

/* 총 시간이 없을 때도 전체삭제는 오른쪽 끝에 붙도록 */
.queue-total[hidden] + .clear-all-btn {
  margin-left: auto;
}

.queue-total {
  margin-left: auto;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.queue-count {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.queue-list {
  position: relative; /* 드래그 계산(offsetTop)의 기준 */
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.queue-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 2px 6px 0;
  min-height: 64px;
  -webkit-user-select: none;
  user-select: none;
}

/* 통근시간을 넘어 이번엔 제외되는 영상 */
.queue-item.is-trimmed {
  background: transparent;
  border-style: dashed;
}

.queue-item.is-trimmed .queue-item__thumb-wrap,
.queue-item.is-trimmed .queue-item__meta {
  opacity: 0.4;
}

/* 드래그 중인 항목: 살짝 떠오르는 느낌 */
.queue-item.is-dragging {
  z-index: 5;
  border-color: var(--brand);
  box-shadow: 0 10px 24px rgba(15, 15, 15, 0.18);
  transition: box-shadow 0.15s ease;
}

.queue-list.is-sorting .queue-item:not(.is-dragging) {
  opacity: 0.85;
}

body.is-sorting {
  cursor: grabbing;
}

/* 방금 담긴 / 중복으로 찾은 항목 강조 */
.queue-item.is-flash {
  animation: item-flash 1.1s ease-out;
}

@keyframes item-flash {
  0%   { box-shadow: 0 0 0 3px rgba(224, 32, 27, 0.55); }
  100% { box-shadow: 0 0 0 3px rgba(224, 32, 27, 0); }
}

.queue-item__handle {
  flex-shrink: 0;
  width: 40px;
  height: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  background: none;
  border-radius: 10px;
  color: #909090;
  cursor: grab;
  touch-action: none; /* 핸들 위에서만 스크롤 대신 드래그 */
}

.queue-item.is-dragging .queue-item__handle {
  color: var(--brand);
  cursor: grabbing;
}

.queue-item__thumb-wrap {
  position: relative;
  flex-shrink: 0;
  width: 80px;
  height: 45px;
  border-radius: 8px;
  overflow: hidden;
  background: #ececec;
}

.queue-item__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.queue-item__thumb.is-broken {
  visibility: hidden;
}

/* 재생 순서 번호 — 썸네일 좌상단 */
.queue-item__index {
  position: absolute;
  top: 3px;
  left: 3px;
  min-width: 20px;
  height: 18px;
  padding: 0 5px;
  border-radius: 5px;
  background: rgba(15, 15, 15, 0.82);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.queue-item__meta {
  flex: 1;
  min-width: 0;
  padding-left: 4px;
}

.queue-item__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.3;
  /* 모바일은 폭이 좁아 한 줄이면 제목이 거의 안 보이므로 두 줄까지 표시 */
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
  word-break: keep-all; /* 한글 단어 중간에서 줄이 끊기지 않게 */
  overflow-wrap: anywhere;
}

.queue-item__duration {
  margin: 3px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 영상 길이 — 썸네일 우하단 (유튜브와 같은 위치·모양) */
.queue-item__time {
  position: absolute;
  right: 3px;
  bottom: 3px;
  padding: 0 4px;
  height: 16px;
  border-radius: 4px;
  background: rgba(15, 15, 15, 0.85);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
}

/* 정보 불러오는 중 */
.queue-item.is-loading .queue-item__title {
  color: var(--text-muted);
  font-weight: 500;
}

/* 삭제·비공개 등 재생 불가 영상 */
.queue-item.is-unavailable .queue-item__thumb-wrap,
.queue-item.is-unavailable .queue-item__meta {
  opacity: 0.45;
}

/* 위/아래 버튼: 모바일에선 드래그 핸들이 대신하므로 숨기고, 데스크탑에서만 추가 */
.queue-item__move {
  display: none;
}

.queue-item__move-btn,
.queue-item__remove {
  flex-shrink: 0;
  width: var(--touch-min);
  height: var(--touch-min);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--danger);
  cursor: pointer;
}

.queue-item__remove:active,
.queue-item__move-btn:active {
  background: #f0f0f0;
}

.queue-item__move-btn:disabled {
  color: #cfcfcf;
  cursor: default;
  background: none;
}

.queue-item button:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

/* 빈 상태 */
.queue-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 40px 20px 24px;
}

.queue-empty__icon {
  display: block;
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 16px;
  background:
    linear-gradient(var(--border), var(--border)) 14px 16px / 28px 4px no-repeat,
    linear-gradient(var(--border), var(--border)) 14px 26px / 28px 4px no-repeat,
    linear-gradient(var(--brand), var(--brand)) 14px 36px / 18px 4px no-repeat,
    var(--surface);
  border: 1px solid var(--border);
}

.queue-empty__title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
}

.queue-empty__desc {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
}

.queue-empty__desc b {
  color: var(--text);
  font-weight: 600;
}

/* 앱 소개 (목록 아래 작은 글씨) */
.app-about {
  margin-top: 8px;
  padding: 16px 4px 0;
  border-top: 1px solid var(--border);
  font-size: 0.8rem;
  line-height: 1.6;
  color: #7a7a7a;
  word-break: keep-all;
}

.app-about p {
  margin: 0 0 6px;
}

.app-about a {
  color: #555;
}

/* 토스트(스낵바) — 하단 재생 버튼 바로 위 */
.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 30;
  max-width: calc(var(--content-max) - 40px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 48px;
  padding: 6px 8px 6px 16px;
  border-radius: 12px;
  background: #0f0f0f;
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.18s ease, transform 0.18s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.toast__msg {
  flex: 1;
}

.toast__action {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: 8px;
  background: none;
  color: #ff6f69; /* 검정 배경 위 대비를 위해 브랜드 레드의 밝은 톤 */
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
}

.toast__action:active {
  background: rgba(255, 255, 255, 0.1);
}

/* 재생 중 상태 바 (재생 시작 버튼 자리를 대신함) */
.session-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 56px;
  padding: 6px 6px 6px 16px;
  border-radius: 18px;
  background: #0f0f0f;
  color: #fff;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

.session-bar__info {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.session-bar__dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 0 rgba(224, 32, 27, 0.6);
  animation: live-pulse 1.8s ease-out infinite;
}

@keyframes live-pulse {
  0%   { box-shadow: 0 0 0 0 rgba(224, 32, 27, 0.6); }
  100% { box-shadow: 0 0 0 10px rgba(224, 32, 27, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .session-bar__dot { animation: none; }
}

.session-bar__text {
  min-width: 0;
  display: flex;
  flex-direction: column;
  line-height: 1.25;
}

.session-bar__text strong {
  font-size: 0.95rem;
}

.session-bar__meta {
  font-size: 0.8rem;
  color: #bdbdbd;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.session-bar__btn {
  flex-shrink: 0;
  min-width: 56px;
  min-height: 44px;
  padding: 0 14px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.session-bar__btn--end {
  background: var(--brand);
}

.session-bar__btn--next {
  background: #fff;
  color: var(--text);
}

.session-bar__btn[hidden] {
  display: none;
}

.session-bar__btn:active {
  filter: brightness(0.9);
}

/* 재생 중에 끼워넣은 "다음 차례" 영상 */
.queue-item.is-next {
  border-color: var(--brand);
  background: #fff5f5;
}

.queue-item.is-next .queue-item__duration::before {
  content: "다음 차례 · ";
  color: var(--brand);
  font-weight: 700;
}

/* 지금 재생 중인 묶음에 든 영상 — 왼쪽에 레드 표시 */
.queue-item.is-playing {
  border-left: 3px solid var(--brand);
}

/* 끝내기 시트: 선택된(다 본) 영상 */
.sheet__pick {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 6px 2px;
  border: none;
  background: none;
  color: var(--text);
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.sheet__check {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 2px solid #cfcfcf;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
}

.sheet__item.is-selected .sheet__check {
  border-color: var(--brand);
  background: var(--brand);
}

.sheet__item.is-selected .sheet__name {
  color: var(--text-muted);
  text-decoration: line-through;
}

/* 앱 안 브라우저(카톡·네이버 등) 안내 배너 */
.inapp-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 6px 10px 14px;
  border-radius: var(--radius);
  background: #0f0f0f;
  color: #fff;
}

.inapp-banner__text {
  flex: 1;
  min-width: 0;
  margin: 0;
  word-break: keep-all;
  font-size: 0.85rem;
  line-height: 1.45;
}

.inapp-banner__btn {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 12px;
  border: none;
  border-radius: 12px;
  background: var(--brand);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

.inapp-banner__close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  border-radius: 50%;
  background: none;
  color: #bdbdbd;
  cursor: pointer;
}

/* 설치 안내 시트 본문 */
.install-body {
  overflow-y: auto;
}

.install-steps {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: step;
}

.install-steps li {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-top: 1px solid var(--border);
  font-size: 0.95rem;
  line-height: 1.5;
}

.install-steps li::before {
  counter-increment: step;
  content: counter(step);
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--brand);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 800;
  line-height: 28px;
  text-align: center;
}

/* 단계 안에 들어가는 "화면에 보이는 버튼 모양" 표시 */
.ui-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  border: 1px solid #d0d0d0;
  border-radius: 8px;
  background: #f5f5f5;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  vertical-align: 1px;
}

.ui-chip svg {
  display: block;
}

.install-note {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 12px;
  background: #f6f6f6;
  font-size: 0.85rem;
  line-height: 1.5;
  color: #444;
}

.install-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.install-copy input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fafafa;
  color: var(--text);
  font-size: 0.85rem;
}

.install-copy button {
  flex-shrink: 0;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--text);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
}

/* 재생 시트 (하단에서 올라오는 패널) */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 40;
}

.sheet__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 15, 15, 0.45);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.sheet__panel {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 85dvh;
  max-width: var(--content-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 8px 20px calc(16px + env(safe-area-inset-bottom));
  border-radius: 20px 20px 0 0;
  background: var(--surface);
  transform: translateY(100%);
  transition: transform 0.22s ease;
}

.sheet.is-open .sheet__backdrop {
  opacity: 1;
}

.sheet.is-open .sheet__panel {
  transform: none;
}

body.has-sheet {
  overflow: hidden;
}

.sheet__grip {
  width: 40px;
  height: 4px;
  margin: 0 auto 12px;
  border-radius: 2px;
  background: #d9d9d9;
}

.sheet__title {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 700;
}

.sheet__desc {
  margin: 6px 0 12px;
  font-size: 0.88rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.sheet__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border-top: 1px solid var(--border);
}

.sheet__item {
  border-bottom: 1px solid var(--border);
}

.sheet__link {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 6px 2px;
  color: var(--text);
  text-decoration: none;
}

.sheet__num {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: #0f0f0f;
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 24px;
  text-align: center;
}

.sheet__name {
  flex: 1;
  min-width: 0;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sheet__time {
  flex-shrink: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.sheet__open {
  flex-shrink: 0;
  padding: 6px 12px;
  border-radius: var(--pill-radius);
  background: var(--brand);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.sheet__item.is-opened .sheet__num {
  background: #bdbdbd;
}

.sheet__item.is-opened .sheet__name {
  color: var(--text-muted);
}

.sheet__item.is-opened .sheet__open {
  background: #f0f0f0;
  color: var(--text);
}

.sheet__actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.sheet__btn {
  flex: 1;
  min-height: var(--touch-min);
  border: 1px solid var(--border);
  border-radius: var(--pill-radius);
  background: var(--surface);
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}

.sheet__btn--primary {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.sheet__btn[hidden] {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.icon-btn {
  min-height: var(--touch-min);
  padding: 0 12px;
  border: none;
  background: none;
  color: var(--danger);
  font-size: 0.9rem;
  cursor: pointer;
}

/* 하단 재생 버튼 */
.app-footer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to top, var(--bg) 70%, transparent);
}

.app-footer > .btn-play,
.app-footer > .session-bar {
  max-width: var(--content-max);
  margin: 0 auto;
}

.btn-play {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 52px;
  border: none;
  border-radius: var(--pill-radius);
  background: var(--brand);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
}

.btn-play:active {
  background: var(--brand-dark);
}

.btn-play__label,
.btn-play__meta,
.icon-btn,
.install-btn,
.paste-btn,
.clip-suggest__add,
.sheet__btn,
.toast__action {
  white-space: nowrap;
}

.btn-play__meta {
  font-size: 0.85rem;
  font-weight: 600;
  opacity: 0.9;
}

.btn-play__meta:empty {
  display: none;
}

.btn-play__meta::before {
  content: "·";
  margin-right: 8px;
}

.btn-play:disabled {
  background: #d9d9d9;
  color: #8a8a8a;
  cursor: not-allowed;
}

/* --- 데스크탑/태블릿 확장 (모바일 스타일 위에 "추가"만 함) ------------- */
/* 보통 폭 이상의 폰: 헤더 여백을 원래대로 */
@media (min-width: 360px) {
  .app-header {
    padding: 8px 8px 8px 20px;
  }

  .header-actions {
    gap: 4px;
  }

  .help-link {
    padding: 0 10px;
  }
}

@media (min-width: 640px) {
  .app-header {
    min-height: 72px;
    padding: 12px 24px 12px 32px;
  }

  .app-main {
    padding-top: 28px;
  }

  .queue-item {
    gap: 10px;
    padding: 8px 6px 8px 2px;
  }

  .queue-item__thumb-wrap {
    width: 112px;
    height: 63px;
  }

  .queue-item__title {
    font-size: 0.98rem;
  }

  /* 데스크탑: 드래그 외에 위/아래 버튼도 노출 */
  .queue-item__move {
    display: flex;
  }

  .queue-item__move-btn,
  .queue-item__remove {
    width: 40px;
    height: 40px;
  }
}

/* 마우스 환경에서만 hover 효과 (터치 기기의 "눌린 채 남는" hover 방지) */
@media (hover: hover) and (pointer: fine) {
  .queue-item:hover {
    border-color: #d4d4d4;
  }

  .queue-item__move-btn:not(:disabled):hover,
  .queue-item__remove:hover,
  .queue-item__handle:hover {
    background: #f2f2f2;
  }

  .queue-item__remove:hover {
    color: var(--brand);
  }

  .icon-btn:hover {
    color: var(--brand);
  }

  .btn-primary:hover,
  .btn-play:not(:disabled):hover {
    background: var(--brand-dark);
  }

  .paste-btn:hover {
    border-color: #cfcfcf;
    background: #fafafa;
  }

  .clip-suggest__add:hover {
    background: var(--brand-dark);
  }

  .clip-suggest__close:hover {
    background: rgba(0, 0, 0, 0.06);
  }

  .sheet__link:hover .sheet__name {
    text-decoration: underline;
  }

  .clear-all-btn:hover {
    color: var(--brand);
  }

  .share-btn:hover {
    background: #f2f2f2;
    color: var(--brand);
  }

  .help-link:hover {
    color: var(--brand);
  }

  .install-btn:hover {
    background: #fff5f5;
  }

  .toast__action:hover {
    background: rgba(255, 255, 255, 0.1);
  }
}
