/* ==========================================================================
   御宅道場工具站 — 設計系統
   中性底色 + 藍色主色，朱色只用在品牌與遊戲分類。所有顏色以 token 定義，
   深色模式只需覆寫 token。
   ========================================================================== */

:root {
  --bg: #f6f6f3;
  --surface: #ffffff;
  --surface-2: #f1f1ed;
  --surface-3: #e9e9e4;
  --border: #e3e3dd;
  --border-strong: #d2d2ca;
  --text: #1b1b19;
  --text-2: #57574f;
  --text-3: #85857c;
  --primary: #3a4fd8;
  --primary-hover: #2e41bf;
  --primary-soft: #eceffd;
  --on-primary: #ffffff;
  --brand: #e2502c;
  --good: #1d8a5a;
  --good-soft: #e6f4ec;
  --warn: #a96b00;
  --warn-soft: #fbf1dc;
  --bad: #cf3245;
  --bad-soft: #fbe9eb;
  --focus: 0 0 0 3px rgb(58 79 216 / 0.28);
  --shadow-sm: 0 1px 2px rgb(20 20 15 / 0.05);
  --shadow: 0 1px 2px rgb(20 20 15 / 0.04), 0 4px 16px rgb(20 20 15 / 0.05);
  --shadow-lg: 0 12px 40px rgb(20 20 15 / 0.16);

  --c-developer-tools: #4554d6;
  --c-text-tools: #0d8582;
  --c-converters: #7a4ee0;
  --c-image-tools: #d03f76;
  --c-calculators: #b77a07;
  --c-website-checkers: #2675c9;
  --c-gaming-tools: #e2502c;

  --font-sans: system-ui, -apple-system, "Segoe UI", "PingFang TC", "Microsoft JhengHei", "Noto Sans TC", "Hiragino Sans", "Yu Gothic UI", "Meiryo", sans-serif;
  --font-mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", "Consolas", "Menlo", monospace;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --container: 1200px;
  --header-h: 60px;

  color-scheme: light;
}

:root:lang(ja) {
  --font-sans: system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Yu Gothic UI", "Meiryo", "Noto Sans JP", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111112;
    --surface: #19191b;
    --surface-2: #212124;
    --surface-3: #2a2a2e;
    --border: #2c2c30;
    --border-strong: #3a3a40;
    --text: #ececea;
    --text-2: #a9a9a2;
    --text-3: #7c7c76;
    --primary: #7f8dff;
    --primary-hover: #97a3ff;
    --primary-soft: #23264a;
    --on-primary: #0d0f24;
    --brand: #ff6a45;
    --good: #4cc38a;
    --good-soft: #15291f;
    --warn: #e9b44c;
    --warn-soft: #2d2412;
    --bad: #ff6b7c;
    --bad-soft: #321a1e;
    --focus: 0 0 0 3px rgb(127 141 255 / 0.35);
    --shadow-sm: none;
    --shadow: 0 1px 0 rgb(255 255 255 / 0.02);
    --shadow-lg: 0 16px 48px rgb(0 0 0 / 0.5);
    --c-developer-tools: #8c96ff;
    --c-text-tools: #3cc6c1;
    --c-converters: #b296ff;
    --c-image-tools: #ff7fab;
    --c-calculators: #e9b44c;
    --c-website-checkers: #6cb0ff;
    --c-gaming-tools: #ff7a55;
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #111112;
  --surface: #19191b;
  --surface-2: #212124;
  --surface-3: #2a2a2e;
  --border: #2c2c30;
  --border-strong: #3a3a40;
  --text: #ececea;
  --text-2: #a9a9a2;
  --text-3: #7c7c76;
  --primary: #7f8dff;
  --primary-hover: #97a3ff;
  --primary-soft: #23264a;
  --on-primary: #0d0f24;
  --brand: #ff6a45;
  --good: #4cc38a;
  --good-soft: #15291f;
  --warn: #e9b44c;
  --warn-soft: #2d2412;
  --bad: #ff6b7c;
  --bad-soft: #321a1e;
  --focus: 0 0 0 3px rgb(127 141 255 / 0.35);
  --shadow-sm: none;
  --shadow: 0 1px 0 rgb(255 255 255 / 0.02);
  --shadow-lg: 0 16px 48px rgb(0 0 0 / 0.5);
  --c-developer-tools: #8c96ff;
  --c-text-tools: #3cc6c1;
  --c-converters: #b296ff;
  --c-image-tools: #ff7fab;
  --c-calculators: #e9b44c;
  --c-website-checkers: #6cb0ff;
  --c-gaming-tools: #ff7a55;
  color-scheme: dark;
}

