/**
 * 공유 링크 뷰어 전용 스타일 — Tailwind CDN보다 나중에 로드되어 우선 적용됩니다.
 * (별도 style.css 없음; 앱 공통 스타일은 index.html 인라인 <style>에 있습니다.)
 */

html.viewer-mode,
html.viewer-mode body,
body.share-mode,
body.viewer-mode {
  overflow: auto !important;
}

html.viewer-mode #appShell,
body.share-mode #appShell,
body.viewer-mode #appShell {
  display: none !important;
  visibility: hidden !important;
  height: 0 !important;
  overflow: hidden !important;
}

html.viewer-mode #shareView,
html.viewer-mode #shareView.hidden,
body.share-mode #shareView,
body.viewer-mode #shareView {
  display: flex !important;
  flex-direction: column !important;
  visibility: visible !important;
  position: fixed !important;
  inset: 0 !important;
  z-index: 40 !important;
  overflow: hidden !important;
  background: linear-gradient(180deg, #eef2f9 0%, #f4f6fb 48%, #eef1f8 100%) !important;
}

html.viewer-mode #toast,
body.share-mode #toast,
body.viewer-mode #toast {
  display: none !important;
}

#shareView.share-view-page {
  position: relative;
  isolation: isolate;
}

#shareView.share-view-page::before,
#shareView.share-view-page::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.18;
  pointer-events: none;
  z-index: 0;
}

#shareView.share-view-page::before {
  width: min(320px, 65vw);
  height: min(320px, 65vw);
  background: #6366f1;
  top: -80px;
  right: -60px;
}

#shareView.share-view-page::after {
  width: min(260px, 50vw);
  height: min(260px, 50vw);
  background: #7c3aed;
  bottom: 10%;
  left: -50px;
}

#shareView .share-view-scroll {
  flex: 1 !important;
  overflow-y: auto !important;
  padding: 16px !important;
  display: flex !important;
  justify-content: center !important;
  align-items: flex-start !important;
  position: relative;
  z-index: 1;
}

@media (min-width: 640px) {
  #shareView .share-view-scroll {
    padding: 28px 20px 36px !important;
  }
}

#shareView .share-view-panel {
  width: 100% !important;
  max-width: 28rem !important;
  border-radius: 20px !important;
  overflow: hidden !important;
  border: 1px solid #e2e8f4 !important;
  background: #fff !important;
  box-shadow: 0 16px 48px rgb(30 27 75 / 0.08), 0 0 0 1px rgb(255 255 255 / 0.8) inset !important;
}

@media (min-width: 640px) {
  #shareView .share-view-panel {
    max-width: 32rem !important;
  }
}

#shareView .share-view-head {
  padding: 20px 20px 18px !important;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
  color: #fff !important;
}

#shareView .share-view-head-bar {
  display: flex !important;
  align-items: center !important;
  justify-content: space-between !important;
  gap: 12px !important;
}

#shareView .share-view-head-tag {
  margin: 0 !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.06em !important;
  text-transform: uppercase !important;
  color: rgb(255 255 255 / 0.82) !important;
}

#shareView .share-view-head-desc {
  margin: 8px 0 0 !important;
  font-size: 13px !important;
  line-height: 1.5 !important;
  color: rgb(255 255 255 / 0.88) !important;
}

#shareView .share-view-head-preview {
  display: flex !important;
  align-items: center !important;
  gap: 12px !important;
  margin-top: 14px !important;
  padding: 12px 14px !important;
  border-radius: 14px !important;
  background: rgb(255 255 255 / 0.14) !important;
  border: 1px solid rgb(255 255 255 / 0.22) !important;
  backdrop-filter: blur(10px);
}

#shareView .share-view-head-icon {
  width: 44px !important;
  height: 44px !important;
  border-radius: 14px !important;
  background: rgb(255 255 255 / 0.22) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 22px !important;
  flex-shrink: 0 !important;
}

#shareView #shareViewWorshipInfo {
  margin: 0 !important;
  font-size: 18px !important;
  font-weight: 800 !important;
  color: #fff !important;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

#shareView #shareViewMeta {
  margin: 4px 0 0 !important;
  font-size: 13px !important;
  color: rgb(255 255 255 / 0.88) !important;
  font-weight: 500;
  line-height: 1.45;
}

#shareView #shareViewMemo {
  white-space: pre-wrap;
}

#shareView .share-view-head-memo {
  margin: 12px 0 0 !important;
  font-size: 13px !important;
  line-height: 1.55 !important;
  color: rgb(255 255 255 / 0.92) !important;
  padding: 11px 13px !important;
  border-radius: 12px !important;
  background: rgb(255 255 255 / 0.1) !important;
  border: 1px solid rgb(255 255 255 / 0.16) !important;
}

