/*!
 * /assets/youtube.css — YouTube 스타일 통합 디자인 시스템
 *
 *  적용 영역:
 *    - body.yt-theme       : 시청자 (view.php) — 다크 베이스
 *    - body.yt-admin       : 관리자 페이지 — 다크 + 빨강 액센트
 *    - body.yt-seller      : 셀러 페이지 — 라이트 베이스 + 빨강 LIVE 톤
 *
 *  토큰 (CSS 변수):
 *    --yt-bg                메인 배경
 *    --yt-surface           카드/표면
 *    --yt-elevated          호버/엘리베이션
 *    --yt-line              구분선
 *    --yt-text              본문 텍스트
 *    --yt-text-soft         보조 텍스트
 *    --yt-muted             약한 텍스트
 *    --yt-red               YouTube 빨강 (LIVE/구독)
 *    --yt-red-deep          진한 빨강 (hover)
 *    --yt-blue              링크/액션
 */

/* ====================== 토큰 ====================== */
:root {
  --yt-radius-card: 12px;
  --yt-radius-btn: 18px;
  --yt-radius-chip: 999px;
  --yt-font: 'Roboto', 'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
  --yt-ease: cubic-bezier(0.4, 0, 0.2, 1);
  --yt-dur: 200ms;
}

/* ====================== 다크 (시청자 + 관리자) ====================== */
body.yt-theme, body.yt-admin {
  --yt-bg: #0f0f0f;
  --yt-surface: #1f1f1f;
  --yt-elevated: #272727;
  --yt-line: #303030;
  --yt-line-strong: #3f3f3f;
  --yt-text: #ffffff;
  --yt-text-soft: #aaaaaa;
  --yt-muted: #717171;
  --yt-red: #ff0000;
  --yt-red-deep: #cc0000;
  --yt-blue: #3ea6ff;
  --yt-green: #2ba640;
  --yt-yellow: #ffd600;

  background: var(--yt-bg);
  color: var(--yt-text);
  font-family: var(--yt-font);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* 라이트 (셀러 페이지) */
body.yt-seller {
  --yt-bg: #f9f9f9;
  --yt-surface: #ffffff;
  --yt-elevated: #f2f2f2;
  --yt-line: #e5e5e5;
  --yt-line-strong: #cccccc;
  --yt-text: #0f0f0f;
  --yt-text-soft: #606060;
  --yt-muted: #909090;
  --yt-red: #cc0000;
  --yt-red-deep: #a00000;
  --yt-blue: #065fd4;
  --yt-green: #1c8c45;
  --yt-yellow: #f5b400;

  background: var(--yt-bg);
  color: var(--yt-text);
  font-family: var(--yt-font);
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.01em;
}

/* ====================== 공통 컴포넌트 ====================== */

/* 헤더 (상단 바) */
.yt-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--yt-bg);
  border-bottom: 1px solid var(--yt-line);
  padding: 0 16px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 14px;
}
.yt-header-logo {
  display: flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  font-size: 20px;
  color: var(--yt-text);
  text-decoration: none;
  letter-spacing: -0.04em;
}
.yt-header-logo .yt-logo-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 22px;
  background: var(--yt-red);
  color: white;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 900;
}
.yt-header-search {
  flex: 1;
  max-width: 640px;
  margin: 0 16px;
  display: flex;
  align-items: center;
  background: var(--yt-surface);
  border: 1px solid var(--yt-line-strong);
  border-radius: var(--yt-radius-chip);
  height: 40px;
  padding: 0 16px;
  transition: border-color var(--yt-dur);
}
.yt-header-search:focus-within { border-color: var(--yt-blue); }
.yt-header-search input {
  flex: 1;
  background: transparent;
  border: 0;
  color: var(--yt-text);
  font-size: 14px;
  outline: none;
}
.yt-header-search input::placeholder { color: var(--yt-muted); }
.yt-header-actions { display: flex; align-items: center; gap: 8px; }
.yt-header-btn {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  color: var(--yt-text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background var(--yt-dur);
}
.yt-header-btn:hover { background: var(--yt-elevated); }

/* 사이드바 */
.yt-sidebar {
  width: 240px;
  background: var(--yt-bg);
  border-right: 1px solid var(--yt-line);
  padding: 12px 0;
  overflow-y: auto;
}
.yt-sidebar-section { padding: 8px 12px; border-bottom: 1px solid var(--yt-line); margin-bottom: 8px; }
.yt-sidebar-section-title {
  padding: 8px 12px 4px;
  font-size: 11px;
  font-weight: 700;
  color: var(--yt-muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.yt-nav-item {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 10px 16px;
  margin: 0 6px;
  border-radius: 10px;
  color: var(--yt-text);
  text-decoration: none;
  font-size: 14px;
  transition: background var(--yt-dur);
}
.yt-nav-item i { width: 24px; font-size: 16px; color: var(--yt-text-soft); }
.yt-nav-item:hover { background: var(--yt-elevated); }
.yt-nav-item.active {
  background: var(--yt-elevated);
  font-weight: 700;
}
.yt-nav-item.active i { color: var(--yt-text); }

/* 카드 */
.yt-card {
  background: var(--yt-surface);
  border-radius: var(--yt-radius-card);
  padding: 16px 18px;
  margin-bottom: 16px;
  transition: background var(--yt-dur);
}
.yt-card-flat {
  background: transparent;
  border: 1px solid var(--yt-line);
  border-radius: var(--yt-radius-card);
  padding: 16px;
}

/* 버튼 */
.yt-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--yt-elevated);
  border: 1px solid transparent;
  color: var(--yt-text);
  padding: 8px 16px;
  border-radius: var(--yt-radius-chip);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--yt-dur);
  text-decoration: none;
}
.yt-btn:hover { background: var(--yt-line-strong); }
.yt-btn:active { transform: scale(0.97); }
.yt-btn-primary {
  background: var(--yt-text);
  color: var(--yt-bg);
}
.yt-btn-primary:hover { background: var(--yt-text-soft); }
.yt-btn-red {
  background: var(--yt-red);
  color: white;
  border-color: var(--yt-red);
}
.yt-btn-red:hover { background: var(--yt-red-deep); border-color: var(--yt-red-deep); }
.yt-btn-outline {
  background: transparent;
  border-color: var(--yt-line-strong);
}
.yt-btn-outline:hover { background: var(--yt-elevated); }

