:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --surface-soft: #f2f4f7;
  --surface-hover: #edf0f4;
  --text: #17202a;
  --muted: #697586;
  --muted-2: #98a2b3;
  --border: #e2e7ed;
  --border-strong: #d0d7e0;
  --accent: #16a085;
  --accent-dark: #11836d;
  --accent-soft: #e9f7f3;
  --blue: #367bf5;
  --add: #0d9668;
  --add-bg: #e9f8f1;
  --add-strong: #bdebd8;
  --remove: #dc4c64;
  --remove-bg: #fff0f2;
  --remove-strong: #f8c9d1;
  --change: #d78a12;
  --change-bg: #fff7e5;
  --shadow: 0 12px 36px rgba(23, 32, 42, 0.07), 0 2px 8px rgba(23, 32, 42, 0.04);
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #101417;
  --surface: #181d21;
  --surface-soft: #20262b;
  --surface-hover: #282f35;
  --text: #edf2f4;
  --muted: #9ca8b2;
  --muted-2: #74818c;
  --border: #2b3339;
  --border-strong: #3a454d;
  --accent: #36c4a6;
  --accent-dark: #55d5bb;
  --accent-soft: #17352f;
  --blue: #72a4ff;
  --add: #5dd6a7;
  --add-bg: #183229;
  --add-strong: #255b49;
  --remove: #ff8497;
  --remove-bg: #3b2026;
  --remove-strong: #6b303b;
  --change: #f2b756;
  --change-bg: #382e1b;
  --shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 0%, color-mix(in srgb, var(--accent) 5%, transparent) 0, transparent 26rem),
    var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

button, textarea, input { font: inherit; }
button, label[for] { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }

.app-shell { min-height: 100vh; }

.site-header {
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(20px, 4vw, 64px);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font-size: 20px;
  font-weight: 750;
  letter-spacing: -0.4px;
  text-decoration: none;
}

.brand-mark {
  width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  color: var(--accent);
}

.brand-mark svg { width: 31px; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.header-actions { display: flex; align-items: center; gap: 10px; }

.tool-tabs {
  align-self: stretch;
  display: flex;
  align-items: center;
  gap: 4px;
}

.tool-tabs button {
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  background: transparent;
  border: 0;
  border-radius: 9px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
}

.tool-tabs button:hover { background: var(--surface-soft); color: var(--text); }
.tool-tabs button.active { background: var(--accent-soft); color: var(--accent); }
.tool-tabs svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.privacy-note {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-right: 8px;
  color: var(--muted);
  font-size: 13px;
}

.status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.icon-button {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  color: var(--muted);
}

.icon-button:hover { background: var(--surface-soft); color: var(--text); }
.icon-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.moon-icon { display: none; }
[data-theme="dark"] .moon-icon { display: block; }
[data-theme="dark"] .sun-icon { display: none; }

main { width: min(1420px, calc(100% - 40px)); margin: 0 auto; }

.hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  padding: 56px 4px 30px;
}

.eyebrow { margin: 0 0 9px; color: var(--accent); font-size: 11px; font-weight: 750; letter-spacing: 1.8px; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 12px; font-size: clamp(32px, 4vw, 50px); line-height: 1.08; letter-spacing: -2.2px; }
h1 span { color: var(--accent); }
.hero-copy { max-width: 660px; margin-bottom: 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.hero-shortcut { display: flex; align-items: center; gap: 14px; padding-bottom: 5px; color: var(--muted); font-size: 12px; }
.hero-shortcut > div { display: flex; align-items: center; gap: 5px; }
kbd { min-width: 28px; height: 28px; display: inline-grid; place-items: center; padding: 0 7px; background: var(--surface); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 6px; color: var(--text); font: 12px var(--sans); }

.workspace {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); position: relative; }
.editor-card:first-child { border-right: 1px solid var(--border); }
.editor-header { height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 18px; border-bottom: 1px solid var(--border); }
.editor-title, .editor-actions { display: flex; align-items: center; }
.editor-title { gap: 11px; min-width: 0; }
.editor-title > div { display: grid; gap: 3px; }
.editor-title strong { font-size: 14px; font-weight: 700; }
.editor-title small { color: var(--muted-2); font-size: 11px; }
.side-indicator { width: 4px; height: 34px; border-radius: 8px; }
.side-indicator.before { background: var(--remove); }
.side-indicator.after { background: var(--add); }
.editor-actions { gap: 6px; }
.file-button, .mini-button { display: inline-flex; align-items: center; gap: 6px; padding: 7px 9px; background: transparent; border: 0; border-radius: 7px; color: var(--muted); font-size: 12px; cursor: pointer; }
.file-button:hover, .mini-button:hover { background: var(--surface-soft); color: var(--text); }
.file-button svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.editor-body { height: 350px; display: flex; position: relative; background: color-mix(in srgb, var(--surface) 96%, var(--surface-soft)); }
.editor-body.dragging { outline: 2px solid var(--accent); outline-offset: -2px; background: var(--accent-soft); }
.editor-body.dragging::after { content: "松开以载入文件"; position: absolute; inset: 16px; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 88%, transparent); border: 1px dashed var(--accent); border-radius: 10px; color: var(--accent); font-weight: 700; z-index: 4; }
.line-rail { width: 50px; flex: 0 0 50px; padding: 20px 12px 20px 6px; overflow: hidden; background: var(--surface-soft); border-right: 1px solid var(--border); color: var(--muted-2); text-align: right; white-space: pre; font: 12.5px/22px var(--mono); user-select: none; }
textarea { width: 100%; height: 100%; resize: none; padding: 20px; background: transparent; border: 0; outline: 0; color: var(--text); caret-color: var(--accent); tab-size: 2; white-space: pre; overflow: auto; font: 13px/22px var(--mono); }
textarea::placeholder { color: var(--muted-2); }
textarea:focus { box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 28%, transparent); }