#shareView .share-view-head .btn-share-dark-toggle,
#shareView .share-view-head #btnExitShareView {
  background: rgb(255 255 255 / 0.14) !important;
  border-color: rgb(255 255 255 / 0.28) !important;
  color: #fff !important;
  box-shadow: none !important;
}

#shareView .share-view-head .btn-share-dark-toggle:hover,
#shareView .share-view-head #btnExitShareView:hover {
  background: rgb(255 255 255 / 0.24) !important;
}

#shareView .share-view-body {
  padding: 18px 20px 20px !important;
  background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
}

#shareView .share-view-section-label {
  margin: 0 0 12px !important;
  font-size: 11px !important;
  font-weight: 700 !important;
  letter-spacing: 0.05em !important;
  text-transform: uppercase !important;
  background: linear-gradient(90deg, #4f46e5, #7c3aed) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  color: transparent !important;
}

#shareView .share-view-songs {
  display: flex !important;
  flex-direction: column !important;
  gap: 12px !important;
}

#shareView .share-view-foot {
  padding: 13px 20px !important;
  text-align: center !important;
  font-size: 11px !important;
  font-weight: 600 !important;
  color: #4338ca !important;
  line-height: 1.5 !important;
  background: linear-gradient(135deg, #eef2ff 0%, #f3e8ff 100%) !important;
  border-top: 1px solid #e0e7ff !important;
}

#shareView .share-view-empty {
  padding: 2.5rem 1rem !important;
  text-align: center !important;
  color: #475569 !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
}

#shareView .share-header-actions {
  display: flex !important;
  flex-shrink: 0 !important;
  align-items: center !important;
  gap: 8px !important;
}

#shareView .share-card {
  border-radius: 18px !important;
  border: 1px solid #e8edf5 !important;
  background: #fff !important;
  padding: 20px !important;
  box-shadow: 0 2px 12px rgb(30 27 75 / 0.04) !important;
  transition: box-shadow 0.25s ease, transform 0.2s ease, border-color 0.25s ease;
  position: relative;
  overflow: hidden;
}

#shareView .share-card::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: linear-gradient(180deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: 18px 0 0 18px;
}

#shareView .share-card:hover,
#shareView .share-card:active,
#shareView .share-card:focus-within {
  border-color: #c7d2fe !important;
  box-shadow:
    0 8px 28px rgb(79 70 229 / 0.14),
    0 0 0 1px rgb(124 58 237 / 0.08),
    0 0 24px rgb(99 102 241 / 0.12) !important;
  transform: translateY(-1px);
}

#shareView .share-card-top {
  display: flex !important;
  align-items: flex-start !important;
  gap: 14px !important;
}

#shareView .share-card-badge {
  width: 36px !important;
  height: 36px !important;
  border-radius: 12px !important;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%) !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 700 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  flex-shrink: 0 !important;
  box-shadow: 0 4px 14px rgb(79 70 229 / 0.32);
}

#shareView .share-card-title {
  margin: 2px 0 0 !important;
  color: #312e81 !important;
  font-size: 17px !important;
  font-weight: 700 !important;
  line-height: 1.35 !important;
  letter-spacing: -0.02em;
}

#shareView .share-card-meta {
  margin-top: 12px !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 6px !important;
  align-items: center !important;
}

#shareView .share-card-memo {
  color: #475569 !important;
  font-size: 13px !important;
  margin-top: 8px !important;
  line-height: 1.5 !important;
}

#shareView .share-song-form {
  font-size: 12px !important;
  font-weight: 600 !important;
  color: #5b21b6 !important;
  margin-top: 6px !important;
  display: inline-block !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  background: #f3e8ff !important;
  border: 1px solid #e9d5ff !important;
}

#shareView .share-chip-key {
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  background: #dbeafe !important;
  border: 1px solid #bfdbfe !important;
  color: #1e40af !important;
}

#shareView .share-chip-tempo {
  font-size: 11px !important;
  font-weight: 700 !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  background: #ede9fe !important;
  border: 1px solid #ddd6fe !important;
  color: #6d28d9 !important;
}

#shareView .share-card-meta .inline-flex {
  font-size: 11px !important;
  font-weight: 600 !important;
  padding: 4px 10px !important;
  border-radius: 999px !important;
  border: 1px solid #e9d5ff !important;
  background: #faf5ff !important;
  color: #7c3aed !important;
}

#shareView .share-actions-row {
  display: grid !important;
  grid-template-columns: 1fr 1fr !important;
  gap: 10px !important;
  margin-top: 16px !important;
  padding-top: 16px !important;
  border-top: 1px solid #f1f5f9 !important;
}