/* LIVE 배지 (YouTube 시그니처) */
.yt-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--yt-red);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.yt-live-badge::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  background: white;
  border-radius: 50%;
  animation: ytLivePulse 1.5s ease infinite;
}
@keyframes ytLivePulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* 칩 (필터/카테고리) */
.yt-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--yt-elevated);
  color: var(--yt-text);
  padding: 8px 12px;
  border-radius: var(--yt-radius-chip);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all var(--yt-dur);
  white-space: nowrap;
}
.yt-chip:hover { background: var(--yt-line-strong); }
.yt-chip.yt-chip-active {
  background: var(--yt-text);
  color: var(--yt-bg);
  font-weight: 600;
}

.yt-chips-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 12px 0;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.yt-chips-row::-webkit-scrollbar { display: none; }

/* 입력 */
.yt-input {
  width: 100%;
  background: var(--yt-surface);
  border: 1px solid var(--yt-line-strong);
  color: var(--yt-text);
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--yt-dur);
  font-family: inherit;
}
.yt-input:focus { border-color: var(--yt-blue); }
.yt-input::placeholder { color: var(--yt-muted); }
.yt-textarea {
  min-height: 80px;
  resize: vertical;
  font-family: inherit;
  line-height: 1.5;
}

/* 테이블 */
.yt-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.yt-table th, .yt-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--yt-line);
}
.yt-table thead th {
  background: var(--yt-surface);
  font-size: 11px;
  font-weight: 700;
  color: var(--yt-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.yt-table tbody tr { transition: background var(--yt-dur); }
.yt-table tbody tr:hover { background: var(--yt-elevated); }

/* 외부 플랫폼 미러 채팅 배지 (이름 앞) — 유튜브=빨강, 틱톡=블랙 */
.lv-src-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px;
  height: 13px;
  border-radius: 3px;
  margin-right: 5px;
  font-size: 8px;
  line-height: 1;
  color: #fff !important;
  vertical-align: middle;
  flex-shrink: 0;
  transform: translateY(-1px);
}
.lv-src-badge.lv-src-yt { background: #ff0000; padding-left: 1px; }  /* YouTube 레드 + ▶ 광학보정 */
.lv-src-badge.lv-src-tt { background: #000000; }
/* 유튜브 미러 채팅 행 이름 톤 (선택적 강조) */
.chat-row.is-youtube .nm { color: inherit; }

/* 채팅 메시지 (YouTube 스타일) */
.yt-chat-msg {
  display: flex;
  gap: 8px;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
  line-height: 1.5;
  transition: background var(--yt-dur);
}
.yt-chat-msg:hover { background: var(--yt-elevated); }
.yt-chat-msg-author {
  font-weight: 600;
  color: var(--yt-text-soft);
  flex-shrink: 0;
}
.yt-chat-msg-text { color: var(--yt-text); overflow-wrap: anywhere; }
.yt-chat-msg-time {
  margin-left: auto;
  color: var(--yt-muted);
  font-size: 11px;
  flex-shrink: 0;
}

/* 알림 박스 */
.yt-alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.yt-alert-info {
  background: rgba(62, 166, 255, 0.15);
  color: var(--yt-blue);
  border: 1px solid rgba(62, 166, 255, 0.3);
}
.yt-alert-success {
  background: rgba(43, 166, 64, 0.15);
  color: var(--yt-green);
  border: 1px solid rgba(43, 166, 64, 0.3);
}
.yt-alert-warning {
  background: rgba(255, 214, 0, 0.15);
  color: var(--yt-yellow);
  border: 1px solid rgba(255, 214, 0, 0.3);
}
.yt-alert-danger {
  background: rgba(255, 0, 0, 0.15);
  color: var(--yt-red);
  border: 1px solid rgba(255, 0, 0, 0.3);
}

/* 통계 카드 */
.yt-stat-card {
  background: var(--yt-surface);
  border-radius: var(--yt-radius-card);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.yt-stat-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--yt-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  display: flex;
  align-items: center;
  gap: 6px;
}
.yt-stat-value {
  font-size: 26px;
  font-weight: 800;
  color: var(--yt-text);
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
}
.yt-stat-sub {
  font-size: 12px;
  color: var(--yt-text-soft);
}

/* 그리드 */
.yt-grid {
  display: grid;
  gap: 16px;
}
.yt-grid-2 { grid-template-columns: repeat(2, 1fr); }
.yt-grid-3 { grid-template-columns: repeat(3, 1fr); }
.yt-grid-4 { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 900px) {
  .yt-grid-3, .yt-grid-4 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .yt-grid-2, .yt-grid-3, .yt-grid-4 { grid-template-columns: 1fr; }
}

/* 스크롤바 (다크 모드) */
body.yt-theme ::-webkit-scrollbar,
body.yt-admin ::-webkit-scrollbar {
  width: 8px; height: 8px;
}
body.yt-theme ::-webkit-scrollbar-track,
body.yt-admin ::-webkit-scrollbar-track { background: transparent; }
body.yt-theme ::-webkit-scrollbar-thumb,
body.yt-admin ::-webkit-scrollbar-thumb {
  background: var(--yt-line-strong);
  border-radius: 4px;
}
body.yt-theme ::-webkit-scrollbar-thumb:hover,
body.yt-admin ::-webkit-scrollbar-thumb:hover { background: var(--yt-muted); }

/* ====================== 바텀시트 시스템 (ClickMate 패턴) ====================== */
.lv-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 999;
  opacity: 0;
  transition: opacity 280ms var(--yt-ease);
  pointer-events: none;
}
.lv-sheet-backdrop.lv-show {
  opacity: 1;
  pointer-events: auto;
}
.lv-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: var(--yt-bg, white);
  border-radius: 20px 20px 0 0;
  box-shadow: 0 -12px 40px rgba(0,0,0,0.3);
  z-index: 1000;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(100%);
  transition: transform 320ms var(--yt-ease);
}
.lv-sheet.lv-show { transform: translateY(0); }
.lv-sheet-light {
  background: white;
  color: #303440;
}
.lv-sheet-handle-wrap {
  flex-shrink: 0;
  padding: 10px 0 4px;
  display: flex;
  justify-content: center;
  cursor: grab;
}
.lv-sheet-handle-wrap:active { cursor: grabbing; }
.lv-sheet-handle {
  width: 36px;
  height: 4px;
  background: #cbd5e1;
  border-radius: 999px;
}
.lv-sheet-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  padding: 4px 12px 14px;
  border-bottom: 1px solid var(--yt-line, #e5e7eb);
  font-weight: 700;
  font-size: 15px;
}
.lv-sheet-header-back, .lv-sheet-header-close {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: transparent;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: inherit;
  font-size: 16px;
  transition: background 160ms;
}
.lv-sheet-header-back:hover, .lv-sheet-header-close:hover { background: rgba(0,0,0,0.06); }
body.yt-theme .lv-sheet-header-back:hover,
body.yt-theme .lv-sheet-header-close:hover { background: rgba(255,255,255,0.1); }
.lv-sheet-title {
  flex: 1;
  text-align: center;
  letter-spacing: -0.02em;
}
.lv-sheet-action {
  background: transparent;
  border: 0;
  color: #ec4899;
  font-weight: 700;
  font-size: 14px;
  padding: 8px 12px;
  cursor: pointer;
}
.lv-sheet-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 18px 20px;
  -webkit-overflow-scrolling: touch;
}
.lv-sheet-footer {
  flex-shrink: 0;
  padding: 12px 16px max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--yt-line, #e5e7eb);
  background: inherit;
}
.lv-sheet-cta {
  width: 100%;
  background: linear-gradient(135deg, #ec4899, #d946ef);
  color: white;
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  letter-spacing: -0.02em;
  transition: transform 140ms, box-shadow 200ms;
}
.lv-sheet-cta:hover { box-shadow: 0 6px 18px rgba(236,72,153,0.45); }
.lv-sheet-cta:active { transform: scale(0.98); }
.lv-sheet-cta:disabled { background: #cbd5e1; cursor: not-allowed; box-shadow: none; }

/* ====================== 영상 오버레이 (B 옵션) ====================== */
/* === PWA Push 알림 토글 (영상 위 우측 상단) === */
.lv-push-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 20;
  background: rgba(0,0,0,0.55);
  color: white;
  border: 1px solid rgba(255,255,255,0.18);
  padding: 7px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 160ms;
}
.lv-push-toggle:hover { background: rgba(0,0,0,0.75); }
.lv-push-toggle.lv-push-on {
  background: hsl(216 90% 45%);
  border-color: hsl(214 100% 47%);
}
.lv-push-toggle:disabled { opacity: 0.6; cursor: wait; }
/* 알림 벨 (로그인 사용자) 와 겹치지 않게 오프셋 */
.notif-bell + .lv-push-toggle,
body:has(.notif-bell) .lv-push-toggle { right: 70px; }
@media (max-width: 480px) {
  .lv-push-toggle { font-size: 11px; padding: 6px 10px; }
}

.lv-video-overlay {
  position: absolute;
  z-index: 5;
  color: white;
  /* 다층 그림자 — 영상 콘텐츠 밝기에 무관한 가독성 보장 */
  text-shadow:
    0 0 2px rgba(0,0,0,0.85),
    0 1px 3px rgba(0,0,0,0.75),
    0 2px 6px rgba(0,0,0,0.5);
  pointer-events: none;
}
.lv-video-overlay > * { pointer-events: auto; }
/* 상단 scrim — 영상 콘텐츠와 무관하게 텍스트 영역 어둡게 (linear gradient) */
.lv-video-overlay-top::before {
  content: '';
  position: absolute;
  top: -56px; left: -14px; right: -14px;
  height: 200px;
  background: linear-gradient(180deg,
    rgba(0,0,0,0.55) 0%,
    rgba(0,0,0,0.30) 50%,
    rgba(0,0,0,0) 100%);
  pointer-events: none;
  z-index: -1;
  border-radius: inherit;
}
.lv-video-overlay-top {
  top: 56px; left: 14px; right: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: absolute;
}
@media (max-width: 480px) {
  .lv-video-overlay-top { top: 48px; left: 10px; right: 10px; gap: 6px; }
  .lv-video-overlay-top::before { top: -48px; left: -10px; right: -10px; height: 180px; }
  .lv-video-title { font-size: 14px; }
  .lv-video-notice { font-size: 11.5px; padding: 6px 12px; }
}
.lv-video-title {
  font-size: 15.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.3;
  /* 제목은 더 강한 그림자 */
  text-shadow:
    0 0 4px rgba(0,0,0,0.9),
    0 1px 4px rgba(0,0,0,0.85),
    0 2px 8px rgba(0,0,0,0.6);
}
.lv-video-store {
  font-size: 12px;
  opacity: 0.85;
  display: inline-flex; align-items: center; gap: 4px;
}
.lv-video-notice {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 12.5px;
  max-width: 100%;
  align-self: flex-start;
}
.lv-video-notice-ic {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, #ff9966, #ff5e62);
  font-size: 11px;
  flex-shrink: 0;
}
.lv-video-notice-badge {
  background: #fbbf24;
  color: #78350f;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* 영상 위 채팅 오버레이 — 모바일 전용 (데스크탑은 사이드 채팅 패널과 중복 방지) */
.lv-chat-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 10px 12px 60px;
  pointer-events: none;
  max-height: 50%;
  overflow: hidden;
  display: none;
  flex-direction: column;
  justify-content: flex-end;
  mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 100%);
}
@media (max-width: 768px) {
  .lv-chat-overlay { display: flex; }
}
.lv-chat-overlay .lv-chat-overlay-msg {
  font-size: 12.5px;
  line-height: 1.4;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  padding: 2px 0;
  overflow-wrap: anywhere;
}
.lv-chat-overlay .lv-chat-overlay-msg .lv-coa-name {
  color: #fcd34d;
  font-weight: 700;
  margin-right: 6px;
}
.lv-chat-overlay .lv-chat-overlay-msg.system .lv-coa-name { color: #fca5a5; }

/* ====================== FAB 부유 액션 (C 옵션) ====================== */
.lv-fab {
  position: fixed;
  display: none;
  bottom: calc(96px + env(safe-area-inset-bottom));
  right: 16px;
  z-index: 50;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ec4899, #d946ef);
  color: white;
  border: 0;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: -0.02em;
  box-shadow: 0 6px 18px rgba(236,72,153,0.45), 0 2px 6px rgba(0,0,0,0.25);
  transition: transform 180ms, box-shadow 200ms;
}
.lv-fab:hover { transform: translateY(-3px); box-shadow: 0 12px 24px rgba(236,72,153,0.55); }
.lv-fab:active { transform: scale(0.94); }
.lv-fab i { font-size: 16px; }
.lv-fab-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: #ef4444;
  color: white;
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  border-radius: 9px;
  padding: 0 5px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid white;
  font-variant-numeric: tabular-nums;
}
.lv-fab-badge:empty { display: none; }