/* ---------- Base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: calc(var(--header-h) + 16px); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 1em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { max-width: 100%; }
code, kbd, pre, samp { font-family: var(--font-mono); font-size: .9em; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: var(--radius-sm); }
::selection { background: var(--primary-soft); }

.icon { width: 1.15em; height: 1.15em; flex: none; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.2em; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.container { width: 100%; max-width: var(--container); margin: 0 auto; padding: 0 20px; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; padding: 8px 14px; background: var(--primary); color: var(--on-primary); border-radius: var(--radius-sm); }
.skip-link:focus { top: 12px; }
[hidden] { display: none !important; }

/* ---------- Header ---------- */

.site-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  background: color-mix(in srgb, var(--bg) 86%, transparent);
  backdrop-filter: saturate(1.6) blur(14px);
  -webkit-backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 20px; height: 100%; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 30px; height: 30px; color: var(--brand); flex: none; }
.brand-sub { color: var(--text-3); font-weight: 600; }
.header-nav { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.header-nav::-webkit-scrollbar { display: none; }
.header-nav a { padding: 6px 10px; border-radius: var(--radius-sm); color: var(--text-2); font-size: .92rem; font-weight: 500; white-space: nowrap; }
.header-nav a:hover, .header-nav a[aria-current="page"] { color: var(--text); background: var(--surface-2); text-decoration: none; }
.header-actions { display: flex; align-items: center; gap: 6px; margin-left: auto; }

.search-trigger {
  display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 12px; min-width: 200px;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); color: var(--text-3);
  font: inherit; font-size: .9rem; cursor: pointer; box-shadow: var(--shadow-sm);
}
.search-trigger:hover { border-color: var(--border-strong); color: var(--text-2); }
.search-trigger kbd { margin-left: auto; padding: 1px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: .75rem; color: var(--text-3); background: var(--surface-2); }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: var(--radius); background: transparent; color: var(--text-2); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.icon-btn .icon { width: 20px; height: 20px; }
[data-theme-toggle] .i-moon { display: none; }
:root[data-theme="dark"] [data-theme-toggle] .i-sun { display: none; }
:root[data-theme="dark"] [data-theme-toggle] .i-moon { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) [data-theme-toggle] .i-sun { display: none; }
  :root:not([data-theme="light"]) [data-theme-toggle] .i-moon { display: inline; }
}

.lang-menu { position: relative; }
.lang-menu summary { list-style: none; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 10px; border-radius: var(--radius); color: var(--text-2); cursor: pointer; font-size: .9rem; }
.lang-menu summary::-webkit-details-marker { display: none; }
.lang-menu summary:hover { background: var(--surface-2); color: var(--text); }
.lang-menu ul { position: absolute; right: 0; top: calc(100% + 6px); min-width: 150px; margin: 0; padding: 6px; list-style: none; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.lang-menu li a { display: block; padding: 7px 10px; border-radius: var(--radius-sm); color: var(--text); font-size: .92rem; }
.lang-menu li a:hover { background: var(--surface-2); text-decoration: none; }
.lang-menu li a[aria-current="true"] { color: var(--primary); font-weight: 600; }

.menu-toggle { display: none; }

@media (max-width: 1100px) {
  .search-trigger { min-width: 0; }
  .search-trigger span, .search-trigger kbd { display: none; }
  .search-trigger { width: 36px; padding: 0; justify-content: center; border-color: transparent; background: transparent; box-shadow: none; }
}

@media (max-width: 860px) {
  .menu-toggle { display: inline-grid; }
  .header-nav {
    position: fixed; inset: var(--header-h) 0 auto 0; flex-direction: column; gap: 2px; padding: 12px 16px 20px;
    background: var(--surface); border-bottom: 1px solid var(--border); box-shadow: var(--shadow-lg);
    transform: translateY(-8px); opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s;
  }
  .header-nav.is-open { transform: none; opacity: 1; pointer-events: auto; }
  .header-nav a { padding: 10px 12px; font-size: 1rem; }
  .brand-sub { display: none; }
}

/* ---------- Footer ---------- */

.site-footer { margin-top: 72px; border-top: 1px solid var(--border); background: var(--surface); color: var(--text-2); font-size: .92rem; }
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 32px; padding: 40px 20px 28px; }
.footer-grid h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 12px; }
.footer-grid ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.footer-grid a { color: var(--text-2); }
.footer-grid a:hover { color: var(--text); }
.footer-bottom { padding: 16px 20px 28px; border-top: 1px solid var(--border); color: var(--text-3); font-size: .85rem; }
@media (max-width: 760px) { .footer-grid { grid-template-columns: 1fr 1fr; } .footer-brand { grid-column: 1 / -1; } }

