/* ============================================================
   ScoreShift — AI 악보 조 변환기
   Main Stylesheet
   ============================================================ */

/* ── Variables ── */
:root {
  --bg-primary:    #0a0a0f;
  --bg-secondary:  #111118;
  --bg-card:       #16161f;
  --bg-card-hover: #1e1e2a;
  --border:        #2a2a3a;
  --border-light:  #3a3a50;

  --accent:        #7c6bff;
  --accent-light:  #9d8fff;
  --accent-dim:    rgba(124, 107, 255, 0.15);
  --accent-glow:   rgba(124, 107, 255, 0.4);

  --green:         #22c55e;
  --green-dim:     rgba(34, 197, 94, 0.15);
  --pink:          #ec4899;
  --pink-dim:      rgba(236, 72, 153, 0.15);
  --cyan:          #06b6d4;
  --cyan-dim:      rgba(6, 182, 212, 0.15);
  --amber:         #f59e0b;
  --amber-dim:     rgba(245, 158, 11, 0.15);

  --text-primary:  #f0f0ff;
  --text-secondary:#a0a0b8;
  --text-muted:    #606078;

  --radius-sm:     6px;
  --radius-md:     12px;
  --radius-lg:     20px;
  --radius-xl:     28px;

  --shadow-card:   0 4px 24px rgba(0,0,0,0.4);
  --shadow-glow:   0 0 40px rgba(124,107,255,0.2);

  --transition:    0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 0.4s cubic-bezier(0.4, 0, 0.2, 1);

  --font-main:     'Inter', sans-serif;
  --font-mono:     'JetBrains Mono', monospace;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: var(--font-main);
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ── Background Particles ── */
.bg-particles {
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  overflow: hidden;
}
.particle {
  position: absolute;
  border-radius: 50%;
  animation: floatParticle linear infinite;
  opacity: 0;
}
@keyframes floatParticle {
  0%   { opacity: 0; transform: translateY(100vh) scale(0); }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.3; }
  100% { opacity: 0; transform: translateY(-10vh) scale(1.5); }
}

/* ── Header ── */
.header {
  position: fixed; top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  height: 64px;
}
.header-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 0 24px;
  height: 100%;
  display: flex; align-items: center; gap: 32px;
}
.logo {
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.logo-icon {
  font-size: 22px;
  filter: drop-shadow(0 0 8px var(--accent));
}
.logo-text {
  font-size: 18px; font-weight: 700;
  background: linear-gradient(135deg, var(--accent-light), var(--pink));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.logo-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.08em;
  background: var(--accent);
  color: #fff;
  padding: 2px 7px;
  border-radius: 20px;
  vertical-align: middle;
}
.nav {
  display: flex; align-items: center; gap: 4px;
  margin-left: auto;
}
.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  padding: 6px 14px; border-radius: var(--radius-sm);
  transition: var(--transition);
}
.nav-link:hover { color: var(--text-primary); background: var(--bg-card); }

.header-status {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; color: var(--text-muted);
  flex-shrink: 0;
}
.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--amber);
  animation: pulse 2s infinite;
}
.status-dot.online { background: var(--green); }
.status-dot.offline { background: var(--pink); animation: none; }
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.8); }
}

/* ── Hero ── */
.hero {
  min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 100px 24px 60px;
  position: relative; z-index: 1;
  gap: 60px;
  max-width: 1200px; margin: 0 auto;
}
.hero-content { flex: 1; max-width: 580px; }
.hero-tag {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent-light);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  padding: 6px 14px; border-radius: 20px;
  margin-bottom: 24px;
}
.hero-title {
  font-size: clamp(32px, 5vw, 52px);
  font-weight: 800; line-height: 1.15;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}
.gradient-text {
  background: linear-gradient(135deg, var(--accent-light) 0%, var(--pink) 50%, var(--cyan) 100%);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero-subtitle {
  font-size: 16px; color: var(--text-secondary);
  line-height: 1.7; margin-bottom: 32px;
}
.hero-chips {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-bottom: 36px;
}
.chip {
  font-size: 13px; color: var(--text-secondary);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 7px 14px; border-radius: 20px;
  transition: var(--transition);
}
.chip:hover {
  border-color: var(--accent); color: var(--accent-light);
}
.hero-cta { font-size: 16px; padding: 14px 32px; }

.hero-visual { flex-shrink: 0; }
.hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-card), var(--shadow-glow);
  min-width: 320px;
}
.mini-staff { width: 100%; min-height: 120px; }
.hero-card-label {
  text-align: center; margin-top: 16px;
  font-size: 14px; color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Main Container ── */
.main-container {
  max-width: 1100px; margin: 0 auto;
  padding: 0 24px 120px;
  position: relative; z-index: 1;
  display: flex; flex-direction: column; gap: 48px;
}

/* ── Section ── */
.section {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px;
  transition: var(--transition-slow);
}
.section.hidden { display: none; }

.section-header {
  margin-bottom: 32px;
}
.step-badge {
  font-size: 11px; font-weight: 700; letter-spacing: 0.15em;
  color: var(--accent);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}
.section-title {
  font-size: 26px; font-weight: 700;
  margin-bottom: 8px;
}
.section-desc {
  font-size: 14px; color: var(--text-secondary);
}
.section-footer {
  margin-top: 28px;
  display: flex; justify-content: flex-end;
}
.section-footer.center { justify-content: center; }

/* ── Buttons ── */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent), #5f52cc);
  color: #fff;
  font-size: 14px; font-weight: 600;
  padding: 12px 24px; border-radius: var(--radius-md);
  border: none; cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 20px rgba(124,107,255,0.35);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(124,107,255,0.5);
  background: linear-gradient(135deg, var(--accent-light), var(--accent));
}
.btn-primary:disabled {
  opacity: 0.4; cursor: not-allowed;
  box-shadow: none;
}
.btn-primary.btn-large { padding: 16px 36px; font-size: 16px; }

.btn-outline {
  display: inline-flex; align-items: center; gap: 8px;
  background: transparent;
  color: var(--accent-light);
  font-size: 14px; font-weight: 600;
  padding: 12px 24px; border-radius: var(--radius-md);
  border: 1.5px solid var(--accent);
  cursor: pointer;
  transition: var(--transition);
}
.btn-outline:hover {
  background: var(--accent-dim);
  transform: translateY(-1px);
}
.btn-outline.btn-large { padding: 16px 36px; font-size: 16px; }

.btn-sm {
  font-size: 12px; padding: 6px 14px;
  background: rgba(255,255,255,0.15);
  color: #fff; border: 1px solid rgba(255,255,255,0.3);
  border-radius: var(--radius-sm); cursor: pointer;
  backdrop-filter: blur(10px);
  transition: var(--transition);
}
.btn-sm:hover { background: rgba(255,255,255,0.25); }

.btn-icon { font-size: 16px; }

/* ── Upload Area ── */
.upload-area {
  border: 2px dashed var(--border-light);
  border-radius: var(--radius-lg);
  min-height: 240px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative; overflow: hidden;
  background: var(--bg-card);
}
.upload-area:hover, .upload-area.drag-over {
  border-color: var(--accent);
  background: var(--accent-dim);
  box-shadow: 0 0 0 4px var(--accent-dim) inset;
}
.upload-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  text-align: center; padding: 40px;
}
.upload-icon { font-size: 52px; line-height: 1; }
.upload-main-text { font-size: 16px; font-weight: 600; }
.upload-sub-text { font-size: 13px; color: var(--text-muted); }

.upload-preview {
  width: 100%; height: 100%;
  position: absolute; inset: 0;
}
.upload-preview img {
  width: 100%; height: 100%;
  object-fit: contain;
  padding: 16px;
}
.preview-overlay {
  position: absolute; top: 12px; right: 12px;
}
.upload-preview.hidden { display: none; }

.upload-info {
  margin-top: 16px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
}
.upload-info.hidden { display: none; }
.info-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 16px;
  display: flex; flex-direction: column; gap: 4px;
}
.info-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; }
.info-value { font-size: 14px; font-weight: 600; font-family: var(--font-mono); color: var(--accent-light); word-break: break-all; }