/* 좌측 FAB (상품 목록) — 모바일 좌하단, 내주문 우하단과 짝 */
.lv-fab.lv-fab-left {
  right: auto;
  left: 16px;
  background: linear-gradient(135deg, #0B5FD9, #0068F0);
  box-shadow: 0 6px 18px rgba(11,95,217,0.45), 0 2px 6px rgba(0,0,0,0.25);
}
.lv-fab.lv-fab-left:hover { box-shadow: 0 12px 24px rgba(11,95,217,0.55); }

@media (max-width: 768px) {
  .lv-fab { display: flex; }
}

/* Sticky 상품 CTA 강화 — 항상 viewport 하단 고정 */
.lv-sticky-product {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: 100%;
  max-width: 540px;
  z-index: 30;
  background: white;
  border-top: 1px solid #e5e7eb;
  padding: 10px 14px max(10px, env(safe-area-inset-bottom));
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 -4px 14px rgba(0,0,0,0.06);
}
/* sticky CTA 가 있을 때 마지막 콘텐츠 가림 방지 (스크롤 끝까지 닿게) */
body.has-sticky-cta { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
body:has(.lv-sticky-product) { padding-bottom: calc(78px + env(safe-area-inset-bottom)); }
body.yt-theme .lv-sticky-product { background: #1f1f1f; border-top-color: #303030; }
.lv-sticky-product-info { flex: 1; min-width: 0; }
.lv-sticky-product-name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--yt-text, #303440);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.02em;
}
.lv-sticky-product-price {
  font-size: 14px;
  font-weight: 800;
  color: #ec4899;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}
.lv-sticky-product-cta {
  flex-shrink: 0;
  background: linear-gradient(135deg, #ec4899, #d946ef);
  color: white;
  border: 0;
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 140ms;
}
.lv-sticky-product-cta:active { transform: scale(0.96); }

/* 유틸리티 */
.yt-text-soft { color: var(--yt-text-soft); }
.yt-text-muted { color: var(--yt-muted); }
.yt-text-red { color: var(--yt-red); }
.yt-text-blue { color: var(--yt-blue); }
.yt-bg-surface { background: var(--yt-surface); }
.yt-bg-elevated { background: var(--yt-elevated); }
.yt-flex { display: flex; }
.yt-flex-center { display: flex; align-items: center; justify-content: center; }
.yt-flex-between { display: flex; align-items: center; justify-content: space-between; }
.yt-gap-2 { gap: 8px; } .yt-gap-3 { gap: 12px; } .yt-gap-4 { gap: 16px; }
.yt-mb-2 { margin-bottom: 8px; } .yt-mb-3 { margin-bottom: 12px; } .yt-mb-4 { margin-bottom: 16px; }
.yt-mt-2 { margin-top: 8px; } .yt-mt-3 { margin-top: 12px; } .yt-mt-4 { margin-top: 16px; }
.yt-p-3 { padding: 12px; } .yt-p-4 { padding: 16px; }

/* Bootstrap 호환 — 기본 클래스 override */
body.yt-theme .btn,
body.yt-admin .btn { font-family: inherit; }
body.yt-theme .btn-primary,
body.yt-admin .btn-primary { background: var(--yt-red); border-color: var(--yt-red); color: white; }
body.yt-theme .btn-primary:hover,
body.yt-admin .btn-primary:hover { background: var(--yt-red-deep); border-color: var(--yt-red-deep); }
body.yt-theme .form-control,
body.yt-admin .form-control {
  background: var(--yt-surface);
  border: 1px solid var(--yt-line-strong);
  color: var(--yt-text);
}
body.yt-theme .form-control:focus,
body.yt-admin .form-control:focus {
  background: var(--yt-surface);
  border-color: var(--yt-blue);
  color: var(--yt-text);
  box-shadow: 0 0 0 3px rgba(62,166,255,0.18);
}
body.yt-theme .card,
body.yt-admin .card {
  background: var(--yt-surface);
  border: 1px solid var(--yt-line);
  color: var(--yt-text);
}
body.yt-theme .card-header,
body.yt-admin .card-header {
  background: var(--yt-elevated);
  border-bottom: 1px solid var(--yt-line);
  color: var(--yt-text);
}
body.yt-theme .table,
body.yt-admin .table { color: var(--yt-text); }
body.yt-theme .table > :not(caption) > * > *,
body.yt-admin .table > :not(caption) > * > * {
  background: transparent;
  color: var(--yt-text);
  border-color: var(--yt-line);
}
body.yt-theme a,
body.yt-admin a { color: var(--yt-blue); }
body.yt-theme a:hover,
body.yt-admin a:hover { color: var(--yt-blue); opacity: 0.85; }

/* ====================== 공지 접기/펴기 (collapsible notice) ====================== */
/* 페이지 본문 공지 */
.lv-notice-collapsible {
  flex-direction: column !important;
  gap: 0 !important;
  padding: 0 !important;
}
.lv-notice-toggle {
  appearance: none;
  background: transparent;
  border: 0;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 18px;
  font-size: 13.5px;
  font-weight: 700;
  color: inherit;
  cursor: pointer;
  text-align: left;
  letter-spacing: -0.01em;
}
.lv-notice-chev {
  transition: transform 220ms cubic-bezier(0.16,1,0.3,1);
  font-size: 11px;
  opacity: 0.7;
}
.lv-notice-collapsible:not(.lv-notice-open) .lv-notice-chev { transform: rotate(180deg); }
.lv-notice-body {
  padding: 0 18px 12px;
  font-size: 13px;
  line-height: 1.55;
  color: inherit;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-line;
  overflow-wrap: anywhere;
  transition: max-height 280ms cubic-bezier(0.16,1,0.3,1), padding 220ms, opacity 220ms;
}
/* 접힘: 첫 줄만 노출 (완전 숨김 X) */
.lv-notice-collapsible:not(.lv-notice-open) .lv-notice-body {
  max-height: 1.55em;
  padding-bottom: 12px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  opacity: 0.85;
}

/* 영상 위 공지 (lv-video-notice) — 접힘 시 인디케이터만 남김 */
.lv-video-notice-collapsible {
  cursor: pointer;
  appearance: none;
  border: 0;
  color: inherit;
  font-family: inherit;
  font-size: inherit;
  transition: padding 200ms, max-width 220ms cubic-bezier(0.16,1,0.3,1);
}
.lv-vn-text {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 1;
  line-clamp: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: pre-line;
  overflow-wrap: anywhere;
  max-width: 60vw;
  line-height: 1.45;
  transition: max-width 220ms cubic-bezier(0.16,1,0.3,1), opacity 180ms, margin 200ms;
}
.lv-vn-chev {
  font-size: 9px;
  opacity: 0.7;
  transition: transform 220ms;
  margin-left: 2px;
  flex-shrink: 0;
}
/* 펼침 상태: 여러 줄 전체 노출 — line-clamp 해제 (display:-webkit-box 안에서는 white-space:pre-line 이 무시되므로 display:block 로 되돌린다) */
.lv-video-notice-collapsible.lv-vn-open .lv-vn-text {
  display: block;
  -webkit-line-clamp: unset;
  line-clamp: unset;
  max-height: 40vh;
  overflow-y: auto;
  white-space: pre-line;
  text-overflow: unset;
}
/* 접힘 상태: 첫 줄만 노출 (완전 숨김 X — 항상 최소 첫 줄은 보이도록) */
.lv-video-notice-collapsible:not(.lv-vn-open) .lv-vn-text {
  -webkit-line-clamp: 1;
  line-clamp: 1;
  max-height: 1.5em;
  overflow: hidden;
}
.lv-video-notice-collapsible:not(.lv-vn-open) .lv-vn-chev { transform: rotate(180deg); }
/* 여러 줄일 때 button flex 정렬 조정 */
.lv-video-notice-collapsible {
  align-items: flex-start;
  text-align: left;
}
.lv-video-notice-collapsible .lv-video-notice-ic { padding-top: 2px; flex-shrink: 0; }

/* ====================== 라이브 스테이지 레이아웃 (시청 화면) ======================
 * 모바일(≤768px): 영상 풀스크린 + 모든 정보 영상 위 오버레이, 페이지 스크롤 없음
 * PC(≥769px) : 좌측 영상+정보 / 우측 채팅 사이드바 (한 화면, 우측 채팅만 스크롤)
 * 적용 조건: body.lv-stage
 * ======================================================================== */

/* -------- 공통: 종모양 알림 (시청 화면 항상 숨김) -------- */
body.lv-stage .notif-bell,
body.lv-stage .notif-panel { display: none !important; }

/* -------- PC 레이아웃: 우측 채팅 사이드바 (>=769px) -------- */
@media (min-width: 769px) {
  body.lv-stage {
    padding-right: 360px;
    overflow-x: hidden;
  }
  body.lv-stage .live-wrap { max-width: none; padding-left: 24px; padding-right: 24px; }

  /* 영상 박스 — 적당한 비율 유지 */
  body.lv-stage .player {
    max-width: 100%;
    margin: 0 auto;
  }
  body.lv-stage .lv-player { aspect-ratio: 16 / 9; }

  /* 우측 채팅 사이드 패널 — 라이트 (YouTube 스타일) */
  body.lv-stage #lvChatWrap {
    position: fixed;
    top: 0;
    right: 0;
    width: 360px;
    height: 100vh;
    height: 100dvh;
    z-index: 30;
    background: #ffffff;
    border-left: 1px solid #e5e7eb;
    display: flex;
    flex-direction: column;
    margin: 0;
    padding: 0;
    border-radius: 0;
    transition: transform 220ms ease, opacity 200ms ease;
  }
  /* 사이드 채팅 헤더 + 토글 버튼 */
  body.lv-stage #lvChatWrap::before {
    content: "실시간 채팅";
    display: block;
    padding: 14px 16px;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: #0f0f0f;
    border-bottom: 1px solid #e5e7eb;
    flex-shrink: 0;
  }
  /* PC 채팅 토글 닫기 버튼 — 채팅 헤더 우측 */
  body.lv-stage #lvChatCollapseBtn {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 31;
    width: 32px;
    height: 32px;
    border-radius: 999px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    color: #606060;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 14px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
    transition: background 0.18s, color 0.18s;
  }
  body.lv-stage #lvChatCollapseBtn:hover { background: #f2f2f2; color: #0f0f0f; }

  body.lv-stage #lvChatWrap .chat-list,
  body.lv-stage #lvChatWrap #chatList {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    padding: 10px 12px;
    margin: 0;
    background: transparent;
  }
  body.lv-stage #lvChatWrap .chat-input {
    flex-shrink: 0;
    padding: 10px 12px;
    border-top: 1px solid #e5e7eb;
    margin: 0;
    background: #ffffff;
  }
  body.lv-stage #lvChatWrap .chat-input input {
    border-radius: 999px;
    background: #f2f2f2;
    border: 1px solid #e5e7eb;
    color: #0f0f0f;
    padding: 9px 14px;
  }
  body.lv-stage #lvChatWrap .chat-input input::placeholder { color: #909090; }
  body.lv-stage #lvChatWrap .chat-input button {
    background: #0f0f0f;
    color: #ffffff;
    border: 0;
    border-radius: 999px;
    padding: 8px 16px;
    font-weight: 700;
    margin-left: 6px;
    cursor: pointer;
  }
  body.lv-stage #lvChatWrap .chat-input button:hover { background: #303030; }
  /* 라이트 사이드바 위 채팅 텍스트 색상 (WCAG AA on #fff) */
  body.lv-stage #lvChatWrap .chat-row { color: #0f0f0f; padding: 6px 8px; border-radius: 6px; }
  body.lv-stage #lvChatWrap .chat-row .nm { color: hsl(216 90% 45%); font-weight: 700; }  /* #0B5FD9 — 5.75:1 on #fff */
  body.lv-stage #lvChatWrap .chat-row.system .nm { color: hsl(28 100% 38%); }
  body.lv-stage #lvChatWrap .chat-row .msg-time { color: #909090; }
  body.lv-stage #lvChatWrap .chat-row:hover { background: #f2f2f2; }

  /* === 채팅 숨김 모드 — body padding 회수 (영상 자연 확장) === */
  body.lv-stage.chat-collapsed { padding-right: 0; }
  body.lv-stage.chat-collapsed #lvChatWrap {
    transform: translateX(100%);
    opacity: 0;
    pointer-events: none;
    visibility: hidden;
  }
  /* sticky 상품 CTA — 채팅 자리 회수 */
  body.lv-stage.chat-collapsed .lv-sticky-product { right: 0; }
  /* 채팅 토글 버튼 — 채팅 숨김 상태에서 더 잘 보이도록 다크 톤 */
  body.lv-stage.chat-collapsed #lvChatCollapseBtn {
    background: rgba(0,0,0,0.65);
    color: #ffffff;
    border-color: transparent;
  }
  body.lv-stage.chat-collapsed #lvChatCollapseBtn:hover { background: rgba(0,0,0,0.85); }
  /* "실시간 채팅" section-title (페이지 본문) 숨김 — 패널 헤더가 대체 */
  body.lv-stage .section-title:has(+ .chat),
  body.lv-stage .section-title:has(+ #lvChatWrap) { display: none !important; }
  body.lv-stage .lv-action-bar + .section-title { display: none !important; }

  /* Sticky 상품 CTA — 좌측 컬럼 안에서만 보이게 (우측 채팅 침범 방지) */
  body.lv-stage .lv-sticky-product {
    left: 0;
    right: 360px;
    transform: none;
    max-width: none;
    margin: 0 auto;
  }

  /* FAB — PC에서는 좌측 상품 FAB 만 숨김, 내주문 FAB 는 채팅 위쪽 우상단에 표시 */
  body.lv-stage .lv-fab.lv-fab-left { display: none !important; }
  body.lv-stage #lvMyOrdersFab {
    bottom: auto !important;
    top: 12px !important;
    right: 56px !important;  /* 채팅 토글 (#lvChatCollapseBtn) 옆 */
    width: 38px !important;
    height: 38px !important;
    border-radius: 999px !important;
    font-size: 9px !important;
    z-index: 32 !important;
  }
  body.lv-stage #lvMyOrdersFab span:not(.lv-fab-badge) { display: none !important; } /* "내주문" 글자 숨김 (아이콘만) */
  body.lv-stage.chat-collapsed #lvMyOrdersFab { right: 12px !important; } /* 채팅 숨김 시 우측으로 이동 */
  /* PC 채팅 collapsed 시 sticky-product 도 전체 너비 사용 */
  body.lv-stage.chat-collapsed .lv-sticky-product { right: 0; }

  /* 영상 위 채팅 오버레이는 PC에선 우측 패널과 중복이므로 숨김 */
  body.lv-stage .lv-chat-overlay { display: none !important; }
}

