/* ============================================================================
 * 대전 사랑하는교회 찬양팀 허브 — v20 신규 기능 통합 스타일시트 (독립 모듈)
 * 디자인 토큰 상속: styles.css (Modern Two-Tone Studio Light / Midnight Dark)
 * 명암비: 라이트 · 다크([data-theme="dark"]) · 드라이브 모드 모두 WCAG AA (4.5:1+)
 * 반응형: 390px 모바일 가로 넘침 0px 보장 · transition: all 미사용
 * ============================================================================ */

/* ============================================================================
 * 0. 공통 박스 모델 · 숨김 보장 · 키프레임 애니메이션
 * ============================================================================ */
.cd-backdrop,
.cd-backdrop *,
.cd-backdrop *::before,
.cd-backdrop *::after,
.ls-backdrop,
.ls-backdrop *,
.ls-backdrop *::before,
.ls-backdrop *::after,
.ls-live-banner,
.ls-live-banner *,
.om-backdrop,
.om-backdrop *,
.om-backdrop *::before,
.om-backdrop *::after,
.sheet-spread-grid,
.sheet-spread-grid *,
.bw-pl-bar,
.bw-pl-bar *,
.bw-pl-backdrop,
.bw-pl-backdrop *,
.bw-pl-backdrop *::before,
.bw-pl-backdrop *::after,
.bw-timer-wrap,
.bw-timer-wrap *,
.bw-drive-overlay,
.bw-drive-overlay *,
.bw-drive-overlay *::before,
.bw-drive-overlay *::after,
.bw-star-btn,
.bw-sheet-jump-btn,
.conti-listen-jump-btn {
  box-sizing: border-box;
}

.cd-backdrop[hidden],
.ls-backdrop[hidden],
.ls-live-banner[hidden],
.om-backdrop[hidden],
.om-progress-wrap[hidden],
.sheet-spread-grid[hidden],
.bw-pl-bar[hidden],
.bw-pl-backdrop[hidden],
.bw-timer-menu[hidden],
.bw-drive-overlay[hidden],
.bw-sheet-jump-btn[hidden],
.conti-listen-jump-btn[hidden] {
  display: none !important;
}

/* 얇은 커스텀 스크롤바 */
.cd-dialog,
.ls-dialog,
.om-dialog,
.om-conti-list,
.bw-pl-modal,
.bw-pl-list {
  scrollbar-width: thin;
  scrollbar-color: var(--border-strong) transparent;
}

.cd-dialog::-webkit-scrollbar,
.ls-dialog::-webkit-scrollbar,
.om-dialog::-webkit-scrollbar,
.om-conti-list::-webkit-scrollbar,
.bw-pl-modal::-webkit-scrollbar,
.bw-pl-list::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

.cd-dialog::-webkit-scrollbar-track,
.ls-dialog::-webkit-scrollbar-track,
.om-dialog::-webkit-scrollbar-track,
.om-conti-list::-webkit-scrollbar-track,
.bw-pl-modal::-webkit-scrollbar-track,
.bw-pl-list::-webkit-scrollbar-track {
  background: transparent;
}

.cd-dialog::-webkit-scrollbar-thumb,
.ls-dialog::-webkit-scrollbar-thumb,
.om-dialog::-webkit-scrollbar-thumb,
.om-conti-list::-webkit-scrollbar-thumb,
.bw-pl-modal::-webkit-scrollbar-thumb,
.bw-pl-list::-webkit-scrollbar-thumb {
  background-color: var(--border-strong);
  border-radius: 999px;
}

@keyframes v20BackdropIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes v20DialogIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes v20MenuIn {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes v20PulseAmber {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.55);
  }
  50% {
    opacity: 0.55;
    box-shadow: 0 0 0 5px rgba(217, 119, 6, 0);
  }
}

@keyframes v20PulseEmerald {
  0%, 100% {
    opacity: 1;
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55);
  }
  50% {
    opacity: 0.55;
    box-shadow: 0 0 0 5px rgba(16, 185, 129, 0);
  }
}

@keyframes v20DriveGlow {
  0%, 100% {
    box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.38), 0 8px 26px rgba(16, 185, 129, 0.44);
  }
  50% {
    box-shadow: 0 0 0 4px rgba(52, 211, 153, 0.42), 0 12px 34px rgba(16, 185, 129, 0.62);
  }
}

/* ============================================================================
 * 1. 피아노 · 기타 코드 운지표 모달 (.cd-*) & 클릭 코드 칩 (.chord-clickable)
 * ============================================================================ */
.cd-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9400;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: v20BackdropIn 160ms var(--ease-out);
}

[data-theme="dark"] .cd-backdrop {
  background: rgba(4, 7, 14, 0.76);
}