/* ---------- Buttons & form controls ---------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: inherit; font-weight: 600; font-size: .95rem; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-lg { height: 48px; padding: 0 24px; font-size: 1rem; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 9px;
  border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--text-2);
  font: inherit; font-size: .85rem; font-weight: 500; cursor: pointer; white-space: nowrap;
}
.btn-ghost:hover { background: var(--surface-3); color: var(--text); }
.btn-ghost .icon { width: 16px; height: 16px; }
.btn-ghost.is-done { color: var(--good); }

.input {
  width: 100%; min-height: 40px; padding: 8px 12px;
  border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text);
  font: inherit; font-size: .95rem;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: var(--focus); }
.input::placeholder { color: var(--text-3); }
select.input { appearance: none; padding-right: 34px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2385857c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; background-size: 16px; }
.input-code { font-family: var(--font-mono); font-size: .88rem; line-height: 1.55; }
input[type="color"].input { padding: 4px; height: 40px; cursor: pointer; }
input[type="range"] { width: 100%; accent-color: var(--primary); }

.control { display: grid; gap: 6px; min-width: 0; }
.control-label { font-size: .82rem; font-weight: 600; color: var(--text-2); }
.control-hint { font-size: .8rem; color: var(--text-3); }

.segmented { display: inline-flex; padding: 3px; gap: 2px; border-radius: var(--radius); background: var(--surface-3); flex-wrap: wrap; }
.segmented label { position: relative; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span { display: block; padding: 4px 12px; border-radius: 7px; font-size: .88rem; font-weight: 500; color: var(--text-2); cursor: pointer; white-space: nowrap; user-select: none; }
.segmented span:hover { color: var(--text); }
.segmented input:checked + span { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgb(0 0 0 / .12); font-weight: 600; }
.segmented input:focus-visible + span { box-shadow: var(--focus); }

.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: .9rem; color: var(--text-2); user-select: none; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; width: 34px; height: 20px; border-radius: 999px; background: var(--border-strong); transition: background .15s; flex: none; }
.switch-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .25); transition: transform .15s; }
.switch input:checked + .switch-track { background: var(--primary); }
.switch input:checked + .switch-track::after { transform: translateX(14px); }
.switch input:focus-visible + .switch-track { box-shadow: var(--focus); }
.switch:hover { color: var(--text); }

/* ---------- Breadcrumb ---------- */

.breadcrumb { display: flex; flex-wrap: wrap; gap: 6px; margin: 20px 0 14px; padding: 0; list-style: none; font-size: .85rem; color: var(--text-3); }
.breadcrumb li + li::before { content: "/"; margin-right: 6px; color: var(--border-strong); }
.breadcrumb a { color: var(--text-2); }

/* ---------- Cards ---------- */

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.tool-card {
  display: flex; gap: 14px; align-items: flex-start; height: 100%; padding: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text);
  box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s, box-shadow .15s;
}
.tool-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow); transform: translateY(-1px); text-decoration: none; }
.tool-card-name { display: block; font-weight: 650; line-height: 1.35; }
.tool-card-desc { display: block; margin-top: 3px; font-size: .86rem; line-height: 1.5; color: var(--text-2); }