/* -------- 모바일 레이아웃: 영상 풀스크린 + 모든 UI 오버레이 (<=768px) -------- */
@media (max-width: 768px) {
  /* body/html 자체 스크롤 차단 */
  html:has(body.lv-stage),
  body.lv-stage {
    overflow: hidden !important;
    height: 100vh !important;
    height: 100dvh !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  /* live-wrap → viewport 채움 */
  body.lv-stage .live-wrap {
    position: fixed;
    inset: 0;
    margin: 0;
    padding: 0;
    max-width: none;
    background: #000;
    overflow: hidden;
  }

  /* player(영상 박스) 전체 viewport */
  body.lv-stage .live-wrap .player {
    position: absolute !important;
    inset: 0 !important;
    width: 100%;
    height: 100%;
    border-radius: 0;
    margin: 0;
    z-index: 1;
  }
  body.lv-stage .lv-player {
    width: 100%;
    height: 100%;
    aspect-ratio: auto !important;
    max-height: none !important;
    border-radius: 0;
  }
  body.lv-stage .lv-player video {
    width: 100%;
    height: 100%;
    object-fit: cover;
  }

  /* LIVE 배지 + 시청자수 위치 (영상 좌상단) */
  body.lv-stage .badge-live,
  body.lv-stage .badge-status {
    top: max(10px, env(safe-area-inset-top));
    left: 12px;
    z-index: 20;
  }
  body.lv-stage .viewer-count {
    top: max(10px, env(safe-area-inset-top));
    right: 12px;
    z-index: 20;
  }

  /* 본문 모든 정보 패널 숨김 — 영상 위 오버레이가 대체 */
  body.lv-stage .meta,
  body.lv-stage .notice,
  body.lv-stage .coupons-wrap,
  body.lv-stage .pinned,
  body.lv-stage .section-title,
  body.lv-stage .products,
  body.lv-stage .lv-action-bar,
  body.lv-stage .lv-reaction-picker { display: none !important; }

  /* 영상 위 채팅 오버레이는 항상 표시 + 위치 조정 (핀 상품/입력 위로) */
  body.lv-stage .lv-chat-overlay {
    display: flex !important;
    bottom: calc(120px + env(safe-area-inset-bottom));
    padding: 10px 12px 8px;
    max-height: 35vh;
  }

  /* 핀 상품 — 영상 위 반투명 카드 오버레이 (채팅 입력 바로 위) */
  body.lv-stage .lv-sticky-product {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: calc(60px + env(safe-area-inset-bottom));
    transform: none;
    max-width: none;
    width: auto;
    background: rgba(0,0,0,0.65);
    backdrop-filter: blur(14px) saturate(150%);
    -webkit-backdrop-filter: blur(14px) saturate(150%);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: 0 6px 20px rgba(0,0,0,0.45);
    z-index: 30;
  }
  body.lv-stage .lv-sticky-product .lv-sticky-product-name { color: white; }
  body.lv-stage .lv-sticky-product .lv-sticky-product-price { color: #fbbf24; }

  /* 채팅 입력 — 알약형 영상 위 오버레이 (최하단) */
  body.lv-stage #lvChatWrap {
    position: fixed;
    left: 8px;
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    transform: none;
    z-index: 35;
    margin: 0;
    padding: 0;
    background: transparent;
    border: 0;
  }
  body.lv-stage #lvChatWrap .chat-list,
  body.lv-stage #lvChatWrap #chatList,
  body.lv-stage #lvChatWrap .lv-new-msg-btn { display: none !important; }
  body.lv-stage #lvChatWrap .chat-input {
    margin: 0 !important;
    padding: 6px 6px 6px 14px !important;
    gap: 6px;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.12);
    border-radius: 999px;
  }
  body.lv-stage #lvChatWrap .chat-input input {
    border-radius: 999px;
    background: transparent;
    border: 0;
    color: white;
    padding: 7px 4px;
    font-size: 13.5px;
  }
  body.lv-stage #lvChatWrap .chat-input input::placeholder { color: rgba(255,255,255,0.55); }
  body.lv-stage #lvChatWrap .chat-input button {
    border-radius: 999px;
    padding: 7px 12px;
    flex-shrink: 0;
  }

  /* FAB 모바일은 영상 우하단 (핀 상품/입력 위로) */
  body.lv-stage .lv-fab {
    bottom: calc(140px + env(safe-area-inset-bottom));
    right: 12px;
  }
  /* 좌측 상품 FAB — 모바일 좌하단 */
  body.lv-stage .lv-fab.lv-fab-left {
    left: 12px;
    right: auto;
  }

  /* 영상 위 공지 — 풀스크린 모드에서는 상단 안전영역 고려 */
  body.lv-stage .lv-video-overlay-top {
    top: max(50px, calc(env(safe-area-inset-top) + 46px));
  }
}