/* ── Loading State ── */
.loading-state {
  display: flex; align-items: center; justify-content: center;
  padding: 60px 40px;
}
.loading-animation {
  display: flex; flex-direction: column; align-items: center; gap: 20px;
  text-align: center;
}
.music-note-loader {
  display: flex; gap: 12px; font-size: 28px;
}
.music-note-loader span {
  display: inline-block;
  animation: noteJump 1.2s ease-in-out infinite;
  color: var(--accent);
}
.music-note-loader span:nth-child(2) { animation-delay: 0.15s; }
.music-note-loader span:nth-child(3) { animation-delay: 0.30s; }
.music-note-loader span:nth-child(4) { animation-delay: 0.45s; }
@keyframes noteJump {
  0%, 100% { transform: translateY(0); opacity: 0.4; }
  50% { transform: translateY(-14px); opacity: 1; }
}
.loading-text { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.loading-bar {
  width: 280px; height: 4px;
  background: var(--bg-card); border-radius: 2px; overflow: hidden;
}
.loading-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--pink));
  border-radius: 2px;
  width: 0%;
  transition: width 0.5s ease;
  animation: loadingProgress 3s ease-in-out infinite;
}
@keyframes loadingProgress {
  0% { width: 5%; }
  30% { width: 45%; }
  60% { width: 72%; }
  80% { width: 88%; }
  100% { width: 96%; }
}
.loading-sub { font-size: 13px; color: var(--text-muted); }

/* ── Analysis Result ── */
.analysis-result { display: flex; flex-direction: column; gap: 24px; }
.analysis-result.hidden { display: none; }

/* ── Verification Header ── */
.verify-header {
  margin-bottom: 4px;
}
.verify-title-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.verify-title {
  font-size: 20px; font-weight: 700;
  color: var(--text-primary);
}
.verify-desc {
  font-size: 13px; color: var(--text-muted); margin-top: 6px;
}
.verify-confidence {
  display: flex; align-items: center; gap: 10px;
}
.confidence-label {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.confidence-bar {
  width: 100px; height: 8px;
  background: var(--bg-card); border-radius: 4px;
  border: 1px solid var(--border); overflow: hidden;
}
.confidence-fill {
  height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--green), #34d399);
  transition: width 1s ease, background 0.5s ease;
}
.confidence-value {
  font-size: 14px; font-weight: 800; font-family: var(--font-mono);
  color: var(--green); min-width: 36px;
}

/* ── Verification Layout (Image + Summary) ── */
.verify-layout {
  display: grid; grid-template-columns: 1fr 1.4fr; gap: 20px;
}
@media (max-width: 768px) { .verify-layout { grid-template-columns: 1fr; } }

.verify-image-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.verify-image-label {
  padding: 12px 16px;
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.verify-image-wrap {
  padding: 16px; min-height: 200px;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.02);
}
.verify-image-wrap img {
  max-width: 100%; max-height: 320px;
  object-fit: contain; border-radius: var(--radius-sm);
}
.verify-image-placeholder {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  color: var(--text-muted); font-size: 14px;
}

.verify-summary-panel {
  display: flex; flex-direction: column;
}
.verify-summary-title {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.verify-summary-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px;
  flex: 1;
}
@media (max-width: 500px) { .verify-summary-grid { grid-template-columns: 1fr; } }

.verify-item {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px 16px;
  display: flex; align-items: flex-start; gap: 12px;
  transition: var(--transition);
}
.verify-item:hover { border-color: var(--border-light); }
.verify-item.primary {
  grid-column: 1 / -1;
  background: linear-gradient(135deg, rgba(124,107,255,0.12), rgba(236,72,153,0.08));
  border-color: var(--accent);
}
.verify-item-icon { font-size: 22px; line-height: 1; flex-shrink: 0; }
.verify-item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.verify-item-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; }
.verify-item-value { font-size: 18px; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.verify-item-sub { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ── Measure Breakdown Panel ── */
.measure-breakdown-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.measure-breakdown-content {
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 8px;
  max-height: 400px; overflow-y: auto;
}
.measure-breakdown-content.hidden { display: none; }

.measure-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.04);
  border-radius: var(--radius-md);
  transition: var(--transition);
}
.measure-row:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.measure-num {
  display: flex; flex-direction: column; align-items: center;
  min-width: 42px; flex-shrink: 0;
}
.measure-num-label {
  font-size: 9px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
}
.measure-num-value {
  font-size: 20px; font-weight: 800;
  font-family: var(--font-mono);
  color: var(--accent-light);
}
.measure-notes {
  display: flex; flex-wrap: wrap; gap: 6px;
  flex: 1; min-width: 0;
}
.measure-chip {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.06);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: default; transition: var(--transition);
  min-width: 48px;
}
.measure-chip:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-1px);
}
.measure-chip.rest {
  opacity: 0.5; font-size: 13px;
  color: var(--text-muted); font-weight: 600;
  padding: 8px 10px;
}
.mc-solfege { font-size: 14px; font-weight: 800; color: var(--pink); line-height: 1; }
.mc-pitch { font-size: 10px; color: var(--text-muted); font-family: var(--font-mono); }
.mc-dur { font-size: 9px; color: var(--cyan); font-family: var(--font-mono); }

.measure-info {
  font-size: 11px; color: var(--text-muted);
  white-space: nowrap; flex-shrink: 0;
  font-family: var(--font-mono);
}

/* ── OMR Panel (오선지 인식) ── */
.omr-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.omr-panel.hidden { display: none; }
.omr-panel .panel-header {
  border-bottom-color: var(--cyan);
}
.omr-badge {
  background: var(--cyan-dim) !important;
  color: var(--cyan) !important;
  border-color: var(--cyan) !important;
}

.omr-content { }
.omr-content.hidden { display: none; }

.omr-layout {
  display: grid; grid-template-columns: 1.2fr 1fr; gap: 0;
}
@media (max-width: 768px) { .omr-layout { grid-template-columns: 1fr; } }

.omr-image-section {
  border-right: 1px solid var(--border);
}
@media (max-width: 768px) {
  .omr-image-section { border-right: none; border-bottom: 1px solid var(--border); }
}
.omr-image-label {
  padding: 10px 16px;
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
}
.omr-image-wrap {
  padding: 12px;
  display: flex; align-items: center; justify-content: center;
  background: #111;
  min-height: 200px;
}
.omr-image-wrap img {
  max-width: 100%; max-height: 400px;
  object-fit: contain; border-radius: var(--radius-sm);
}

.omr-info-section {
  display: flex; flex-direction: column;
}

.omr-stats {
  display: grid; grid-template-columns: 1fr 1fr; gap: 0;
  border-bottom: 1px solid var(--border);
}
.omr-stat {
  display: flex; flex-direction: column; align-items: center;
  padding: 16px 12px; gap: 4px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}
.omr-stat:nth-child(2n) { border-right: none; }
.omr-stat:nth-child(n+3) { border-bottom: none; }
.omr-stat-value {
  font-size: 22px; font-weight: 800;
  font-family: var(--font-mono);
  color: var(--cyan);
}
.omr-stat-label {
  font-size: 11px; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.06em;
}

.omr-notes-list {
  padding: 12px 16px;
  max-height: 250px; overflow-y: auto;
  display: flex; flex-direction: column; gap: 8px;
}
.omr-notes-header {
  font-size: 11px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.omr-measure-row {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.omr-measure-label {
  font-size: 11px; font-weight: 700; color: var(--cyan);
  font-family: var(--font-mono);
  min-width: 50px;
}
.omr-note-chip {
  display: flex; flex-direction: column; align-items: center;
  padding: 4px 8px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.3);
  border-radius: var(--radius-sm);
  cursor: default; transition: var(--transition);
  min-width: 40px;
}
.omr-note-chip:hover {
  border-color: var(--cyan);
  background: var(--cyan-dim);
  transform: translateY(-1px);
}
.omr-note-chip strong {
  font-size: 13px; color: var(--pink); line-height: 1;
}
.omr-note-chip small {
  font-size: 9px; color: var(--text-muted);
  font-family: var(--font-mono);
}

/* ── Legacy Result Cards (removed, replaced by verify-layout) ── */
.result-cards {
  display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 16px;
}
@media (max-width: 768px) { .result-cards { grid-template-columns: 1fr 1fr; } }

.result-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 20px;
  display: flex; align-items: flex-start; gap: 16px;
  transition: var(--transition);
}
.result-card:hover { border-color: var(--border-light); }
.result-card.primary-card {
  background: linear-gradient(135deg, rgba(124,107,255,0.12), rgba(236,72,153,0.08));
  border-color: var(--accent);
}
.card-icon { font-size: 28px; line-height: 1; flex-shrink: 0; }
.card-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 6px; }
.card-value { font-size: 22px; font-weight: 700; color: var(--text-primary); line-height: 1; }
.card-sub { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Panels ── */
.notes-panel, .score-panel, .ai-panel, .notes-comparison-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
}
.panel-header h3 { font-size: 15px; font-weight: 600; }
.panel-badge {
  font-size: 11px; font-weight: 700;
  background: var(--accent-dim); color: var(--accent-light);
  border: 1px solid var(--accent);
  padding: 3px 10px; border-radius: 20px;
}
.panel-toggle { font-size: 12px; color: var(--text-muted); }

