/* 시청자 왼쪽 카테고리 레일(web-rail.js). 스튜디오 .st-rail 패턴: 고정 레일 + 라벨 + 활성 표시. z-index는 모달(--z-modal 300) 아래 */
:root { --v-rail-w: 232px; --v-rail-icon-w: 64px; --v-tab-h: 56px; --v-rail-top: 72px; }
/* 레일 색 토큰: 라이트는 페이지 토큰(--surface·--edge·--ink…)을 그대로 쓰고, 다크는 페이지가 다크 토큰을 안 줘도(지갑: 라이트 별칭만 있음 → 레일이 하얗게) 항상 어두운 값.
   값은 공용 헤더 다크(#121418/#2a2d33/#e8e9ec)·지갑 다크 2차 버튼(#23262d/#343841/#f2f3f5)·DESIGN.md 다크 강조(#a4baff)와 같다 */
:root[data-theme="dark"] { --v-surface: #121418; --v-surface-2: #1d2026; --v-line: #2a2d33; --v-ink: #e8e9ec; --v-ink-soft: #d3d6dc; --v-muted: #a7abb4; --v-accent: #a4baff; --v-accent-face: #1e2740; --v-focus: #a4baff; --v-control-bg: #23262d; --v-control-line: #343841; --v-control-ink: #f2f3f5; }
.v-rail { position: fixed; top: var(--v-rail-top); bottom: 0; left: 0; z-index: 100; display: flex; flex-direction: column; gap: 12px; width: var(--v-rail-w); padding: 16px 12px; overflow-y: auto; border-right: 1px solid var(--v-line, var(--edge)); background: var(--v-surface, var(--surface)); }
.v-card { display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: 2px 10px; align-items: center; padding: 12px; border: 1px solid var(--v-line, var(--edge)); border-radius: 12px; color: inherit; text-decoration: none; }
.v-card-me:hover, .v-card-me.is-active { background: var(--v-surface-2, var(--surface-2)); }
.v-avatar { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--v-accent-face, var(--blue-face, var(--surface-2))); color: var(--v-accent, var(--blue-deep)); font-size: 15px; font-weight: 600; }
.v-card-main { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; min-width: 0; }
.v-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-size: 15px; font-weight: 600; letter-spacing: -0.025em; }
.v-grade, .v-badge { display: inline-flex; align-items: center; min-height: 20px; padding: 0 8px; border-radius: 999px; background: var(--v-surface-2, var(--surface-2)); color: var(--v-ink-soft, var(--ink-soft)); font-size: 12px; font-weight: 500; }
.v-card-sub { grid-column: 2; color: var(--v-muted, var(--muted)); font-size: 12px; }
.v-card-login { display: block; }
.v-card-text { margin: 0 0 8px; color: var(--v-ink-soft, var(--ink-soft)); font-size: 13px; line-height: 1.4; }
.v-login { display: inline-flex; align-items: center; justify-content: center; width: 100%; min-height: 36px; border-radius: 8px; background: #0056fa; color: #ffffff; font-size: 14px; font-weight: 600; text-decoration: none; }
.v-rail-list { display: grid; gap: 2px; margin: 0; padding: 0; list-style: none; }
.v-rail-item { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 10px; border-radius: 8px; color: var(--v-ink-soft, var(--ink-soft)); font-size: 14px; font-weight: 500; text-decoration: none; }
.v-rail-item:hover { background: var(--v-surface-2, var(--surface-2)); color: var(--v-ink, var(--ink)); }
.v-rail-item:focus-visible { outline: 3px solid var(--v-focus, var(--focus, #0056fa)); outline-offset: 2px; }
.v-rail-item.is-active { background: var(--v-surface-2, var(--surface-2)); color: var(--v-accent, var(--blue-deep)); font-weight: 600; }
.v-rail-item.is-active::before { display: none; }
.v-ico { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; }
.v-ico svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.v-label { flex: 1; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.v-badge { margin-left: auto; }
/* 잠긴 항목(지갑, 캐시 스위치 off): 무디 글자 + 자물쇠 16 + '준비 중', 누를 수 없음(hover 없음). 아이콘 레일에선 아이콘만 흐리게 */
.v-rail-item.is-locked { color: var(--v-ink-soft, var(--ink-soft)); cursor: default; } /* 라이트 --muted(#6d78a5)는 종이 면에서 4.5:1 미만 → ink-soft */
.v-rail-item.is-locked:hover { background: none; color: var(--v-ink-soft, var(--ink-soft)); }
.v-rail-item.is-locked.is-active { background: none; color: var(--v-ink-soft, var(--ink-soft)); font-weight: 500; }
.v-rail-item.is-locked.is-active::before { display: none; }
.v-rail-item .v-lock { flex: none; width: 16px; height: 16px; margin-left: auto; }
.v-rail-item .v-lock svg { width: 16px; height: 16px; }
.v-soon { flex: none; font-size: 12px; font-weight: 500; }
@media (max-width: 1099px) { .v-rail .v-lock, .v-rail .v-soon { display: none; } .v-rail-item.is-locked .v-ico { opacity: .5; } }
body.channel-body .v-rail .v-lock, body.channel-body .v-rail .v-soon { display: none; }
body.channel-body .v-rail-item.is-locked .v-ico { opacity: .5; }
.v-tabbar { display: none; }
body.has-rail { padding-left: var(--v-rail-w); }
body.has-rail .top-nav, body.has-rail .site-nav { display: none; } /* 레일이 덮는 상단 링크 중복 제거 */
@media (min-width: 1100px) and (max-width: 1439px) { body.has-rail .live-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
/* 아이콘 레일: 768~1099px, 그리고 채널 페이지는 모든 데스크톱 폭(플레이어+패널 너비 유지) */
@media (max-width: 1099px) { body.has-rail { padding-left: var(--v-rail-icon-w); } .v-rail { width: var(--v-rail-icon-w); padding: 12px 8px; } }
@media (min-width: 768px) {
  body.channel-body.has-rail { padding-left: var(--v-rail-icon-w); }
  body.channel-body .v-rail { width: var(--v-rail-icon-w); padding: 12px 8px; }
}
@media (max-width: 1099px) { .v-rail .v-label, .v-rail .v-badge, .v-rail .v-card-main, .v-rail .v-card-sub, .v-rail .v-card-text { display: none; } .v-rail .v-card { grid-template-columns: 1fr; justify-items: center; padding: 6px; border: 0; } .v-rail .v-login { width: auto; min-height: 32px; padding: 0 8px; font-size: 12px; } .v-rail-item { justify-content: center; padding: 0; } .v-rail-item.is-active::before { left: -8px; } }
body.channel-body .v-rail .v-label, body.channel-body .v-rail .v-badge, body.channel-body .v-rail .v-card-main, body.channel-body .v-rail .v-card-sub, body.channel-body .v-rail .v-card-text { display: none; }
body.channel-body .v-rail .v-card { grid-template-columns: 1fr; justify-items: center; padding: 6px; border: 0; }
body.channel-body .v-rail .v-login { width: auto; min-height: 32px; padding: 0 8px; font-size: 12px; }
body.channel-body .v-rail-item { justify-content: center; padding: 0; }
body.channel-body .v-rail-item.is-active::before { left: -8px; }
/* 767px 이하: 레일 없음, 하단 탭 바(홈·라이브·찾기·내 페이지) */
@media (max-width: 767px) {
  body.has-rail { padding-left: 0; padding-bottom: calc(var(--v-tab-h) + env(safe-area-inset-bottom, 0px)); }
  .v-rail { display: none; }
  .v-tabbar { position: fixed; right: 0; bottom: 0; left: 0; z-index: 100; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); height: calc(var(--v-tab-h) + env(safe-area-inset-bottom, 0px)); padding-bottom: env(safe-area-inset-bottom, 0px); border-top: 1px solid var(--v-line, var(--edge)); background: var(--v-surface, var(--surface)); }
  .v-tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--v-muted, var(--muted)); font-size: 12px; font-weight: 500; text-decoration: none; }
  .v-tab.is-active { color: var(--v-accent, var(--blue-deep)); font-weight: 600; }
  .v-tab:focus-visible { outline: 3px solid var(--v-focus, var(--focus, #0056fa)); outline-offset: -3px; }
}
/* 레일(프로필 카드)이 있는 폭에선 홈 히어로의 시청자 카드는 중복이라 숨김(390 탭 바 환경에선 유지) */

/* 헤더 좌상단 계정 칩(레일 폭 안, 헤더 높이 중앙) — 레일 상단 프로필 카드 대체 */
.v-header-me { position: fixed; top: 0; left: 0; z-index: 101; display: inline-flex; align-items: center; gap: 8px; height: var(--v-rail-top); max-width: var(--v-rail-w); padding: 0 12px; color: var(--v-ink, var(--ink)); font-size: 14px; font-weight: 600; text-decoration: none; }
.v-header-me .v-avatar { width: 32px; height: 32px; font-size: 14px; }
.v-header-me .v-name { max-width: 150px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.v-header-me.is-active .v-name { color: var(--v-accent, var(--blue-deep)); }
.v-header-me .hu-menu { top: calc(50% + 26px); right: auto; left: 12px; } /* 칩 메뉴는 아바타 아래 왼쪽 정렬 */
@media (max-width: 1099px) { .v-header-me .v-name { display: none; } .v-header-me .hu-menu { left: 8px; } }
@media (max-width: 767px) { .v-header-me { display: none; } }

/* 공용 헤더(모든 시청자 페이지): 64px sticky, 로고·토글·계정 메뉴를 같은 좌표에 — 콘텐츠 그리드(최대 1320px, 20px 안쪽)에 맞춤 */
body.has-rail header.v-header { position: sticky; top: 0; z-index: 30; height: 64px; min-height: 64px; max-height: 64px; box-sizing: border-box; padding: 0; overflow: visible; }
body.has-rail header.v-header .v-brand { position: absolute; top: 50%; left: var(--v-hdr-left, max(24px, calc((100% - 1320px) / 2 + 20px))); display: inline-flex; align-items: center; gap: 8px; height: 44px; margin: 0; padding: 0; transform: translateY(-50%); color: var(--v-ink, var(--ink)); font-size: 19px; font-weight: 700; letter-spacing: -0.02em; text-decoration: none; }
body.has-rail header.v-header .v-brand img { display: block; width: auto; height: 26px; }
body.has-rail header.v-header .v-actions { position: absolute; top: 50%; right: var(--v-hdr-right, max(24px, calc((100% - 1320px) / 2 + 20px))); display: inline-flex; align-items: center; gap: 8px; transform: translateY(-50%); }
body.has-rail header.v-header .v-actions .theme-toggle, body.has-rail header.v-header .v-actions .v-theme { display: inline-grid; place-items: center; width: 44px; height: 44px; border: 0; border-radius: 8px; background: none; color: var(--v-ink, var(--ink)); cursor: pointer; }
body.has-rail header.v-header .v-actions .theme-toggle:hover { background: var(--v-surface-2, var(--surface-2)); }
body.has-rail header.v-header .v-actions #account-button[hidden] { display: none; }
@media (max-width: 767px) { body.has-rail header.v-header .v-brand { left: 16px; } body.has-rail header.v-header .v-actions { right: 12px; } }

/* 아이콘 레일(채널 페이지·768~1099px): 계정 칩은 64px 열 안에 아바타만 중앙(이름은 title) */
body.channel-body .v-header-me { width: var(--v-rail-icon-w); max-width: var(--v-rail-icon-w); justify-content: center; padding: 0; }
body.channel-body .v-header-me .v-name { display: none; }
body.channel-body .v-header-me .hu-menu { left: 8px; }
@media (max-width: 1099px) { .v-header-me { width: var(--v-rail-icon-w); max-width: var(--v-rail-icon-w); justify-content: center; padding: 0; } }
/* 로그아웃 칩 = 작은 로그인 버튼(2차 버튼 모양·모서리 8, 알약 아님). 아이콘 레일에선 64px 열 안 작은 버튼 */
.v-header-login .v-name { display: inline-flex; align-items: center; min-height: 36px; padding: 0 14px; border: 1px solid var(--v-control-line, var(--edge)); border-radius: 8px; background: var(--v-control-bg, var(--surface)); color: var(--v-control-ink, var(--ink)); font-size: 14px; }
.v-header-login:hover .v-name { background: var(--v-surface-2, var(--surface-2)); }
.v-header-login:focus-visible { outline: 3px solid var(--v-focus, var(--focus, #0056fa)); outline-offset: -3px; }
body.channel-body .v-header-login .v-name { display: inline-flex; min-height: 32px; padding: 0 8px; font-size: 12px; }
@media (max-width: 1099px) { .v-header-login .v-name { display: inline-flex; min-height: 32px; padding: 0 8px; font-size: 12px; } }

/* 공용 계정 블록(헤더 오른쪽, 모든 시청자 페이지 동일 — web-rail.js unifyHeader): 로그아웃 = 로그인 버튼 하나(모서리 8, 알약 아님), 로그인 = 아바타·이름 → 내 페이지·지갑·로그아웃 */
body.has-rail header.v-header .v-actions .header-account { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; margin: 0; padding: 0 16px; border: 1px solid var(--v-control-line, var(--edge)); border-radius: 8px; background: var(--v-control-bg, var(--surface)); color: var(--v-control-ink, var(--ink)); font-size: 14px; font-weight: 600; line-height: 1.2; text-decoration: none; cursor: pointer; }
body.has-rail header.v-header .v-actions .header-account:hover { background: var(--v-surface-2, var(--surface-2)); }
body.has-rail header.v-header .v-actions .header-account:focus-visible { outline: 3px solid var(--v-focus, var(--focus, #0056fa)); outline-offset: 2px; }
/* 계정 메뉴 공통(.v-account: 좌상단 칩 details.v-header-me, 모바일 오른쪽 details.header-user): summary = 아바타(+이름), 펼침 = 내 페이지·지갑·로그아웃 */
.header-user { position: relative; }
.v-account > summary { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 10px 0 4px; border-radius: 8px; color: var(--v-ink, var(--ink)); list-style: none; cursor: pointer; }
.v-account > summary::-webkit-details-marker { display: none; }
.v-account > summary:hover, .v-account[open] > summary { background: var(--v-surface-2, var(--surface-2)); }
.v-account > summary:focus-visible { outline: 3px solid var(--v-focus, var(--focus, #0056fa)); outline-offset: 2px; }
.hu-avatar { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--v-accent-face, var(--blue-face, var(--surface-2))); color: var(--v-accent, var(--blue-deep)); font-size: 14px; font-weight: 600; }
.hu-menu { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; display: grid; min-width: 160px; padding: 6px; border: 1px solid var(--v-line, var(--edge)); border-radius: 12px; background: var(--v-surface, var(--surface)); box-shadow: 0 6px 20px rgba(0, 0, 0, 0.06); }
body.has-rail .v-account .hu-menu > a, body.has-rail .v-account .hu-menu > button { display: flex; align-items: center; min-height: 40px; padding: 0 12px; border: 0; border-radius: 8px; background: none; color: var(--v-ink, var(--ink)); font: inherit; font-size: 14px; font-weight: 500; text-align: left; text-decoration: none; cursor: pointer; }
body.has-rail .v-account .hu-menu > a:hover, body.has-rail .v-account .hu-menu > button:hover { background: var(--v-surface-2, var(--surface-2)); }
/* 계정 메뉴의 잠긴 지갑: 무디 글자 + 자물쇠 + '준비 중', 누를 수 없음 */
body.has-rail .v-account .hu-menu > .is-locked { display: flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; color: var(--v-ink-soft, var(--ink-soft)); font-size: 14px; font-weight: 500; cursor: default; }
body.has-rail .v-account .hu-menu > .is-locked .v-lock { width: 16px; height: 16px; margin-left: auto; }
body.has-rail .v-account .hu-menu > .is-locked .v-lock svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.hu-soon { font-size: 12px; }
/* 모바일 전용 오른쪽 계정(.v-mobile-account): 레일·칩이 있는 768px 이상에선 숨김 */
@media (min-width: 768px) { body.has-rail header.v-header .v-actions .v-mobile-account { display: none; } }
@media (max-width: 767px) { .header-user > summary { padding: 0 4px; } }
/* 다크: 헤더·계정 버튼(로그인)은 레일 토큰으로 — 페이지 토큰과 무관하게 레일과 같은 면 */
/* 헤더 안 페이지 고유 링크(채널 페이지 '채널 탐색')도 계정 버튼과 같은 2차 버튼 모양(모서리 8·높이 44), 다크에선 어두운 면 */
body.has-rail header.v-header .v-actions .header-download { min-height: 44px; padding: 0 16px; border: 1px solid var(--v-control-line, var(--edge)); border-radius: 8px; background: var(--v-control-bg, var(--surface)); color: var(--v-control-ink, var(--ink)); font-size: 14px; font-weight: 600; }
:root[data-theme="dark"] body.has-rail header.v-header .v-actions .header-account, :root[data-theme="dark"] body.has-rail header.v-header .v-actions #account-button, :root[data-theme="dark"] body.has-rail header.v-header .v-actions .header-download { background: var(--v-control-bg); border-color: var(--v-control-line); color: var(--v-control-ink); }
:root[data-theme="dark"] body.has-rail details.v-account.v-header-me .hu-menu > a, :root[data-theme="dark"] body.has-rail details.v-account.v-header-me .hu-menu > button, :root[data-theme="dark"] body.has-rail header.v-header .v-actions .hu-menu > a, :root[data-theme="dark"] body.has-rail header.v-header .v-actions .hu-menu > button, :root[data-theme="dark"] body.has-rail .v-account > summary { color: var(--v-ink); } /* 지갑 다크의 a 전체 파랑 규칙보다 우선 */
:root[data-theme="dark"] .hu-menu { box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4); }
:root[data-theme="dark"] body.has-rail header.v-header { background: var(--v-surface); border-bottom: 1px solid var(--v-line); color: var(--v-ink); }
:root[data-theme="dark"] body.has-rail header.v-header .v-brand, :root[data-theme="dark"] body.has-rail header.v-header .theme-toggle { color: var(--v-control-ink); }
