:root {
  color-scheme: light dark;
  --bg: #f5f5f5;
  --surface: #fff;
  --ink: #171717;
  --muted: #555555;
  --subtle: #f2f2f2;
  --border: #dedede;
  --accent: #222222;
  --accent-ink: #fff;
  --accent-wash: #ebebeb;
  --strong: #181818;
  --error: #333333;
  --shadow: 0 8px 26px rgba(0, 0, 0, .045);
  --diff-add: #f0f0f0;
  --diff-remove: #e3e3e3;
  --diff-mark: #c9c9c9;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111111;
    --surface: #1b1b1b;
    --ink: #f4f4f4;
    --muted: #b6b6b6;
    --subtle: #151515;
    --border: #383838;
    --accent: #eeeeee;
    --accent-ink: #151515;
    --accent-wash: #2d2d2d;
    --strong: #f2f2f2;
    --error: #eeeeee;
    --shadow: none;
    --diff-add: #303030;
    --diff-remove: #252525;
    --diff-mark: #4c4c4c;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); }
button, select, textarea, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .48; }
button, select, .file-button { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
a { color: inherit; }
.shell { width: min(1160px, calc(100% - 88px)); margin-inline: auto; }
.site-header { border-bottom: 1px solid var(--border); }
.topbar { min-height: 72px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 740; letter-spacing: .04em; text-decoration: none; }
.brand img { display: block; border-radius: 9px; }
.status { display: inline-flex; gap: 8px; align-items: center; font-size: 13px; font-weight: 650; color: var(--strong); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-wash); }
#workspace { padding-top: 26px; }
.intro { padding: 44px 0 36px; }
.intro h1 { color: var(--strong); margin: 0; font-size: clamp(41px, 6.4vw, 70px); font-weight: 770; letter-spacing: -.07em; line-height: 1.15; }
.intro p { margin: 14px 0 0; color: var(--muted); font-size: clamp(15px, 2vw, 17px); line-height: 1.7; }
.mode-switch { padding: 4px; display: inline-flex; gap: 4px; border: 1px solid var(--border); border-radius: 13px; background: var(--subtle); margin-bottom: 18px; }
.mode-switch button { background: transparent; min-width: 112px; min-height: 42px; border: 0; border-radius: 9px; font-size: 15px; font-weight: 680; padding: 0 15px; color: var(--muted); }
.mode-switch button[aria-pressed="true"] { background: var(--strong); color: var(--surface); }
.workbench { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.11fr); gap: 16px; align-items: stretch; }
.panel { min-width: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 22px; box-shadow: var(--shadow); padding: 24px; display: flex; flex-direction: column; gap: 15px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; min-height: 58px; }
.panel.is-expanded { grid-column: 1 / -1; }
.panel.is-expanded #input, .panel.is-expanded #output, .panel.is-expanded .empty-result { min-height: clamp(320px, 58svh, 660px); }
.panel h2 { font-size: 21px; letter-spacing: -.035em; margin: 0; line-height: 1.35; }
.panel-heading p { margin: 5px 0 0; font-size: 13px; line-height: 1.5; color: var(--muted); }
.text-button { background: transparent; border: 0; padding: 5px 8px; min-height: 44px; color: var(--muted); font-size: 14px; }
.client-field { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 14px; align-items: center; }
.client-field label { font-size: 14px; font-weight: 650; }
select, .file-button, .primary, .secondary { border: 1px solid var(--border); padding: 0 13px; min-height: 44px; border-radius: 9px; font-weight: 650; }
select { width: 100%; background: var(--surface); font-size: 16px; }
.file-row { display: flex; align-items: center; gap: 12px; min-width: 0; }
.file-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: max-content; flex: none; cursor: pointer; color: var(--strong); background: var(--accent-wash); border-color: transparent; font-size: 14px; user-select: none; }
.file-row:focus-within .file-button { outline: 2px solid var(--accent); outline-offset: 3px; }
.file-symbol { width: 12px; height: 14px; display: inline-block; border: 1.5px solid currentColor; border-radius: 2px; position: relative; }
.file-symbol::before { content: ""; position: absolute; width: 5px; height: 1px; background: currentColor; top: 5px; left: 2px; box-shadow: 0 3px currentColor; }
.file-label { min-width: 0; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
textarea { width: 100%; min-height: 198px; display: block; border-radius: 11px; padding: 13px; background: var(--subtle); border: 1px solid var(--border); font: 16px/1.55 ui-monospace, SFMono-Regular, Consolas, "PingFang SC", monospace; resize: vertical; overflow-wrap: anywhere; }
textarea::placeholder { color: var(--muted); opacity: .86; }
#output { min-height: 245px; flex: 1; }
.strict-control { min-height: 44px; display: flex; gap: 8px; align-items: center; width: max-content; max-width: 100%; font-size: 13px; color: var(--muted); cursor: pointer; }
.strict-control input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); flex: none; }
.strict-hint { display: inline; }
.actions { display: flex; gap: 7px; flex: none; }
.primary, .secondary { font-size: 14px; min-width: 61px; white-space: nowrap; }
.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.secondary { background: var(--surface); color: var(--accent); }
.empty-result { flex: 1; min-height: 264px; border: 1px dashed var(--border); border-radius: 11px; display: flex; flex-direction: column; align-items: center; justify-content: center; background: var(--subtle); color: var(--muted); }
.empty-result p { margin: 13px 0 4px; font-size: 15px; font-weight: 680; color: var(--strong); }
.empty-icon { width: 37px; height: 44px; border: 2px solid var(--accent); border-radius: 7px; padding: 9px 7px; opacity: .55; display: grid; align-content: center; gap: 5px; }
.empty-icon span { height: 2px; border-radius: 2px; background: var(--accent); }
.empty-icon span:last-child { width: 63%; }
.review, .install-help { color: var(--muted); font-size: 13px; line-height: 1.65; }
.review summary, .install-help summary { min-height: 34px; line-height: 34px; cursor: pointer; font-weight: 680; color: var(--strong); }
.review ul { margin: 2px 0 0; padding-inline-start: 20px; }
.review li + li { margin-top: 3px; }
.install-help { margin: 16px 0 10px; }
.install-help summary { min-height: 44px; line-height: 44px; width: max-content; max-width: 100%; }
.install-help p { margin: 0 0 12px; max-width: 565px; }
.footer { padding: 0 0 max(22px, env(safe-area-inset-bottom)); color: var(--muted); font-size: 12px; }
.error { color: var(--error); margin: -8px 0 0; font-size: 13px; line-height: 1.55; }
.notice { position: fixed; z-index: 2; inset: auto 18px max(18px, env(safe-area-inset-bottom)); width: max-content; max-width: calc(100% - 36px); margin: auto; background: var(--strong); color: var(--surface); padding: 10px 16px; border-radius: 12px; font-size: 14px; box-shadow: var(--shadow); }
.visually-hidden, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.skip:focus { position: absolute; z-index: 3; background: var(--surface); color: var(--ink); padding: 8px; }
@media (max-width: 860px) {
  .shell { width: calc(100% - 48px); }
  .panel { padding: 19px; }
}
@media (max-width: 650px) {
  .shell { width: calc(100% - 36px); }
  .topbar { min-height: 60px; }
  #workspace { padding-top: 16px; }
  .mode-switch { display: flex; margin-bottom: 13px; }
  .mode-switch button { flex: 1; }
  .workbench { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .panel { gap: 11px; border-radius: 17px; padding: 16px; }
  .panel-heading { min-height: 52px; }
  .panel h2 { font-size: 19px; }
  textarea { min-height: 142px; }
  #output, .empty-result { min-height: 158px; }
  .footer p { margin: 0; }
}
@media (max-width: 360px) {
  .shell { width: calc(100% - 24px); }
  .panel { padding: 12px; }
  .primary, .secondary { min-width: 54px; padding-inline: 8px; }
}

.expand-button { min-width: 44px; }
.result-actions { justify-content: space-between; }
.comparison {
  width: min(1080px, calc(100% - 40px));
  max-width: none;
  max-height: min(86dvh, 900px);
  margin: auto;
  padding: 18px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border);
  border-radius: 16px;
  overflow: hidden;
}
.comparison[open] { display: flex; flex-direction: column; }
.comparison::backdrop { background: rgb(0 0 0 / .66); }
.comparison-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.comparison-heading h2 { font-size: 20px; margin: 0; }
.comparison-heading p, .comparison-summary { font-size: 13px; color: var(--muted); margin: 7px 0 0; line-height: 1.55; }
.comparison-summary { margin: 13px 0 10px; }
.comparison-scroll { min-height: 0; overflow: auto; border: 1px solid var(--border); border-radius: 8px; overscroll-behavior: contain; }
.diff-table { width: 100%; table-layout: fixed; border-spacing: 0; font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace; }
.diff-table thead { position: sticky; top: 0; background: var(--surface); }
.diff-table th { padding: 8px 4px; border-bottom: 1px solid var(--border); text-align: left; color: var(--muted); }
.diff-table th:nth-child(-n+2) { width: 5.5ch; text-align: center; white-space: nowrap; }
.diff-table th:nth-child(3) { width: 3ch; }
.diff-table td { padding: 3px 5px; vertical-align: top; }
.diff-table td:nth-child(-n+2) { text-align: right; color: var(--muted); user-select: none; }
.diff-table td:nth-child(3) { text-align: center; border-left: 1px solid var(--border); font-weight: 800; }
.diff-table td:nth-child(4) { white-space: pre-wrap; overflow-wrap: anywhere; }
.diff-add { background: var(--diff-add); }
.diff-remove { background: var(--diff-remove); }
.diff-table mark { color: inherit; background: var(--diff-mark); border-radius: 2px; font-weight: 700; }
.diff-table .diff-gap td { background: var(--subtle); text-align: left; padding: 5px 12px; font-size: 12px; }
@media (max-width: 650px) {
  .comparison { width: calc(100% - 16px); padding: 12px; max-height: 92dvh; }
  .diff-table { font-size: 12px; }
}