.notes-scroll { overflow-x: auto; max-height: 280px; overflow-y: auto; }

.notes-table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
.notes-table thead { position: sticky; top: 0; z-index: 2; background: var(--bg-card); }
.notes-table th {
  padding: 10px 16px; text-align: left;
  font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.notes-table td {
  padding: 10px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-family: var(--font-mono);
}
.notes-table tbody tr:hover { background: rgba(255,255,255,0.03); }
.note-name { color: var(--accent-light); font-weight: 600; }
.note-duration { color: var(--cyan); }
.note-measure { color: var(--text-muted); }
.note-solfege { color: var(--pink); font-weight: 700; font-size: 14px; }

/* Solfege Panel (계이름) */
.solfege-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.solfege-flow {
  padding: 20px 24px;
  display: flex; flex-wrap: wrap; gap: 8px;
  align-items: center;
}
.solfege-note {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 10px 14px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-width: 56px;
  transition: var(--transition);
}
.solfege-note:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-2px);
}
.solfege-note .solfege-kr {
  font-size: 18px; font-weight: 800;
  color: var(--pink);
}
.solfege-note .solfege-en {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.solfege-note .solfege-oct {
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}
.solfege-note.rest {
  opacity: 0.5;
}
.solfege-note.rest .solfege-kr {
  color: var(--text-muted);
}
.solfege-measure-bar {
  width: 2px; height: 48px;
  background: var(--border-light);
  border-radius: 1px;
  margin: 0 4px;
}

/* Comparison Table */
.comparison-table td:nth-child(2) { color: var(--text-secondary); }
.comparison-table td:nth-child(3) { color: var(--text-muted); text-align: center; font-size: 18px; }
.comparison-table td:nth-child(4) { color: var(--green); font-weight: 600; }

.score-render-area {
  padding: 24px; min-height: 160px;
  background: #fff;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow-x: auto;
}
.score-render-area.large { min-height: 240px; }

/* 계이름 오버레이 라벨 */
.vf-solfege-label {
  display: flex; flex-direction: column; align-items: center; gap: 1px;
  pointer-events: none;
}
.vf-sol-kr {
  font-size: 11px; font-weight: 800;
  color: #ec4899;
  text-shadow: 0 0 3px rgba(255,255,255,0.9);
  white-space: nowrap;
}
.vf-sol-en {
  font-size: 9px; font-weight: 600;
  color: #7c6bff;
  font-family: 'JetBrains Mono', monospace;
  white-space: nowrap;
}

.ai-raw {
  padding: 20px;
  font-family: var(--font-mono); font-size: 13px; line-height: 1.7;
  color: var(--text-secondary);
  max-height: 300px; overflow-y: auto;
  white-space: pre-wrap; word-break: break-word;
}
.ai-raw.hidden { display: none; }

/* ── Transpose Panel ── */
.transpose-panel {
  display: flex; flex-direction: column; gap: 28px;
}

.key-display {
  display: flex; align-items: center; justify-content: center; gap: 24px;
  padding: 32px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.key-box {
  text-align: center; min-width: 140px;
  padding: 20px 28px;
  border-radius: var(--radius-md);
}
.key-box.original {
  background: rgba(124,107,255,0.1);
  border: 1px solid var(--accent);
}
.key-box.target {
  background: rgba(34,197,94,0.1);
  border: 1px solid var(--green);
}
.key-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px; }
.key-name { font-size: 28px; font-weight: 800; }
.key-box.original .key-name { color: var(--accent-light); }
.key-box.target .key-name { color: var(--green); }
.key-accidentals { font-size: 18px; margin-top: 6px; color: var(--text-muted); }

.transpose-arrow {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  flex: 1; max-width: 160px;
}
.arrow-line {
  width: 100%; height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--green));
  border-radius: 1px;
}
.arrow-head { font-size: 24px; color: var(--text-muted); }
.semitone-badge {
  font-size: 12px; font-weight: 700; font-family: var(--font-mono);
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid var(--amber);
  padding: 3px 12px; border-radius: 20px;
}

.key-selector-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 24px;
}
@media (max-width: 700px) { .key-selector-grid { grid-template-columns: 1fr; } }
.selector-section h4 {
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.key-buttons {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.key-btn {
  font-size: 13px; font-weight: 600; font-family: var(--font-mono);
  padding: 8px 14px; border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-card); color: var(--text-secondary);
  cursor: pointer; transition: var(--transition);
}
.key-btn:hover { border-color: var(--border-light); color: var(--text-primary); }
.key-btn.active {
  border-color: var(--accent);
  background: var(--accent-dim); color: var(--accent-light);
}
.key-btn.original-key {
  border-color: var(--accent);
  background: var(--accent-dim); color: var(--accent-light);
  box-shadow: 0 0 0 2px var(--accent-glow);
}

.semitone-slider-section {
  display: flex; flex-direction: column; gap: 12px;
  padding: 24px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.slider-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.slider-wrapper {
  display: flex; align-items: center; gap: 16px;
}
.slider-min, .slider-max {
  font-size: 12px; color: var(--text-muted); font-family: var(--font-mono);
  flex-shrink: 0;
}

/* Custom Slider */
.slider {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 6px;
  background: linear-gradient(90deg, var(--accent) 0%, var(--border-light) 50%, var(--green) 100%);
  border-radius: 3px; outline: none; cursor: pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-light);
  border: 3px solid var(--bg-primary);
  box-shadow: 0 0 0 2px var(--accent);
  cursor: pointer; transition: var(--transition);
}
.slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
  box-shadow: 0 0 0 3px var(--accent), 0 0 20px var(--accent-glow);
}

.slider-value {
  text-align: center; font-size: 20px; font-weight: 700;
  font-family: var(--font-mono); color: var(--accent-light);
}

.transpose-options {
  display: flex; gap: 20px; flex-wrap: wrap;
  padding: 20px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.option-row {
  display: flex; align-items: center; gap: 10px;
  cursor: pointer; user-select: none;
}
input[type="checkbox"] {
  width: 18px; height: 18px; cursor: pointer;
  accent-color: var(--accent);
}
.option-label { font-size: 14px; color: var(--text-secondary); }

/* ── Output Section ── */
.comparison-tabs {
  display: flex; gap: 4px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 4px;
  margin-bottom: 24px;
  width: fit-content;
}
.tab-btn {
  font-size: 13px; font-weight: 600;
  padding: 8px 20px; border-radius: var(--radius-sm);
  border: none; background: transparent;
  color: var(--text-muted); cursor: pointer; transition: var(--transition);
}
.tab-btn.active {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 10px rgba(124,107,255,0.4);
}
.tab-btn:hover:not(.active) { color: var(--text-primary); }

.tab-content { display: flex; flex-direction: column; gap: 16px; }
.tab-content.hidden { display: none; }

.output-score-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.output-panel-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--border);
  font-size: 15px; font-weight: 600;
}
.output-key-badge {
  font-size: 12px; font-weight: 700; font-family: var(--font-mono);
  padding: 3px 12px; border-radius: 20px;
}
.output-key-badge.original {
  background: var(--accent-dim); color: var(--accent-light);
  border: 1px solid var(--accent);
}
.output-key-badge.transposed {
  background: var(--green-dim); color: var(--green);
  border: 1px solid var(--green);
}

.side-by-side-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 20px;
}
@media (max-width: 768px) { .side-by-side-grid { grid-template-columns: 1fr; } }

/* ── Download Panel ── */
.download-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
}
.download-panel h3 { font-size: 16px; font-weight: 700; margin-bottom: 20px; }
.download-buttons {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px;
}
.btn-download {
  display: flex; align-items: center; gap: 14px;
  padding: 16px 20px;
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md); cursor: pointer;
  transition: var(--transition); text-align: left;
}
.btn-download:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(124,107,255,0.2);
}
.dl-icon { font-size: 28px; flex-shrink: 0; }
.dl-text { display: flex; flex-direction: column; gap: 2px; }
.dl-text strong { font-size: 14px; color: var(--text-primary); }
.dl-text small { font-size: 12px; color: var(--text-muted); }