.tool-icon {
  display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none;
  border-radius: 10px; color: var(--cat, var(--primary)); background: color-mix(in srgb, var(--cat, var(--primary)) 13%, transparent);
}
.tool-icon .icon { width: 21px; height: 21px; }
.tool-icon.is-lg { width: 52px; height: 52px; border-radius: 13px; }
.tool-icon.is-lg .icon { width: 27px; height: 27px; }
.tool-icon.is-sm { width: 32px; height: 32px; border-radius: 8px; }
.tool-icon.is-sm .icon { width: 17px; height: 17px; }
[data-cat="developer-tools"] { --cat: var(--c-developer-tools); }
[data-cat="text-tools"] { --cat: var(--c-text-tools); }
[data-cat="converters"] { --cat: var(--c-converters); }
[data-cat="image-tools"] { --cat: var(--c-image-tools); }
[data-cat="calculators"] { --cat: var(--c-calculators); }
[data-cat="website-checkers"] { --cat: var(--c-website-checkers); }
[data-cat="gaming-tools"] { --cat: var(--c-gaming-tools); }

/* ---------- Home ---------- */

.hero { padding: 56px 0 28px; text-align: center; }
.hero h1 { font-size: clamp(1.8rem, 1.2rem + 2.4vw, 2.9rem); letter-spacing: -0.025em; max-width: 820px; margin: 0 auto 14px; }
.hero .lead { max-width: 640px; margin: 0 auto 28px; color: var(--text-2); font-size: 1.08rem; }
.hero-search { position: relative; max-width: 600px; margin: 0 auto; }
.hero-search .icon { position: absolute; left: 18px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--text-3); pointer-events: none; }
.hero-search input { height: 56px; padding: 0 20px 0 50px; border-radius: 14px; font-size: 1.05rem; box-shadow: var(--shadow); }
.trust { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px 20px; margin: 20px 0 0; padding: 0; list-style: none; color: var(--text-2); font-size: .9rem; }
.trust li { display: inline-flex; align-items: center; gap: 6px; }
.trust .icon { color: var(--good); }

.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 24px 0 0; padding: 0; list-style: none; }
.chip { display: inline-flex; align-items: center; gap: 7px; height: 34px; padding: 0 14px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); color: var(--text-2); font-size: .88rem; font-weight: 500; }
.chip:hover { border-color: var(--border-strong); color: var(--text); text-decoration: none; }
.chip .icon { color: var(--cat, var(--primary)); width: 16px; height: 16px; }

.section { margin-top: 44px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-head h2 { margin: 0; display: inline-flex; align-items: center; gap: 10px; }
.section-head h2 a { color: inherit; }
.section-head p { margin: 4px 0 0; color: var(--text-2); font-size: .92rem; }
.section-link { font-size: .9rem; font-weight: 500; white-space: nowrap; }
.filter-empty { padding: 32px; text-align: center; color: var(--text-2); }

/* ---------- Tool page ---------- */

.page-header { margin-bottom: 20px; }
.page-title { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.page-title h1 { margin: 0; }
.page-summary { max-width: 860px; color: var(--text-2); font-size: 1.04rem; margin-bottom: 12px; }
.badges { display: flex; flex-wrap: wrap; gap: 6px; margin: 0; padding: 0; list-style: none; }
.badges li { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: .8rem; font-weight: 500; }
.badges .icon { width: 14px; height: 14px; }
.badges .is-good { background: var(--good-soft); color: var(--good); }

/* Workspace：所有工具共用的外框 */
.ws { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); overflow: hidden; }
.ws-toolbar { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px 22px; padding: 14px 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.ws-toolbar .control { grid-auto-flow: row; }
.ws-toolbar .input { min-height: 34px; padding: 5px 10px; }
.ws-toolbar select.input { padding-right: 30px; }
.ws-toolbar .switch { min-height: 34px; }
.ws-grid { display: grid; grid-template-columns: 1fr 1fr; }
.ws-grid > .pane + .pane { border-left: 1px solid var(--border); }
.ws-grid.is-stack { grid-template-columns: 1fr; }
.ws-grid.is-stack > .pane + .pane { border-left: 0; border-top: 1px solid var(--border); }
.ws-grid.is-form { grid-template-columns: minmax(280px, 380px) 1fr; }
.pane { display: flex; flex-direction: column; min-width: 0; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 6px 8px 6px 16px; background: var(--surface-2); border-bottom: 1px solid var(--border); }
.pane-title { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); }
.pane-actions { display: flex; gap: 2px; flex-wrap: wrap; justify-content: flex-end; }
.pane-body { flex: 1; padding: 16px; }
.pane-fields { display: grid; gap: 16px; align-content: start; }
.pane-fields .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pane-text {
  flex: 1; width: 100%; min-height: 360px; padding: 14px 16px; margin: 0;
  border: 0; resize: vertical; background: var(--surface); color: var(--text);
  font-family: var(--font-mono); font-size: .88rem; line-height: 1.6; tab-size: 2;
}
.pane-text:focus { outline: none; box-shadow: inset 0 0 0 2px var(--primary); border-radius: 0; }
.pane-text[readonly] { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); }
.pane-text.is-short { min-height: 160px; }
.pane-split { display: grid; grid-template-rows: auto 1fr; }
.pane-split > .pane-text { border-top: 1px solid var(--border); }
.pane-out { flex: 1; min-height: 360px; padding: 16px; overflow: auto; }
.ws-status { display: flex; align-items: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-top: 1px solid var(--border); background: var(--surface-2); color: var(--text-3); font-size: .85rem; }
.ws-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--border-strong); flex: none; }
.ws-status.is-good { color: var(--good); }
.ws-status.is-good::before { background: var(--good); }
.ws-status.is-bad { color: var(--bad); }
.ws-status.is-bad::before { background: var(--bad); }
.ws-status.is-busy::before { background: var(--primary); animation: pulse 1s infinite; }
.ws-status .hint { margin-left: auto; color: var(--text-3); }
.ws-status .status-actions { margin-left: auto; margin-right: -8px; }
@keyframes pulse { 50% { opacity: .3; } }