.cd-dialog {
  max-width: 560px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 16px;
  background: var(--bg-elevated);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  min-width: 0;
  animation: v20DialogIn 200ms var(--ease-out);
}

.cd-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-hairline);
  min-width: 0;
}

.cd-head > div {
  min-width: 0;
  flex: 1 1 auto;
}

.cd-title {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--ink-primary);
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}

.cd-sub {
  margin: 4px 0 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  line-height: 1.4;
}

.cd-close {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease, transform 140ms var(--ease-out);
}

.cd-close:hover {
  background: var(--bg-subtle-hover);
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.cd-close:active {
  transform: scale(0.94);
}

.cd-body {
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
  flex: 1 1 auto;
}

.cd-section {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 13px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}

.cd-section-title {
  margin: 0;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--ink-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.cd-notes-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.cd-note-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 30px;
  min-width: 40px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border: 1px solid rgba(29, 78, 216, 0.26);
  font-family: var(--font-mono);
  font-size: 13.5px;
  font-weight: 800;
  line-height: 1.2;
}

[data-theme="dark"] .cd-note-pill {
  border-color: rgba(96, 165, 250, 0.38);
}

.cd-note-pill.is-bass {
  background: var(--accent-brass-soft);
  color: #92400E;
  border-color: rgba(180, 83, 9, 0.38);
  box-shadow: inset 0 0 0 1px rgba(180, 83, 9, 0.14);
}

[data-theme="dark"] .cd-note-pill.is-bass {
  background: var(--accent-brass-soft);
  color: var(--accent-brass);
  border-color: rgba(251, 191, 36, 0.44);
  box-shadow: inset 0 0 0 1px rgba(251, 191, 36, 0.14);
}

.cd-piano-wrap {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 8px 6px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
}

.cd-piano-wrap svg {
  width: 100%;
  height: auto;
  display: block;
  max-width: 100%;
}

.cd-guitar-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px 18px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
}

.cd-guitar-wrap svg {
  width: 100%;
  max-width: 220px;
  height: auto;
  display: block;
  flex-shrink: 0;
}

.cd-guitar-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  flex: 1 1 160px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-secondary);
  line-height: 1.45;
}

.cd-guitar-meta strong,
.cd-guitar-meta code {
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-weight: 700;
}

.cd-foot {
  position: sticky;
  bottom: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 18px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-hairline);
}

.cd-play-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: var(--radius-md);
  background: var(--accent-primary);
  color: var(--ink-on-accent);
  border: 1px solid transparent;
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.2;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color 150ms ease, transform 140ms var(--ease-out), box-shadow 150ms ease;
}

.cd-play-btn:hover {
  background: var(--accent-primary-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

.cd-play-btn:active {
  transform: translateY(0) scale(0.97);
}

.cd-play-btn.is-secondary {
  background: var(--bg-subtle);
  color: var(--ink-primary);
  border-color: var(--border-strong);
  box-shadow: none;
}

.cd-play-btn.is-secondary:hover {
  background: var(--bg-subtle-hover);
}

/* 조옮김표 내 클릭 가능한 코드 칩 / 카드 */
.chord-clickable {
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease, transform 150ms var(--ease-out), box-shadow 150ms ease;
}

.chord-clickable:not(.chord-pair) {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(29, 78, 216, 0.24);
  background-color: var(--accent-primary-soft);
  color: var(--accent-primary);
  font-weight: 700;
}

[data-theme="dark"] .chord-clickable:not(.chord-pair) {
  border-color: rgba(96, 165, 250, 0.34);
}

.chord-clickable:hover {
  border-color: var(--accent-primary);
  transform: translateY(-1.5px);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.16);
}

[data-theme="dark"] .chord-clickable:hover {
  box-shadow: 0 4px 12px rgba(96, 165, 250, 0.22);
}

.chord-pair.chord-clickable:hover {
  background-color: var(--accent-primary-soft);
}

.chord-clickable:active {
  transform: translateY(0) scale(0.98);
}

/* ============================================================================
 * 2. 인도자 ↔ 팀원 실시간 강단 싱크 모달 & 상단 뱃지 (.ls-*)
 * ============================================================================ */
.ls-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9400;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: v20BackdropIn 160ms var(--ease-out);
}

[data-theme="dark"] .ls-backdrop {
  background: rgba(4, 7, 14, 0.76);
}

.ls-dialog {
  max-width: 480px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 16px;
  background: var(--bg-elevated);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  min-width: 0;
  animation: v20DialogIn 200ms var(--ease-out);
}

.ls-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-hairline);
  min-width: 0;
}

.ls-head h2,
.ls-head h3,
.ls-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
  line-height: 1.3;
  min-width: 0;
}

