/* jhlim TV — 다크 모드 기본, 모바일 우선 */
:root {
  --bg: #0e1016;
  --surface: #171a23;
  --surface2: #222636;
  --line: #2c3144;
  --text: #eef0f6;
  --muted: #9aa1b5;
  --accent: #ff5a5f;
  --star: #ffc94d;
  --radius: 14px;
  --mini-bar: 28px;

  /* ── 크기 변수: 글자 크기 설정(html[data-size])이 아래 값만 바꾼다 ──
     기본값 = 휴대폰 '보통' (v1.1 과 같은 크기). PC 값은 아래 @media (min-width: 900px) 에서 덮어씀 */
  --font-base: 16px;  /* 기준 글자 크기 (html 의 font-size, 다른 글자는 rem 으로 비례) */
  --btn-h: 44px;      /* 버튼·입력칸 높이 (휴대폰은 최소 터치 영역 44px) */
  --tab-h: 44px;      /* 장르 탭 높이 */
  --space: 8px;       /* 기본 여백·간격 */
  --card-h: 64px;     /* 채널 카드 높이 */
  --star-w: 56px;     /* 즐겨찾기 별 칸 너비 */
}

/* 휴대폰(좁은 화면)의 글자 크기 단계. '작게' 에서도 버튼 높이는 터치 최소 44px 유지 */
@media (max-width: 899px) {
  html[data-size="small"] { --font-base: 14px; --card-h: 56px; --star-w: 50px; }
  html[data-size="large"] { --font-base: 18px; --btn-h: 50px; --tab-h: 50px; --card-h: 74px; --star-w: 60px; }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html { font-size: var(--font-base); }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
body { font-size: 1rem; }

button, select, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }

.layout { display: flex; flex-direction: column; min-height: 100vh; }

/* ───── 플레이어 ───── */
.watch { background: var(--bg); }