/* ── Toast ── */
.toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-card);
  font-size: 14px;
  animation: slideInToast 0.3s ease;
  min-width: 280px; max-width: 380px;
}
.toast.success { border-left: 3px solid var(--green); }
.toast.error   { border-left: 3px solid var(--pink); }
.toast.info    { border-left: 3px solid var(--cyan); }
.toast.warning { border-left: 3px solid var(--amber); }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-msg { flex: 1; line-height: 1.4; }
.toast-close {
  color: var(--text-muted); cursor: pointer; flex-shrink: 0;
  background: none; border: none; font-size: 18px; padding: 0; line-height: 1;
}
@keyframes slideInToast {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0); opacity: 1; }
}

/* ── Footer ── */
.footer {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  padding: 24px;
  position: relative; z-index: 1;
}
.footer-inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; flex-wrap: wrap;
  font-size: 13px; color: var(--text-muted);
}
.footer-logo {
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-light), var(--pink));
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-card); border-radius: 3px; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

/* ── Utilities ── */
.hidden { display: none !important; }
.text-accent  { color: var(--accent-light); }
.text-green   { color: var(--green); }
.text-pink    { color: var(--pink); }
.text-muted   { color: var(--text-muted); }

/* ── Responsive ── */
@media (max-width: 960px) {
  .hero { flex-direction: column; text-align: center; min-height: auto; padding: 100px 24px 40px; }
  .hero-chips { justify-content: center; }
  .hero-visual { width: 100%; }
  .hero-card { min-width: auto; }
  .nav { display: none; }
  .result-cards { grid-template-columns: 1fr 1fr; }
  .section { padding: 28px 20px; }
}
@media (max-width: 600px) {
  .result-cards { grid-template-columns: 1fr; }
  .upload-info { grid-template-columns: 1fr; }
  .key-display { flex-direction: column; }
  .transpose-arrow { flex-direction: row; }
}

/* 라이브러리/조변환 페이지 이동 링크는 아이패드(세로 모드 포함)에서도 항상 보여야 함 */
@media (max-width: 960px) {
  .nav { display: flex !important; gap: 2px; }
  .nav-link { font-size: 12px; padding: 6px 10px; white-space: nowrap; }
}

/* ============================================================
   악보 라이브러리 (홈)
   ============================================================ */
.nav-link.active {
  color: var(--text-primary);
  background: var(--accent-dim);
  border: 1px solid var(--accent);
}

.lib-container { padding-top: 100px; gap: 32px; }

.lib-hero { text-align: center; padding: 0 0 8px; }
.lib-hero-title {
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 800; letter-spacing: -0.02em;
  margin-bottom: 8px;
}
.lib-hero-sub { color: var(--text-secondary); font-size: 14px; margin-bottom: 28px; }

.lib-toolbar {
  display: flex; align-items: center; gap: 12px;
  flex-wrap: wrap; justify-content: center;
  margin-bottom: 24px;
}
.lib-search-wrap {
  position: relative;
  flex: 1 1 320px; max-width: 440px;
}
.lib-search-icon {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font-size: 14px; opacity: 0.6; pointer-events: none;
}
.lib-search-input {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 16px 12px 38px;
  font-size: 14px; color: var(--text-primary);
  font-family: var(--font-main);
  transition: var(--transition);
}
.lib-search-input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}

.lib-chord-filter {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  justify-content: center;
  padding: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.lib-chord-filter-label {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--text-muted); text-transform: uppercase;
  flex-shrink: 0;
}
.lib-chord-chips { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.lib-chord-empty { font-size: 13px; color: var(--text-muted); }
.lib-chord-chip {
  font-size: 13px; font-weight: 600;
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 6px 14px; border-radius: 20px;
  cursor: pointer; transition: var(--transition);
  font-family: var(--font-mono);
}
.lib-chord-chip:hover { border-color: var(--accent-light); color: var(--text-primary); }
.lib-chord-chip.active {
  background: var(--accent); border-color: var(--accent); color: #fff;
}

.lib-upload-progress {
  display: flex; align-items: center; gap: 16px;
  background: var(--bg-secondary);
  border: 1px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 18px 22px;
}
.lib-upload-progress.hidden { display: none; }
.lib-upload-spinner {
  width: 28px; height: 28px; flex-shrink: 0;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.lib-upload-progress-title { font-weight: 700; margin-bottom: 2px; }
.lib-upload-progress-sub { font-size: 12px; color: var(--text-muted); }
.lib-upload-progress > div:last-child { flex: 1; min-width: 0; }
.lib-upload-list { list-style: none; margin: 10px 0 0; padding: 0; max-height: 220px; overflow-y: auto; font-size: 13px; }
.lib-upload-list:empty { display: none; }
.lib-upload-list li { display: flex; gap: 8px; align-items: baseline; padding: 4px 0; border-top: 1px solid var(--border); }
.lib-upload-list .up-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-upload-list .up-note { flex-shrink: 0; font-size: 12px; color: var(--text-muted); max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-upload-list .up-work .up-name { font-weight: 700; }
.lib-upload-list .up-fail .up-note { color: #ff6b6b; }

/* 늘 보이는 업로드 상자 (끌어다 놓기 / 눌러서 선택) */
.lib-dropbox {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 22px; cursor: pointer;
  border: 2px dashed var(--border); border-radius: var(--radius-lg);
  background: var(--bg-secondary);
  transition: border-color .15s, background .15s;
}
.lib-dropbox:hover, .lib-dropbox.drag-over { border-color: var(--accent); background: rgba(124,107,255,0.08); }
.lib-dropbox-icon { font-size: 28px; flex-shrink: 0; }
.lib-dropbox-text { display: flex; flex-direction: column; gap: 3px; font-size: 15px; }
.lib-dropbox-sub { font-size: 12px; color: var(--text-muted); }

.lib-grid-section { display: flex; flex-direction: column; gap: 16px; }
.lib-grid-header { display: flex; justify-content: flex-end; }
.lib-grid-count { font-size: 13px; color: var(--text-muted); font-family: var(--font-mono); }

.lib-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 20px;
}

.lib-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  display: flex; flex-direction: column;
  position: relative;
}
.lib-card:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow-card); }

.lib-card-thumb {
  position: relative;
  aspect-ratio: 3 / 4;
  background: var(--bg-card);
  cursor: pointer;
  overflow: hidden;
}
.lib-card-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lib-card-thumb.lib-thumb-fallback::before {
  content: "🎼";
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 48px; opacity: 0.3;
}
.lib-card-pages {
  position: absolute; bottom: 8px; right: 8px;
  background: rgba(10,10,15,0.75);
  color: #fff; font-size: 11px; font-family: var(--font-mono);
  padding: 2px 8px; border-radius: 10px;
}