.ls-close,
.ls-head > button {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.ls-close:hover,
.ls-head > button:hover {
  background: var(--bg-subtle-hover);
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.ls-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.ls-room-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.ls-room-input {
  flex: 1 1 140px;
  min-width: 0;
  width: 100%;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--ink-primary);
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.04em;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.ls-room-input::placeholder {
  color: var(--ink-muted);
  font-family: var(--font-sans);
  font-weight: 500;
  letter-spacing: normal;
}

.ls-room-input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.16);
}

[data-theme="dark"] .ls-room-input:focus {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
}

.ls-room-row button {
  flex-shrink: 0;
  min-height: 42px;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-strong);
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.ls-room-row button:hover {
  background: var(--bg-subtle-hover);
}

/* 실시간 상태 뱃지 필 (인도자 앰버 점멸 / 팀원 에메랄드 점멸) */
.ls-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  max-width: 100%;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  color: var(--ink-secondary);
  border: 1px solid var(--border-hairline);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ls-status-pill.is-leader,
.ls-status-pill.is-follower {
  padding-left: 10px;
}

.ls-status-pill.is-leader::before,
.ls-status-pill.is-follower::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ls-status-pill.is-leader {
  background: var(--accent-brass-soft);
  color: #92400E;
  border-color: rgba(180, 83, 9, 0.36);
}

.ls-status-pill.is-leader::before {
  background-color: #D97706;
  animation: v20PulseAmber 1.5s ease-in-out infinite;
}

[data-theme="dark"] .ls-status-pill.is-leader {
  background: var(--accent-brass-soft);
  color: #FCD34D;
  border-color: rgba(251, 191, 36, 0.44);
}

[data-theme="dark"] .ls-status-pill.is-leader::before {
  background-color: #FBBF24;
}

.ls-status-pill.is-follower {
  background: var(--accent-sage-soft);
  color: #065F46;
  border-color: rgba(5, 150, 105, 0.36);
}

.ls-status-pill.is-follower::before {
  background-color: #10B981;
  animation: v20PulseEmerald 1.5s ease-in-out infinite;
}

[data-theme="dark"] .ls-status-pill.is-follower {
  background: var(--accent-sage-soft);
  color: #6EE7B7;
  border-color: rgba(52, 211, 153, 0.44);
}

[data-theme="dark"] .ls-status-pill.is-follower::before {
  background-color: #34D399;
}

.ls-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.ls-actions button {
  min-height: 44px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-size: 13.5px;
  font-weight: 700;
  line-height: 1.25;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  min-width: 0;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 140ms var(--ease-out), box-shadow 150ms ease;
}

.ls-actions button:hover {
  background: var(--bg-subtle);
  transform: translateY(-1px);
}

.ls-actions button:active {
  transform: translateY(0) scale(0.98);
}

.ls-actions button.is-leader,
.ls-actions button.is-primary {
  background: var(--accent-primary);
  color: var(--ink-on-accent);
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.ls-actions button.is-leader:hover,
.ls-actions button.is-primary:hover {
  background: var(--accent-primary-hover);
}

.ls-actions button.is-follower {
  background: #047857;
  color: #FFFFFF;
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.ls-actions button.is-follower:hover {
  background: #065F46;
}

[data-theme="dark"] .ls-actions button.is-follower {
  background: #10B981;
  color: #022C22;
}

[data-theme="dark"] .ls-actions button.is-follower:hover {
  background: #34D399;
}

.ls-actions button.is-stop,
.ls-actions button.is-danger {
  grid-column: 1 / -1;
  background: var(--accent-crimson-soft);
  color: var(--accent-crimson);
  border-color: rgba(185, 28, 28, 0.30);
}

[data-theme="dark"] .ls-actions button.is-stop,
[data-theme="dark"] .ls-actions button.is-danger {
  border-color: rgba(248, 113, 113, 0.36);
}

/* 악보 상단 슬림 실시간 싱크 상태 바 */
.ls-live-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 8px 12px;
  margin-bottom: 10px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-sm);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-primary);
}

.ls-live-banner.is-leader {
  background: var(--accent-brass-soft);
  border-color: rgba(180, 83, 9, 0.36);
  color: #78350F;
}

[data-theme="dark"] .ls-live-banner.is-leader {
  background: rgba(51, 37, 16, 0.92);
  border-color: rgba(251, 191, 36, 0.38);
  color: #FDE68A;
}

.ls-live-banner.is-follower {
  background: var(--accent-sage-soft);
  border-color: rgba(5, 150, 105, 0.36);
  color: #064E3B;
}

[data-theme="dark"] .ls-live-banner.is-follower {
  background: rgba(18, 51, 41, 0.92);
  border-color: rgba(52, 211, 153, 0.38);
  color: #A7F3D0;
}

