:root {
  color-scheme: light;
  --page: #f5f7f8;
  --panel: #fff;
  --ink: #17252f;
  --muted: #4a5c67;
  --line: #c4d0d7;
  --link: #19576b;
  --button: #144757;
  --button-text: #fff;
  --mark: #e0f0eb;
  --mark-text: #245447;
  --sans: system-ui, sans-serif;
  --mono: ui-monospace, Consolas, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #141b20;
  --panel: #1a252c;
  --ink: #eef4f5;
  --muted: #b6cad2;
  --line: #50656f;
  --link: #8fcedf;
  --button: #99d8e6;
  --button-text: #153543;
  --mark: #203c39;
  --mark-text: #a8e3cd;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--page); color: var(--ink); font: 1rem/1.5 var(--sans); }
a { color: var(--link); }
button { color: inherit; font: inherit; cursor: pointer; }
button:disabled { cursor: default; opacity: .65; }
a:focus-visible, button:focus-visible, textarea:focus-visible { outline: 2px solid var(--link); outline-offset: 3px; }
body > header > div, body > footer > div, .format-workbench, body > main:not(.format-workbench) { width: min(100% - 2rem, 74rem); margin-inline: auto; }
body > header > div, body > footer > div:not(.app-meta) { display: flex; justify-content: space-between; align-items: center; padding-block: .8rem; gap: .6rem; }
body > header nav, body > footer nav { display: flex; flex-wrap: wrap; align-items: center; gap: .7rem; }
body > header a, body > footer a { font-size: .88rem; }
body > footer { border-top: 1px solid var(--line); }
body > main:not(.format-workbench) { min-height: 60vh; max-width: 48rem; }
.brand { display: inline-flex; align-items: center; gap: .48rem; color: var(--ink); text-decoration: none; font-weight: 680; white-space: nowrap; }
.brand img { width: 1.7rem; height: 1.7rem; border-radius: 4px; }
.workbench-heading { margin-block: 2.3rem 1.8rem; }
.workbench-kicker { color: var(--link); font: 700 .8rem/1.2 var(--mono); }
.workbench-heading h1 { color: var(--ink); font-size: 2.25rem; line-height: 1.12; margin: .5rem 0; }
.workbench-heading p { margin: 0; color: var(--muted); }
.format-tool { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); border-block: 1px solid var(--line); margin-bottom: 2.4rem; }
.format-tool section { min-width: 0; padding-block: 1.1rem 1.4rem; }
#table-source { padding-right: 1.2rem; border-right: 1px solid var(--line); }
#table-formats { padding-left: 1.2rem; }
.panel-title, .file-actions, .source-actions, .result-actions { display: flex; align-items: center; gap: .55rem; }
.panel-title, .source-actions { justify-content: space-between; }
.panel-title { margin-bottom: .7rem; }
.panel-title h2 { margin: 0; font-size: 1.18rem; }
.panel-title span, .panel-title output, .source-actions small, .result-actions small { color: var(--muted); font-size: .79rem; overflow-wrap: anywhere; }
.panel-title span { max-width: 55%; text-align: right; }
.format-tool button { flex: 0 0 auto; min-height: 2.6rem; padding: .4rem .75rem; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); font-weight: 620; }
.format-tool button.primary { border-color: var(--button); background: var(--button); color: var(--button-text); }
.format-tool button.quiet { border-color: transparent; background: transparent; color: var(--link); }
.format-tool textarea { display: block; width: 100%; min-width: 0; padding: .7rem; resize: vertical; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--ink); font: .94rem/1.62 var(--mono); }
#table-text { min-height: 17.5rem; margin: .7rem 0; }
#table-output { min-height: 10rem; margin: .45rem 0 .7rem; }
#table-results > label { font-size: .88rem; font-weight: 650; }
.result-actions { flex-wrap: wrap; justify-content: end; }
.result-actions small { flex: 1 0 auto; }
.column-scroll { max-height: 16rem; overflow: auto; margin-bottom: 1.2rem; }
.column-scroll table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.column-scroll th, .column-scroll td { text-align: left; padding: .45rem .35rem; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.column-scroll thead th { color: var(--muted); font-weight: 550; }
.column-scroll tbody th small { display: block; color: var(--muted); font-weight: 400; }
.column-scroll td:last-child code { padding: .15rem .3rem; border-radius: 4px; background: var(--mark); color: var(--mark-text); }
.format-empty { min-height: 16rem; display: grid; place-content: center; justify-items: center; color: var(--muted); }
.format-demo { display: grid; grid-template-columns: 2ch 1ch 2ch; font: 1.35rem/1.45 var(--mono); }
.format-demo span:nth-child(3n+1) { text-align: right; }
.format-demo b { color: var(--link); border-inline: 1px solid var(--line); text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 760px), (max-width: 960px) and (max-height: 500px) and (pointer: coarse) {
  .workbench-heading { margin-block: 1rem .9rem; }
  .workbench-heading h1 { font-size: 1.8rem; }
  .format-tool { display: block; margin-bottom: 1rem; }
  .format-tool section { padding-block: .85rem; }
  #table-source, #table-formats { padding-inline: 0; border-inline: 0; }
  #table-text { min-height: 15rem; }
  .format-tool button { min-height: 2.75rem; }
  .source-actions { flex-wrap: wrap; justify-content: end; }
}