.check-bar { display: flex; gap: 10px; padding: 16px; }
.check-bar .input { height: 48px; font-size: 1rem; }
.check-try { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 0 16px 14px; margin-top: -4px; font-size: .85rem; color: var(--text-3); }
.check-try button { border: 0; background: none; padding: 2px 4px; color: var(--primary); font: inherit; cursor: pointer; }
.check-try button:hover { text-decoration: underline; }
.check-out { min-height: 200px; padding: 16px; border-top: 1px solid var(--border); }

.dropzone {
  display: grid; place-items: center; gap: 6px; margin: 16px; padding: 40px 20px; text-align: center; cursor: pointer;
  border: 2px dashed var(--border-strong); border-radius: var(--radius-lg); color: var(--text-2); transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone .icon { width: 36px; height: 36px; color: var(--primary); }
.dropzone strong { color: var(--text); font-size: 1.02rem; }
.dropzone input { position: absolute; opacity: 0; pointer-events: none; width: 1px; }

.empty { display: grid; place-items: center; min-height: 160px; color: var(--text-3); font-size: .92rem; text-align: center; }

@media (max-width: 860px) {
  .ws-grid, .ws-grid.is-form { grid-template-columns: 1fr; }
  .ws-grid > .pane + .pane { border-left: 0; border-top: 1px solid var(--border); }
  .pane-text { min-height: 220px; }
  .pane-out { min-height: 200px; }
  .check-bar { flex-direction: column; }
  .ws-status .hint { display: none; }
}

/* ---------- Report（檢查、計算型工具共用的結果樣式） ---------- */

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 16px; }
.tile { padding: 12px 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.tile-label { display: block; font-size: .78rem; color: var(--text-3); font-weight: 600; }
.tile-value { display: block; margin-top: 2px; font-size: 1.35rem; font-weight: 700; line-height: 1.3; word-break: break-word; font-variant-numeric: tabular-nums; }
.tile-hint { display: block; margin-top: 2px; font-size: .78rem; color: var(--text-3); }
.tile.is-good { border-color: color-mix(in srgb, var(--good) 35%, var(--border)); background: var(--good-soft); }
.tile.is-good .tile-value { color: var(--good); }
.tile.is-warn { border-color: color-mix(in srgb, var(--warn) 35%, var(--border)); background: var(--warn-soft); }
.tile.is-warn .tile-value { color: var(--warn); }
.tile.is-bad { border-color: color-mix(in srgb, var(--bad) 35%, var(--border)); background: var(--bad-soft); }
.tile.is-bad .tile-value { color: var(--bad); }
.tile.is-hero { grid-column: 1 / -1; }
.tile.is-hero .tile-value { font-size: 2rem; }

.report-section { margin-top: 16px; }
.report-section h3 { margin: 0 0 8px; font-size: .9rem; color: var(--text-2); }
.kv { width: 100%; border-collapse: collapse; font-size: .9rem; }
.kv th, .kv td { padding: 8px 10px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.kv th { width: 34%; color: var(--text-2); font-weight: 500; }
.kv td { word-break: break-word; font-size: .88rem; }
.kv thead th { width: auto; background: var(--surface-2); white-space: nowrap; }
.kv tr:last-child th, .kv tr:last-child td { border-bottom: 0; }
.kv-wrap { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.dot { display: inline-block; width: 8px; height: 8px; margin-right: 6px; border-radius: 50%; background: var(--text-3); vertical-align: 1px; }
.dot.is-good { background: var(--good); }
.dot.is-warn { background: var(--warn); }
.dot.is-bad { background: var(--bad); }
.pill { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; font-family: var(--font-sans); background: var(--surface-3); color: var(--text-2); }
.pill.is-good { background: var(--good-soft); color: var(--good); }
.pill.is-warn { background: var(--warn-soft); color: var(--warn); }
.pill.is-bad { background: var(--bad-soft); color: var(--bad); }
.note { margin-top: 12px; padding: 10px 12px; border-radius: var(--radius); background: var(--surface-2); color: var(--text-2); font-size: .88rem; }

.preview { line-height: 1.7; }
.preview > :first-child { margin-top: 0; }
.preview pre { padding: 12px; overflow: auto; background: var(--surface-2); border-radius: var(--radius); }
.preview code { padding: 1px 5px; background: var(--surface-2); border-radius: 4px; }
.preview pre code { padding: 0; background: none; }
.preview table { border-collapse: collapse; }
.preview th, .preview td { padding: 6px 10px; border: 1px solid var(--border); }
.preview blockquote { margin: 0 0 1em; padding: 4px 14px; border-left: 3px solid var(--border-strong); color: var(--text-2); }
.preview img { max-width: 100%; }

.match-text { white-space: pre-wrap; word-break: break-word; font-family: var(--font-mono); font-size: .88rem; line-height: 1.7; }
mark.hit { background: color-mix(in srgb, var(--warn) 30%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
mark.hit:nth-of-type(even) { background: color-mix(in srgb, var(--primary) 25%, transparent); }
.diff { font-family: var(--font-mono); font-size: .86rem; line-height: 1.6; }
.diff-line { display: flex; gap: 10px; padding: 0 10px; white-space: pre-wrap; word-break: break-word; }
.diff-line .ln { width: 3ch; flex: none; color: var(--text-3); text-align: right; user-select: none; }
.diff-line.is-add { background: var(--good-soft); }
.diff-line.is-del { background: var(--bad-soft); }
.diff-line.is-add .sign { color: var(--good); }
.diff-line.is-del .sign { color: var(--bad); }
.tree { font-family: var(--font-mono); font-size: .86rem; line-height: 1.7; }
.tree details { padding-left: 16px; }
.tree summary { margin-left: -16px; cursor: pointer; }
.tree .k { color: var(--c-developer-tools); }
.tree .s { color: var(--good); }
.tree .n { color: var(--c-converters); }
.tree .b { color: var(--warn); }

.swatch { width: 100%; height: 120px; border-radius: var(--radius); border: 1px solid var(--border); margin-bottom: 16px; }
.qr-box { display: grid; place-items: center; padding: 20px; }
.qr-box canvas, .qr-box img { width: min(280px, 100%); height: auto; image-rendering: pixelated; border-radius: var(--radius-sm); }

.file-list { list-style: none; margin: 0; padding: 0 16px 16px; display: grid; gap: 8px; }
.file-item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); }
.file-item img { width: 48px; height: 48px; object-fit: cover; border-radius: 6px; background: var(--surface-2); }
.file-meta { flex: 1; min-width: 0; font-size: .86rem; }
.file-meta strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .92rem; }
.file-meta span { color: var(--text-3); }

.price-chart { width: 100%; height: 220px; }

/* ---------- Article（工具說明、分類說明、靜態頁） ---------- */

.content-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 40px; margin-top: 40px; }
@media (max-width: 960px) { .content-grid { grid-template-columns: 1fr; } }
.prose { max-width: 760px; }
.prose > section + section { margin-top: 40px; }
.prose h2 { font-size: 1.3rem; padding-bottom: 8px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.prose ul, .prose ol { padding-left: 1.4em; }
.prose li + li { margin-top: 4px; }
.prose code { padding: 1px 5px; border-radius: 4px; background: var(--surface-2); }

.steps { counter-reset: step; list-style: none; padding: 0 !important; display: grid; gap: 12px; }
.steps li { counter-increment: step; position: relative; padding-left: 44px; min-height: 30px; margin: 0 !important; }
.steps li::before { content: counter(step); position: absolute; left: 0; top: -1px; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; font-size: .9rem; }

.example + .example { margin-top: 24px; }
.example h3 { font-size: 1rem; }
.example-io { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 760px) { .example-io { grid-template-columns: 1fr; } }
.code-block { margin: 0; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.code-block figcaption { padding: 6px 12px; font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-3); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.code-block pre { margin: 0; padding: 12px; overflow: auto; font-size: .84rem; line-height: 1.55; white-space: pre-wrap; word-break: break-word; }

.facts { width: 100%; border-collapse: collapse; font-size: .95rem; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.facts th, .facts td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--border); }
.facts th { width: 32%; background: var(--surface-2); font-weight: 600; color: var(--text-2); }
.facts tr:last-child th, .facts tr:last-child td { border-bottom: 0; }

.faq details { border-bottom: 1px solid var(--border); }
.faq details:first-of-type { border-top: 1px solid var(--border); }
.faq summary { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 2px; cursor: pointer; font-weight: 600; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; flex: none; font-size: 1.3rem; font-weight: 400; color: var(--text-3); line-height: 1; }
.faq details[open] summary::after { content: "−"; }
.faq .answer { padding: 0 2px 16px; color: var(--text-2); }
.faq .answer > :last-child { margin-bottom: 0; }

.aside-block + .aside-block { margin-top: 28px; }
.aside-block h2 { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--text-3); margin-bottom: 10px; }
.mini-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.mini-list a { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: var(--radius); color: var(--text); font-size: .92rem; font-weight: 500; }
.mini-list a:hover { background: var(--surface); text-decoration: none; box-shadow: var(--shadow-sm); }
@media (min-width: 961px) { .tool-aside { position: sticky; top: calc(var(--header-h) + 20px); align-self: start; } }

.static-page { max-width: 760px; margin: 0 auto; }
.static-page h1 { margin-top: 8px; }

/* ---------- Search dialog ---------- */

.search-dialog { width: min(640px, calc(100% - 24px)); max-height: min(560px, calc(100vh - 80px)); margin: 72px auto auto; padding: 0; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); }
.search-dialog::backdrop { background: rgb(10 10 12 / 0.45); backdrop-filter: blur(2px); }
.search-box { display: flex; align-items: center; gap: 10px; padding: 0 16px; border-bottom: 1px solid var(--border); }
.search-box .icon { width: 20px; height: 20px; color: var(--text-3); }
.search-box input { flex: 1; height: 56px; border: 0; background: transparent; color: var(--text); font: inherit; font-size: 1.05rem; }
.search-box input:focus, .search-box input:focus-visible { outline: none; box-shadow: none; }
.search-box input::-webkit-search-cancel-button { display: none; }
.search-results { list-style: none; margin: 0; padding: 8px; overflow: auto; max-height: 440px; }
.search-results a { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: var(--radius); color: var(--text); }
.search-results a:hover, .search-results a[aria-selected="true"] { background: var(--surface-2); text-decoration: none; }
.search-results small { display: block; color: var(--text-2); font-size: .82rem; }
.search-empty { padding: 28px; text-align: center; color: var(--text-3); }

/* ---------- Ads ---------- */

.ad-slot { margin: 28px 0; min-height: 120px; }
.ad-slot ins[data-ad-status="unfilled"] { display: none !important; }

/* ---------- 404 ---------- */

.not-found { padding: 72px 0 24px; text-align: center; }
.not-found .code { font-size: 4rem; font-weight: 800; color: var(--text-3); line-height: 1; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* 修正：範例區塊內的程式碼不套用行內 code 底色；面板標題內的分段按鈕縮小 */
.prose pre code, .code-block code { padding: 0; background: none; border-radius: 0; }
.pane-head .segmented { padding: 2px; }
.pane-head .segmented span { padding: 2px 10px; font-size: .82rem; }
.ws-toolbar .is-grow { flex: 1 1 320px; }
.ws-toolbar .is-grow .input { font-family: var(--font-mono); }
.switch-group { display: flex; flex-wrap: wrap; gap: 6px 16px; min-height: 34px; align-items: center; }
@media (max-width: 860px) { .lang-menu summary span { display: none; } }
.is-mono .input { font-family: var(--font-mono); }