.ls-live-banner button {
  min-height: 28px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.ls-live-banner button:hover {
  background: var(--bg-subtle);
}

#standOverlay .ls-live-banner {
  margin-bottom: 0;
  border-radius: 0;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  padding: 6px 14px;
  font-size: 12.5px;
  flex-shrink: 0;
}

/* ============================================================================
 * 3. 오프라인 저장소 관리자 모달 (.om-*)
 * ============================================================================ */
.om-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9400;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: v20BackdropIn 160ms var(--ease-out);
}

[data-theme="dark"] .om-backdrop {
  background: rgba(4, 7, 14, 0.76);
}

.om-dialog {
  max-width: 560px;
  width: 100%;
  max-height: 90dvh;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 16px;
  background: var(--bg-elevated);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  min-width: 0;
  animation: v20DialogIn 200ms var(--ease-out);
}

.om-head {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 14px;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-hairline);
  min-width: 0;
}

.om-head h2,
.om-head h3,
.om-title {
  margin: 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
  line-height: 1.3;
  min-width: 0;
}

.om-close,
.om-head > button {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  min-width: 36px;
  min-height: 36px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.om-close:hover,
.om-head > button:hover {
  background: var(--bg-subtle-hover);
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.om-body {
  padding: 16px 18px 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.om-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
}

.om-stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: var(--radius-md);
  padding: 12px 13px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  box-shadow: var(--shadow-sm);
}

.om-stat-val {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: var(--accent-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.om-stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-secondary);
  line-height: 1.3;
}

.om-progress-wrap {
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  min-width: 0;
}

.om-progress-bar {
  width: 100%;
  height: 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-subtle);
  overflow: hidden;
  position: relative;
}

.om-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: var(--radius-pill);
  background: linear-gradient(90deg, var(--accent-primary) 0%, #3B82F6 100%);
  transition: width 220ms var(--ease-out);
}

[data-theme="dark"] .om-progress-fill {
  background: linear-gradient(90deg, #3B82F6 0%, #60A5FA 100%);
}

.om-progress-text {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-secondary);
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.om-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-width: 0;
}

.om-actions button {
  min-height: 40px;
  padding: 8px 14px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-surface);
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  flex: 1 1 auto;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 140ms var(--ease-out);
}

.om-actions button:hover {
  background: var(--bg-subtle);
}

.om-actions button:active {
  transform: scale(0.98);
}

.om-actions button.is-primary {
  background: var(--accent-primary);
  color: var(--ink-on-accent);
  border-color: transparent;
  box-shadow: var(--shadow-sm);
}

.om-actions button.is-primary:hover {
  background: var(--accent-primary-hover);
}

.om-actions button.is-danger {
  background: var(--accent-crimson-soft);
  color: var(--accent-crimson);
  border-color: rgba(185, 28, 28, 0.30);
}

[data-theme="dark"] .om-actions button.is-danger {
  border-color: rgba(248, 113, 113, 0.36);
}

.om-conti-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 260px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 2px;
  min-width: 0;
}

.om-conti-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  min-width: 0;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.om-conti-row:hover {
  border-color: var(--border-strong);
}

.om-conti-row > div,
.om-conti-row > span {
  min-width: 0;
}

.om-conti-row button {
  flex-shrink: 0;
  min-height: 32px;
  padding: 5px 11px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border: 1px solid rgba(29, 78, 216, 0.28);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.om-conti-row button:hover {
  background: var(--accent-primary);
  color: var(--ink-on-accent);
  border-color: var(--accent-primary);
}

[data-theme="dark"] .om-conti-row button {
  border-color: rgba(96, 165, 250, 0.38);
}

/* ============================================================================
 * 4. 태블릿 가로 2쪽 펼침 보기 (.sheet-spread-grid)
 * ============================================================================ */
.sv-viewport.is-spread .sv-img,
.sv-viewport.is-spread .sv-anno,
.sv-img[hidden],
.sv-anno[hidden] {
  display: none !important;
}

.sheet-spread-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  align-items: start;
}

.sheet-spread-page {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 4px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.sheet-spread-grid img,
.sheet-spread-page img {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 6px;
  background-color: var(--bg-surface);
}

.sheet-spread-page img.is-inverted,
.sheet-spread-grid.is-inverted img {
  filter: invert(0.91) hue-rotate(180deg) contrast(1.06);
}

.sheet-spread-page-num,
.sheet-spread-label {
  position: absolute;
  bottom: 8px;
  right: 8px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: rgba(15, 23, 42, 0.74);
  color: #F8FAFC;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  pointer-events: none;
}

/* 강단 풀스크린(#standOverlay) 2쪽 펼침 최적화 */
#standOverlay .sv-viewport.is-spread .sv-img,
.sv-viewport.is-spread .sv-anno,
.sv-img[hidden],
.sv-anno[hidden] {
  display: none !important;
}

.sheet-spread-grid {
  height: 100%;
  max-height: calc(100dvh - 108px);
  align-items: center;
  padding: 6px 10px;
  gap: 10px;
}

#standOverlay .sheet-spread-page {
  height: 100%;
  max-height: calc(100dvh - 108px);
  padding: 2px;
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

#standOverlay .sheet-spread-grid img,
#standOverlay .sheet-spread-page img {
  width: 100%;
  height: 100%;
  max-height: calc(100dvh - 108px);
  object-fit: contain;
  border-radius: 6px;
}