#shareView .share-action-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 6px !important;
  width: 100% !important;
  min-width: 0 !important;
  height: 42px !important;
  padding: 0 12px !important;
  border-radius: 12px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  text-decoration: none !important;
}

#shareView .share-action-btn-score {
  background: linear-gradient(135deg, #059669 0%, #047857 100%) !important;
  color: #fff !important;
  border: none !important;
}

#shareView .share-action-btn-video {
  background: #fff !important;
  color: #1e293b !important;
  border: 1px solid #e2e8f0 !important;
}

#shareView .share-action-btn-disabled {
  background: #f8fafc !important;
  color: #94a3b8 !important;
  border: 1px dashed #cbd5e1 !important;
  grid-column: 1 / -1 !important;
}

#shareView .share-view-loading {
  max-width: 42rem !important;
  margin: 0 auto !important;
  padding: 3rem 1.5rem !important;
  text-align: center !important;
  color: #475569 !important;
  font-size: 14px !important;
}

#shareView .share-view-loading::before {
  content: '';
  display: block;
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
  border: 3px solid #e2e8f4;
  border-top-color: #4f46e5;
  border-radius: 50%;
  animation: share-spin 0.8s linear infinite;
}

@keyframes share-spin {
  to { transform: rotate(360deg); }
}

/* Tailwind utility fallbacks inside #shareView (viewer mode) */
html.viewer-mode #shareView .flex,
body.viewer-mode #shareView .flex,
body.share-mode #shareView .flex {
  display: flex !important;
}

html.viewer-mode #shareView .flex-wrap,
body.viewer-mode #shareView .flex-wrap,
body.share-mode #shareView .flex-wrap {
  flex-wrap: wrap !important;
}

html.viewer-mode #shareView .items-center,
body.viewer-mode #shareView .items-center,
body.share-mode #shareView .items-center {
  align-items: center !important;
}

html.viewer-mode #shareView .flex-1,
body.viewer-mode #shareView .flex-1,
body.share-mode #shareView .flex-1 {
  flex: 1 1 0% !important;
}

html.viewer-mode #shareView .min-w-0,
body.viewer-mode #shareView .min-w-0,
body.share-mode #shareView .min-w-0 {
  min-width: 0 !important;
}

html.viewer-mode #shareView .shrink-0,
body.viewer-mode #shareView .shrink-0,
body.share-mode #shareView .shrink-0 {
  flex-shrink: 0 !important;
}

html.viewer-mode #shareView .hidden,
body.viewer-mode #shareView .hidden,
body.share-mode #shareView .hidden {
  display: none !important;
}

/* Dark mode */
html.viewer-mode.share-dark #shareView,
body.share-mode.share-dark #shareView {
  background: linear-gradient(180deg, #0f172a 0%, #1e1b4b 50%, #1e1b4b 100%) !important;
}

html.viewer-mode.share-dark #shareView.share-view-page::before,
body.share-mode.share-dark #shareView.share-view-page::before {
  background: #4f46e5;
  opacity: 0.22;
}

html.viewer-mode.share-dark #shareView.share-view-page::after,
body.share-mode.share-dark #shareView.share-view-page::after {
  background: #7c3aed;
  opacity: 0.16;
}

html.viewer-mode.share-dark #shareView .share-view-panel,
body.share-mode.share-dark #shareView .share-view-panel {
  background: #18181b !important;
  border-color: #3f3f46 !important;
}

html.viewer-mode.share-dark #shareView .share-view-head,
body.share-mode.share-dark #shareView .share-view-head {
  background: linear-gradient(135deg, #3730a3 0%, #6d28d9 100%) !important;
}

html.viewer-mode.share-dark #shareView .share-view-body,
body.share-mode.share-dark #shareView .share-view-body {
  background: linear-gradient(180deg, #18181b 0%, #1e1b4b 100%) !important;
}

html.viewer-mode.share-dark #shareView .share-view-foot,
body.share-mode.share-dark #shareView .share-view-foot {
  background: linear-gradient(135deg, #27272a 0%, #312e81 100%) !important;
  border-color: #4338ca !important;
  color: #a5b4fc !important;
}

html.viewer-mode.share-dark #shareView .share-card,
body.share-mode.share-dark #shareView .share-card {
  background: #1e1b4b !important;
  border-color: #4338ca !important;
}

html.viewer-mode.share-dark #shareView .share-card-title,
body.share-mode.share-dark #shareView .share-card-title {
  color: #e0e7ff !important;
}

html.viewer-mode #btnExitShareView,
html.viewer-mode.share-dark #shareView #btnExitShareView {
  display: none !important;
}
