/* HSJ Lab 小工具（/tools）：上面一張說明視窗、下面十張工具卡片；點卡片打開對話框（內容由 tools.js 產生） */
.tl-page { max-width: 1080px; padding-top: 40px; gap: 40px; }
.tl-intro-body { padding-top: 28px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.tl-noscript { font-weight: 700; }

/* 卡片 */
.tl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 22px; }
.tl-card {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  min-height: 210px; padding: 28px 22px 26px;
  background: var(--white); color: var(--ink); border: var(--border); border-radius: 22px; box-shadow: var(--shadow);
  font: inherit; cursor: pointer; transition: transform .15s ease, box-shadow .15s ease;
}
.tl-card:hover { transform: translate(-2px, -2px); box-shadow: var(--shadow-lg); }
.tl-card:active { transform: translate(1px, 1px); box-shadow: var(--shadow-sm); }
.tl-ico {
  width: 64px; height: 64px; flex: none; display: inline-flex; align-items: center; justify-content: center;
  border: var(--border); border-radius: 18px; box-shadow: var(--shadow-sm);
}
.tl-card .tl-ico { margin-bottom: 6px; }
.tl-name { font-size: 20px; font-weight: 800; letter-spacing: .01em; }
.tl-desc { font-size: 14px; line-height: 1.6; color: var(--muted); max-width: 22em; }
@media (max-width: 560px) {
  .tl-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
  .tl-card { min-height: 0; padding: 20px 12px; gap: 6px; border-radius: 18px; }
  .tl-ico { width: 52px; height: 52px; border-radius: 15px; }
  .tl-ico svg { width: 26px; height: 26px; }
  .tl-name { font-size: 16px; }
  .tl-desc { font-size: 12px; }
}

/* 對話框 */
.tl-dialog {
  width: min(760px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 0;
  background: var(--white); color: var(--ink); border: var(--border); border-radius: 26px; box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.tl-dialog[open] { display: flex; flex-direction: column; }
.tl-dialog::backdrop { background: rgb(30 35 42 / .45); }
.tl-dialog-head {
  display: flex; align-items: center; gap: 14px; padding: 18px 20px 16px 22px;
  border-bottom: 2px dashed var(--line); flex: none;
}
.tl-dialog-ico { width: 46px; height: 46px; border-radius: 14px; }
.tl-dialog-ico svg { width: 24px; height: 24px; }
.tl-dialog-head h2 { flex: 1; font-size: 22px; font-weight: 800; }
.tl-close {
  width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  background: var(--white); color: var(--ink); border: var(--border); border-radius: 12px; box-shadow: var(--shadow-sm); cursor: pointer;
}
.tl-dialog-body { padding: 22px; overflow-y: auto; display: flex; flex-direction: column; gap: 18px; }
@media (max-width: 560px) {
  .tl-dialog { width: 100%; max-width: 100%; max-height: 100dvh; height: 100dvh; border-radius: 0; border: 0; margin: 0; }
  .tl-dialog-body { padding: 18px 16px 28px; }
}

/* 分頁切換（加密／解密、圖片合成 PDF／PDF 拆成圖片） */
.tl-seg { display: inline-flex; align-self: flex-start; padding: 4px; gap: 4px; background: var(--soft); border: var(--border); border-radius: 14px; }
.tl-seg button {
  min-height: 38px; padding: 6px 16px; border: 0; border-radius: 10px; background: transparent; color: var(--ink);
  font: 700 14px var(--sans); cursor: pointer;
}
.tl-seg button[aria-pressed="true"] { background: var(--ink); color: var(--white); }

/* 拖放區 */
.tl-drop {
  display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center;
  padding: 26px 18px; border: 2px dashed var(--ink); border-radius: 18px; background: var(--soft);
  transition: background .15s ease;
}
.tl-drop.is-over { background: var(--green); }
.tl-drop-title { font-size: 16px; font-weight: 800; }
.tl-drop-hint { font-size: 13px; color: var(--muted); }
.tl-drop-btns { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.tl-drop input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* 按鈕 */
.tl-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  padding: 8px 16px; background: var(--white); color: var(--ink); border: var(--border); border-radius: 12px;
  box-shadow: var(--shadow-sm); font: 700 14px var(--sans); text-decoration: none; cursor: pointer; white-space: nowrap;
}
.tl-btn.primary { background: var(--ink); color: var(--white); box-shadow: 3px 3px 0 #6BCB77; font-weight: 800; }
.tl-btn.small { min-height: 34px; padding: 4px 10px; font-size: 13px; border-radius: 10px; }
.tl-btn:disabled { opacity: .5; cursor: default; }
.tl-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }

/* 選項 */
.tl-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 200px), 1fr)); gap: 14px 18px; }
.tl-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.tl-field > span, .tl-field legend { font-size: 13px; font-weight: 800; }
.tl-field legend { padding: 0; margin-bottom: 6px; }
fieldset.tl-field { border: 0; margin: 0; padding: 0; }
.tl-field input[type="text"], .tl-field input[type="password"], .tl-field input[type="number"], .tl-field select {
  width: 100%; min-height: 42px; padding: 8px 12px; background: var(--white); color: var(--ink);
  border: var(--border); border-radius: 12px; font: 600 15px var(--sans);
}
.tl-field input[type="range"] { width: 100%; accent-color: var(--ink); }
.tl-choices { display: flex; flex-wrap: wrap; gap: 8px; }
.tl-choices label {
  display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 6px 12px;
  border: 1.5px solid var(--ink); border-radius: 999px; font-size: 14px; font-weight: 700; cursor: pointer; background: var(--white);
}
.tl-choices input { accent-color: var(--ink); margin: 0; }
.tl-choices label:has(input:checked) { background: var(--yellow); }
.tl-pass { display: flex; gap: 8px; }
.tl-pass input { flex: 1; }
.tl-check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 700; cursor: pointer; }
.tl-check input { accent-color: var(--ink); width: 18px; height: 18px; margin: 0; }
.tl-note { font-size: 13px; color: var(--muted); line-height: 1.7; }