/* ============================================================================
 * 5. 찬양 듣기 즐겨찾기(★) & 내 플레이리스트 바 / 모달 (.bw-star-btn, .bw-pl-*)
 * ============================================================================ */
.bw-star-btn {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  min-width: 32px;
  min-height: 32px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-muted);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: color 150ms ease, background-color 150ms ease, border-color 150ms ease, transform 140ms var(--ease-out);
}

.bw-star-btn svg {
  width: 16px;
  height: 16px;
  display: block;
}

.bw-star-btn:hover {
  background: var(--bg-subtle);
  color: #D97706;
}

.bw-star-btn:active {
  transform: scale(0.88);
}

.bw-star-btn.is-starred {
  color: #F59E0B;
}

.bw-star-btn.is-starred:hover {
  background: var(--accent-brass-soft);
  border-color: rgba(245, 158, 11, 0.36);
  color: #D97706;
}

[data-theme="dark"] .bw-star-btn.is-starred {
  color: #FBBF24;
}

[data-theme="dark"] .bw-star-btn.is-starred:hover {
  background: var(--accent-brass-soft);
  border-color: rgba(251, 191, 36, 0.40);
  color: #FCD34D;
}

/* 좌측 레일 내 슬림 플레이리스트 바 */
.bw-pl-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  background: var(--bg-elevated);
  border: 1px solid var(--border-hairline);
}

.bw-pl-select {
  flex: 1 1 auto;
  min-width: 0;
  width: 100%;
  height: 32px;
  padding: 0 24px 0 9px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--ink-primary);
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.bw-pl-select:hover {
  border-color: var(--accent-primary);
}

.bw-pl-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.bw-pl-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 32px;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--ink-primary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 140ms var(--ease-out);
}

.bw-pl-btn:hover {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.bw-pl-btn:active {
  transform: scale(0.96);
}

.bw-pl-btn.is-active {
  background: var(--accent-primary-soft);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.bw-pl-btn.is-primary {
  background: var(--accent-primary);
  color: var(--ink-on-accent);
  border-color: transparent;
}

.bw-pl-btn.is-primary:hover {
  background: var(--accent-primary-hover);
  color: var(--ink-on-accent);
}

.bw-pl-btn.is-danger {
  color: var(--accent-crimson);
  border-color: rgba(185, 28, 28, 0.30);
}

.bw-pl-btn.is-danger:hover {
  background: var(--accent-crimson-soft);
  border-color: var(--accent-crimson);
  color: var(--accent-crimson);
}

/* 플레이리스트 관리 모달 */
.bw-pl-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9450;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: v20BackdropIn 160ms var(--ease-out);
}

[data-theme="dark"] .bw-pl-backdrop {
  background: rgba(4, 7, 14, 0.76);
}

.bw-pl-modal {
  max-width: 460px;
  width: 100%;
  max-height: 88dvh;
  overflow-y: auto;
  overflow-x: hidden;
  border-radius: 16px;
  background: var(--bg-elevated);
  color: var(--ink-primary);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 18px;
  min-width: 0;
  animation: v20DialogIn 200ms var(--ease-out);
}

.bw-pl-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border-hairline);
  min-width: 0;
}

.bw-pl-head h2,
.bw-pl-head h3,
.bw-pl-title {
  margin: 0;
  font-size: 16.5px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink-primary);
  line-height: 1.3;
  min-width: 0;
}

.bw-pl-close,
.bw-pl-head > button {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  border-radius: var(--radius-md);
  background: var(--bg-subtle);
  border: 1px solid var(--border-hairline);
  color: var(--ink-secondary);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 150ms ease, color 150ms ease, border-color 150ms ease;
}

.bw-pl-close:hover,
.bw-pl-head > button:hover {
  background: var(--bg-subtle-hover);
  color: var(--ink-primary);
  border-color: var(--border-strong);
}

.bw-pl-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
  overflow-x: hidden;
  min-width: 0;
}

.bw-pl-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  min-width: 0;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.bw-pl-row:hover {
  border-color: var(--border-strong);
}

.bw-pl-row.is-active,
.bw-pl-row.is-included {
  background: var(--accent-primary-soft);
  border-color: rgba(29, 78, 216, 0.34);
}