.lib-card-body { padding: 14px 14px 10px; flex: 1; }
.lib-card-title {
  font-size: 14px; font-weight: 700;
  margin-bottom: 8px; cursor: pointer;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.lib-card-title:hover { color: var(--accent-light); }
.lib-card-chords { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-card-chord {
  font-size: 11px; font-family: var(--font-mono); font-weight: 600;
  background: var(--accent-dim); color: var(--accent-light);
  padding: 2px 8px; border-radius: 10px;
}
.lib-card-nochords { font-size: 11px; color: var(--text-muted); }

.lib-card-actions {
  display: flex; gap: 6px;
  padding: 0 14px 14px;
}
.lib-card-action-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 10px; font-size: 13px; cursor: pointer;
  transition: var(--transition);
}
.lib-card-action-btn:hover { border-color: var(--accent-light); }

.lib-card-editing { grid-column: span 1; }
.lib-card-edit-body { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.lib-edit-title-input {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 8px 10px;
  color: var(--text-primary); font-size: 13px; font-weight: 600;
}
.lib-edit-chords { display: flex; flex-wrap: wrap; gap: 6px; }
.lib-chord-editable {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-family: var(--font-mono);
  background: var(--accent-dim); color: var(--accent-light);
  padding: 2px 4px 2px 8px; border-radius: 10px;
}
.lib-chord-editable button {
  background: none; border: none; color: inherit;
  cursor: pointer; font-size: 13px; line-height: 1; padding: 2px;
}
.lib-edit-add-chord { display: flex; gap: 6px; }
.lib-edit-add-chord input {
  flex: 1; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 10px;
  color: var(--text-primary); font-size: 12px;
}
.lib-edit-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }

.lib-empty, .lib-offline {
  text-align: center; padding: 60px 24px;
  background: var(--bg-secondary);
  border: 1px dashed var(--border-light);
  border-radius: var(--radius-lg);
}
.lib-empty.hidden, .lib-offline.hidden { display: none; }
.lib-empty-icon { font-size: 40px; display: block; margin-bottom: 12px; opacity: 0.6; }
.lib-empty-title { font-weight: 700; margin-bottom: 6px; }
.lib-empty-sub { font-size: 13px; color: var(--text-muted); line-height: 1.6; }
.lib-offline code {
  font-family: var(--font-mono); font-size: 12px;
  background: var(--bg-card); padding: 2px 6px; border-radius: 4px;
}

/* ============================================================
   악보 뷰어 (PDF + 필기)
   ============================================================ */
.viewer-body {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}

.viewer-header {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.viewer-back-btn {
  font-size: 20px; color: var(--text-secondary); text-decoration: none;
  padding: 4px 8px; border-radius: var(--radius-sm);
}
.viewer-back-btn:hover { background: var(--bg-card); color: var(--text-primary); }
.viewer-title {
  flex: 1; font-weight: 700; font-size: 15px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.viewer-header-actions { display: flex; gap: 8px; flex-shrink: 0; }

.viewer-toolbar {
  display: flex; align-items: center; gap: 16px;
  flex-wrap: wrap;
  padding: 8px 16px;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.viewer-toolbar-group { display: flex; align-items: center; gap: 6px; }
.viewer-toolbar-zoom { margin-left: auto; }

.viewer-tool-btn {
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px; cursor: pointer;
  transition: var(--transition);
}
.viewer-tool-btn:hover { border-color: var(--border-light); }
.viewer-tool-btn.active { border-color: var(--accent); background: var(--accent-dim); }
.viewer-tool-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.viewer-color-swatch {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border);
  cursor: pointer; transition: var(--transition);
  padding: 0;
}
.viewer-color-swatch.active { border-color: var(--text-primary); box-shadow: 0 0 0 2px var(--accent); }

.viewer-width-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 12px; cursor: pointer;
  color: var(--text-secondary);
}
.viewer-width-btn.active { border-color: var(--accent); color: var(--accent-light); }

.viewer-canvas-scroll {
  flex: 1;
  overflow: auto;
  display: flex; justify-content: center;
  background: #050508;
  padding: 12px;
}
.viewer-page-stack { position: relative; height: fit-content; margin: 0 auto; }
#pdfCanvas { display: block; background: #fff; box-shadow: var(--shadow-card); }
#inkCanvas { position: absolute; inset: 0; }

.viewer-page-nav {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 10px 16px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.viewer-page-indicator { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); min-width: 70px; text-align: center; }

/* ============================================================
   찬양 악보 라이브러리 — 곡 찾기 / 콘티 목록 / 새 콘티 트레이
   ============================================================ */
.lib-drop-hint { font-size: 12px; color: var(--text-muted); margin-top: -12px; }
a.btn-sm { text-decoration: none; display: inline-flex; align-items: center; }
.btn-sm:disabled { opacity: 0.35; cursor: default; }
.btn-compact { padding: 8px 16px; font-size: 13px; }
.btn-link {
  background: none; border: none; padding: 0 4px;
  color: var(--accent-light); font-size: 12px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}
.btn-link:disabled { color: var(--text-muted); cursor: default; }

/* 탭 */
.lib-tabs {
  display: flex; gap: 4px; justify-content: center;
  border-bottom: 1px solid var(--border);
  margin-bottom: -16px;
}
.lib-tab {
  background: none; border: none; cursor: pointer;
  padding: 12px 20px; font-size: 15px; font-weight: 600;
  color: var(--text-secondary); font-family: var(--font-main);
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: var(--transition);
}
.lib-tab:hover { color: var(--text-primary); }
.lib-tab.active { color: var(--text-primary); border-bottom-color: var(--accent); }
.lib-tab-count { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }

/* 필터 */
.lib-filter-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lib-filter-row .lib-chord-chips { justify-content: flex-start; }
.lib-key-chip { font-weight: 700; }
.lib-chip-count { font-size: 10px; opacity: 0.6; font-weight: 400; margin-left: 2px; }
.lib-chord-details summary {
  cursor: pointer; font-size: 13px; color: var(--text-secondary);
  margin-bottom: 10px; user-select: none;
}
.lib-chord-details .lib-chord-chips { justify-content: flex-start; }
.lib-grid-header { justify-content: flex-start; }

/* 곡 카드 */
.lib-song-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.song-thumb { aspect-ratio: 1 / 1.3; background: #fff; }
.song-thumb img { object-fit: cover; object-position: top; }
.song-key-badge {
  position: absolute; top: 8px; left: 8px;
  min-width: 34px; height: 34px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff;
  font-weight: 800; font-size: 15px; font-family: var(--font-mono);
  border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}
.song-key-badge.static { position: static; flex-shrink: 0; }
.song-meta { font-size: 12px; color: var(--text-muted); margin-bottom: 6px; }
.song-card-actions { padding: 0 14px 14px; }
.song-add-btn {
  width: 100%; padding: 8px 12px;
  background: var(--accent-dim); color: var(--accent-light);
  border: 1px solid var(--accent); border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer;
  font-family: var(--font-main); transition: var(--transition);
  white-space: nowrap;
}
.song-add-btn:hover { background: var(--accent); color: #fff; }
.song-add-btn.on { background: var(--green-dim); border-color: var(--green); color: var(--green); }
.song-version-actions .song-add-btn, .conti-song-head .song-add-btn { width: auto; }

/* 모달 */
body.modal-open { overflow: hidden; }
.lib-modal {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(5,5,10,0.8); backdrop-filter: blur(6px);
  display: flex; justify-content: center; align-items: flex-start;
  overflow-y: auto; padding: 40px 16px;
}
.lib-modal-box {
  position: relative; width: 100%; max-width: 980px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 28px;
}
.lib-modal-close {
  position: absolute; top: 14px; right: 16px;
  background: none; border: none; color: var(--text-secondary);
  font-size: 28px; cursor: pointer; line-height: 1;
}
.lib-modal-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; padding-right: 32px; }
.lib-modal-sub { font-size: 13px; color: var(--text-muted); margin-bottom: 20px; line-height: 1.6; }

.song-version { border-top: 1px solid var(--border); padding: 18px 0; }
.song-version-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.song-version-info { flex: 1; min-width: 180px; display: flex; flex-direction: column; gap: 2px; }
.song-version-info span { font-size: 12px; color: var(--text-muted); }
.song-version-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.song-edit { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.song-edit.hidden { display: none; }
.song-edit .lib-edit-title-input { flex: 1; min-width: 160px; }
.song-key-input { max-width: 110px; flex: 0 0 110px !important; min-width: 80px !important; }

.song-pages { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 12px; }
.song-pages.small { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.song-page { margin: 0; background: #fff; border-radius: var(--radius-sm); overflow: hidden; position: relative; min-height: 80px; }
.song-page img { width: 100%; display: block; }
.song-page figcaption {
  font-size: 11px; color: var(--text-secondary); background: var(--bg-card);
  padding: 4px 8px; display: flex; justify-content: space-between; align-items: center; gap: 4px;
}

/* 콘티 목록 */
.lib-conti-list { display: flex; flex-direction: column; gap: 12px; }
.conti-row {
  display: flex; gap: 16px; align-items: flex-start;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 14px;
}
.conti-thumb { width: 72px; flex-shrink: 0; border-radius: var(--radius-sm); background: #fff; }
.conti-thumb img { object-position: top; }
.conti-info { flex: 1; min-width: 0; }
.conti-title { font-weight: 700; margin-bottom: 4px; cursor: pointer; overflow-wrap: anywhere; }
.conti-title:hover { color: var(--accent-light); }
.conti-songs { display: flex; flex-wrap: wrap; gap: 6px; }
.conti-song-chip {
  font-size: 12px; padding: 3px 10px; border-radius: 12px;
  background: var(--bg-card); border: 1px solid var(--border); color: var(--text-secondary);
}
.conti-song-chip b { color: var(--accent-light); font-family: var(--font-mono); }
.conti-actions { display: flex; flex-direction: column; gap: 6px; flex-shrink: 0; }

/* 콘티 상세 (곡 보정) */
.conti-edit-head { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; padding-right: 32px; }
.conti-title-input { flex: 1; min-width: 200px; font-weight: 700; }
.conti-song { border-top: 1px solid var(--border); padding: 14px 0; }
.conti-song.suspicious .conti-song-head { opacity: 0.85; }
.conti-song.orphan { opacity: 0.6; }
.conti-song-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.conti-song-head .lib-edit-title-input { flex: 1; min-width: 160px; }
.conti-song-no {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent-light);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; flex-shrink: 0;
}
.conti-hint { font-size: 12px; color: var(--amber); margin: -4px 0 10px; }

/* 새 콘티 트레이 */
body.has-setlist .footer { padding-bottom: 80px; }
.setlist-tray {
  position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%);
  width: min(560px, calc(100% - 32px)); z-index: 200;
  background: var(--bg-card); border: 1px solid var(--accent);
  border-radius: var(--radius-lg); box-shadow: 0 10px 40px rgba(0,0,0,0.6);
  overflow: hidden;
}
.setlist-tray-bar {
  width: 100%; display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; background: none; border: none; cursor: pointer;
  color: var(--text-primary); font-size: 14px; font-family: var(--font-main); text-align: left;
}
.setlist-tray-keys {
  flex: 1; min-width: 0; font-family: var(--font-mono); font-size: 12px; color: var(--accent-light);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.setlist-tray-toggle { color: var(--text-muted); font-size: 12px; }
.setlist-panel { border-top: 1px solid var(--border); padding: 12px 14px 14px; }
.setlist-items { list-style: none; max-height: 45vh; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.setlist-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 8px; cursor: grab;
}
.setlist-item.dragging { opacity: 0.4; }
.setlist-no { width: 18px; text-align: center; font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); }
.setlist-thumb { width: 34px; height: 44px; background: #fff; border-radius: 3px; overflow: hidden; flex-shrink: 0; }
.setlist-thumb img { width: 100%; height: 100%; object-fit: cover; object-position: top; }
.setlist-info { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.setlist-info strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.setlist-info span { font-size: 11px; color: var(--text-muted); }
.setlist-info b { color: var(--accent-light); font-family: var(--font-mono); }
.setlist-item-actions { display: flex; gap: 4px; }
.setlist-item-actions .btn-sm { padding: 4px 9px; }
.setlist-export { display: flex; flex-direction: column; gap: 8px; }
.setlist-check { font-size: 12px; color: var(--text-secondary); display: flex; gap: 6px; align-items: center; }
.setlist-export-actions { display: flex; justify-content: space-between; gap: 8px; }

/* 드래그 앤 드롭 */
.lib-dropzone {
  position: fixed; inset: 0; z-index: 400; pointer-events: none;
  background: rgba(124,107,255,0.15); border: 3px dashed var(--accent);
  display: flex; align-items: center; justify-content: center;
}
.lib-dropzone-inner {
  background: var(--bg-card); padding: 20px 32px; border-radius: var(--radius-lg);
  font-size: 18px; font-weight: 700;
}

@media (max-width: 640px) {
  .conti-row { flex-wrap: wrap; }
  .conti-actions { flex-direction: row; flex-wrap: wrap; width: 100%; }
  .lib-modal { padding: 12px 8px; }
  .lib-modal-box { padding: 20px 14px; }
  .lib-song-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .song-add-btn { font-size: 12px; padding: 7px 6px; }
}

/* ============================================================
   로그인 / 계정 / 홈 화면에 추가 / 보기 전용 모드
   ============================================================ */
body.read-only .admin-only { display: none !important; }

.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; min-height: 100dvh; padding: 24px;
}
.login-box {
  width: 100%; max-width: 360px; text-align: center;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 36px 28px;
}
.login-logo {
  width: 64px; height: 64px; margin: 0 auto 16px;
  border-radius: 18px; font-size: 34px; color: #fff;
  display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, var(--accent), var(--pink));
}
.login-title { font-size: 22px; font-weight: 800; margin-bottom: 6px; }
.login-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 22px; line-height: 1.5; }
.login-form { display: flex; flex-direction: column; gap: 10px; }
.login-input { padding-left: 16px; font-size: 16px; /* 16px 미만이면 iOS가 확대함 */ }
.login-btn { justify-content: center; padding: 13px; font-size: 15px; }
.login-error { min-height: 18px; font-size: 13px; color: var(--pink); }

.header-account { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.header-account-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  color: var(--text-secondary); font-size: 12px; font-family: var(--font-main);
  padding: 6px 10px; border-radius: var(--radius-sm); cursor: pointer;
  text-decoration: none; white-space: nowrap;
}
.header-account-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.header-account-btn.hidden { display: none; }
.header-account-role {
  font-size: 11px; color: var(--amber); background: var(--amber-dim);
  padding: 3px 8px; border-radius: 10px;
}

.install-guide {
  position: fixed; inset: 0; z-index: 500;
  background: rgba(5,5,10,0.8); backdrop-filter: blur(4px);
  display: flex; align-items: flex-end; justify-content: center; padding: 16px;
}
.install-guide-box {
  width: 100%; max-width: 420px;
  background: var(--bg-secondary); border: 1px solid var(--border);
  border-radius: var(--radius-lg); padding: 24px;
  margin-bottom: env(safe-area-inset-bottom);
}
.install-guide-box h3 { margin-bottom: 14px; }
.install-guide-box ol { padding-left: 20px; display: flex; flex-direction: column; gap: 8px; font-size: 14px; line-height: 1.5; }
.install-guide-box p { font-size: 13px; color: var(--text-secondary); margin: 14px 0 16px; line-height: 1.5; }
.install-guide-box .btn-primary { width: 100%; justify-content: center; }
.install-icon {
  display: inline-block; padding: 0 6px; border-radius: 6px;
  background: var(--bg-card); border: 1px solid var(--border);
}
.conti-song-title { flex: 1; min-width: 0; }

/* 홈 화면 앱(standalone)에서 아이폰 노치/홈 바 영역 피하기 */
@media (display-mode: standalone) {
  .header { padding-top: env(safe-area-inset-top); height: calc(64px + env(safe-area-inset-top)); }
  .setlist-tray { bottom: calc(16px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .header-account-btn { padding: 5px 8px; font-size: 11px; }
  .header-inner { gap: 10px; padding: 0 12px; }
  .header-status { display: none; }
}
a.logo { text-decoration: none; color: inherit; }
@media (max-width: 640px) { .logo-text { font-size: 15px; } }

/* 곡 화면 — 이 곡이 들어간 콘티 목록 */
.song-section-title { font-size: 15px; font-weight: 700; margin: 8px 0 12px; }
.song-section-title span { font-size: 12px; color: var(--text-muted); font-family: var(--font-mono); margin-left: 4px; }
.song-contis { margin-bottom: 20px; display: flex; flex-direction: column; gap: 10px; }
.song-contis .song-section-title { margin-bottom: 2px; }
.song-conti-row {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 12px 14px;
  display: flex; flex-direction: column; gap: 10px;
}
.song-conti-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.song-conti-name {
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
  color: var(--text-primary); font-size: 14px; font-weight: 700; font-family: var(--font-main);
  display: flex; align-items: center; gap: 8px; flex: 1; min-width: 160px;
}
.song-conti-name:hover span:last-child { color: var(--accent-light); text-decoration: underline; }
.song-conti-date {
  font-family: var(--font-mono); font-size: 12px; font-weight: 500;
  color: var(--accent-light); background: var(--accent-dim);
  padding: 2px 8px; border-radius: 8px; flex-shrink: 0;
}
.song-conti-key { font-size: 12px; color: var(--text-secondary); }
.song-conti-key b { color: var(--accent-light); font-family: var(--font-mono); }
.song-conti-actions { display: flex; gap: 6px; }
.conti-song-chip.current { background: var(--accent-dim); border-color: var(--accent); color: var(--text-primary); font-weight: 700; }
.modal-back { display: inline-block; margin-bottom: 14px; font-size: 13px; }

/* 업로드 확인(컨펌) 단계 */
.review-banner {
  background: rgba(124,107,255,0.12); border: 1px solid var(--accent);
  border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 16px;
}
.review-banner-title { font-weight: 800; font-size: 15px; margin-bottom: 6px; }
.review-banner-sub { font-size: 13px; color: var(--text-secondary); line-height: 1.7; margin-bottom: 12px; }
.review-banner.compact { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; font-size: 14px; margin-bottom: 4px; }
.review-footer { display: flex; justify-content: center; padding: 20px 0 8px; }
.confirm-btn { font-size: 15px; padding: 12px 22px; }
.pending-badge {
  display: inline-block; font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px;
  background: #ffb020; color: #1a1200; vertical-align: middle;
}
.conti-row.pending { border-color: #ffb020; }
.song-pages.small { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.song-page figcaption { flex-wrap: wrap; }
.page-tools { display: flex; gap: 4px; flex-wrap: wrap; }
.page-tools .btn-sm { font-size: 11px; padding: 4px 8px; }

/* 즐겨찾기 표시 */
.mark-picker { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 18px; }
.mark-picker-label { font-size: 12px; color: var(--text-muted); margin-right: 4px; }
.mark-btn {
  font-size: 20px; line-height: 1; width: 40px; height: 40px; border-radius: 10px; cursor: pointer;
  background: var(--bg-secondary); border: 2px solid var(--border); opacity: .45; filter: grayscale(.6);
  transition: transform .1s, opacity .1s;
}
.mark-btn:hover { opacity: .8; }
.mark-btn.on { opacity: 1; filter: none; border-color: var(--accent); transform: scale(1.05); background: rgba(124,107,255,0.15); }
.card-marks { letter-spacing: 1px; }
.mark-chip { font-size: 15px; }

/* 라이브 (NOW) */
.now-row { margin: 6px 0 14px; }
.btn-now {
  background: #e5384f; color: #fff; border: none; border-radius: 999px; cursor: pointer;
  font-weight: 800; padding: 10px 18px; font-size: 14px; box-shadow: 0 0 0 0 rgba(229,56,79,.6);
}
.btn-now:hover { filter: brightness(1.1); }
.btn-now.btn-compact { padding: 8px 14px; font-size: 13px; }
.live-dot { width: 10px; height: 10px; border-radius: 50%; background: #ff3b52; display: inline-block; flex-shrink: 0; animation: live-blink 1s steps(2, start) infinite; }
@keyframes live-blink { to { visibility: hidden; } }
@keyframes live-flash { 0%, 100% { background: #e5384f; } 50% { background: #8a1020; } }
.live-alert {
  position: fixed; left: 50%; top: max(12px, env(safe-area-inset-top)); transform: translateX(-50%); z-index: 900;
  width: min(560px, calc(100% - 24px)); display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 16px; color: #fff; box-shadow: 0 10px 40px rgba(0,0,0,.5);
  animation: live-flash 1s ease-in-out infinite;
}
.live-alert.hidden { display: none; }
.live-alert .live-dot { background: #fff; }
.live-alert-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.live-alert-text strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.live-alert-text span { font-size: 12px; opacity: .9; }
.live-ok-btn { background: #fff; color: #c41c33; border: none; border-radius: 10px; padding: 10px 18px; font-weight: 900; font-size: 15px; cursor: pointer; }
.live-alert-x { background: none; border: none; color: #fff; font-size: 22px; cursor: pointer; opacity: .8; padding: 0 4px; }
.live-indicator {
  position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); z-index: 450;
  display: flex; align-items: center; gap: 8px; max-width: calc(100% - 32px);
  background: #e5384f; color: #fff; border: none; border-radius: 999px; padding: 10px 16px;
  font-weight: 800; font-size: 13px; cursor: pointer; box-shadow: 0 6px 20px rgba(0,0,0,.4);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.live-indicator .live-dot { background: #fff; }
.live-indicator.hidden { display: none; }
.live-viewer {
  position: fixed; inset: 0; z-index: 800; background: #000; color: #fff;
  display: flex; flex-direction: column;
}
.live-viewer.hidden { display: none; }
.live-top {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  padding-top: max(10px, env(safe-area-inset-top)); background: #111; flex-shrink: 0;
}
.live-badge { display: flex; align-items: center; gap: 6px; font-weight: 900; font-size: 12px; color: #ff6b7d; }
.live-now { flex: 1; min-width: 0; display: flex; align-items: baseline; gap: 8px; overflow: hidden; white-space: nowrap; }
.live-now strong { font-size: 16px; overflow: hidden; text-overflow: ellipsis; }
.live-key { background: var(--accent); color: #fff; border-radius: 6px; padding: 1px 7px; font-size: 13px; font-weight: 800; }
.live-count { font-size: 12px; color: #aaa; flex-shrink: 0; }
.live-top-btn { background: #222; color: #fff; border: 1px solid #333; border-radius: 8px; padding: 7px 12px; font-size: 13px; cursor: pointer; flex-shrink: 0; }
.live-songs { display: flex; gap: 6px; overflow-x: auto; padding: 6px 12px 8px; background: #111; flex-shrink: 0; scrollbar-width: none; }
.live-songs::-webkit-scrollbar { display: none; }
.live-song-chip { flex-shrink: 0; background: #1d1d24; color: #ccc; border: 1px solid #333; border-radius: 999px; padding: 5px 12px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.live-song-chip.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.live-song-chip b { color: #ffd76b; }
.live-track {
  flex: 1; min-height: 0; display: flex; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.live-track::-webkit-scrollbar { display: none; }
.live-slide { flex: 0 0 100%; width: 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; display: flex; align-items: center; justify-content: center; background: #fff; overflow: auto; }
.live-slide img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; user-select: none; -webkit-user-drag: none; }
.live-nav {
  position: absolute; top: 55%; transform: translateY(-50%); z-index: 2;
  width: 44px; height: 72px; border: none; border-radius: 10px; cursor: pointer;
  background: rgba(0,0,0,.25); color: #fff; font-size: 34px; opacity: .55;
}
.live-nav:hover { opacity: 1; background: rgba(0,0,0,.5); }
.live-nav.prev { left: 6px; }
.live-nav.next { right: 6px; }
@media (hover: none) { .live-nav { display: none; } }   /* 터치 기기는 옆으로 밀어서 넘김 */
.pending-badge.processing { background: var(--accent); color: #fff; }
.ai-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.ai-row-sub { font-size: 12px; color: var(--text-muted); }
.ai-btn { border-color: var(--accent); }
.error-hint { color: #ff8a8a; }

/* 콘티 화면: 전체 저장 */
.save-all-bar {
  position: sticky; bottom: 0; z-index: 5;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; justify-content: flex-end;
  margin: 16px -4px 0; padding: 12px 14px;
  background: var(--bg-card); border: 2px solid #f59e0b; border-radius: 12px;
  box-shadow: 0 -4px 16px rgba(0,0,0,.12);
}
.save-all-bar #saveAllCount { flex: 1; min-width: 140px; font-weight: 600; font-size: 14px; }
.save-all-bar .btn-primary { min-width: 120px; }
form.dirty .lib-edit-title-input { border-color: #f59e0b; background: rgba(245,158,11,.08); }

/* 분류: 설교 전/후, 느린/빠른 */
.song-cats { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; flex-basis: 100%; }
.song-cats-sep { width: 1px; height: 18px; background: rgba(255,255,255,.15); margin: 0 2px; }
.choice-chip { display: inline-flex; align-items: center; padding: 5px 11px; border-radius: 999px; font-size: 13px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.18); color: var(--text-secondary, #aaa); user-select: none; }
.choice-chip input { position: absolute; opacity: 0; pointer-events: none; }
.choice-chip:has(input:checked) { color: #fff; border-color: transparent; font-weight: 600; }
.choice-before:has(input:checked) { background: #7c6bff; }
.choice-after:has(input:checked) { background: #ec4899; }
.choice-slow:has(input:checked) { background: #06b6d4; }
.choice-fast:has(input:checked) { background: #f59e0b; }
.choice-chip:has(input:focus-visible) { outline: 2px solid #fff; }
.from-here { font-size: 12px; }
.matched-badge { font-size: 12px; color: #22c55e; }
.song-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 4px; }
.song-tag { font-size: 11px; padding: 2px 7px; border-radius: 999px; color: #fff; font-weight: 600; }
.tag-before { background: #7c6bff; } .tag-after { background: #ec4899; }
.tag-slow { background: #06b6d4; } .tag-fast { background: #f59e0b; }
.cat-chip.active.cat-before { background: #7c6bff; border-color: #7c6bff; }
.cat-chip.active.cat-after { background: #ec4899; border-color: #ec4899; }
.cat-chip.active.cat-slow { background: #06b6d4; border-color: #06b6d4; }
.cat-chip.active.cat-fast { background: #f59e0b; border-color: #f59e0b; }
.conti-section-head { margin: 18px 0 8px; font-size: 15px; padding-left: 10px; border-left: 4px solid #7c6bff; }
.conti-section-head.sec-after { border-left-color: #ec4899; }
.conti-song-chip.sec-before { box-shadow: inset 3px 0 0 #7c6bff; }
.conti-song-chip.sec-after { box-shadow: inset 3px 0 0 #ec4899; }
.tempo-picker .tempo-btn { padding: 6px 12px; border-radius: 999px; border: 1px solid rgba(255,255,255,.18); background: transparent; color: inherit; cursor: pointer; font-size: 13px; }
.tempo-picker .tempo-btn.on { background: #06b6d4; border-color: #06b6d4; color: #fff; font-weight: 600; }
.tempo-picker .tempo-btn:disabled { opacity: .6; cursor: default; }

/* 같은 악보 / 겹치는 콘티 */
.sheet-dup-note { font-size: 12px; font-weight: 400; color: var(--text-secondary, #aaa); margin-left: 6px; }
.sheet-used-in { font-size: 12px; color: #22c55e; margin: 4px 0 8px; }
.overlap-banner { border: 1px solid rgba(34,197,94,.5); background: rgba(34,197,94,.08); border-radius: 12px; padding: 12px 14px; margin-bottom: 12px; }
.overlap-title { font-weight: 700; margin: 0 0 6px; }
.overlap-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 4px 0; font-size: 14px; }
.overlap-row > span { flex: 1; min-width: 200px; }
.overlap-sub { font-size: 12px; color: var(--text-secondary, #aaa); margin: 6px 0 0; }
.btn-sm.danger { border-color: rgba(239,68,68,.6); color: #fca5a5; }
.pending-badge.dup { background: rgba(34,197,94,.2); color: #4ade80; }

/* 조 변환: 맨 위 ⚡ 바로 변환하기 카드 */
.quick-card { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.quick-title { font-weight: 700; font-size: 18px; }
.quick-drop { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 14px; cursor: pointer;
  border: 2px dashed var(--border); border-radius: 14px; text-align: center; transition: border-color .15s, background .15s; }
.quick-drop:hover, .quick-drop.drag-over { border-color: var(--accent, #7c6bff); background: rgba(124,107,255,.08); }
.quick-drop.has-file { border-style: solid; border-color: #22c55e; }
.quick-drop-icon { font-size: 30px; }
.quick-drop-text { font-weight: 600; word-break: break-all; }
.quick-drop-sub { font-size: 12px; color: var(--text-secondary); }
.quick-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.quick-row select { flex: 1; max-width: 200px; padding: 9px 10px; border-radius: 10px; background: var(--bg-card-hover); color: var(--text-primary); border: 1px solid var(--border); font-size: 15px; }
.quick-go { width: 100%; justify-content: center; padding: 14px; font-size: 16px; }
.quick-go:disabled { opacity: .5; cursor: not-allowed; }
@media (max-width: 900px) {
  /* 휴대폰: 설명을 줄여서 바로 변환 카드가 첫 화면에 보이게 */
  .hero { padding-top: 84px; gap: 20px; }
  .hero-subtitle, .hero-chips, .hero-tag { display: none; }
  .hero-title { font-size: 26px; }
}

/* 제목·키가 같은 악보 여러 장 → 하나만 남기기 */
.dup-sheet-banner { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; background: rgba(255,196,0,.10); border: 1px solid rgba(255,196,0,.35); }
.dup-sheet-banner p { margin: 0 0 8px; font-size: 14px; }
.dup-sheet-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dup-sheets { margin: 4px 0 18px; padding: 10px 12px; border-radius: 12px; border: 1px dashed rgba(255,255,255,.25); }
.dup-sheets > summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.dup-sheets-sub { font-size: 13px; opacity: .75; margin: 8px 0; }
.keep-sheet-btn { white-space: nowrap; }
.kept-hint { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.song-cats-label { font-size: 12px; opacity: .7; margin-right: 2px; }

/* 콘티 목록: 분류·즐겨찾기 필터 */
.conti-song-chip.hit { border-color: var(--accent); color: var(--text-primary); font-weight: 600; }
.conti-song-chip.dim { opacity: .4; }
.conti-mark-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 8px; }
.conti-mark-toggle { padding: 3px 10px; }
.conti-mark-pick { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.conti-mark-pick .mark-btn { padding: 2px 8px; }
.conti-filter-empty { padding: 16px 0; }

/* ── 예배 라이브: 라이브 화면 위 콘티 탭 ─────────────── */
.live-sets { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px 4px; background: #0b0b10; flex-shrink: 0; scrollbar-width: none; }
.live-sets::-webkit-scrollbar { display: none; }
.live-set-tab { flex-shrink: 0; background: #17171e; color: #ddd; border: 1px solid #2c2c36; border-radius: 10px; padding: 8px 14px;
  font-size: 14px; font-weight: 700; cursor: pointer; white-space: nowrap; }
.live-set-tab span { font-weight: 400; font-size: 12px; opacity: .7; margin-left: 4px; }
.live-set-tab.active { background: #e5384f; border-color: #e5384f; color: #fff; }
.live-set-tab.mine { border-style: dashed; }
.live-set-tab.add { background: transparent; color: #aaa; border-style: dashed; font-weight: 500; }
.live-add { background: #111118; border-bottom: 1px solid #222; padding: 8px 12px; max-height: 40vh; overflow-y: auto; flex-shrink: 0; }
.live-add.hidden { display: none; }
.live-add-search { width: 100%; background: #1d1d24; color: #fff; border: 1px solid #333; border-radius: 8px; padding: 8px 10px; font-size: 14px; margin-bottom: 6px; }
.live-add-list { display: flex; flex-direction: column; gap: 4px; }
.live-add-item { text-align: left; background: #1a1a22; color: #eee; border: 1px solid #2a2a33; border-radius: 8px; padding: 8px 10px; font-size: 14px; cursor: pointer; }
.live-add-item span { color: #ffd76b; font-size: 12px; }
.live-add-item small { color: #999; margin-left: 4px; }
.live-add-empty { color: #999; font-size: 13px; }

/* ── 예배 라이브 셋팅 화면 ───────────────────────────── */
.ws-open-btn { white-space: nowrap; }
.ws-head { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0; }
.ws-field { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.ws-grow { flex: 1; min-width: 200px; }
.ws-saved { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 8px; }
.ws-saved-label { font-size: 12px; color: var(--text-secondary); margin-right: 2px; }
.ws-state { font-size: 12px; color: #ffb020; margin-left: 6px; font-weight: 500; }
.ws-state.ok { color: #34c77b; }
.ws-sets { list-style: none; padding: 0; margin: 0 0 12px; display: flex; flex-direction: column; gap: 8px; }
.ws-set { display: flex; gap: 10px; align-items: flex-start; background: var(--bg-secondary); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px; }
.ws-set-no { background: #e5384f; color: #fff; border-radius: 50%; width: 26px; height: 26px; display: flex; align-items: center; justify-content: center; font-weight: 800; flex-shrink: 0; }
.ws-set-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.ws-set-title { font-weight: 700; }
.ws-set-tools { display: flex; gap: 4px; flex-shrink: 0; }
.ws-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin: 4px 0 18px; }
.ws-empty { color: var(--text-secondary); font-size: 14px; padding: 8px 0; }
.ws-sub { font-size: 13px; color: var(--text-secondary); margin: 6px 0; }
.ws-search { width: 100%; margin: 10px 0 6px; }
.ws-pick { display: flex; flex-direction: column; }
.ws-pick-row { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.ws-pick-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.ws-pick-name small { color: var(--text-secondary); margin-left: 4px; }
.ws-date { color: var(--accent-light); font-family: var(--font-mono); font-size: 12px; margin-right: 6px; }
@media (max-width: 600px) {
  .ws-set { flex-wrap: wrap; }
  .ws-set-tools { width: 100%; justify-content: flex-end; }
  .ws-actions > * { flex: 1; }
}
