.tool-workspace {
  --tool-field: #0b1120;
  --tool-result: #101a2e;
  --tool-soft: #17223b;
  --tool-raised: #24314e;
  --tool-cyan: #7cdef4;
  --tool-violet: #c3afff;
  --tool-error: #ff9cb6;
  --tool-add-bg: #102c38;
  --tool-remove-bg: #302033;
  --tool-focus: #9caeff;
  --tool-glow: rgba(116, 137, 255, .12);
  --tool-highlight: #3d3565;
  --tool-highlight-ink: #f1eaff;
  color: var(--ink, #edf2ff);
  animation: tool-arrive .3s ease-out both;
}
[data-theme="light"] .tool-workspace {
  --tool-field: #fafbff;
  --tool-result: #f1f5ff;
  --tool-soft: #e9eeff;
  --tool-raised: #fff;
  --tool-cyan: #146b86;
  --tool-violet: #7145b8;
  --tool-error: #a53155;
  --tool-add-bg: #e9f6fc;
  --tool-remove-bg: #fcecf3;
  --tool-focus: #586bca;
  --tool-glow: rgba(89, 111, 215, .08);
  --tool-highlight: #e0d7ff;
  --tool-highlight-ink: #45317f;
}
.tool-workspace * { box-sizing: border-box; }
.tool-workspace .tool-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin: 0 0 22px; }
.tool-workspace .tool-topline { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 22px; }
.tool-workspace .tool-badge { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 20px; padding: 7px 12px; background: linear-gradient(110deg, var(--tool-soft), var(--tool-result)); color: var(--tool-cyan); font-size: 11px; font-weight: 600; letter-spacing: .025em; white-space: nowrap; }
.tool-workspace .tool-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: var(--tool-cyan); box-shadow: 0 0 9px var(--tool-cyan); margin-right: 8px; }
.tool-workspace .tool-spacer { flex: 1; }
.tool-workspace .tool-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 22px; margin: 0 0 20px; }
.tool-workspace .tool-field { display: flex; flex-direction: column; gap: 10px; margin: 0; min-width: 0; }
.tool-workspace .tool-field > span, .tool-workspace .tool-result-head > span { font-size: 12px; color: var(--ink, #edf2ff); font-weight: 650; letter-spacing: .015em; }
.tool-workspace textarea { display: block; width: 100%; min-height: 310px; padding: 19px; font-family: 'Cascadia Code', Consolas, 'SFMono-Regular', monospace; font-size: 13px; line-height: 1.85; border: 1px solid var(--line); border-radius: 14px; resize: vertical; tab-size: 2; color: var(--ink, #edf2ff); background: var(--tool-field); box-shadow: inset 0 1px 7px rgba(0, 0, 0, .08); transition: border-color .18s, box-shadow .18s; scrollbar-color: var(--tool-raised) transparent; }
.tool-workspace textarea::placeholder, .tool-workspace input::placeholder { color: var(--muted, #98a5bf); opacity: .75; }
.tool-workspace textarea[readonly] { background: var(--tool-result); }
.tool-workspace textarea:focus, .tool-workspace input:focus, .tool-workspace select:focus { outline: 2px solid var(--tool-focus); outline-offset: 2px; box-shadow: 0 0 0 5px var(--tool-glow); }
.tool-workspace input:not([type="checkbox"]):not([type="color"]), .tool-workspace select { max-width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--ink, #edf2ff); background: var(--tool-field); font: inherit; font-size: 13px; transition: border-color .18s, box-shadow .18s; }
.tool-workspace input[type="checkbox"] { accent-color: var(--accent, #91a4ff); width: 15px; height: 15px; flex: 0 0 auto; }
.tool-workspace button { cursor: pointer; }
.tool-workspace button:focus-visible { outline: 2px solid var(--tool-focus); outline-offset: 3px; }
.tool-workspace .btn { transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease, background-color .18s ease; }
.tool-workspace .btn:active { transform: translateY(1px); }
.tool-workspace .tool-note { color: var(--muted, #98a5bf); font-size: 12px; line-height: 1.7; margin: 0; }
.tool-workspace .tool-status { min-height: 23px; margin: 4px 0 18px; color: var(--tool-cyan); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.tool-workspace .tool-status.is-error { color: var(--tool-error); }
.tool-workspace .tool-result { min-width: 0; }
.tool-workspace .tool-result-head { min-height: 23px; display: flex; justify-content: space-between; align-items: center; gap: 10px; margin: -6px 0 10px; }
.tool-workspace .tool-segment { display: inline-flex; background: var(--tool-field); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.tool-workspace .tool-segment button { border: 0; padding: 7px 13px; font-size: 12px; background: transparent; color: var(--muted, #98a5bf); border-radius: 7px; transition: background-color .18s, color .18s; }
.tool-workspace .tool-segment button[aria-pressed="true"] { background: var(--tool-raised); color: var(--accent, #91a4ff); box-shadow: inset 0 1px 0 rgba(170, 190, 255, .1), 0 2px 8px rgba(0, 0, 0, .08); }
.tool-workspace .tool-result-actions { display: flex; gap: 8px; margin-top: 12px; }
.tool-workspace .tool-draft { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; border-top: 1px solid var(--line); padding-top: 18px; }
.tool-workspace .tool-draft label, .tool-workspace .tool-check { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; }
.tool-workspace .tool-draft .btn { font-size: 12px; }
.tool-workspace .tool-draft .tool-note { flex-basis: 100%; }
.tool-workspace .tool-tree-search { display: flex; gap: 6px; padding-bottom: 10px; }
.tool-workspace .tool-tree-search input { width: 100%; min-width: 80px; }
.tool-workspace .tool-tree-search .btn { flex: 0 0 auto; }
.tool-workspace .tool-tree { min-height: 250px; max-height: 440px; padding: 18px; background: var(--tool-result); border: 1px solid var(--line); border-radius: 14px; overflow: auto; font: 12px/1.85 'Cascadia Code', Consolas, monospace; scrollbar-color: var(--tool-raised) transparent; }
.tool-workspace .tool-tree details > details, .tool-workspace .tool-tree details > .tool-tree-leaf { margin-left: 15px; border-left: 1px solid var(--line); padding-left: 11px; }
.tool-workspace .tool-tree summary { cursor: pointer; padding: 2px 0; color: var(--accent); overflow-wrap: anywhere; }
.tool-workspace .tool-tree-leaf { overflow-wrap: anywhere; padding-top: 2px; padding-bottom: 2px; }
.tool-workspace .tool-tree .type-string { color: var(--tool-cyan); }
.tool-workspace .tool-tree .type-number { color: var(--tool-violet); }
.tool-workspace .tool-tree .type-boolean, .tool-workspace .tool-tree .type-null { color: var(--accent); }
.tool-workspace .tool-tree mark { background: var(--tool-highlight); color: var(--tool-highlight-ink); border-radius: 3px; padding: 1px 2px; }
.tool-workspace #json-tree-note { margin-top: 8px; }
.tool-workspace .tool-clock { position: relative; display: flex; justify-content: space-between; align-items: center; gap: 20px; border: 1px solid var(--line); background: radial-gradient(ellipse at 95% 0, rgba(119, 104, 241, .17), transparent 65%), linear-gradient(115deg, var(--tool-result), var(--tool-field)); border-radius: 16px; padding: 26px; margin-bottom: 25px; box-shadow: inset 0 1px 0 rgba(175, 194, 255, .05); overflow: hidden; }
.tool-workspace .tool-clock::after { content: ''; position: absolute; bottom: 0; left: 26px; right: 26px; height: 1px; background: linear-gradient(90deg, var(--tool-cyan), var(--accent), transparent); opacity: .5; pointer-events: none; }
.tool-workspace .tool-clock > div { display: grid; gap: 8px; }
.tool-workspace .tool-eyebrow { font-size: 10px; color: var(--tool-cyan); letter-spacing: .17em; }
.tool-workspace .tool-clock strong { font-size: clamp(20px, 3vw, 30px); font-weight: 500; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.tool-workspace .tool-mono { font: 12px/1.6 'Cascadia Code', Consolas, monospace; color: var(--muted, #98a5bf); }
.tool-workspace .tool-inline-label { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; font-size: 12px; }
.tool-workspace .tool-panel { border: 1px solid var(--line); padding: 24px; border-radius: 16px; background: linear-gradient(145deg, var(--tool-glow), transparent 55%); display: flex; flex-direction: column; align-items: stretch; gap: 16px; min-width: 0; transition: border-color .22s, box-shadow .22s; }
.tool-workspace .tool-panel h3, .tool-workspace .tool-palette h3 { font-size: 16px; font-weight: 600; margin: 0 0 3px; }
.tool-workspace .tool-panel > .btn { align-self: flex-start; }
.tool-workspace .tool-readout { margin-top: 5px; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 9px 12px; padding: 16px; background: var(--tool-result); border: 1px solid var(--line); border-radius: 12px; }
.tool-workspace .tool-readout > span { grid-column: 1 / -1; font-size: 11px; color: var(--muted, #98a5bf); }
.tool-workspace .tool-readout output { min-width: 0; overflow-wrap: anywhere; font: 14px/1.65 'Cascadia Code', Consolas, monospace; }
.tool-workspace .tool-readout .btn { font-size: 11px; padding: 6px 9px; min-height: 32px; }
.tool-workspace.tool-encoding > .tool-note { margin: -7px 0 22px; }
.tool-workspace.tool-encoding > .tool-note:last-child { margin: 0; }
.tool-workspace .tool-diff-view { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin: 0 0 18px; background: var(--tool-field); }
.tool-workspace .tool-diff-legend { display: grid; grid-template-columns: 45px 45px 1fr; padding: 11px 8px; background: var(--tool-soft); border-bottom: 1px solid var(--line); font-size: 10px; color: var(--muted, #98a5bf); text-align: center; }
.tool-workspace .tool-diff-legend span:last-child { text-align: left; padding-left: 13px; }
.tool-workspace #diff-result { max-height: 470px; overflow: auto; }
.tool-workspace .tool-diff-line { display: grid; grid-template-columns: 45px 45px 22px minmax(0, 1fr); padding: 4px 8px; min-height: 28px; font: 12px/1.7 'Cascadia Code', Consolas, monospace; }
.tool-workspace .tool-diff-line > span { text-align: center; color: var(--muted); font-size: 10px; user-select: none; }
.tool-workspace .tool-diff-line code { white-space: pre-wrap; overflow-wrap: anywhere; color: inherit; background: none; font: inherit; padding: 0; }
.tool-workspace .tool-diff-line.is-add { background: var(--tool-add-bg); color: var(--tool-cyan); }
.tool-workspace .tool-diff-line.is-remove { background: var(--tool-remove-bg); color: var(--tool-error); }
.tool-workspace .tool-diff-line.is-add > span:nth-child(3), .tool-workspace .tool-diff-line.is-remove > span:nth-child(3) { color: inherit; font-weight: 700; }
.tool-workspace .tool-empty { font-size: 13px; color: var(--muted, #98a5bf); text-align: center; padding: 38px 18px; margin: 0; }
.tool-workspace .tool-options { display: flex; flex-wrap: wrap; align-items: center; gap: 15px 24px; padding: 17px 20px; background: linear-gradient(115deg, var(--tool-result), var(--tool-field)); border: 1px solid var(--line); border-radius: 14px; margin-bottom: 24px; }
.tool-workspace .tool-options select { min-height: 34px; padding: 7px 9px; }
.tool-workspace .tool-stats { margin-top: 10px; font-variant-numeric: tabular-nums; }
.tool-workspace .tool-color-layout { display: grid; grid-template-columns: minmax(180px, .8fr) minmax(0, 1.2fr); gap: 32px; }
.tool-workspace .tool-color-preview { position: relative; aspect-ratio: 1; border-radius: 18px; display: flex; align-items: flex-end; padding: 25px; box-shadow: inset 0 0 0 1px rgba(170, 190, 255, .16), 0 16px 32px rgba(0, 0, 0, .12); transition: background-color .18s ease; overflow: hidden; }
.tool-workspace .tool-color-preview::before { content: ''; position: absolute; inset: 0; border: 8px solid rgba(255, 255, 255, .045); border-radius: inherit; pointer-events: none; }
.tool-workspace .tool-color-preview span { font: 20px/1.2 'Cascadia Code', Consolas, monospace; letter-spacing: .08em; }
.tool-workspace .tool-color-picker { display: flex; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px; margin-top: 13px; background: var(--tool-result); cursor: pointer; font-size: 12px; }
.tool-workspace input[type="color"] { border: 0; border-radius: 5px; background: none; padding: 0; width: 31px; height: 31px; cursor: pointer; }
.tool-workspace .tool-color-controls .tool-toolbar { margin-top: 16px; }
.tool-workspace .tool-color-values { border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 16px; background: var(--tool-result); }
.tool-workspace .tool-color-values > div { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 15px 13px; }
.tool-workspace .tool-color-values > div + div { border-top: 1px solid var(--line); }
.tool-workspace .tool-color-values span { color: var(--tool-cyan); font-size: 10px; letter-spacing: .06em; }
.tool-workspace .tool-color-values output { overflow-wrap: anywhere; font: 12px/1.7 'Cascadia Code', Consolas, monospace; }
.tool-workspace .tool-color-values .btn { min-height: 30px; padding: 5px 8px; font-size: 11px; }
.tool-workspace .tool-palette { margin-top: 30px; border-top: 1px solid var(--line); padding-top: 25px; }
.tool-workspace .tool-section-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.tool-workspace .tool-color-saved { display: flex; flex-wrap: wrap; gap: 12px; }
.tool-workspace .tool-color-saved > .tool-empty { width: 100%; border: 1px dashed var(--line); border-radius: 12px; background: var(--tool-field); }
.tool-workspace .tool-color-chip { display: grid; grid-template-columns: 1fr 22px; width: 102px; background: var(--tool-result); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: transform .18s, box-shadow .18s; animation: tool-arrive .2s ease-out both; }
.tool-workspace .tool-swatch { height: 60px; grid-column: 1 / -1; border: 0; padding: 0; }
.tool-workspace .tool-color-chip > span { font: 10px/1.2 'Cascadia Code', Consolas, monospace; padding: 11px 0 11px 8px; }
.tool-workspace .tool-remove { background: none; border: 0; padding: 0; color: var(--muted); font-size: 18px; }
.tool-workspace .tool-remove:hover { color: var(--tool-error); }
.tool-workspace [hidden] { display: none !important; }
.tool-workspace .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; }
@media (max-width: 760px) {
  .tool-workspace .tool-split, .tool-workspace .tool-color-layout { grid-template-columns: minmax(0, 1fr); gap: 22px; }
  .tool-workspace .tool-topline { align-items: flex-start; flex-direction: column; gap: 8px; }
  .tool-workspace textarea { min-height: 250px; }
  .tool-workspace .tool-result-head { margin-top: 0; }
  .tool-workspace .tool-panel { padding: 18px; }
  .tool-workspace .tool-clock { padding: 19px; flex-wrap: wrap; }
  .tool-workspace .tool-clock .btn { font-size: 12px; }
  .tool-workspace .tool-options { gap: 16px; padding: 16px; }
  .tool-workspace .tool-color-preview { aspect-ratio: 1.8; }
  .tool-workspace .tool-toolbar { gap: 8px; }
  .tool-workspace .tool-toolbar .btn { font-size: 12px; padding: 9px 12px; }
}
@keyframes tool-arrive { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@media (hover: hover) {
  .tool-workspace .btn:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 5px 16px var(--tool-glow); }
  .tool-workspace .tool-panel:hover { border-color: var(--tool-focus); box-shadow: 0 8px 28px var(--tool-glow); }
  .tool-workspace .tool-color-chip:hover { transform: translateY(-3px); box-shadow: 0 8px 20px var(--tool-glow); }
}
@media (prefers-reduced-motion: reduce) {
  .tool-workspace, .tool-workspace *, .tool-workspace *::before, .tool-workspace *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .tool-workspace .btn:hover, .tool-workspace .tool-color-chip:hover { transform: none; }
}