[data-theme="dark"] .bw-pl-row.is-active,
[data-theme="dark"] .bw-pl-row.is-included {
  border-color: rgba(96, 165, 250, 0.42);
}

.bw-pl-row > label,
.bw-pl-row > span,
.bw-pl-row > div {
  min-width: 0;
}

.bw-pl-create-row {
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: 100%;
  min-width: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border-hairline);
}

.bw-pl-create-row input {
  flex: 1 1 120px;
  min-width: 0;
  width: 100%;
  min-height: 38px;
  padding: 7px 11px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  color: var(--ink-primary);
  font-size: 13.5px;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.bw-pl-create-row input::placeholder {
  color: var(--ink-muted);
}

.bw-pl-create-row input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, 0.16);
}

[data-theme="dark"] .bw-pl-create-row input:focus {
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.24);
}

.bw-pl-create-row button {
  flex-shrink: 0;
  min-height: 38px;
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  background: var(--accent-primary);
  color: var(--ink-on-accent);
  border: 1px solid transparent;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, transform 140ms var(--ease-out);
}

.bw-pl-create-row button:hover {
  background: var(--accent-primary-hover);
}

.bw-pl-create-row button:active {
  transform: scale(0.97);
}

/* ============================================================================
 * 6. 취침 · 기도 타이머 버튼 & 팝오버 (.bw-timer-*)
 * ============================================================================ */
.bw-timer-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.bw-timer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 7px 11px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-hairline);
  background-color: var(--bg-subtle);
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 150ms ease, transform 140ms var(--ease-out);
}

.bw-timer-btn:hover {
  background-color: var(--bg-subtle-hover);
  border-color: var(--border-strong);
}

.bw-timer-btn:active {
  transform: scale(0.96);
}

.bw-timer-btn.is-active {
  background-color: var(--accent-plum-soft);
  color: var(--accent-plum);
  border-color: rgba(109, 40, 217, 0.38);
  font-weight: 700;
  box-shadow: 0 2px 8px rgba(109, 40, 217, 0.14);
}

[data-theme="dark"] .bw-timer-btn.is-active {
  border-color: rgba(192, 132, 252, 0.44);
  box-shadow: 0 2px 10px rgba(192, 132, 252, 0.20);
}

.bw-timer-menu {
  position: absolute;
  bottom: calc(100% + 6px);
  right: 0;
  min-width: 175px;
  max-width: min(240px, calc(100vw - 24px));
  z-index: 40;
  border-radius: 12px;
  padding: 6px;
  background: var(--bg-surface);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 3px;
  animation: v20MenuIn 150ms var(--ease-out);
}

.bw-timer-opt {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 36px;
  padding: 7px 11px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--ink-primary);
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: left;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, color 140ms ease, border-color 140ms ease;
}

.bw-timer-opt:hover {
  background: var(--bg-subtle);
}

.bw-timer-opt.is-active {
  background: var(--accent-plum-soft);
  color: var(--accent-plum);
  border-color: rgba(109, 40, 217, 0.28);
  font-weight: 700;
}

[data-theme="dark"] .bw-timer-opt.is-active {
  border-color: rgba(192, 132, 252, 0.36);
}

.bw-timer-opt.is-cancel,
.bw-timer-opt.is-danger {
  color: var(--accent-crimson);
}

.bw-timer-opt.is-cancel:hover,
.bw-timer-opt.is-danger:hover {
  background: var(--accent-crimson-soft);
}

/* ============================================================================
 * 7. 운전 · 이동 중 드라이브 모드 (.bw-drive-*)
 * ============================================================================ */
.bw-drive-overlay {
  position: fixed;
  inset: 0;
  z-index: 9650;
  background: #090d16;
  background-image: radial-gradient(circle at 50% 0%, rgba(30, 64, 175, 0.22), transparent 58%);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 16px;
  padding: calc(16px + env(safe-area-inset-top, 0px)) 16px calc(18px + env(safe-area-inset-bottom, 0px));
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  animation: v20BackdropIn 180ms var(--ease-out);
}

.bw-drive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  flex-shrink: 0;
  min-width: 0;
}

.bw-drive-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 13px;
  border-radius: var(--radius-pill);
  background: rgba(59, 130, 246, 0.16);
  border: 1px solid rgba(147, 197, 253, 0.36);
  color: #bfdbfe;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.bw-drive-close {
  min-height: 44px;
  min-width: 44px;
  padding: 8px 16px;
  border-radius: 12px;
  background: rgba(248, 250, 252, 0.10);
  border: 1px solid rgba(148, 163, 184, 0.32);
  color: #f8fafc;
  font-size: 15px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 140ms ease, border-color 140ms ease, transform 120ms var(--ease-out);
}