.swap-button { position: absolute; z-index: 5; top: 29px; left: 50%; width: 34px; height: 34px; transform: translate(-50%, -50%); display: grid; place-items: center; padding: 0; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 50%; color: var(--muted); cursor: pointer; box-shadow: 0 3px 10px rgba(0,0,0,.08); }
.swap-button:hover { color: var(--accent); border-color: var(--accent); transform: translate(-50%, -50%) rotate(180deg); }
.swap-button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.control-bar { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 13px 18px; background: var(--surface-soft); border-top: 1px solid var(--border); }
.options, .primary-actions { display: flex; align-items: center; gap: 10px; }
.options { gap: 20px; }
.check-control { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; cursor: pointer; user-select: none; }
.check-control input { position: absolute; opacity: 0; pointer-events: none; }
.fake-check { width: 17px; height: 17px; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 5px; }
.fake-check svg { width: 12px; fill: none; stroke: transparent; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.check-control input:checked + .fake-check { background: var(--accent); border-color: var(--accent); }
.check-control input:checked + .fake-check svg { stroke: #fff; }
.check-control input:focus-visible + .fake-check { outline: 2px solid var(--blue); outline-offset: 2px; }
.secondary-button, .compare-button, .copy-button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 0 16px; border-radius: 9px; font-size: 13px; font-weight: 650; cursor: pointer; }
.secondary-button, .copy-button { background: var(--surface); border: 1px solid var(--border-strong); color: var(--text); }
.secondary-button:hover, .copy-button:hover { background: var(--surface-hover); }
.compare-button { min-width: 132px; background: var(--accent); border: 1px solid var(--accent); color: #fff; box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 25%, transparent); }
.compare-button:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.secondary-button svg, .compare-button svg, .copy-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.result-section { margin-top: 34px; }
.result-topbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 16px; padding: 0 4px; }
.result-topbar h2 { margin: 0; font-size: 22px; letter-spacing: -.5px; }
.result-actions { display: flex; align-items: center; gap: 10px; }
.view-switch { display: flex; padding: 3px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 9px; }
.view-switch button { padding: 7px 14px; background: transparent; border: 0; border-radius: 6px; color: var(--muted); font-size: 12px; cursor: pointer; }
.view-switch button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.copy-button { min-height: 36px; padding: 0 12px; font-size: 12px; }

.stats { min-height: 76px; display: flex; align-items: center; gap: clamp(20px, 5vw, 70px); padding: 14px 20px; background: var(--surface); border: 1px solid var(--border); border-bottom: 0; border-radius: 13px 13px 0 0; }
.stat { display: flex; align-items: center; gap: 11px; }
.stat-icon { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 8px; font: 700 19px var(--mono); }
.stat-icon.added { color: var(--add); background: var(--add-bg); }
.stat-icon.removed { color: var(--remove); background: var(--remove-bg); }
.stat-icon.changed { color: var(--change); background: var(--change-bg); }
.stat > div { display: grid; gap: 2px; }
.stat strong { font-size: 17px; }
.stat small, .similarity span { color: var(--muted); font-size: 11px; }
.similarity { min-width: 160px; display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; margin-left: auto; align-items: center; }
.similarity strong { font-size: 15px; }
.similarity-track { grid-column: 1 / -1; height: 5px; overflow: hidden; background: var(--surface-soft); border-radius: 10px; }
.similarity-track span { display: block; height: 100%; width: 100%; background: var(--accent); border-radius: inherit; transition: width .3s ease; }

.diff-view { max-height: 610px; overflow: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 0 0 13px 13px; outline: none; font: 12.5px/22px var(--mono); }
.diff-table { width: 100%; min-width: 760px; border-collapse: collapse; table-layout: fixed; }
.diff-table.split col.num { width: 48px; }
.diff-table.split col.code { width: calc(50% - 48px); }
.diff-table.unified col.num { width: 48px; }
.diff-table.unified col.sign { width: 30px; }
.diff-table td { height: 22px; padding: 0; vertical-align: top; border-bottom: 1px solid color-mix(in srgb, var(--border) 58%, transparent); }
.diff-table tr:last-child td { border-bottom: 0; }
.diff-num { padding: 0 10px !important; background: var(--surface-soft); color: var(--muted-2); text-align: right; user-select: none; }
.diff-code { padding: 0 12px !important; white-space: pre-wrap; overflow-wrap: anywhere; tab-size: 2; }
.diff-sign { text-align: center; user-select: none; }
.split-divider { border-left: 1px solid var(--border); }
.diff-empty { background-image: repeating-linear-gradient(-45deg, transparent, transparent 4px, color-mix(in srgb, var(--border) 55%, transparent) 4px, color-mix(in srgb, var(--border) 55%, transparent) 5px); }
.line-add .diff-code, .line-add.diff-code, .line-add .diff-sign { background-color: var(--add-bg); }
.line-remove .diff-code, .line-remove.diff-code, .line-remove .diff-sign { background-color: var(--remove-bg); }
.line-change-left .diff-code, .line-change-left.diff-code { background-color: var(--remove-bg); }
.line-change-right .diff-code, .line-change-right.diff-code { background-color: var(--add-bg); }
.token-add { background: var(--add-strong); border-radius: 2px; }
.token-remove { background: var(--remove-strong); border-radius: 2px; }
.same-message { padding: 44px 20px; color: var(--muted); text-align: center; font-family: var(--sans); }
.same-message svg { width: 28px; display: block; margin: 0 auto 10px; fill: none; stroke: var(--add); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.json-hero { padding-bottom: 24px; }
.load-json-example {
  flex: 0 0 auto;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  cursor: pointer;
}
.load-json-example:hover { background: var(--accent-soft); }

.json-workbench {
  height: min(680px, calc(100vh - 220px));
  min-height: 540px;
  display: grid;
  grid-template-columns: minmax(340px, 43%) minmax(0, 57%);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.json-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.json-source-pane { border-right: 1px solid var(--border); }
.json-pane-header, .json-toolbar {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.side-indicator.json-source { background: var(--blue); }
.json-compact-actions, .json-toolbar-group { display: flex; align-items: center; gap: 3px; }
.json-icon-button {
  width: 34px;
  height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
}
label.json-icon-button { display: inline-grid; }
.json-icon-button:hover { background: var(--surface-soft); color: var(--accent); }
.json-icon-button:active { transform: translateY(1px); }
.json-icon-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.toolbar-divider { width: 1px; height: 20px; margin: 0 4px; background: var(--border); }
.toolbar-right { margin-left: auto; }
.json-status { display: inline-flex; align-items: center; gap: 7px; margin-right: 5px; color: var(--muted); font-size: 11px; white-space: nowrap; }
.json-status > span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.json-status.valid { color: var(--add); }
.json-status.valid > span { background: var(--add); box-shadow: 0 0 0 3px var(--add-bg); }
.json-status.invalid { color: var(--remove); }
.json-status.invalid > span { background: var(--remove); box-shadow: 0 0 0 3px var(--remove-bg); }

.json-editor-body { min-height: 0; flex: 1; display: flex; position: relative; background: color-mix(in srgb, var(--surface) 97%, var(--surface-soft)); }
.json-editor-body.dragging { outline: 2px solid var(--blue); outline-offset: -2px; }
.json-editor-body.dragging::after { content: "松开以载入 JSON"; position: absolute; z-index: 3; inset: 16px; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 91%, transparent); border: 1px dashed var(--blue); border-radius: 10px; color: var(--blue); font-weight: 700; }
.json-line-rail { padding-top: 18px; padding-bottom: 18px; }
.json-editor-body textarea { padding: 18px; line-height: 22px; }

.json-tree-wrap { min-height: 0; flex: 1; position: relative; overflow: auto; background: color-mix(in srgb, var(--surface) 98%, var(--surface-soft)); }
.json-tree { min-width: max-content; padding: 16px 18px 28px; font: 13px/24px var(--mono); }
.json-tree-row { min-height: 24px; display: flex; align-items: flex-start; padding-left: calc(var(--depth) * 20px); white-space: pre; }
.json-tree-row:hover { background: color-mix(in srgb, var(--surface-hover) 62%, transparent); }
.tree-toggle, .tree-spacer { width: 20px; height: 22px; flex: 0 0 20px; margin: 0 2px 0 0; padding: 0; }
.tree-toggle { display: grid; place-items: center; background: transparent; border: 0; border-radius: 5px; color: var(--muted); cursor: pointer; }
.tree-toggle:hover { background: var(--surface-hover); color: var(--accent); }
.tree-toggle svg { width: 12px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s ease; }
.json-tree-node.collapsed > .json-tree-row .tree-toggle svg { transform: rotate(-90deg); }
.json-tree-node.collapsed > .json-tree-children, .json-tree-node.collapsed > .json-tree-closing { display: none; }
.json-tree-node:not(.collapsed) > .json-tree-row .tree-summary { display: none; }
.tree-key { color: #a32d92; font-weight: 650; }
.tree-string { color: #139f5b; }
.tree-number { color: #1597c7; }
.tree-boolean { color: #de7b22; }
.tree-null { color: #d2577a; font-style: italic; }
.tree-punctuation { color: var(--muted); }
.tree-summary { margin-left: 7px; color: var(--muted-2); font-family: var(--sans); font-size: 10px; }
[data-theme="dark"] .tree-key { color: #e58ed9; }
[data-theme="dark"] .tree-string { color: #68d391; }
[data-theme="dark"] .tree-number { color: #63c6e6; }
[data-theme="dark"] .tree-boolean { color: #f4b46b; }

.json-tree-empty { height: 100%; min-height: 260px; display: grid; place-content: center; justify-items: center; gap: 8px; padding: 30px; color: var(--muted); text-align: center; }
.json-tree-empty > span { width: 56px; height: 56px; display: grid; place-items: center; margin-bottom: 4px; background: var(--surface-soft); border-radius: 16px; color: var(--accent); font: 18px var(--mono); }
.json-tree-empty strong { color: var(--text); font-size: 14px; }
.json-tree-empty small { font-size: 11px; }
.json-error { display: flex; align-items: flex-start; gap: 12px; margin: 24px; padding: 16px; background: var(--remove-bg); border: 1px solid var(--remove-strong); border-radius: 10px; color: var(--remove); }
.json-error svg { width: 20px; flex: 0 0 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.json-error strong { color: var(--text); font-size: 13px; }
.json-error p { margin: 5px 0 0; font: 12px/1.6 var(--mono); overflow-wrap: anywhere; }

.json-pane-footer {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 7px 14px;
  background: var(--surface-soft);
  border-top: 1px solid var(--border);
  color: var(--muted);
}
.json-pane-footer > div { display: flex; gap: 14px; font-size: 10px; }
.json-pane-footer .check-control { font-size: 10px; }

.json-workbench:fullscreen { width: 100vw; height: 100vh; min-height: 0; border: 0; border-radius: 0; }

.radix-hero { padding-bottom: 24px; }
.radix-feature-note { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 4px; padding: 9px 12px; background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 24%, var(--border)); border-radius: 9px; color: var(--accent); font-size: 11px; font-weight: 650; white-space: nowrap; }
.radix-feature-note svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.radix-workbench { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.radix-input-section { padding: 24px; border-bottom: 1px solid var(--border); }
.radix-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.radix-section-heading > div { display: flex; align-items: center; gap: 12px; }
.radix-section-heading > div > div { display: grid; gap: 3px; }
.radix-section-heading strong { font-size: 14px; }
.radix-section-heading small { color: var(--muted); font-size: 10px; }
.section-number { width: 31px; height: 31px; display: grid; place-items: center; background: var(--accent-soft); border-radius: 8px; color: var(--accent); font: 700 10px var(--mono); }
.radix-section-heading > button { padding: 7px 10px; background: transparent; border: 1px solid var(--border-strong); border-radius: 7px; color: var(--accent); font-size: 11px; cursor: pointer; }
.radix-section-heading > button:hover { background: var(--accent-soft); }

.base-selector { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; padding: 0; border: 0; }
.base-choice { position: relative; cursor: pointer; }
.base-choice input { position: absolute; opacity: 0; pointer-events: none; }
.base-choice span { min-width: 61px; height: 38px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 12px; background: var(--surface-soft); border: 1px solid transparent; border-radius: 9px; color: var(--muted); font-size: 12px; transition: .15s ease; }
.base-choice span strong { color: var(--text); font-size: 13px; }
.base-choice:hover span { background: var(--surface-hover); }
.base-choice input:checked + span { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); color: var(--accent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 14%, transparent); }
.base-choice input:checked + span strong { color: var(--accent); }
.base-choice input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 2px; }

.radix-input-row { display: flex; align-items: stretch; gap: 10px; }
.radix-input-wrap { min-width: 0; flex: 1; height: 50px; display: flex; align-items: center; background: color-mix(in srgb, var(--surface) 97%, var(--surface-soft)); border: 1px solid var(--border-strong); border-radius: 10px; overflow: hidden; transition: border-color .15s ease, box-shadow .15s ease; }
.radix-input-wrap:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 13%, transparent); }
.radix-input-wrap > span { align-self: stretch; min-width: 62px; display: grid; place-items: center; padding: 0 12px; background: var(--surface-soft); border-right: 1px solid var(--border); color: var(--accent); font: 700 11px var(--mono); }
.radix-input-wrap input { min-width: 0; flex: 1; height: 100%; padding: 0 15px; background: transparent; border: 0; outline: 0; color: var(--text); font: 14px var(--mono); }
.radix-input-wrap input::placeholder { color: var(--muted-2); font-family: var(--sans); }
.radix-input-wrap button { width: 40px; align-self: stretch; display: grid; place-items: center; padding: 0; background: transparent; border: 0; color: var(--muted); cursor: pointer; }
.radix-input-wrap button:hover { color: var(--remove); }
.radix-input-wrap button svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.radix-convert-button { flex: 0 0 132px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; background: var(--accent); border: 1px solid var(--accent); border-radius: 10px; color: #fff; font-size: 13px; font-weight: 700; cursor: pointer; box-shadow: 0 5px 14px color-mix(in srgb, var(--accent) 22%, transparent); }
.radix-convert-button:hover { background: var(--accent-dark); }
.radix-convert-button svg { width: 17px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.radix-error { margin-top: 10px; padding: 9px 11px; background: var(--remove-bg); border: 1px solid var(--remove-strong); border-radius: 8px; color: var(--remove); font: 11px/1.5 var(--mono); }

.radix-results-section { padding: 24px; }
.results-heading { margin-bottom: 14px; }
.copy-all-button { display: inline-flex !important; align-items: center; gap: 6px; color: var(--text) !important; }
.copy-all-button svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.radix-table-wrap { position: relative; min-height: 250px; border: 1px solid var(--border); border-radius: 11px; overflow: hidden; }
.radix-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.radix-table th { height: 40px; padding: 0 14px; background: var(--surface-soft); border-bottom: 1px solid var(--border); color: var(--muted); text-align: left; font-size: 10px; font-weight: 650; }
.radix-table th:first-child { width: 90px; }
.radix-table th:nth-child(3) { width: 230px; }
.radix-table th:last-child { width: 50px; }
.radix-table td { min-height: 48px; padding: 8px 14px; border-bottom: 1px solid var(--border); color: var(--muted); font-size: 11px; vertical-align: middle; }
.radix-table tr:last-child td { border-bottom: 0; }
.radix-table tbody tr:hover { background: color-mix(in srgb, var(--accent-soft) 38%, transparent); }
.base-label { display: inline-flex; align-items: baseline; gap: 3px; color: var(--text); }
.base-label strong { font: 700 14px var(--mono); }
.base-label span { color: var(--muted-2); font-size: 9px; }
.radix-result-value { width: 100%; min-height: 33px; display: flex; align-items: center; padding: 6px 10px; overflow-wrap: anywhere; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font: 12px/1.5 var(--mono); }
.radix-copy-button { width: 31px; height: 31px; display: grid; place-items: center; padding: 0; background: transparent; border: 0; border-radius: 7px; color: var(--muted); cursor: pointer; }
.radix-copy-button:hover { background: var(--accent-soft); color: var(--accent); }
.radix-copy-button svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.radix-empty { position: absolute; inset: 40px 0 0; display: grid; place-content: center; justify-items: center; gap: 8px; background: var(--surface); color: var(--muted); text-align: center; }
.radix-empty > div { margin-bottom: 5px; color: var(--accent); font: 700 18px var(--mono); letter-spacing: 1px; }
.radix-empty > div span { color: var(--muted-2); }
.radix-empty strong { color: var(--text); font-size: 14px; }
.radix-empty small { font-size: 10px; }
.alphabet-note { display: flex; align-items: flex-start; gap: 8px; padding: 15px 4px 30px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.alphabet-note svg { width: 15px; flex: 0 0 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

.encoding-hero, .timestamp-hero { padding-bottom: 24px; }
.encoding-workbench, .timestamp-workbench { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.encoding-toolbar { min-height: 68px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 11px 15px; background: var(--surface-soft); border-bottom: 1px solid var(--border); }
.encoding-modes { display: flex; flex-wrap: wrap; gap: 5px; }
.encoding-modes button, .encoding-direction button { min-height: 34px; padding: 0 11px; background: transparent; border: 1px solid transparent; border-radius: 8px; color: var(--muted); font-size: 11px; font-weight: 650; cursor: pointer; }
.encoding-modes button:hover, .encoding-direction button:hover { color: var(--text); }
.encoding-modes button.active { background: var(--surface); border-color: var(--border); color: var(--accent); box-shadow: 0 1px 4px rgba(0,0,0,.06); }
.encoding-direction { flex: 0 0 auto; display: flex; padding: 3px; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; }
.encoding-direction button { min-height: 31px; }
.encoding-direction button.active { background: var(--accent); color: #fff; }
.encoding-editors { min-height: 430px; display: grid; grid-template-columns: minmax(0, 1fr) 58px minmax(0, 1fr); }
.encoding-editor-pane { min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.encoding-editor-pane:first-child { border-right: 1px solid var(--border); }
.encoding-editor-pane.result-pane { border-left: 1px solid var(--border); }
.encoding-pane-header { min-height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--border); }
.encoding-pane-header > div { display: flex; align-items: center; gap: 10px; }
.encoding-pane-header > div > div { display: grid; gap: 3px; }
.encoding-pane-header strong { font-size: 13px; }
.encoding-pane-header small { color: var(--muted); font-size: 10px; }
.side-indicator.encoding-source { background: var(--blue); }
.side-indicator.encoding-result { background: var(--add); }
.encoding-pane-header button { display: inline-flex; align-items: center; gap: 6px; padding: 6px 8px; background: transparent; border: 0; border-radius: 7px; color: var(--muted); font-size: 11px; cursor: pointer; }
.encoding-pane-header button:hover { background: var(--surface-soft); color: var(--text); }
.encoding-pane-header button svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.encoding-editor-pane textarea { min-height: 0; flex: 1; padding: 18px; line-height: 22px; }
.encoding-editor-pane.result-pane textarea { color: var(--accent-dark); }
.encoding-middle-actions { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; background: var(--surface-soft); }
.encoding-middle-actions button { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 50%; color: var(--muted); cursor: pointer; }
.encoding-middle-actions button:first-child { background: var(--accent); border-color: var(--accent); color: #fff; }
.encoding-middle-actions button:hover { color: var(--accent); border-color: var(--accent); }
.encoding-middle-actions button:first-child:hover { color: #fff; background: var(--accent-dark); }
.encoding-middle-actions svg { width: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.encoding-footer { min-height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 15px; background: var(--surface-soft); border-top: 1px solid var(--border); color: var(--muted); font-size: 10px; }
.encoding-footer p { margin: 0; }
.encoding-status { display: inline-flex; align-items: center; gap: 7px; }
.encoding-status span { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); }
.encoding-status.success { color: var(--add); }
.encoding-status.success span { background: var(--add); }
.encoding-status.error { color: var(--remove); }
.encoding-status.error span { background: var(--remove); }

.timestamp-workbench { padding: 16px; }
.current-time-card { min-height: 80px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 14px 17px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 12px; }
.current-time-card > div:first-child { display: grid; gap: 4px; }
.current-time-card small { color: var(--muted); font-size: 10px; }
.current-time-card > div:first-child > div { display: flex; align-items: center; gap: 8px; }
.current-time-card strong { font: 700 clamp(24px, 3vw, 31px) var(--mono); letter-spacing: -.5px; }
.current-time-card strong + span { padding: 3px 7px; background: var(--accent-soft); border-radius: 6px; color: var(--accent); font-size: 10px; font-weight: 700; }
.current-time-actions { display: flex; gap: 8px; }
.current-time-actions button { min-height: 40px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 0 13px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; color: var(--text); font-size: 11px; cursor: pointer; }
.current-time-actions button:hover { background: var(--surface-hover); }
.current-time-actions button.pause-time { background: var(--remove); border-color: var(--remove); color: #fff; }
.current-time-actions button.pause-time.paused { background: var(--add); border-color: var(--add); }
.current-time-actions svg { width: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.time-view-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 14px 0 0; padding: 3px; background: var(--surface-soft); border-radius: 10px; }
.time-view-switch button { min-height: 36px; background: transparent; border: 0; border-radius: 8px; color: var(--muted); font-size: 11px; font-weight: 650; cursor: pointer; }
.time-view-switch button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.time-converter-block { padding: 18px 0; }
.time-converter-block + .time-converter-block { border-top: 1px solid var(--border); }
.time-converter-block h2 { display: flex; align-items: center; gap: 8px; margin: 0 0 16px; font-size: 14px; }
.time-converter-block h2 svg { width: 18px; fill: none; stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.time-form-grid { display: grid; align-items: end; gap: 9px; }
.timestamp-to-date-grid { grid-template-columns: minmax(220px, 1.7fr) 120px minmax(150px, .8fr) auto auto; }
.date-to-timestamp-grid { grid-template-columns: minmax(280px, 1fr) minmax(150px, 180px) auto; }
.time-form-grid label, .batch-time-toolbar label, .batch-time-editors label, .time-result-label { min-width: 0; display: grid; gap: 7px; color: var(--muted); font-size: 10px; }
.time-form-grid input, .time-form-grid select, .time-result-label input, .time-result-label select, .batch-time-toolbar select { width: 100%; height: 40px; padding: 0 12px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; outline: 0; color: var(--text); font-size: 12px; }
.time-form-grid input:focus, .time-form-grid select:focus, .time-result-label input:focus, .batch-time-toolbar select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 12%, transparent); }
.fill-current-button, .time-convert-button { height: 40px; padding: 0 13px; border: 0; border-radius: 9px; font-size: 11px; font-weight: 650; cursor: pointer; white-space: nowrap; }
.fill-current-button { display: inline-flex; align-items: center; gap: 5px; background: var(--surface-soft); color: var(--text); }
.fill-current-button svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.time-convert-button { background: var(--accent); color: #fff; }
.time-convert-button:hover { background: var(--accent-dark); }
.time-result-label { margin-top: 12px; }
.time-result-label > div { display: flex; gap: 8px; }
.time-result-label input { flex: 1; min-width: 0; font-family: var(--mono); }
.time-result-label select { flex: 0 0 120px; }
.time-result-label button, .batch-time-footer button { flex: 0 0 auto; padding: 0 13px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: 9px; color: var(--muted); font-size: 11px; cursor: pointer; }
.time-result-label button:hover, .batch-time-footer button:hover { color: var(--accent); border-color: var(--accent); }
.time-error { margin-top: 8px; color: var(--remove); font-size: 10px; }

.batch-time-view { padding: 18px 0 2px; }
.batch-time-toolbar { display: grid; grid-template-columns: minmax(170px, 1fr) 130px minmax(150px, 1fr) auto; align-items: end; gap: 9px; margin-bottom: 14px; }
.batch-time-editors { min-height: 320px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.batch-time-editors textarea { min-height: 280px; padding: 14px; background: var(--surface-soft); border: 1px solid var(--border); border-radius: 10px; outline: 0; resize: vertical; line-height: 21px; }
.batch-time-editors textarea:focus { border-color: var(--accent); }
.batch-time-footer { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 10px; color: var(--muted); font-size: 10px; }
.batch-time-footer button { min-height: 34px; }

.empty-state { display: grid; justify-items: center; padding: 58px 20px 70px; color: var(--muted); text-align: center; }
.empty-icon { width: 72px; height: 72px; display: grid; place-items: center; margin-bottom: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 20px; box-shadow: 0 8px 24px rgba(23, 32, 42, .05); color: var(--muted-2); }
.empty-icon svg { width: 48px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.empty-state h2 { margin-bottom: 7px; color: var(--text); font-size: 16px; }
.empty-state p { margin-bottom: 15px; font-size: 13px; }
.empty-state button { padding: 8px 13px; background: transparent; border: 1px solid var(--border-strong); border-radius: 8px; color: var(--accent); font-size: 12px; cursor: pointer; }
.empty-state button:hover { background: var(--accent-soft); }

.app-shell > footer { width: min(1420px, calc(100% - 40px)); display: flex; justify-content: space-between; margin: 0 auto; padding: 24px 4px 30px; border-top: 1px solid var(--border); color: var(--muted-2); font-size: 11px; }
.app-shell > footer p { margin: 0; }

.toast { position: fixed; z-index: 30; left: 50%; bottom: 28px; transform: translate(-50%, 20px); padding: 10px 15px; background: var(--text); border-radius: 9px; color: var(--bg); font-size: 12px; opacity: 0; pointer-events: none; transition: .2s ease; box-shadow: var(--shadow); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 820px) {
  .site-header { height: auto; min-height: 66px; display: grid; grid-template-columns: auto 1fr auto; padding-top: 7px; }
  .tool-tabs { grid-column: 1 / -1; grid-row: 2; justify-content: center; min-width: 0; padding: 5px 0 7px; overflow-x: auto; }
  .header-actions { grid-column: 3; grid-row: 1; }
  main { width: min(100% - 24px, 680px); }
  .hero { align-items: flex-start; padding-top: 38px; }
  .hero-shortcut { display: none; }
  .editor-grid { grid-template-columns: 1fr; }
  .editor-card:first-child { border-right: 0; border-bottom: 1px solid var(--border); }
  .editor-body { height: 260px; }
  .swap-button { top: 50%; left: auto; right: 14px; transform: translateY(-50%) rotate(90deg); }
  .swap-button:hover { transform: translateY(-50%) rotate(270deg); }
  .control-bar { align-items: stretch; flex-direction: column; }
  .primary-actions { justify-content: flex-end; }
  .stats { flex-wrap: wrap; gap: 14px 28px; }
  .similarity { flex: 1; min-width: 180px; }
  .json-workbench { height: auto; min-height: 0; grid-template-columns: 1fr; }
  .json-source-pane { height: 390px; border-right: 0; border-bottom: 1px solid var(--border); }
  .json-preview-pane { height: 520px; }
  .radix-table th:nth-child(3), .radix-table td:nth-child(3) { display: none; }
  .encoding-toolbar { align-items: stretch; flex-direction: column; }
  .encoding-direction { align-self: flex-start; }
  .encoding-editors { grid-template-columns: 1fr; }
  .encoding-editor-pane { height: 300px; }
  .encoding-editor-pane:first-child { border-right: 0; border-bottom: 1px solid var(--border); }
  .encoding-editor-pane.result-pane { border-left: 0; border-top: 1px solid var(--border); }
  .encoding-middle-actions { height: 54px; flex-direction: row; }
  .timestamp-to-date-grid { grid-template-columns: 1fr 120px; }
  .timestamp-to-date-grid label:nth-child(3) { grid-column: 1 / -1; }
  .date-to-timestamp-grid { grid-template-columns: 1fr 160px auto; }
  .batch-time-toolbar { grid-template-columns: 1fr 120px; }
  .batch-time-toolbar label:nth-child(3) { grid-column: 1 / -1; }
  .app-shell > footer { width: calc(100% - 24px); }
}

@media (max-width: 560px) {
  .site-header { padding: 0 14px; }
  .brand > span:last-child { display: none; }
  .tool-tabs button { gap: 0; padding: 0 8px; font-size: 11px; }
  .tool-tabs svg { display: none; }
  .privacy-note { display: none; }
  h1 { letter-spacing: -1.5px; }
  .hero { padding-top: 32px; }
  .hero-copy { font-size: 14px; }
  .editor-header { height: auto; min-height: 66px; padding: 10px 12px; }
  .file-button span { display: none; }
  .editor-actions { gap: 0; }
  .options { flex-wrap: wrap; gap: 12px 16px; }
  .primary-actions { display: grid; grid-template-columns: 1fr 1fr; }
  .secondary-button, .compare-button { min-width: 0; padding: 0 10px; }
  .result-topbar { align-items: flex-start; flex-direction: column; }
  .result-actions { width: 100%; justify-content: space-between; }
  .stats { align-items: stretch; }
  .stat { flex: 1; min-width: 88px; }
  .similarity { flex-basis: 100%; margin-left: 0; }
  .json-hero { align-items: flex-start; flex-direction: column; }
  .json-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .json-toolbar-group { flex-wrap: wrap; }
  .toolbar-right { width: 100%; justify-content: space-between; }
  .json-source-pane { height: 350px; }
  .json-preview-pane { height: 500px; }
  .radix-hero { align-items: flex-start; flex-direction: column; }
  .radix-input-section, .radix-results-section { padding: 18px 14px; }
  .radix-section-heading { align-items: flex-start; }
  .base-selector { display: grid; grid-template-columns: repeat(4, 1fr); }
  .base-choice span { min-width: 0; padding: 0 6px; }
  .radix-input-row { flex-direction: column; }
  .radix-convert-button { min-height: 45px; flex-basis: auto; }
  .radix-table-wrap { overflow-x: auto; }
  .radix-table { min-width: 520px; }
  .radix-table th:nth-child(3), .radix-table td:nth-child(3) { display: none; }
  .radix-table th:first-child { width: 70px; }
  .radix-table th:last-child { width: 44px; }
  .encoding-footer { align-items: flex-start; flex-direction: column; }
  .current-time-card { align-items: flex-start; flex-direction: column; }
  .current-time-actions { width: 100%; display: grid; grid-template-columns: repeat(3, 1fr); }
  .current-time-actions button { padding: 0 7px; }
  .timestamp-workbench { padding: 12px; }
  .timestamp-to-date-grid, .date-to-timestamp-grid { grid-template-columns: 1fr; }
  .timestamp-to-date-grid label:nth-child(3) { grid-column: auto; }
  .fill-current-button, .time-convert-button { width: 100%; justify-content: center; }
  .time-result-label > div { flex-wrap: wrap; }
  .time-result-label input { flex-basis: calc(100% - 70px); }
  .time-result-label select { flex: 1; }
  .batch-time-toolbar { grid-template-columns: 1fr; }
  .batch-time-toolbar label:nth-child(3) { grid-column: auto; }
  .batch-time-editors { grid-template-columns: 1fr; }
  .batch-time-editors textarea { min-height: 190px; }
  .app-shell > footer { justify-content: center; text-align: center; }
  .app-shell > footer p:last-child { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}