/* ====================== Skeleton 로딩 (체감 속도 즉시 개선) ====================== */
@keyframes lvSkeletonPulse {
  0%, 100% { background-position: 200% 0; }
  50%      { background-position: -200% 0; }
}
.lv-skel {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.05) 0%,
    rgba(255,255,255,0.12) 50%,
    rgba(255,255,255,0.05) 100%);
  background-size: 200% 100%;
  animation: lvSkeletonPulse 1.4s ease-in-out infinite;
  border-radius: 6px;
  color: transparent !important;
  user-select: none;
  pointer-events: none;
}
/* Light 컨텍스트 (Seller/Admin light theme) */
body.yt-seller .lv-skel,
body:not(.yt-theme):not(.yt-admin) .lv-skel {
  background: linear-gradient(90deg, #eef0f3 0%, #f6f7f9 50%, #eef0f3 100%);
  background-size: 200% 100%;
}
.lv-skel-text {
  display: inline-block;
  height: 0.9em;
  width: 8em;
  vertical-align: middle;
  border-radius: 4px;
}
.lv-skel-line {
  height: 12px;
  width: 100%;
  margin-bottom: 8px;
  border-radius: 6px;
}
.lv-skel-line.short { width: 60%; }
.lv-skel-line.tiny  { width: 35%; }
.lv-skel-img {
  width: 72px; height: 72px;
  border-radius: 10px;
}
.lv-skel-product {
  display: flex; gap: 12px; align-items: center;
  padding: 12px 16px;
}
.lv-skel-product .lv-skel-info { flex: 1; }
.lv-skel-chat-row {
  padding: 8px 12px;
  display: flex; gap: 8px; align-items: flex-start;
}
.lv-skel-chat-row .lv-skel-name { width: 50px; height: 12px; }
.lv-skel-chat-row .lv-skel-msg  { flex: 1; height: 12px; max-width: 200px; }

/* ====================== View Transitions API (Chrome 111+, Safari 18+) ====================== */
@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 220ms;
    animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  }
  ::view-transition-old(root) {
    animation-name: lvVtFadeOut;
  }
  ::view-transition-new(root) {
    animation-name: lvVtFadeIn;
  }
}
@keyframes lvVtFadeOut {
  to { opacity: 0; transform: translateY(-6px); }
}
@keyframes lvVtFadeIn {
  from { opacity: 0; transform: translateY(8px); }
}