.bw-drive-close:hover {
  background: rgba(248, 250, 252, 0.18);
  border-color: rgba(226, 232, 240, 0.48);
}

.bw-drive-close:active {
  transform: scale(0.96);
}

.bw-drive-info {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 12px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  padding: 8px 4px;
  min-width: 0;
}

.bw-drive-title {
  margin: 0;
  font-size: clamp(22px, 5.5vw, 34px);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1.25;
  color: #f8fafc;
  word-break: keep-all;
  overflow-wrap: anywhere;
  max-width: 100%;
}

.bw-drive-sub {
  margin: 0;
  font-size: clamp(13.5px, 3.4vw, 16px);
  font-weight: 600;
  color: #cbd5e1;
  line-height: 1.4;
  max-width: 100%;
}

.bw-drive-lyric {
  margin: 4px 0 0;
  width: 100%;
  min-height: 60px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.84);
  border: 1px solid rgba(147, 197, 253, 0.24);
  font-size: clamp(16px, 4vw, 22px);
  color: #93c5fd;
  font-weight: 700;
  line-height: 1.45;
  word-break: keep-all;
  overflow-wrap: anywhere;
  display: flex;
  align-items: center;
  justify-content: center;
}

.bw-drive-time {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: #e2e8f0;
  padding: 5px 14px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(148, 163, 184, 0.20);
}

.bw-drive-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  width: 100%;
  max-width: 640px;
  margin: 0 auto;
  flex-shrink: 0;
}

.bw-drive-btn {
  min-height: 88px;
  width: 100%;
  padding: 14px 12px;
  border-radius: 18px;
  font-size: 18px;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: -0.01em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: #162033;
  border: 1.5px solid rgba(148, 163, 184, 0.28);
  color: #f8fafc;
  cursor: pointer;
  min-width: 0;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
  transition: transform 120ms var(--ease-out), background-color 150ms ease, border-color 150ms ease, color 150ms ease, box-shadow 180ms ease;
}

.bw-drive-btn svg {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
}

.bw-drive-btn small,
.bw-drive-btn .bw-drive-btn-sub {
  font-size: 12.5px;
  font-weight: 700;
  opacity: 0.86;
}

.bw-drive-btn:hover {
  background: #1e2c45;
  border-color: rgba(148, 163, 184, 0.45);
}

.bw-drive-btn:active {
  transform: scale(0.96);
}

.bw-drive-btn.is-wide {
  grid-column: 1 / -1;
}

.bw-drive-btn.is-play {
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  border-color: rgba(147, 197, 253, 0.48);
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.42);
}

.bw-drive-btn.is-play:hover {
  background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
}

.bw-drive-btn.is-play.is-playing {
  background: #10b981;
  border-color: #34d399;
  color: #022c22;
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.38), 0 10px 28px rgba(16, 185, 129, 0.52);
  animation: v20DriveGlow 2.2s ease-in-out infinite;
}

.bw-drive-btn.is-play.is-playing:hover {
  background: #34d399;
}

.bw-drive-btn.is-repeat.is-active {
  background: #f59e0b;
  border-color: #fcd34d;
  color: #0f172a;
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.34), 0 8px 24px rgba(245, 158, 11, 0.42);
}

.bw-drive-btn.is-repeat.is-active:hover {
  background: #fbbf24;
}

/* ============================================================================
 * 8. [악보 보기 →] / [찬양 듣기 →] 상호 점프 버튼
 * ============================================================================ */
.bw-sheet-jump-btn,
.conti-listen-jump-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 32px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent-primary-soft);
  color: var(--accent-primary);
  border: 1.5px solid rgba(29, 78, 216, 0.36);
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.2;
  white-space: nowrap;
  max-width: 100%;
  cursor: pointer;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease, transform 140ms var(--ease-out), box-shadow 150ms ease;
}

[data-theme="dark"] .bw-sheet-jump-btn,
[data-theme="dark"] .conti-listen-jump-btn {
  border-color: rgba(96, 165, 250, 0.48);
}

.bw-sheet-jump-btn:hover,
.conti-listen-jump-btn:hover {
  background: var(--accent-primary);
  color: var(--ink-on-accent);
  border-color: var(--accent-primary);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(29, 78, 216, 0.24);
}

[data-theme="dark"] .bw-sheet-jump-btn:hover,
[data-theme="dark"] .conti-listen-jump-btn:hover {
  box-shadow: 0 4px 14px rgba(96, 165, 250, 0.28);
}

.bw-sheet-jump-btn:active,
.conti-listen-jump-btn:active {
  transform: translateY(0) scale(0.97);
}

.bw-sheet-jump-btn:disabled,
.conti-listen-jump-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

/* ============================================================================
 * 9. 반응형 & 접근성 (모바일 390px 가로 넘침 0px · 모션 감축 지원)
 * ============================================================================ */

