/* 歌詞頁樣式（自 hymn-lyrics.html 搬出，只搬不改） */
    /* V3 極小修正：不向一般使用者顯示內部搜尋順位；保留 DOM 節點供既有 JS 更新與後台設定使用。 */
    #sourceOrderList, #sourceBadge { display: none !important; }
    /* 中性分享網址只隱藏品牌 Header 和署名；管理員齒輪及下拉選單照常可用。 */
    .neutral-attribution { display: none !important; }
    html.neutral-lyrics #clc-header,
    html.neutral-lyrics body > footer { display: none !important; } /* 單獨分享（沒有 Header）時也不要 Footer */
    html { font-size: 15px; }
    /* 全站字型：英文 Arial、中文微軟正黑體（三站一致；粗體用 Arial Bold，見 header.js） */
    body {
      -webkit-font-smoothing: antialiased;
      transition: background-color 0.3s ease, color 0.3s ease;
      font-family: "CLC Arial", Arial, "Microsoft JhengHei", sans-serif; /* 英文 Arial、中文微軟正黑體 */
    }

    #clc-header {
      font-family: "CLC Arial", Arial, "Microsoft JhengHei", sans-serif !important;
      font-size: 16px; /* 首頁 Header 使用 16px/19px 的字級基準 */
    }
    @media (min-width: 1024px) { #clc-header { font-size: 19px; } }

    /* 容器與紙張樣式 (歌詞區域專用微軟正黑體) */
    .sheet-page {
      background: #ffffff;
      color: #000000;
      box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.3);
      position: relative;
      margin: 0 auto 2rem auto;
      page-break-after: always;
      break-after: page;
      box-sizing: border-box;
      font-family: "CLC Arial", Arial, "Microsoft JhengHei", sans-serif; /* 英文 Arial、中文微軟正黑體 */
      text-align: center; /* 歌詞全部至中 */
    }

    /* 1. A4 直向 (210mm x 297mm，邊距 12.7mm) */
    .sheet-a4-portrait {
      width: 210mm;
      min-height: 297mm;
      max-height: 297mm;
      padding: 12.7mm;
      overflow: hidden;
    }

    /* 2. A3 直向 (297mm x 420mm，邊距 12.7mm) */
    .sheet-a3-portrait {
      width: 297mm;
      min-height: 420mm;
      max-height: 420mm;
      padding: 12.7mm;
      overflow: hidden;
    }

    /* 3. A3 橫向 (420mm x 297mm，邊距 上12.7mm 左右下4.1mm 用於A2拼貼) */
    .sheet-a3-landscape-split {
      width: 420mm;
      min-height: 297mm;
      max-height: 297mm;
      padding: 12.7mm 4.1mm 4.1mm 4.1mm;
      overflow: hidden;
    }

    @media screen and (max-width: 1023px), screen and (hover: none) and (pointer: coarse) {
      #previewZoomControls { display: none !important; }
    }
    /* 螢幕預覽縮放 */
    @media screen {
      .preview-scaler {
        transform-origin: top center;
        transition: transform 0.2s ease;
      }
    }

    /* 白紙上的段落工具：滑過（或點進段落）時右上角出現 ⤒併入上段／＋新增段落／－刪除段落；列印與 PDF 不會輸出 */
    .sheet-page .lyrics-section.has-tools { position: relative; border-radius: 6px; }
    .sec-tools { position: absolute; z-index: 5; display: flex; align-items: center; gap: 0.3em; opacity: 0; pointer-events: none; transition: opacity .15s; }
    .sec-tools.sec-tr { top: -0.2em; right: -0.2em; }
    .sec-tools.sec-tl { top: -0.2em; left: -0.2em; }
    .sec-tools.sec-bl { bottom: -0.2em; left: -0.2em; }
    .sec-tools.sec-br { bottom: -0.2em; right: -0.2em; }
    /* 段落標題旁的類型下拉：只顯示 ▾，透明的 select 疊在上面；點標題文字仍可直接編輯 */
    .sec-tools.sec-type { top: 0; left: 50%; }
    .sec-type .sec-type-btn { position: relative; width: 1.6em; height: 1.6em; border-radius: 999px; border: 0.08em solid #94a3b8; background: #fff; color: #334155;
      display: grid; place-items: center; font: 800 0.8em/1 system-ui, sans-serif; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
    .sec-type .sec-type-btn:hover { border-color: #007E8A; color: #007E8A; }
    .sec-type select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
    .lyrics-section.has-tools:hover > .sec-tools, .lyrics-section.has-tools:focus-within > .sec-tools { opacity: 1; pointer-events: auto; }
    .sec-tools .sec-grip { cursor: grab; letter-spacing: -0.1em; }
    .sec-tools select { height: 1.8em; border-radius: 999px; border: 0.08em solid #94a3b8; background: #fff; color: #334155; font: 700 0.75em/1 system-ui, sans-serif; padding: 0 0.5em; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
    .lyrics-section.drop-before { box-shadow: 0 -4px 0 0 #007E8A; }
    .lyrics-section.drop-after { box-shadow: 0 4px 0 0 #007E8A; }
    .lyrics-section.dragging-src { opacity: 0.45; }
    .sec-tools button { width: 1.8em; height: 1.8em; border-radius: 999px; border: 0.08em solid #94a3b8; background: #fff; color: #334155;
      font: 800 1em/1 system-ui, sans-serif; box-shadow: 0 1px 3px rgba(0,0,0,.15); cursor: pointer; display: grid; place-items: center; }
    .sec-tools button:hover { border-color: #007E8A; color: #007E8A; }
    .sec-tools button.sec-del:hover { border-color: #e11d48; color: #e11d48; }
    /* 空白段落：網站主色（藍綠）淡底＋虛線框＋小字「請新增歌詞」，填入歌詞後自動消失 */
    :root { --empty-bg: rgba(127, 214, 223, 0.16); --empty-border: #7fd6df; --empty-text: #007E8A; }
    .lyrics-section.sec-empty { background: var(--empty-bg); outline: 1.5px dashed var(--empty-border); outline-offset: 2px; }
    .lyrics-section.sec-empty .lyrics-block:empty::before { content: '＋ 請新增歌詞'; display: inline-block; font-size: 0.42em; line-height: calc(var(--lh, 1.25) / 0.42); font-weight: 600; letter-spacing: 0.08em; color: var(--empty-text); opacity: 0.8; }
    @media (hover: none) { .lyrics-section.has-tools > .sec-tools { opacity: 1; pointer-events: auto; } }

    /* ⓘ 說明：平常收起，滑過或點一下（手機）才顯示 */
    .hint { position: relative; display: inline-grid; place-items: center; width: 16px; height: 16px; margin-left: 4px; border-radius: 999px;
      border: 1px solid currentColor; font: 700 10px/1 system-ui, sans-serif; color: #94a3b8; cursor: help; vertical-align: middle; background: transparent; padding: 0; }
    .hint:hover, .hint:focus { color: #007E8A; outline: none; }
    .hint::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%); z-index: 60;
      width: max-content; max-width: 240px; white-space: normal; text-align: left; padding: 8px 10px; border-radius: 10px;
      background: #1e293b; color: #f8fafc; font: 500 11px/1.5 system-ui, sans-serif; box-shadow: 0 6px 18px rgba(0,0,0,.25);
      opacity: 0; pointer-events: none; transition: opacity .15s; }
    .hint:hover::after, .hint:focus::after { opacity: 1; }
    .hint.tip-left::after { left: auto; right: -6px; transform: none; }
    /* 字級（2026-11-30，照準則 2-1：Material 3／Apple 參考）：最小 12px、說明 13px、內文與按鈕 14px、標題 16px；紙張與投影片預覽本身的字級不受影響 */
    main :is(.text-\[9px\], .text-\[10px\], .text-\[11px\]) { font-size: 12px !important; }
    main :is(.text-xs, .text-\[12px\]) { font-size: 13px !important; }
    main :is(.text-sm, .text-\[13px\]) { font-size: 14px !important; }
    @media (min-width: 640px) {
      main [class*="sm:text-xs"] { font-size: 13px !important; }
      main [class*="sm:text-sm"] { font-size: 14px !important; }
      main [class*="sm:text-base"], main h2.text-base { font-size: 16px !important; }
    }
    @media (max-width: 767px) { main :is(input[type="text"], input[type="search"], input:not([type]), select, textarea) { font-size: 16px !important; } }
    .hint { font-size: 13px !important; }
    .hint::after { font-size: 13px !important; }

    /* 可直接在畫面上點選編輯文字 */
    .editable-focus {
      outline: none;
      border-radius: 4px;
      transition: background-color 0.2s;
    }
    .editable-focus:hover {
      background-color: rgba(0, 126, 138, 0.08);
    }
    .editable-focus:focus {
      background-color: rgba(245, 158, 11, 0.18);
      box-shadow: 0 0 0 2px #F59E0B;
    }
    @media print {
      .editable-focus:focus { background: transparent !important; box-shadow: none !important; }
    }

    /* 歌詞輸出：長句自動折行，不依賴 Tailwind CDN 是否載入。 */
    .sheet-page .lyrics-line,
    .sheet-page .lyrics-label,
    .sheet-page .lyrics-title {
      display: block;
      width: 100%;
      max-width: 100%;
      min-width: 0;
      box-sizing: border-box;
      white-space: pre-wrap !important;
      overflow-wrap: anywhere !important;
      word-break: break-word !important;
      text-align: center;
    }
    .sheet-page .lyrics-section { width: 100%; min-width: 0; }
    /* 整篇編輯 */
    #printArea.paper-editor { outline: none; caret-color: #007E8A; cursor: text; }
    #printArea.paper-editor .lyr-label[data-empty="1"]::before { content: '（段落標籤）'; color: #94a3b8; font-weight: 400; }
    #printArea .lyr-gap { user-select: none; }
    #printArea .lyr-type { position: absolute; z-index: 5; line-height: 1; user-select: none; }
    #printArea .lyr-type button { width: 1.3em; height: 1.3em; display: inline-flex; align-items: center; justify-content: center; font: 400 1em/1 Arial, sans-serif; color: #64748b; background: transparent; border: 0; border-radius: 4px; padding: 0; cursor: pointer; opacity: 0.7; }
    #printArea .lyr-type button:hover, #printArea .lyr-type button:focus { background: #e2e8f0; outline: none; opacity: 1; }
    /* 段落類型選單：圓角、半透明底、靠左、無外框 */
    #labelMenu { position: fixed; z-index: 70; min-width: 132px; padding: 4px; border-radius: 12px; background: rgba(255,255,255,0.78); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); box-shadow: 0 10px 30px rgba(15,23,42,0.18), 0 1px 3px rgba(15,23,42,0.10); display: flex; flex-direction: column; }
    #labelMenu button { text-align: left; padding: 7px 12px; border: 0; border-radius: 8px; background: transparent; color: #1e293b; font: 500 14px/1.2 "CLC Arial", Arial, "Microsoft JhengHei", sans-serif; cursor: pointer; }
    #labelMenu button:hover, #labelMenu button:focus { background: rgba(0,126,138,0.12); outline: none; }
    #labelMenu button.on { color: #007E8A; font-weight: 700; }
    #labelMenu { padding-bottom: 2px; }
    #labelMenu button:last-child { padding-bottom: 4px; } /* 最後一行下方留白減半 */
    .dark #labelMenu { background: rgba(30,35,48,0.78); box-shadow: 0 10px 30px rgba(0,0,0,0.45); }
    .dark #labelMenu button { color: #e2e8f0; }
    .dark #labelMenu button:hover, .dark #labelMenu button:focus { background: rgba(45,212,191,0.16); }
    .dark #labelMenu button.on { color: #5eead4; }
    #printArea .lyr-type select:hover, #printArea .lyr-type select:focus { opacity: 1; }
    /* 文字以換行結尾時，在最後一行保留可見的空白行高度（不改動實際歌詞資料）。 */
    .sheet-page .lyrics-block[data-trailing-break="1"]::after { content: "\200B"; }
    @media print {
      #printArea { margin: 0 !important; padding: 0 !important; }
      #printArea > .sheet-page { margin: 0 !important; }
    }

    /* 搜尋框：黃色外框＋淡淡光暈，提示可在這裡輸入（點進去輸入時改回原本的藍綠色框） */
    .search-glow { border-color: #E2BE3A !important; }
    .search-glow:not(:focus-within) { box-shadow: 0 0 0 3px rgba(242,215,92,.22), 0 0 12px rgba(242,215,92,.35); }
    .dark .search-glow { border-color: rgba(242,215,92,.55) !important; }
    .dark .search-glow:not(:focus-within) { box-shadow: 0 0 0 3px rgba(242,215,92,.10), 0 0 12px rgba(242,215,92,.18); }
    /* 一鍵列印樣式（快捷鍵 Ctrl+P 容錯保護） */
    @media print {
      body {
        background: #ffffff !important;
        color: #000000 !important;
        margin: 0 !important;
        padding: 0 !important;
      }
      #clc-header, #controlPanel, footer, .no-print,
      #globalSettingsModal, #globalStatusModal, #globalRegistrationStatusModal,
      body > .fixed {
        display: none !important;
      }
      #previewViewport {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        background: transparent !important;
        overflow: visible !important;
      }
      .preview-scaler {
        transform: none !important;
      }
      .sheet-page {
        margin: 0 !important;
        box-shadow: none !important;
        page-break-after: always !important;
        break-after: page !important;
      }
      .sheet-page:last-child {
        page-break-after: avoid !important;
        break-after: avoid !important;
        margin-bottom: 0 !important;
      }
    }
    /* V5：桌面為左控制欄＋右預覽；手機為搜尋→設定→預覽→下載。 */
    .mode-tab[aria-selected="true"] { background:#007E8A; color:#fff; border-color:#007E8A; }
    .mode-tab[aria-selected="false"] { background:transparent; border-color:rgba(125,145,165,.4); }
    #printWorkspace.hidden, #pptWorkspace.hidden, #printPreview.hidden, #pptPreview.hidden { display:none !important; }
    #leftSidebar, #rightPreview { display:contents; }
    #printWorkspace:not(.hidden), #pptWorkspace:not(.hidden),
    #printPreview:not(.hidden), #pptPreview:not(.hidden) { display:contents; }
    #searchCard { order:0; }
    #layoutSettingsCard, #pptControls { order:1; min-width:0; }
    #lyricsPreviewColumn, #pptPreviewColumn { order:2; min-width:0; }
    #adminSaveCard, #downloadActions { order:3; min-width:0; }
    #quickSongAdmin { order:4; min-width:0; }
    @media screen and (min-width:1024px) {
      #leftSidebar { display:flex; flex-direction:column; flex:0 0 410px; min-width:0; gap:16px; }
      #rightPreview { display:flex; flex:1; min-width:0; }
      #printWorkspace:not(.hidden), #pptWorkspace:not(.hidden) { display:flex; flex-direction:column; gap:16px; width:100%; }
      #printPreview:not(.hidden), #pptPreview:not(.hidden) { display:flex; flex:1; min-width:0; }
      #layoutSettingsCard, #adminSaveCard, #downloadActions, #quickSongAdmin, #pptControls, #lyricsPreviewColumn, #pptPreviewColumn { order:initial; }
      #pptControls { width:100%; }
      #lyricsPreviewColumn, #pptPreviewColumn { width:100%; }
    }
    #previewViewport { min-height:0 !important; }
    #previewStage { position:relative; flex:0 0 auto; }
    #previewCanvas { position:absolute; top:0; left:0; transform-origin:top left !important; }
    #pptSlideVisual { position:relative; aspect-ratio:16 / 9; overflow:hidden; }
    #pptSlideVisual .ppt-text {
      position:absolute; overflow-wrap:anywhere; width:86%; left:7%; text-align:center;
      font-family:Arial,"Microsoft JhengHei",sans-serif; font-weight:800;
      white-space:pre-line; line-height:1;
    }
    /* PPT 縮圖列：隱藏橫向捲軸，保留觸控／滑鼠滑動，短歌單依舊置中。 */
    #pptThumbs { position:relative; min-width:0; scrollbar-width:none; -ms-overflow-style:none; touch-action:pan-x; overscroll-behavior-x:contain; cursor:grab; user-select:none; }
    #pptThumbs::-webkit-scrollbar { display:none; }
    /* 滑軌略過點擊，保留原生把手拖動與鍵盤操作。 */
    .hymn-thumb-only { pointer-events: none; }
    .hymn-thumb-only::-webkit-slider-thumb { pointer-events: auto; cursor: grab; }
    .hymn-thumb-only::-moz-range-thumb { pointer-events: auto; cursor: grab; }
    #pptPresetStrip { touch-action:pan-x; overscroll-behavior-x:contain; cursor:grab; user-select:none; }
    #pptPresetStrip::-webkit-scrollbar { display:none; }
    #pptPresetStrip.dragging { cursor:grabbing; }
    #pptThumbs.dragging { cursor:grabbing; }
    #pptThumbs > button:first-child { margin-left:auto; }
    #pptThumbs > button:last-child { margin-right:auto; }
    #pptImageDrop.dragging { border-color:#007E8A !important; background:rgba(0,126,138,.12); }
    @media print {
      #leftSidebar,#pptPreview { display:none !important; }
      #rightPreview,#printPreview,#lyricsPreviewColumn { display:block !important; }
      #previewStage { width:auto !important; height:auto !important; position:static !important; }
      #previewCanvas { position:static !important; transform:none !important; width:auto !important; }
      #previewViewport { display:block !important; overflow:visible !important; }
    }
/* 電腦滿版（2026-11-30 改）：兩欄＝左（搜尋、版面規格、下載，隨螢幕加寬、固定並自己捲動）｜右白紙；手機不變 */
@media screen and (min-width: 1024px) {
  main.hymn-main #leftSidebar { flex-basis: clamp(380px, 26vw, 480px); align-self: flex-start; position: sticky; top: 60px;
    max-height: calc(100dvh - 72px); overflow-y: auto; overscroll-behavior: contain; padding-right: 4px; }
  #leftSidebar > #ytSuggestBar { flex-shrink: 0; }
  /* 齒輪（準則：電腦放內容區最右上角，手機放第一張卡片右上角） */
  main.hymn-main { position: relative; }
  main.hymn-main > #hymnGearWrap { position: absolute; top: 20px; right: 24px; z-index: 40; }
  main.hymn-main #previewZoomToolbar, main.hymn-main #pptPreviewColumn > :first-child { padding-right: 40px; }
  /* 左欄固定位置：有 Header 時在 Header（48px）下面；單獨分享／內嵌（沒有 Header）時貼齊上緣，和右邊預覽頂端對齊 */
  html.neutral-lyrics main.hymn-main #leftSidebar { top: 12px; max-height: calc(100dvh - 24px); }
}