/* 檔案清單與結果 */
.tl-list { list-style: none; margin: 0; padding: 0; border: var(--border); border-radius: 16px; overflow: hidden; }
.tl-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 52px; border-top: 1px solid var(--line); }
.tl-list li:first-child { border-top: 0; }
.tl-list .tl-thumb { width: 40px; height: 40px; object-fit: cover; border: 1.5px solid var(--ink); border-radius: 8px; flex: none; }
.tl-item { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.tl-item b { font-size: 14px; font-weight: 700; overflow-wrap: anywhere; }
.tl-item small { font: 500 12px var(--mono); color: var(--muted); overflow-wrap: anywhere; }
.tl-item small.bad { color: var(--bad); font-family: var(--sans); font-weight: 700; }
.tl-item small.ok { color: var(--ok); font-family: var(--sans); font-weight: 700; }
.tl-x {
  width: 32px; height: 32px; flex: none; display: inline-flex; align-items: center; justify-content: center; padding: 0;
  background: transparent; border: 1.5px solid var(--line-2); border-radius: 9px; color: var(--muted); cursor: pointer;
}
.tl-list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; font-weight: 800; }
.tl-more { justify-content: center; color: var(--muted); font-size: 13px; }

/* 雜湊值 */
.tl-hash { display: flex; align-items: flex-start; gap: 8px; margin-top: 4px; }
.tl-hash code {
  flex: 1; min-width: 0; font: 500 12.5px/1.5 var(--mono); overflow-wrap: anywhere; user-select: all;
  padding: 4px 8px; background: var(--soft); border-radius: 8px;
}
.tl-hash code.match { background: var(--green); }
.tl-hash code.mismatch { background: var(--pink); }
.tl-hash-name { font: 700 11px var(--mono); color: var(--muted); min-width: 4.5em; padding-top: 5px; }

/* 重新命名預覽 */
.tl-rename-new { font-weight: 800; }
.tl-rename-old { text-decoration: line-through; color: var(--muted); }

/* 進度 */
.tl-progress { display: flex; flex-direction: column; gap: 6px; }
.tl-progress progress { width: 100%; height: 14px; appearance: none; border: var(--border); border-radius: 999px; overflow: hidden; background: var(--soft); }
.tl-progress progress::-webkit-progress-bar { background: var(--soft); }
.tl-progress progress::-webkit-progress-value { background: #6BCB77; }
.tl-progress progress::-moz-progress-bar { background: #6BCB77; }
.tl-status { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.tl-status.bad { color: var(--bad); }
.tl-status.ok { color: var(--ok); }

/* 排序按鈕（圖片合成 PDF） */
.tl-order { display: flex; gap: 4px; flex: none; }