/* 760px 미만 스마트폰 세로 화면: 2쪽 펼침 → 1열 깔끔 폴백 */
@media (max-width: 759px) and (orientation: portrait), (max-width: 520px) {
  .sv-viewport.is-spread .sv-img,
.sv-viewport.is-spread .sv-anno,
.sv-img[hidden],
.sv-anno[hidden] {
  display: none !important;
}

.sheet-spread-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  #standOverlay .sv-viewport.is-spread .sv-img,
.sv-viewport.is-spread .sv-anno,
.sv-img[hidden],
.sv-anno[hidden] {
  display: none !important;
}

.sheet-spread-grid {
    height: auto;
    max-height: none;
    align-items: start;
    padding: 6px;
  }

  #standOverlay .sheet-spread-page {
    height: auto;
    max-height: none;
  }

  #standOverlay .sheet-spread-grid img,
  #standOverlay .sheet-spread-page img {
    height: auto;
    max-height: none;
  }
}

/* 760px 미만 가로 화면: 2열 유지 + 컴팩트 여백으로 가로 넘침 0px */
@media (max-width: 759px) and (orientation: landscape) {
  .sv-viewport.is-spread .sv-img,
.sv-viewport.is-spread .sv-anno,
.sv-img[hidden],
.sv-anno[hidden] {
  display: none !important;
}

.sheet-spread-grid {
    gap: 6px;
  }

  .sheet-spread-page {
    padding: 2px;
  }
}

/* 오프라인 저장소 통계 3열 → 모바일 1열 */
@media (max-width: 540px) {
  .om-stats-grid {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
  }

  .om-stat-card {
    padding: 10px 13px;
  }
}

/* 480px 이하 스마트폰(390px 기준) 여백 · 래핑 최적화 */
@media (max-width: 480px) {
  .cd-backdrop,
  .ls-backdrop,
  .om-backdrop,
  .bw-pl-backdrop {
    padding: 10px;
  }

  .cd-head,
  .ls-head,
  .om-head {
    padding: 13px 14px 11px;
  }

  .cd-body,
  .ls-body,
  .om-body {
    padding: 13px 14px 15px;
    gap: 12px;
  }

  .cd-foot {
    padding: 10px 14px;
  }

  .cd-title {
    font-size: 18px;
  }

  .ls-room-row,
  .bw-pl-create-row {
    flex-wrap: wrap;
  }

  .om-conti-row {
    padding: 9px 10px;
    gap: 8px;
  }

  .bw-pl-bar {
    padding: 5px 6px;
    gap: 5px;
  }

  .bw-pl-modal {
    padding: 14px;
    gap: 12px;
  }

  .bw-drive-overlay {
    padding: calc(12px + env(safe-area-inset-top, 0px)) 12px calc(14px + env(safe-area-inset-bottom, 0px));
    gap: 12px;
  }

  .bw-drive-grid {
    gap: 10px;
  }

  .bw-drive-btn {
    min-height: 84px;
    font-size: 16.5px;
    padding: 12px 10px;
  }
}

/* 초소형 화면(360px 이하) 액션 1열 안전 래핑 */
@media (max-width: 360px) {
  .ls-actions {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* 낮은 가로 화면(차량 거치대 가로 모드 등) 드라이브 오버레이 최적화 */
@media (max-height: 620px) {
  .bw-drive-overlay {
    gap: 10px;
    padding-top: calc(10px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .bw-drive-info {
    gap: 6px;
    padding: 2px 4px;
  }

  .bw-drive-lyric {
    min-height: 44px;
    padding: 8px 12px;
  }

  .bw-drive-btn {
    min-height: 68px;
    font-size: 16px;
    padding: 10px;
  }
}

/* 모션 감축 접근성 설정 존중 */
@media (prefers-reduced-motion: reduce) {
  .cd-backdrop,
  .cd-dialog,
  .ls-backdrop,
  .ls-dialog,
  .om-backdrop,
  .om-dialog,
  .bw-pl-backdrop,
  .bw-pl-modal,
  .bw-timer-menu,
  .bw-drive-overlay,
  .ls-status-pill.is-leader::before,
  .ls-status-pill.is-follower::before,
  .bw-drive-btn.is-play.is-playing {
    animation: none !important;
  }

  .cd-close,
  .cd-play-btn,
  .chord-clickable,
  .ls-actions button,
  .om-actions button,
  .om-progress-fill,
  .bw-star-btn,
  .bw-pl-btn,
  .bw-timer-btn,
  .bw-timer-opt,
  .bw-drive-close,
  .bw-drive-btn,
  .bw-sheet-jump-btn,
  .conti-listen-jump-btn {
    transition: none !important;
  }
}