.player-wrap {
  position: sticky;
  top: 0;
  z-index: 20;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  overflow: hidden;
}
.player-host, .player-host iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.player-message {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 16px;
  text-align: center;
  color: var(--muted);
  background: radial-gradient(circle at 50% 40%, #1b1f2c, #000 75%);
}
.player-message p { margin: 0; }
.player-message .big { font-size: 40px; }
.player-message.offline { z-index: 5; color: var(--text); background: #05060a; }
.player-message .row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

.btn {
  min-height: var(--btn-h);
  padding: 0 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-weight: 600;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.small { min-height: 36px; padding: 0 14px; font-size: 0.875rem; }

/* 소리 켜기 버튼: 플레이어 전체를 덮지 않고 가운데 아래쪽에만 (유튜브 조작 방해 금지) */
.unmute-btn {
  position: absolute;
  z-index: 6;
  left: 50%;
  bottom: 18%;
  transform: translateX(-50%);
  min-height: 56px;
  padding: 0 26px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: #fff;
  font-size: 19px;
  font-weight: 800;
  white-space: nowrap;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse { 50% { transform: translateX(-50%) scale(1.05); } }

/* 채널 전환 시 번호·이름 표시 */
.osd {
  position: absolute;
  z-index: 7;
  top: 12px;
  left: 12px;
  padding: 8px 14px;
  border-radius: 10px;
  background: rgba(0, 0, 0, .7);
  font-size: 22px;
  font-weight: 800;
  pointer-events: none;
}
.osd .n { color: var(--accent); margin-right: 8px; }

/* 숫자 키로 번호 입력 중 */
.digits {
  position: absolute;
  z-index: 8;
  top: 12px;
  right: 16px;
  font-size: 64px;
  font-weight: 900;
  color: #7dff9b;
  text-shadow: 0 2px 10px #000;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.under-player {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 0;
  min-height: 36px;
}
.small-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.875rem;
  text-decoration: none;
}
.small-link[aria-disabled="true"] { opacity: .45; pointer-events: none; }
.sleep-left { color: var(--star); font-size: 0.875rem; font-variant-numeric: tabular-nums; }

/* ───── 현재 채널 정보 바 ───── */
.info-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 8px 12px 0;
  padding: 10px 14px;
  min-height: 60px;
  border-radius: var(--radius);
  background: var(--surface);
  touch-action: pan-y; /* 세로 스크롤은 허용, 가로 밀기는 우리가 처리 */
  user-select: none;
}
.info-num { font-size: 1.625rem; font-weight: 900; color: var(--accent); min-width: 2ch; text-align: center; }
.info-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.info-name { font-size: 1.125rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.info-genres { font-size: 0.8125rem; color: var(--muted); }
.swipe-hint { font-size: 0.75rem; color: var(--muted); white-space: nowrap; }

/* ───── 컨트롤 바 ───── */
.controls { padding: 8px 12px 4px; display: flex; flex-direction: column; gap: 8px; }
.ctrl-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.main-row .ctrl { flex: 1; min-height: 52px; font-size: 1.125rem; }
.ctrl {
  min-height: var(--btn-h);
  min-width: var(--btn-h);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface2);
  font-weight: 700;
}
.ctrl:active, .btn:active { transform: scale(.97); }
.ctrl.small { font-size: 0.9375rem; }
.ctrl.mute { flex: 0 0 72px; font-size: 1.5rem; }
.ctrl.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.volume { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 240px; }
.volume input[type="range"] { flex: 1; height: var(--btn-h); accent-color: var(--accent); }
.vol-num { width: 3ch; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.ios-hint { margin: 0; color: var(--muted); font-size: 0.875rem; }

.sleep {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--btn-h);
  padding: 0 4px 0 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface2);
  font-size: 0.9375rem;
  font-weight: 700;
}
.sleep select {
  min-height: 40px;
  border: 0;
  background: transparent;
  font-weight: 700;
}
.sleep select option { background: var(--surface2); }

/* ───── 검색·탭·목록 ───── */
.browse { padding: 4px 12px 24px; }
.search-box { padding: 6px 0 8px; }
.search-box input {
  width: 100%;
  min-height: var(--btn-h);
  padding: 0 16px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  outline: none;
}
.search-box input:focus { border-color: var(--accent); }

.tabs {
  display: flex;
  gap: var(--space);
  overflow-x: auto;
  scrollbar-width: none;      /* 스크롤바 숨김 (Firefox) */
  padding: 2px 0 10px;
  scroll-behavior: smooth;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: 0 0 auto;
  min-height: var(--tab-h);
  padding: 0 calc(var(--space) * 2.25);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
.tab[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }

.list-tools { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 0.8125rem; padding-bottom: 8px; }

.channel-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space); }
.card {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  overflow: hidden;
}
.card.active { border-color: var(--accent); box-shadow: inset 4px 0 0 var(--accent); }
.card-main {
  flex: 1;
  display: flex;
  align-items: center;
  gap: calc(var(--space) * 1.5);
  min-height: var(--card-h);
  padding: var(--space) calc(var(--space) * 1.5);
  border: 0;
  background: none;
  text-align: left;
  min-width: 0;
}
.card-num { font-size: 1.125rem; font-weight: 900; color: var(--accent); min-width: 2.2ch; text-align: center; }
.card-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.card-name { font-size: 1.0625rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-genres { font-size: 0.8125rem; color: var(--muted); }
.card-note { font-size: 0.75rem; color: #c9a95c; }
.badge {
  margin-left: auto;
  flex: 0 0 auto;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  background: var(--surface2);
  color: var(--muted);
}
.badge.link { color: #8fd0ff; }
.badge.live { color: #fff; background: #c4302b; }
.badge.paid { color: #ffd36b; background: #4a3a10; }
.card.disabled .card-main { opacity: .55; }
.star {
  flex: 0 0 var(--star-w);
  border: 0;
  border-left: 1px solid var(--line);
  background: none;
  font-size: 1.5rem;
  color: var(--muted);
}
.star[aria-pressed="true"] { color: var(--star); }
.move { display: flex; flex-direction: column; border-left: 1px solid var(--line); }
.move button { flex: 1; min-width: 48px; min-height: 32px; border: 0; background: var(--surface2); font-size: 0.875rem; }
.move button + button { border-top: 1px solid var(--line); }
.move button:disabled { opacity: .3; cursor: default; }

.empty { color: var(--muted); text-align: center; padding: 24px 0; }
.footer-note { color: #5f6679; font-size: 0.75rem; text-align: center; margin-top: 24px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(20px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 100;
  max-width: 90vw;
  padding: 12px 18px;
  border-radius: 12px;
  background: rgba(30, 34, 48, .96);
  border: 1px solid var(--line);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .5);
  font-size: 0.9375rem;
}

.mini-bar { display: none; }

/* ───── 음성 명령 ───── */
.ctrl.mic.listening { background: var(--accent); border-color: var(--accent); color: #fff; animation: pulse-bg 1s ease-in-out infinite; }
@keyframes pulse-bg { 50% { opacity: .7; } }
.cmd-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.cmd-row input {
  flex: 1;
  min-width: 0;
  min-height: var(--btn-h);
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  outline: none;
}
.cmd-row input:focus { border-color: var(--accent); }
.cmd-hint { flex-basis: 100%; margin: 0; font-size: 0.8125rem; color: var(--muted); }
.cmd-hint:empty { display: none; }

/* ───── 설정: 글자 크기 ───── */
.lbl-short { display: none; }
.small-link.gear { border: 0; cursor: pointer; justify-content: center; min-width: 44px; padding: 0 12px; font-size: 1.0625rem; }
.small-link.gear.on { background: var(--accent); color: #fff; }
.settings-row { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space); }
.settings-label { font-size: .9375rem; color: var(--muted); }
.settings-panel {
  display: flex;
  flex-direction: column;
  gap: var(--space);
  padding: var(--space) calc(var(--space) * 1.5);
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  max-height: 46vh;
  overflow-y: auto;
}
.chk { display: inline-flex; align-items: center; gap: 8px; min-height: var(--btn-h); font-size: .9375rem; }
.chk input { width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }
.svc-list { display: inline-flex; flex-wrap: wrap; gap: 4px calc(var(--space) * 1.5); }
.svc-list .chk { color: var(--muted); }
.svc-list input:disabled + span { opacity: .5; }
.mini-btn {
  min-height: var(--btn-h);
  padding: 0 calc(var(--space) * 1.8);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface2);
  font-size: .9375rem;
  font-weight: 700;
}
.mini-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.backup-box { display: flex; flex-direction: column; gap: var(--space); }
.backup-box textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  font: .8125rem/1.4 ui-monospace, Consolas, monospace;
  resize: vertical;
}
.backup-msg { margin: 0; font-size: .875rem; color: var(--muted); }
.backup-msg.ok { color: #7dff9b; }
.backup-msg.err { color: #ff8a8a; }

/* 종목 칩 (스포츠·취미): 장르 탭과 같은 방식 (휴대폰: 한 줄 좌우 스크롤, PC: 줄바꿈) */
.subtabs { padding-top: 0; }
.tab.sub { background: transparent; border-style: dashed; color: var(--text); }
.tab.sub[aria-selected="true"] { background: var(--accent); border-color: var(--accent); border-style: solid; color: #fff; }
.card-sub { font-size: .75rem; color: #e6c46a; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.seg-btn {
  min-height: var(--btn-h);
  padding: 0 calc(var(--space) * 2.25);
  border: 0;
  background: var(--surface2);
  font-size: .9375rem;
  font-weight: 700;
}
.seg-btn + .seg-btn { border-left: 1px solid var(--line); }
.seg-btn[aria-pressed="true"] { background: var(--accent); color: #fff; }
.settings-hint { font-size: .75rem; color: var(--muted); }

/* ───── v1.4: 차단 안내 · 공식 사이트 버튼 · 장르 표시 설정 ───── */
button.small-link { border: 0; cursor: pointer; font-family: inherit; }
.btn.big-btn { min-height: calc(var(--btn-h) + 10px); padding: 0 calc(var(--space) * 3.5); font-size: 1.125rem; font-weight: 800; }
.badge.blocked { color: #fff; background: #6b3a8a; }
.tab.temp { border-style: dashed; color: var(--text); }   /* 음성으로 잠시 연, 꺼 둔 장르 */

/* 카드 오른쪽 버튼 묶음: [공식 사이트] · ★ (휴대폰은 가로로 나란히) */
.card-side { display: flex; align-items: stretch; }
.card-site {
  flex: 0 0 var(--star-w);
  border: 0;
  border-left: 1px solid var(--line);
  background: none;
  font-size: 1.25rem;
  color: var(--muted);
}

.genre-settings { border: 1px solid var(--line); border-radius: 10px; padding: 0 var(--space); }
.genre-settings summary { min-height: var(--btn-h); display: flex; align-items: center; cursor: pointer; font-weight: 700; font-size: .9375rem; }
.genre-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 4px var(--space); margin: var(--space) 0; }
.genre-row { display: flex; align-items: center; gap: 4px; }
.genre-row .chk { flex: 1; min-width: 0; }
.mini-btn.move-btn { min-width: var(--btn-h); padding: 0; }
.mini-btn:disabled { opacity: .35; cursor: default; }
.version { margin: 0; text-align: right; font-size: .75rem; color: var(--muted); }

/* ───── 플레이어 자리(.stage)·조작 영역(.dock): 휴대폰·미니 창에서는 투명 (기존 모양 그대로) ───── */
.stage, .dock { display: contents; }

/* ───── PC 넓은 화면: 한 화면 맞춤 — 왼쪽(플레이어+조작) / 오른쪽(탭·검색 고정 + 채널 격자) ───── */
@media (min-width: 900px) {
  /* PC 크기 단계 (기본 = 작게: 촘촘). 글자 크기 설정이 이 변수들만 바꿈 */
  :root { --font-base: 16px; --btn-h: 38px; --tab-h: 34px; --space: 8px;  --card-h: 56px; --star-w: 36px; }
  html[data-size="small"] { --font-base: 14px; --btn-h: 32px; --tab-h: 28px; --space: 6px;  --card-h: 46px; --star-w: 30px; }
  html[data-size="large"] { --font-base: 18px; --btn-h: 44px; --tab-h: 40px; --space: 10px; --card-h: 66px; --star-w: 44px; }

  /* 페이지 전체는 스크롤하지 않음: 앱 높이 = 창 높이 */
  html, body { height: 100%; overflow: hidden; }
  .layout { flex-direction: row; height: 100vh; height: 100dvh; min-height: 0; overflow: hidden; }

  /* 왼쪽: 세로 flex. 플레이어(.stage)가 남는 높이를 모두 쓰고, 아래 조작 영역(.dock)은 필요한 만큼만 */
  .watch {
    flex: 1;
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: var(--space);
    padding: var(--space) 0 var(--space) var(--space);
    overflow: hidden;
  }
  .stage {
    display: flex;
    flex: 1 1 0;
    min-height: 120px;
    align-items: center;
    justify-content: center;
    container-type: size;          /* 아래 cqw/cqh 로 남은 공간 안에 16:9 를 맞춤 */
    background: #000;              /* 남는 공간은 검은 여백으로 가운데 정렬 */
    border-radius: var(--radius);
    overflow: hidden;
  }
  .player-wrap {
    position: relative;
    flex: none;
    width: min(100cqw, calc(100cqh * 16 / 9));   /* 폭과 높이 중 작은 쪽에 맞춤 */
    aspect-ratio: 16 / 9;
    border-radius: 0;
  }
  /* 공식 사이트(내장 브라우저)는 비율 없이 자리 전체를 사용 */
  body.official .player-wrap { width: 100cqw; height: 100cqh; aspect-ratio: auto; }

  /* 조작 영역: 채널 정보 + 컨트롤을 한 줄로 (좁으면 자동으로 다음 줄) */
  .dock {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: calc(var(--space) * .75) var(--space);
    padding-right: var(--space);
  }
  .controls, .under-player { display: contents; }   /* 안쪽 요소들이 .dock 의 한 칸씩이 됨 */
  .ctrl-row { flex-wrap: nowrap; gap: calc(var(--space) * .5); }

  .info-bar {
    order: 1;
    flex: 1 1 100px;            /* 기준 폭을 작게: 줄바꿈 전에 먼저 줄어들고, 남는 폭은 이 칸이 차지 */
    min-width: 100px;
    margin: 0;
    padding: 0 var(--space);
    min-height: var(--btn-h);
    gap: var(--space);
    border-radius: 10px;
  }
  .info-num { font-size: 1.25rem; }
  .info-main { flex-direction: row; align-items: baseline; gap: var(--space); overflow: hidden; }
  .info-name { font-size: 1rem; flex: 0 1 auto; }
  .info-genres { font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .swipe-hint { display: none; }

  .main-row { order: 2; }
  .vol-row { order: 3; flex: 0 1 190px; min-width: 130px; }
  .tools-row { order: 4; }
  .small-link { order: 5; }   /* 유튜브에서 열기 · ⚙ */
  .sleep-left { order: 5; }
  .settings-panel { order: 6; flex-basis: 100%; }
  .cmd-row { order: 7; flex-basis: 100%; flex-wrap: nowrap; }

  .ctrl { padding: 0 calc(var(--space) * 1.25); border-radius: 8px; }
  .ctrl.small { font-size: .9375rem; }
  .main-row .ctrl, .main-row .ctrl.mute { flex: none; min-height: var(--btn-h); font-size: 1rem; }
  .ctrl.mute { font-size: 1.125rem; }
  .volume { min-width: 0; gap: calc(var(--space) * .5); }
  .volume input[type="range"] { min-width: 0; }
  .vol-num { width: 2.6ch; }
  .sleep { padding: 0 2px 0 calc(var(--space) * 1.2); gap: 4px; border-radius: 8px; font-size: .9375rem; }
  .sleep select { min-height: calc(var(--btn-h) - 4px); font-size: .875rem; }
  .small-link { min-height: var(--btn-h); padding: 0 calc(var(--space) * 1.5); font-size: .8125rem; }
  .small-link.gear { min-width: var(--btn-h); padding: 0; font-size: 1rem; }
  .sleep-left { font-size: .8125rem; }
  .seg { border-radius: 8px; }
  .cmd-row input { border-radius: 8px; font-size: .9375rem; }
  .cmd-hint { flex: 0 1 auto; flex-basis: auto; max-width: 48%; font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

  /* 글자 라벨은 숨기고 아이콘만 (마우스를 올리면 title 툴팁). 듣는 중에는 글자도 보임 */
  .ctrl .lbl, .sleep .lbl { display: none; }
  .ctrl.listening .lbl { display: inline; }
  .lbl-full { display: none; }
  .lbl-short { display: inline; }

  /* 오른쪽: 탭·검색은 위에 고정, 채널 목록만 스크롤 */
  .browse {
    flex: 0 0 clamp(360px, 32vw, 640px);
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: var(--space) calc(var(--space) * 1.5) 0;
  }
  .search-box { padding: 0 0 var(--space); }
  .search-box input { padding: 0 12px; border-radius: 10px; font-size: .9375rem; }
  .browse .tabs { flex-wrap: wrap; overflow: visible; gap: calc(var(--space) * .7); padding: 0 0 var(--space); }   /* 칩 형태로 여러 줄 */
  .tab { padding: 0 calc(var(--space) * 1.6); font-size: .875rem; }
  .browse .subtabs { flex-wrap: wrap; overflow: visible; }
  .tab.sub { min-height: calc(var(--tab-h) * .86); font-size: .8125rem; }
  html[data-size="small"] .card-sub { display: none; }       /* 촘촘 모드에서는 툴팁으로만 */
  .list-tools { padding-bottom: var(--space); }
  .list-scroll { flex: 1; min-height: 0; overflow-y: auto; padding-bottom: var(--space); }

  /* 채널 카드: 여러 열 격자 (칸 폭은 글자 크기에 비례) */
  .channel-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(calc(var(--font-base) * 10.5), 1fr));
    gap: calc(var(--space) * .75);
  }
  .card { border-radius: 10px; }
  .card-main { gap: calc(var(--space) * .9); padding: 4px calc(var(--space) * 1.1); }
  .card-num { font-size: 1rem; min-width: 1.6ch; }
  .card-name { font-size: .9375rem; }
  .card-genres, .card-note { font-size: .75rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  html[data-size="small"] .card-note { display: none; }      /* 촘촘 모드에서는 메모를 툴팁으로만 */
  .badge { padding: 1px 6px; font-size: .6875rem; }
  .badge.yt, .badge.live { display: none; }                   /* 흔한 표시는 생략 (활성 카드는 테두리로 구분) */
  .badge .b-lbl { display: none; }                            /* '↗ 공식 사이트' → '↗' */
  .star { font-size: 1.125rem; }
  .move button { min-width: 28px; min-height: 0; font-size: .75rem; }
  .footer-note { margin-top: calc(var(--space) * 2); }

  /* 카드 오른쪽 버튼은 세로로 쌓아서 이름 칸을 넓게 */
  .card-side { flex-direction: column; flex: 0 0 var(--star-w); border-left: 1px solid var(--line); }
  .card-side .star, .card-side .card-site { flex: 1 1 0; min-height: 0; width: var(--star-w); border-left: 0; font-size: 1rem; line-height: 1; padding: 0; }
  .card-side .card-site + .star { border-top: 1px solid var(--line); }
  .badge.blocked { font-size: .6875rem; }
  .genre-list { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
}

/* ───── 휴대폰 가로 회전: 플레이어를 화면 가득 ───── */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body { overflow: hidden; }
  .stage { container-type: normal; }   /* container-type 은 fixed 자식을 가두므로 해제 */
  .player-wrap { position: fixed; inset: 0; z-index: 60; aspect-ratio: auto; width: auto; height: 100vh; height: 100dvh; border-radius: 0; }
}
/* 전체 화면 API 를 못 쓰는 기기(아이폰 등)용 대체 전체 화면 */
body.pseudo-fs { overflow: hidden; }
body.pseudo-fs .stage { container-type: normal; }
body.pseudo-fs .player-wrap { position: fixed; inset: 0; z-index: 60; aspect-ratio: auto; width: auto; height: 100vh; height: 100dvh; border-radius: 0; }
.player-wrap:fullscreen { aspect-ratio: auto; border-radius: 0; }

/* ───── PC 미니 창 모드: 플레이어만 ───── */
body.mini { overflow: hidden; }
body.mini .layout { height: 100vh; overflow: hidden; }
body.mini .browse,
body.mini .dock,
body.mini .under-player,
body.mini .info-bar,
body.mini .controls { display: none; }
body.mini .watch { padding: 0; overflow: hidden; flex: 1; }
body.mini .mini-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--mini-bar);
  padding: 0 4px 0 10px;
  background: #000;
  font-size: 12px;
  color: var(--muted);
  -webkit-app-region: drag;   /* 잡고 끌어서 창 이동 */
  user-select: none;
}
body.mini .mini-title { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.mini .mini-restore {
  -webkit-app-region: no-drag;
  height: 22px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface2);
  font-size: 12px;
}
body.mini .player-wrap { position: relative; aspect-ratio: auto; width: 100%; height: calc(100vh - var(--mini-bar)); border-radius: 0; }
body.mini .osd { font-size: 16px; }
body.mini .unmute-btn { min-height: 40px; font-size: 15px; }

/* ───── PC 내장 브라우저 (공식 사이트) ───── */
.web-bar {
  position: absolute;
  z-index: 9;
  top: 0;
  left: 0;
  right: 0;
  height: 40px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 6px;
  background: #1b1e2a;
  border-bottom: 1px solid var(--line);
}
.wb {
  min-width: 34px;
  height: 32px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface2);
  font-size: 15px;
  font-weight: 700;
}
.wb:disabled { opacity: .35; cursor: default; }
.wb.wide { font-size: 13px; }
.wb-title { flex: 1; min-width: 0; padding: 0 6px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wb-zoom { width: 44px; text-align: center; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.web-area {
  position: absolute;
  z-index: 8;
  top: 40px;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  color: #555;
}
body.mini .web-bar .wb-title, body.mini .web-bar .wb-zoom, body.mini .web-bar #wbZoomOut, body.mini .web-bar #wbZoomIn { display: none; }

/* ───── v1.61: 국기·🛍 표시 · 지역 제한 배지 · 내가 추가한 방송 · 웹 화면 안 공식 사이트 ───── */
.card-mark { margin-right: 4px; font-weight: 400; }
.badge.blocked.region { background: #2f5d7c; }
.custom-form { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--space) 0 4px; }
.custom-form select, .custom-form input {
  min-height: var(--btn-h); padding: 0 10px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface2); color: var(--text); font: inherit; font-size: .9375rem;
}
.custom-form input { flex: 1 1 140px; min-width: 0; }
.custom-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: var(--space); }
.custom-row { display: flex; align-items: center; gap: 8px; }
.custom-name { flex: 1; min-width: 0; font-size: .875rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 웹: 화면 안 공식 사이트 — 휴대폰은 16:9 보다 높게 (사이트를 읽을 수 있게), PC 는 플레이어 자리 전체 */
body.site-open .player-wrap { aspect-ratio: auto; height: min(75vh, 680px); }
.site-bar { gap: 6px; }
.site-note { flex: 0 1 auto; min-width: 0; font-size: 12px; color: #ffd27a; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.site-area { background: #fff; }
.site-loading { margin: 0; color: #555; }
.site-frame-host { position: absolute; inset: 0; }
.site-frame { width: 100%; height: 100%; border: 0; background: #fff; display: block; }
.site-fail { background: var(--surface); color: var(--text); z-index: 2; }
@media (max-width: 520px) {
  .site-bar .wb-title { display: none; }      /* 좁은 폰: 이름 대신 "주문·로그인은 새 창" 안내를 보여 줌 */
  .site-note { flex: 1 1 auto; }
}
@media (min-width: 900px) {
  body.site-open .player-wrap { width: 100cqw; height: 100cqh; aspect-ratio: auto; }
}
body.mini.site-open .player-wrap { height: calc(100vh - var(--mini-bar)); }

/* ═════ v1.8 ═════ */
/* ── 멀티뷰: 칸 = 플레이어 자리 + 아래 이름 막대 (플레이어 위에 덮지 않음) ── */
.mv-grid { position: absolute; inset: 0; display: grid; gap: 4px; background: #000; z-index: 3; }
.mv-grid.mv-2.mv-cols { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr; }
.mv-grid.mv-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.mv-grid.mv-2.mv-rows { position: relative; inset: auto; grid-template-columns: 1fr; }
.mv-cell { display: flex; flex-direction: column; min-width: 0; min-height: 0; border: 2px solid transparent; border-radius: 6px; }
.mv-cell.sel { border-color: var(--accent); }
.mv-host { position: relative; flex: 1 1 auto; min-height: 0; background: #000; }
.mv-rows .mv-host { flex: none; aspect-ratio: 16 / 9; }
.mv-bar { flex: none; display: flex; align-items: stretch; height: 34px; background: var(--surface); }
.mv-name { flex: 1; min-width: 0; border: 0; background: none; color: var(--text); font: inherit; font-size: .875rem; text-align: left; padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.mv-cell.sel .mv-name { font-weight: 800; }
.mv-bar.need-sound .mv-name { color: #fff; background: var(--accent); }
.mv-del { flex: none; width: 40px; border: 0; border-left: 1px solid var(--line); background: none; color: var(--muted); font-size: 1rem; cursor: pointer; }
.mv-empty { position: absolute; inset: 0; width: 100%; border: 1px dashed var(--line); background: #0b0d12; color: var(--muted); font-size: 1rem; cursor: pointer; }
.mv-msg { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; padding: 8px; text-align: center; font-size: .875rem; color: var(--muted); background: #0b0d12; }
.mv-msg p { margin: 0; }
body.mv #playerHost { display: none; }
body.mv .player-wrap { aspect-ratio: auto; height: auto; min-height: 56.25vw; }
body.mv .mv-grid:not(.mv-rows) { position: absolute; }
body.mv .player-wrap:has(.mv-rows) { min-height: 0; }
.mv-seg { flex: none; }
.mv-seg .seg-btn { min-width: 40px; padding: 0 10px; }

/* ── 지금 추천 · 장 시작 안내 ── */
.reco-row { display: flex; align-items: center; gap: 6px; padding: 6px var(--space); overflow-x: auto; scrollbar-width: none; white-space: nowrap; }
.reco-row::-webkit-scrollbar { display: none; }
.reco-label { flex: none; font-size: .8125rem; font-weight: 700; color: var(--star); }
.reco-chip { flex: none; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface2); color: var(--text); font: inherit; font-size: .875rem; cursor: pointer; }
.reco-chip:hover, .reco-chip:focus-visible { border-color: var(--accent); }
.market-note { display: flex; align-items: stretch; margin: 6px var(--space) 0; border-radius: 10px; overflow: hidden; background: #2a3b23; }
.market-go { flex: 1; min-height: 44px; border: 0; background: none; color: #d9ffc7; font: inherit; font-weight: 700; text-align: left; padding: 0 12px; cursor: pointer; }
.market-x { flex: none; width: 44px; border: 0; background: none; color: #d9ffc7; font-size: 1rem; cursor: pointer; }

/* ── 편성표 설정 ── */
.sched-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.sched-row { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.sched-row select, .sched-row input, #subLang, #preferLang {
  min-height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface2); color: var(--text); font: inherit; font-size: .875rem;
}
.link-box { flex: 1 1 200px; min-width: 0; min-height: 40px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface2); color: var(--text); font: inherit; font-size: .8125rem; }

/* ── 공통 대화상자 ── */
.dialog-back { position: fixed; inset: 0; z-index: 200; display: flex; align-items: center; justify-content: center; padding: 12px; background: rgba(0, 0, 0, .6); }
.dialog-back[hidden] { display: none; }
.dialog { width: min(440px, 100%); max-height: 90vh; display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); }
.dialog-back.wide .dialog, .dialog.wide { width: min(640px, 100%); }
.dialog-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.dialog-head h2 { flex: 1; margin: 0; font-size: 1.0625rem; }
.dialog-x { width: 44px; height: 44px; border: 0; background: none; color: var(--muted); font-size: 1.125rem; cursor: pointer; }
.dialog-body { padding: 12px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.dialog-body p { margin: 0; }
.dialog-buttons { padding: 10px 12px; border-top: 1px solid var(--line); justify-content: flex-end; flex-wrap: wrap; }
.share-fields { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.share-out { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.share-out .row { width: 100%; justify-content: center; }
canvas.qr { width: 240px; height: 240px; image-rendering: pixelated; border-radius: 8px; }
.lang-tabs { display: flex; flex-wrap: wrap; gap: 6px; }
.lang-h { margin: 6px 0 0; font-size: .9375rem; color: var(--star); }
.lang-list { display: flex; flex-wrap: wrap; gap: 6px; }
#ccBtn.on { background: var(--accent); color: #fff; border-color: var(--accent); }
.osd .v { margin-left: 8px; font-size: .8em; color: var(--muted); }

/* ── 안드로이드 작은 창(PIP): 플레이어만 꽉 차게 (덮개 없음) ── */
body.pip-mode .browse, body.pip-mode .dock, body.pip-mode .toast, body.pip-mode #recoRow { display: none !important; }
body.pip-mode .player-wrap { position: fixed; inset: 0; z-index: 60; aspect-ratio: auto; width: auto; height: 100vh; border-radius: 0; }
body.pip-mode .stage { container-type: normal; }
body.pip-mode .unmute-btn, body.pip-mode .osd { display: none; }

/* PC: 멀티뷰는 플레이어 자리 전체 */
@media (min-width: 900px) {
  body.mv .player-wrap { width: 100cqw; height: 100cqh; min-height: 0; aspect-ratio: auto; }
  .reco-row { padding: 4px 0; }
}
/* 휴대폰 가로: 멀티뷰도 화면 가득 */
@media (orientation: landscape) and (max-height: 500px) and (pointer: coarse) {
  body.mv .player-wrap { height: 100vh; height: 100dvh; min-height: 0; }
}

/* ── 되감기 ── */
.ts-row { gap: 6px; flex-wrap: wrap; }
.ts-live { color: var(--text); font-variant-numeric: tabular-nums; }
.ts-live.at-live { color: #fff; background: #c4161c; border-color: #c4161c; }

/* ── 앱 안내 · 새 버전 ── */
.app-note { display: flex; align-items: center; gap: 8px; margin: 6px var(--space); padding: 6px 10px; border-radius: 10px; background: #3b2a14; color: #ffd9a3; }
.app-note span { flex: 1; }
.update-note { background: #1d2f45; }
.update-note .market-go { color: #cfe3ff; }
.version-row { justify-content: flex-end; }
.upd-notes { margin: 0; padding-left: 20px; }
.tv-voice-note { font-size: .8125rem; color: var(--muted); align-self: center; }

/* ── 안드로이드 TV (10피트 화면) ── */
body.tv :focus-visible, body.tv :focus { outline: 4px solid #ffd54d !important; outline-offset: 2px; }
body.tv .card:focus-within { box-shadow: 0 0 0 4px #ffd54d; }
/* 전체 화면: 플레이어만 (목록·컨트롤은 OK 를 누르면 플레이어 옆/아래로 — 플레이어 위에 덮지 않음) */
body.tv.tv-full .browse, body.tv.tv-full .dock { display: none !important; }
body.tv.tv-full .player-wrap { position: fixed; inset: 0; z-index: 60; aspect-ratio: auto; width: auto; height: 100vh; border-radius: 0; }
body.tv.tv-full .stage { container-type: normal; }
body.tv.tv-full.mv .mv-grid { position: absolute; }
body.tv .digits { font-size: 72px; }

/* ── 서버 기능 ── */
.card-now { display: block; font-size: .8125rem; color: #ff8a8e; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-now.off { color: var(--muted); }
.card.offair .card-main { opacity: .62; }
.live-only-row { padding: 0 var(--space); }
.live-only-row:has(> [hidden]) { display: none; }
.live-only[aria-pressed="true"] { background: #c4161c; border-color: #c4161c; color: #fff; }
.recent-list { display: flex; flex-direction: column; gap: 6px; }
.recent-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 48px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface2); color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.recent-title { font-size: .9375rem; }
.recent-date { font-size: .75rem; color: var(--muted); }
.remote-code { margin: 0; text-align: center; font-size: 2.25rem; font-weight: 800; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.alert-list { display: flex; flex-direction: column; gap: 2px; margin: 6px 0; }
#alertFrom, #alertTo { min-height: 40px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface2); color: var(--text); font: inherit; }
