:root {
  --bg: #f6f5f1;
  --surface: #ffffff;
  --surface-2: #efede7;
  --text: #1d1c1a;
  --muted: #6b6860;
  --line: #e2dfd7;
  --accent: #b5501a;
  --accent-ink: #ffffff;
  --accent-soft: #fdf2ea;
  --warn: #9a5b12;
  --warn-soft: #fbf0df;
  --error: #a3322a;
  --error-soft: #fbe6e3;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 28, 24, .06), 0 6px 24px rgba(30, 28, 24, .06);
  --font: "Noto Sans TC", "PingFang TC", "Microsoft JhengHei", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #161714;
    --surface: #1f201d;
    --surface-2: #282a26;
    --text: #ecebe6;
    --muted: #a3a197;
    --line: #34362f;
    --accent: #f2a463;
    --accent-ink: #2a1406;
    --accent-soft: #3a2a1e;
    --warn: #e0a85c;
    --warn-soft: #3a2f1f;
    --error: #ef8a80;
    --error-soft: #3d2422;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 28px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #161714; --surface: #1f201d; --surface-2: #282a26; --text: #ecebe6; --muted: #a3a197;
  --line: #34362f; --accent: #f2a463; --accent-ink: #2a1406; --accent-soft: #3a2a1e;
  --warn: #e0a85c; --warn-soft: #3a2f1f; --error: #ef8a80; --error-soft: #3d2422; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.65 var(--font); overflow-x: hidden;
}
a { color: var(--accent); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* header */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { display: flex; align-items: center; justify-content: space-between; height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 9px; background: var(--accent); color: var(--accent-ink); }
.header-nav { display: flex; gap: 18px; font-size: 14px; }
.header-nav a { color: var(--muted); text-decoration: none; }
.header-nav a:hover { color: var(--text); }

/* layout：寬螢幕右側放側欄廣告 */
.wrap { max-width: 1240px; }
.layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; }
.side-col { display: none; }
@media (min-width: 1100px) {
  .layout { grid-template-columns: minmax(0, 1fr) 300px; }
  .side-col { display: block; padding-top: 24px; }
  .ad-side { position: sticky; top: 20px; min-height: 600px; }
}

/* ad slots */
.ad-slot { overflow: hidden; }
.ad-placeholder {
  display: grid; place-items: center; color: var(--muted); font-size: 12px; letter-spacing: .04em;
  border: 1px dashed var(--line); border-radius: 10px;
  background: repeating-linear-gradient(-45deg, transparent 0 10px, var(--surface-2) 10px 11px);
}
.ad-top { min-height: 90px; margin-top: 16px; }
.ad-mid { min-height: 120px; margin: 40px 0; }
.ad-bottom { min-height: 90px; margin: 8px auto 0; }

/* hero */
.hero { padding: 44px 0 8px; text-align: center; }
h1 { font-size: clamp(26px, 4.4vw, 40px); line-height: 1.25; margin: 0 0 12px; letter-spacing: -.01em; }
.lead { color: var(--muted); max-width: 640px; margin: 0 auto 28px; }
.lead strong { color: var(--text); }
.br-sm { display: none; }

.drop {
  display: flex; flex-direction: column; align-items: center; gap: 8px; cursor: pointer;
  max-width: 720px; margin: 0 auto; padding: 44px 20px;
  background: var(--surface); border: 2px dashed var(--line); border-radius: 20px; box-shadow: var(--shadow);
  transition: border-color .15s, background .15s, transform .15s;
}
.drop:hover, .drop:focus-visible { border-color: var(--accent); outline: none; }
.drop.dragging { border-color: var(--accent); background: var(--accent-soft); transform: scale(1.01); }
.drop.disabled { cursor: progress; opacity: .7; }
.drop-icon { color: var(--accent); }
.drop-title { font-size: 18px; font-weight: 600; }
.drop-title u { text-decoration-color: var(--accent); text-underline-offset: 4px; }
.drop-sub { font-size: 13px; color: var(--muted); }

.progress { max-width: 720px; margin: 18px auto 0; }
.progress-bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress-bar span { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 99px; transition: width .2s; }
.progress-bar.indeterminate span { width: 35%; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { from { transform: translateX(-100%); } to { transform: translateX(290%); } }
.progress-text { margin-top: 8px; font-size: 13px; color: var(--muted); word-break: break-all; }

.alert { max-width: 720px; margin: 18px auto 0; padding: 12px 16px; border-radius: 10px; background: var(--error-soft); color: var(--error); text-align: left; }
.notice { margin: 0 0 14px; padding: 10px 14px; border-radius: 10px; background: var(--warn-soft); color: var(--warn); font-size: 14px; }

/* results */
.results { margin-top: 36px; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 22px; box-shadow: var(--shadow); }
.results-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; }
.results-head h2 { margin: 0; font-size: 22px; word-break: break-all; }
.results-head p { margin: 2px 0 0; font-size: 14px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.btn {
  font: inherit; font-size: 14px; font-weight: 600; padding: 9px 16px; border-radius: 10px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .6; cursor: progress; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.06); border-color: var(--accent); }

.toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0 16px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 99px; cursor: pointer;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
}
.tab[aria-selected="true"] { background: var(--text); color: var(--bg); border-color: var(--text); }
.tab .n { opacity: .7; margin-left: 4px; }
.toggle { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.search {
  margin-left: auto; font: inherit; font-size: 14px; padding: 7px 12px; min-width: 180px;
  border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text);
}

.grid { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.card { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--bg); display: flex; flex-direction: column; min-width: 0; }
.thumb {
  height: 128px; display: grid; place-items: center; background:
    conic-gradient(var(--surface-2) 25%, transparent 0 50%, var(--surface-2) 0 75%, transparent 0) 0 0 / 16px 16px;
  color: var(--muted); font-size: 12px; font-weight: 700; letter-spacing: .06em; overflow: hidden;
}
.thumb img { max-width: 100%; max-height: 100%; image-rendering: auto; }
.thumb img.pixel { image-rendering: pixelated; }
.thumb audio, .thumb video { width: 92%; max-height: 120px; }
.thumb pre { margin: 0; padding: 10px; width: 100%; height: 100%; overflow: hidden; font: 11px/1.45 var(--mono); color: var(--text); white-space: pre-wrap; word-break: break-all; text-align: left; background: var(--surface); }
.badge { padding: 6px 10px; border-radius: 8px; background: var(--surface); border: 1px solid var(--line); }
.meta { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sub { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.chip { font-size: 11px; padding: 1px 7px; border-radius: 99px; background: var(--accent-soft); color: var(--accent); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60%; }
.dl { font: inherit; font-size: 12px; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 0; cursor: pointer; }
.empty { text-align: center; color: var(--muted); padding: 30px 0; grid-column: 1 / -1; }
.more-wrap { text-align: center; margin-top: 14px; }

.log { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 14px; font-size: 14px; }
.log summary { cursor: pointer; font-weight: 600; }
.log-item { margin: 10px 0 0; padding: 10px 12px; border-radius: 10px; background: var(--bg); border: 1px solid var(--line); }
.log-item b { font-family: var(--mono); font-size: 12px; }
.log-item .ex { font-size: 12px; color: var(--muted); word-break: break-all; margin-top: 4px; }
.lv-error { border-left: 3px solid var(--error); }
.lv-warning { border-left: 3px solid var(--warn); }
.lv-info { border-left: 3px solid var(--line); }

.results-title { min-width: 0; }
.path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.font-sample { font-size: 26px; color: var(--text); padding: 0 8px; text-align: center; line-height: 1.3; word-break: break-all; }

/* password dialog */
.pw-dialog {
  border: 1px solid var(--line); border-radius: 16px; padding: 22px; width: min(420px, calc(100vw - 32px));
  background: var(--surface); color: var(--text); box-shadow: var(--shadow);
}
.pw-dialog::backdrop { background: rgba(0, 0, 0, .45); }
.pw-dialog h3 { margin: 0 0 6px; font-size: 18px; word-break: break-all; }
.pw-dialog p { margin: 0 0 14px; font-size: 14px; }
.pw-dialog .pw-wrong { color: var(--error); }
.pw-dialog input {
  width: 100%; font: inherit; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--text);
}
.pw-dialog input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.pw-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

/* info sections */
.info { margin: 48px 0; }
.info h2 { font-size: 22px; margin: 0 0 16px; }
.format-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 12px; }
.fg { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.fg h3 { margin: 0 0 6px; font-size: 16px; }
.fg p { margin: 0; color: var(--muted); font-size: 14px; }
.faq details { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin-bottom: 8px; }
.faq summary { cursor: pointer; font-weight: 600; }
.faq p { margin: 8px 0 2px; color: var(--muted); }

/* 文件頁（隱私權政策、使用條款） */
.doc { max-width: 760px; padding-top: 32px; padding-bottom: 20px; }
.doc h1 { font-size: 30px; margin: 0 0 4px; }
.doc h2 { font-size: 19px; margin: 28px 0 8px; }
.doc p, .doc li { color: var(--text); }
.doc ul { padding-left: 22px; }
.fill-in { background: var(--warn-soft); color: var(--warn); padding: 1px 6px; border-radius: 6px; }

.site-footer { border-top: 1px solid var(--line); margin-top: 40px; background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 20px 16px; font-size: 13px; }

@media (max-width: 640px) {
  .br-sm { display: inline; }
  .hero { padding-top: 28px; }
  .drop { padding: 32px 16px; }
  .ad-top { height: 60px; }
  .results { padding: 16px; border-radius: 16px; }
  .search { margin-left: 0; width: 100%; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .thumb { height: 104px; }
  .header-nav { gap: 12px; }
}
