/* Single source stylesheet. Components first; responsive and accessibility rules below. */

/* Theme tokens */
:root {
  color-scheme: light;
  --bg: #f6f7f3;
  --surface: #fff;
  --surface-soft: #f8faf7;
  --ink: #202e2a;
  --muted: #5f6e68;
  --line: #dce3da;
  --accent: #126754;
  --accent-hover: #0b5142;
  --accent-soft: #e9f4ed;
  --accent-line: #a8caba;
  --danger: #a4312c;
  --danger-bg: #fff1ef;
  --shadow: 0 12px 48px -32px #193b2d50, 0 2px 6px #203f2a04;
  --radius: 20px;
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: auto;
  font-family: "Segoe UI Variable Text", "Segoe UI", ui-sans-serif, system-ui, sans-serif;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #131d19;
  --surface: #1b2922;
  --surface-soft: #17241e;
  --ink: #edf3ea;
  --muted: #b3c2b6;
  --line: #35483b;
  --accent: #a4dfbc;
  --accent-hover: #b9edcc;
  --accent-soft: #233f2f;
  --accent-line: #537b60;
  --danger: #ffb5a9;
  --danger-bg: #3c2622;
  --shadow: 0 15px 45px -25px #0009;
}

/* Document defaults and keyboard focus */
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: inherit; text-underline-offset: 4px; -webkit-tap-highlight-color: transparent; touch-action: manipulation; overflow-wrap: anywhere; }
button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
  color: var(--ink);
  border: 0;
  touch-action: manipulation;
  overflow-wrap: anywhere;
  transition: background-color 180ms, border-color 180ms, color 180ms, transform 180ms;
}
textarea {
  font: inherit;
  color: var(--ink);
  display: block;
  width: 100%;
  border: 0;
  border-radius: 0;
  background: transparent;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  tab-size: 4;
  height: 180px;
  min-height: 160px;
  padding: 8px 18px 12px;
  font-size: 15px;
  line-height: 1.65;
}
input { font: inherit; }
button:disabled { opacity: 0.42; cursor: not-allowed; }
button:disabled:hover { transform: none; }
summary { touch-action: manipulation; overflow-wrap: anywhere; }
button:focus-visible, a:focus-visible, summary:focus-visible, input:focus-visible { outline: 3px solid var(--accent); outline-offset: 4px; }
textarea:focus-visible { outline: 3px solid var(--accent); outline-offset: -4px; }
[hidden] { display: none !important; }
h1 { line-height: 1.05; margin: 0; font-weight: 720; overflow-wrap: anywhere; font-size: clamp(30px, 3vw, 40px); letter-spacing: -0.035em; text-wrap: balance; }
h1 span { color: var(--accent); }
textarea::placeholder { color: var(--muted); opacity: 0.72; font-family: ui-sans-serif, "Segoe UI", sans-serif; line-height: 1.8; }
textarea[aria-invalid="true"] { background: var(--danger-bg); }
label, h2, h3, p { overflow-wrap: anywhere; }
select { font: inherit; color: var(--ink); }
select:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
legend { font-size: 13px; font-weight: 650; padding: 0 0 14px; }
button:not(:disabled):active { transform: translateY(1px); }

/* Shared controls and fields */
.shell { width: min(1160px, calc(100% - 64px)); margin: 0 auto; }
.icon { flex: 0 0 auto; vertical-align: middle; }
.skip { position: absolute; top: -120px; left: 20px; z-index: 10; background: var(--accent); color: var(--surface); padding: 14px; border-radius: 8px; }
.skip:focus { top: 12px; }
.small-button { display: flex; align-items: center; gap: 5px; background: transparent; color: var(--muted); border-radius: 6px; font-size: 13px; min-height: 40px; padding: 8px 10px; }
.small-button .icon { width: 14px; height: 14px; }
.small-button:not(:disabled):hover { background: var(--accent-soft); color: var(--accent); }
.separator { height: 16px; width: 1px; background: var(--line); margin: 0 2px; }
.text-button { display: inline-flex; align-items: center; gap: 5px; background: transparent; padding: 5px 0; color: var(--accent); font-weight: 650; font-size: 13px; min-height: 40px; }
.text-button:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-button .icon { width: 14px; height: 14px; }
.options { display: flex; gap: 20px; flex-wrap: wrap; margin-top: 14px; font-size: 14px; line-height: 1.5; }
.options label { display: flex; align-items: center; gap: 7px; line-height: 1.5; }
.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  font-weight: 650;
  border-radius: 9px;
  background: var(--accent);
  color: var(--surface);
  border: 1px solid var(--accent);
  min-height: 44px;
  font-size: 14px;
}
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 16px;
  font-weight: 650;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: var(--surface);
  min-height: 44px;
  font-size: 14px;
}
.primary-button:not(:disabled):hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.secondary-button:not(:disabled):hover { border-color: var(--accent-line); background: var(--surface-soft); }
.primary-button .icon, .secondary-button .icon { width: 16px; height: 16px; }
.notice { padding: 16px 20px; border: 1px solid var(--line); background: var(--surface-soft); border-radius: 10px; font-size: 13px; line-height: 1.7; }
.notice.error { border-color: var(--danger); color: var(--danger); background: var(--danger-bg); }
.section-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; margin-bottom: 24px; }
.section-heading h2 { font-size: 27px; font-weight: 680; letter-spacing: -0.9px; margin: 0; }
.section-heading > p { color: var(--muted); font-size: 12px; }
.inline-link { color: var(--accent); display: inline-flex; gap: 8px; align-items: center; font-size: 12px; font-weight: 600; }
.inline-link .icon { width: 15px; height: 15px; }
.field-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.four-fields { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.field { display: flex; flex-direction: column; gap: 7px; margin: 0 0 12px; min-width: 0; }
.field > span { font-weight: 650; color: var(--muted); font-size: 14px; line-height: 1.5; }
.field input {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  min-height: 44px;
  font-size: 15px;
  max-width: 100%;
}
.field select {
  width: 100%;
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  min-height: 44px;
  font-size: 15px;
  max-width: 100%;
  text-overflow: ellipsis;
}
.check-field { display: inline-flex; align-items: center; gap: 9px; min-width: 0; overflow-wrap: anywhere; font-size: 14px; line-height: 1.5; }
.check-field input, .options input { accent-color: var(--accent); width: 17px; height: 17px; flex-shrink: 0; }
.hint { color: var(--muted); margin: 10px 0; font-size: 13px; line-height: 1.65; }
.pill { padding: 6px 12px; background: var(--accent-soft); color: var(--accent); border-radius: 20px; font-size: 12px; white-space: nowrap; }
.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; }

/* Header, navigation and introduction */
.site-header { border-bottom: 1px solid var(--line); background: var(--surface); }
.header-inner { display: flex; align-items: center; gap: 40px; justify-content: space-between; min-height: 68px; height: auto; padding-block: 12px; }
.brand { display: inline-flex; gap: 12px; align-items: center; text-decoration: none; font-size: 21px; font-weight: 750; letter-spacing: -0.7px; min-width: 0; }
.brand > span:last-child { overflow-wrap: anywhere; }
.brand-mark {
  width: 38px;
  height: 38px;
  display: inline-flex;
  justify-content: center;
  align-items: center;
  font-size: 34px;
  line-height: 1;
  font-weight: 600;
  color: rgb(255, 255, 255);
  background: rgb(18, 103, 84);
  border-radius: 11px;
  padding-bottom: 4px;
  flex-shrink: 0;
  letter-spacing: -3px;
}
.brand-mark span { color: rgb(201, 235, 189); }
.main-nav { display: flex; align-items: center; gap: 28px; margin-left: auto; font-weight: 550; color: var(--muted); font-size: 14px; }
.main-nav a { text-decoration: none; }
.main-nav a:hover { color: var(--accent); }
.header-actions { display: flex; align-items: center; gap: 12px; }
.language-switch { padding: 4px; display: flex; border: 1px solid var(--line); border-radius: 10px; gap: 2px; }
.language-switch a { font-size: 11px; letter-spacing: 0.04em; font-weight: 750; padding: 8px 10px; min-height: 32px; text-decoration: none; color: var(--muted); border-radius: 6px; }
.language-switch a.active { background: var(--accent-soft); color: var(--accent); }
.icon-button { background: transparent; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 9px; }
.icon-button:hover { background: var(--accent-soft); }
.hero { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; padding: 20px 0; }
.eyebrow { font-size: 10px; font-weight: 800; letter-spacing: 0.16em; color: var(--accent); display: flex; align-items: center; gap: 8px; margin: 0 0 15px; line-height: 1.8; }
.eyebrow > span { width: 6px; height: 6px; background: var(--accent); border-radius: 50%; }
.intro { color: var(--muted); margin: 10px 0 0; font-size: 15px; line-height: 1.5; max-width: 70ch; text-wrap: pretty; }
.privacy-chip { display: flex; gap: 10px; padding: 13px 16px; margin-bottom: 2px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-soft); max-width: 310px; }
.privacy-chip .icon { margin-top: 2px; color: var(--accent); }
.privacy-chip strong { display: block; font-weight: 700; margin-bottom: 5px; font-size: 13px; }
.privacy-chip span { color: var(--muted); display: block; font-size: 12px; line-height: 1.5; }
.language-menu { position: relative; }
.language-menu > summary { cursor: pointer; list-style: none; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; font-size: 13px; font-weight: 700; }
.language-menu > summary::-webkit-details-marker { display: none; }
.language-menu .language-switch { position: absolute; right: 0; top: calc(100% + 9px); display: grid; width: 220px; padding: 8px; z-index: 50; background: var(--surface); box-shadow: var(--shadow); }
.language-menu .language-switch a { font-size: 14px; padding: 12px; }
.hero .eyebrow { font-size: 11px; line-height: 1.4; margin-bottom: 8px; }

/* Workspace, editors and export */
.workspace { border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); border-radius: var(--radius); overflow: hidden; scroll-margin-top: 18px; }
.workspace-top { border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; background: var(--surface-soft); gap: 12px; flex-wrap: wrap; padding: 6px 18px; }
.workspace-label { display: flex; align-items: center; gap: 7px; font-weight: 700; color: var(--accent); letter-spacing: 0.03em; font-size: 12px; }
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.history-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; max-width: 100%; margin-left: auto; }
.editor-grid { display: grid; grid-template-columns: 1fr 1fr; }
.editor { min-width: 0; }
.source-editor { border-right: 1px solid var(--line); }
.result-editor { background: var(--surface-soft); }
.editor-top { display: flex; align-items: center; justify-content: space-between; min-height: 53px; gap: 8px; padding: 8px 18px; }
.editor-top > label { font-weight: 750; white-space: nowrap; font-size: 14px; }
.editor-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.mode-label { padding: 5px 8px; border: 1px solid var(--accent-line); color: var(--accent); border-radius: 6px; overflow-wrap: anywhere; font-size: 12px; }
.editor-foot { color: var(--muted); letter-spacing: 0.01em; margin: 0; font-size: 12px; line-height: 1.5; padding: 8px 18px 12px; }
.stats-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
  padding: 13px 22px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.stat { display: flex; gap: 7px; align-items: baseline; padding-right: 22px; margin-right: 22px; border-right: 1px solid var(--line); }
.stat:last-of-type { border: 0; margin: 0 0 0 auto; padding-right: 0; }
.stat strong { font-weight: 750; font-variant-numeric: tabular-nums; font-size: 18px; }
.stat span { color: var(--muted); font-size: 12px; }
.stat-hint { color: var(--muted); flex-basis: 100%; padding-top: 10px; font-size: 12px; }
.result-actions { border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 12px 18px; background: var(--surface-soft); gap: 12px; }
.export-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.status-line { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; min-height: 42px; padding: 10px 2px; }
.status-line p { margin: 0; font-size: 11px; line-height: 1.5; color: var(--accent); }
.status-line > span { font-size: 9px; color: var(--muted); flex-shrink: 0; margin-left: auto; padding-top: 2px; }
.workspace-modes { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; border-bottom: 1px solid var(--line); padding: 8px 18px; }
.mode-button { background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; padding: 10px 16px; font-weight: 650; min-height: 44px; font-size: 14px; }
.mode-button[aria-pressed="true"] { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.workspace-modes #cancel-work { margin-left: auto; }
.workspace[data-mode="compare"] .editor-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.workspace[data-mode="compare"] .editor textarea { min-height: 250px; }
.second-editor { border-inline: 1px solid var(--line); }
.quick-toolbar { display: flex; flex-wrap: wrap; align-items: center; border-bottom: 1px solid var(--line); padding: 8px 18px; gap: 4px 8px; }
.quick-toolbar > label { font-size: 13px; color: var(--muted); margin-right: 0.25rem; }
.quick-buttons { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
#quick-tool { display: none; }
.quick-toolbar [aria-pressed="true"] { border-color: var(--accent); box-shadow: currentcolor 0 -2px inset; }
.quick-toolbar button { overflow-wrap: anywhere; font-size: 12px; }
.history-actions .small-button { white-space: nowrap; flex-shrink: 0; }
.drop-hint { font-size: 12px; line-height: 1.5; margin: 0; padding: 4px 18px; color: var(--muted); }
.drop-hint strong { display: none; color: var(--accent); }
.editor.drag-active { background: var(--accent-soft); outline: 3px dashed var(--accent); outline-offset: -5px; }
.drag-active .drop-hint span { display: none; }
.drag-active .drop-hint strong { display: block; }
.result-actions > button { max-width: 100%; }
.workspace[data-mode="compare"][data-comparison="text-diff"] .editor-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.workspace[data-mode="compare"][data-comparison="text-diff"] .result-editor { display: none; }

/* Catalog, search and analysis */
.transformations { padding: 23px 22px 0; }
.tools-heading { display: flex; justify-content: space-between; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; align-items: flex-start; }
.tools-heading h2 { margin: 0; font-weight: 750; letter-spacing: -0.2px; font-size: 17px; }
.tools-heading p { color: var(--muted); margin: 5px 0 0; line-height: 1.6; font-size: 13px; }
.tabs { display: flex; padding: 4px; border-radius: 9px; background: var(--bg); border: 1px solid var(--line); gap: 3px; justify-content: flex-start; flex-wrap: wrap; max-width: 100%; }
.tabs button {
  padding: 8px 12px;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-weight: 600;
  line-height: 1.4;
  word-break: normal;
  hyphens: none;
  overflow-wrap: normal;
  min-height: 44px;
  font-size: 13px;
}
.tabs button[aria-selected="true"] { color: var(--accent); background: var(--surface); box-shadow: rgba(0, 0, 0, 0.047) 0 1px 3px; }
.tabs .category-word { display: inline-block; white-space: nowrap; }
.tool-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 9px; }
.tool-grid.three-tools { grid-template-columns: repeat(3, 1fr); }
.tool-button {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  text-align: left;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 10px;
  transition: background 0.15s, border-color 0.15s;
  min-width: 0;
  min-height: 90px;
  padding: 14px;
}
.tool-button > span:nth-child(2) { font-weight: 600; overflow-wrap: anywhere; font-size: 13px; line-height: 1.45; }
.tool-button:hover { border-color: var(--accent-line); background: var(--surface-soft); }
.tool-button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.tool-symbol { font-size: 20px; font-weight: 650; letter-spacing: -0.7px; line-height: 1; max-width: 3.2rem; overflow: hidden; }
.selected-mark { position: absolute; right: 9px; top: 9px; opacity: 0; }
.selected-mark .icon { width: 13px; height: 13px; }
.tool-button[aria-pressed="true"] .selected-mark { opacity: 1; }
.tool-note { display: flex; gap: 7px; align-items: flex-start; color: var(--muted); min-height: 34px; margin: 15px 0; font-size: 13px; line-height: 1.65; }
.tool-note .icon { width: 13px; height: 13px; margin-top: 2px; }
.extra-options { margin-top: 18px; padding: 18px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 12px; }
.add-step-row { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 12px; }
.add-step-row .small-button { border: 1px solid var(--line); background: var(--surface-soft); }
.extra-options textarea {
  min-height: 4rem;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 0.5rem;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  resize: vertical;
  max-width: 100%;
}
.analysis-results { margin: 1.2rem; padding: 1rem; border: 1px solid var(--line); border-radius: 0.9rem; }
.analysis-results .section-heading { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.7rem; }
.analysis-results .section-heading h2 { font-size: 1.1rem; margin: 0; }
.frequency-table td:first-child { overflow-wrap: anywhere; max-width: 28rem; }
.frequency-table td:not(:first-child) { font-variant-numeric: tabular-nums; }
.analysis-navigation { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 0.7rem; margin-top: 1rem; }
#catalog-info { overflow-wrap: anywhere; }
#panel-case { grid-template-columns: repeat(7, minmax(0, 1fr)); }
.tool-search { margin: 0 0 20px; }
.tool-search > label { display: block; font-size: 14px; font-weight: 650; margin-bottom: 8px; }
.search-input-row { display: flex; align-items: center; gap: 8px; }
.search-input-row input {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 10px 14px;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 9px;
  font: inherit;
}
.tool-search .hint:empty { display: none; }
.search-results { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; list-style: none; padding: 0; margin: 12px 0; }
.search-result {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  height: 100%;
  padding: 12px 14px;
  text-align: left;
  color: var(--ink);
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow-wrap: anywhere;
}
.search-result:hover, .search-result[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); }
.search-result span { font-size: 14px; font-weight: 600; }
.search-result small { font-size: 12px; color: var(--muted); }
.transformations[data-searching="true"] [role="tablist"], .transformations[data-searching="true"] [role="tabpanel"] { display: none !important; }

/* Recipes, presets and list comparisons */
.step-number {
  position: absolute;
  left: 0;
  top: 2px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 750;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent-soft);
}
.recipe-panel { padding: 24px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.recipe-heading { display: flex; justify-content: space-between; gap: 16px; align-items: center; }
.recipe-heading h2 { margin: 0; font-size: 20px; }
.recipe-steps { list-style: none; margin: 18px 0; padding: 0; display: grid; gap: 10px; }
.recipe-steps li { padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.step-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.step-top > label { font-weight: 650; }
.step-actions, .recipe-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.step-actions .small-button { font-size: 12px; padding: 7px 10px; min-height: 34px; border: 1px solid var(--line); }
.step-actions [data-action="edit"] { max-width: 220px; }
.recipe-steps summary { cursor: pointer; font-size: 12px; color: var(--muted); margin-top: 10px; }
.parameter-list { display: grid; grid-template-columns: minmax(70px, 1fr) minmax(0, 2fr); gap: 8px 15px; font-size: 12px; }
.parameter-list dt { color: var(--muted); }
.parameter-list dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-family: ui-monospace, monospace; }
.step-trace { display: block; font-size: 11px; color: var(--muted); margin-top: 8px; }
.recipe-actions .small-button { border: 1px solid var(--line); background: var(--surface); }
.privacy-hint { border-left: 3px solid var(--accent-line); padding: 6px 12px; margin-top: 18px; }
.compare-settings { padding: 16px 24px; background: var(--surface-soft); border-bottom: 1px solid var(--line); }
.compare-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.compare-buttons button { border: 1px solid var(--line); }
.compare-buttons button[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.computation-note { padding: 0 24px; color: var(--muted); font-size: 13px; line-height: 1.65; }
.preset-picker { padding: 20px 0; margin-bottom: 24px; border-block: 1px solid var(--line); }
.preset-picker h3 { margin: 0; font-size: 18px; }
.preset-picker h4 { margin: 16px 0 8px; font-size: 14px; }
.preset-picker > .field { max-width: 34rem; }
.preset-picker > p { font-size: 14px; line-height: 1.65; max-width: 72ch; }
.preset-picker ol { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 32px; padding-left: 24px; font-size: 14px; line-height: 1.5; }
.preset-picker li { padding-left: 2px; }
.recipe-panel > .field-grid { margin-top: 16px; }

/* Review, inspection and offline panels */
.work-extras { padding: 0 1.4rem 1rem; }
.work-detail { border-top: 1px solid var(--line); }
.work-detail > summary { cursor: pointer; font-weight: 650; padding: 1rem 0; list-style-position: inside; font-size: 15px; }
.detail-content { padding: 0 0 1rem; min-width: 0; }
.detail-content .hint { margin: 0.65rem 0; }
.diff-output {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 14px / 1.7 ui-monospace, Consolas, monospace;
  background: var(--bg);
  border: 1px solid var(--line);
  padding: 1rem;
  border-radius: 12px;
  max-height: 28rem;
  overflow: auto;
  tab-size: 4;
}
.diff-output ins { background: rgb(217, 247, 231); color: rgb(19, 74, 49); text-decoration: underline 2px; }
.diff-output del { background: rgb(255, 225, 223); color: rgb(124, 28, 36); text-decoration: line-through; }
.diff-output [data-change]:focus { outline: rgb(118, 97, 201) solid 3px; outline-offset: 3px; }
.unicode-table-wrap { overflow: auto; max-height: 26rem; }
.unicode-table { width: 100%; border-collapse: collapse; font-size: 0.82rem; }
.unicode-table td { text-align: left; padding: 0.65rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.unicode-table th { text-align: left; padding: 0.65rem; border-bottom: 1px solid var(--line); vertical-align: top; font-weight: 650; }
.unicode-options { display: grid; gap: 0.8rem; }
.unicode-options .field { max-width: 28rem; }
.work-detail .field > span { overflow-wrap: anywhere; }
.diff-split { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.diff-split > section { min-width: 0; }
.diff-split h3 { font-size: 14px; margin: 12px 0; }
.diff-split .diff-output { min-height: 100px; margin: 0; }
.diff-output:empty { display: block; }
.work-detail .recipe-actions { flex-wrap: wrap; }
.work-detail .options { align-items: center; }
#offline-status, #connection-status { overflow-wrap: anywhere; }

/* Guides, content pages and footer */
.how-section { padding: 36px 0 48px; scroll-margin-top: 20px; }
.faq-section h2 { font-size: 27px; font-weight: 680; letter-spacing: -0.9px; margin: 0 0 18px; line-height: 1.2; }
.steps-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 32px; }
.step { position: relative; padding: 0 8px 0 44px; }
.step h3 { font-size: 13px; margin: 0 0 8px; line-height: 1.8; }
.step p { font-size: 12px; line-height: 1.8; color: var(--muted); margin: 0; }
.faq-section { border-top: 1px solid var(--line); padding: 40px 0 60px; display: grid; grid-template-columns: 1fr 1.8fr; gap: 80px; }
.faq-section .eyebrow { margin-bottom: 10px; }
.faq-list details { border-bottom: 1px solid var(--line); }
.faq-list summary { list-style: none; cursor: pointer; padding: 16px 0; font-size: 12px; font-weight: 650; display: flex; justify-content: space-between; gap: 18px; line-height: 1.7; }
.faq-list details:first-child summary { padding-top: 0; }
.faq-list summary::-webkit-details-marker { display: none; }
.faq-list summary > span { font-size: 19px; color: var(--accent); font-weight: 400; }
.faq-list details[open] summary > span { transform: rotate(45deg); }
.faq-list p { margin: 0 0 18px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.site-footer { border-top: 1px solid var(--line); background: var(--surface); }
.footer-inner { display: flex; justify-content: space-between; gap: 30px; padding: 30px 0; align-items: center; }
.footer-inner strong { font-size: 14px; }
.footer-inner p { color: var(--muted); font-size: 11px; margin: 7px 0 0; }
.footer-links { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 18px; font-size: 11px; color: var(--muted); }
.footer-links span { font-size: 9px; flex-basis: 100%; text-align: right; }
.document { max-width: 800px; padding-top: 48px; padding-bottom: 70px; }
.document > .eyebrow { margin-top: 34px; }
.document h1 { font-size: 43px; line-height: 1.15; }
.document-lead { font-size: 18px; line-height: 1.7; color: var(--muted); margin: 22px 0 40px; }
.document section { margin: 30px 0; }
.document h2 { font-size: 21px; }
.document section p { line-height: 1.85; color: var(--muted); font-size: 15px; }
.related-section { padding-top: 46px; }
.related-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.related-card { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; text-decoration: none; }
.related-card:hover { border-color: var(--accent); }
.related-card h3 { font-size: 16px; margin: 0 0 10px; }
.related-card p { font-size: 13px; color: var(--muted); line-height: 1.65; margin: 0 0 12px; }
.related-card > span { margin-top: auto; color: var(--accent); }
.dedicated-guide { margin-top: 30px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); padding: 28px; }
.dedicated-guide p { line-height: 1.8; color: var(--muted); max-width: 85ch; }
.dedicated-guide h3 { font-size: 14px; }
.dedicated-guide pre {
  background: var(--surface-soft);
  padding: 18px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font: 14px / 1.8 ui-monospace, monospace;
  border: 1px solid var(--line);
  border-radius: 10px;
}

/* System color preference */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #131d19;
    --surface: #1b2922;
    --surface-soft: #17241e;
    --ink: #edf3ea;
    --muted: #b3c2b6;
    --line: #35483b;
    --accent: #a4dfbc;
    --accent-hover: #b9edcc;
    --accent-soft: #233f2f;
    --accent-line: #537b60;
    --danger: #ffb5a9;
    --danger-bg: #3c2622;
    --shadow: 0 15px 45px -25px #0009;
  }
}

/* Responsive: (max-width: 1000px) */
@media (max-width: 1000px) {
  .header-inner { gap: 18px; }
  .main-nav { gap: 16px; }
  .stat { padding-right: 14px; margin-right: 14px; }
  .tools-heading { flex-direction: column; }
  .tool-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #panel-case { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .step-top { align-items: flex-start; flex-direction: column; }
  .related-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Responsive: (max-width: 980px) */
@media (max-width: 980px) {
  .shell { width: calc(100% - 40px); }
  .editor-top { flex-wrap: wrap; }
  .editor-actions { gap: 10px; }
  .faq-section { gap: 35px; }
}

/* Responsive: (max-width: 760px) */
@media (max-width: 760px) {
  h1 { font-size: 32px; }
  .field-grid, .four-fields { grid-template-columns: 1fr; gap: 6px; }
  .main-nav { display: none; }
  .header-inner { gap: 12px; }
  .brand { font-size: 18px; }
  .hero { padding: 16px 0; gap: 12px; }
  .intro { font-size: 14px; }
  .privacy-chip { padding: 0; max-width: 100%; background: transparent; border: 0; border-radius: 0; }
  .privacy-chip strong { display: inline; margin: 0 5px 0 0; }
  .privacy-chip span { display: inline; }
  .workspace[data-mode="compare"] .editor-grid { grid-template-columns: 1fr; }
  .second-editor { border-inline: 0; border-block: 1px solid var(--line); }
  .workspace-modes { gap: 6px; }
  .mode-button { padding: 10px 12px; flex: 1 1 auto; }
  .editor-actions { flex-wrap: wrap; justify-content: flex-end; }
  .editor-top { gap: 8px; flex-wrap: wrap; }
  .workspace[data-mode="compare"][data-comparison="text-diff"] .editor-grid { grid-template-columns: 1fr; }
  .result-actions { align-items: stretch; }
  .result-actions .export-actions { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .result-actions button { white-space: normal; justify-content: center; }
  .stat { border: 0; padding: 5px 12px 5px 0; margin: 0; }
  .stat:last-of-type { margin-left: 0; }
  .extra-options { padding: 14px; }
  .tool-grid, .tool-grid.three-tools, #panel-case, .search-results { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .recipe-panel, .compare-settings { padding: 14px; }
  .recipe-actions { gap: 10px; }
  .recipe-actions button { flex: 1 1 150px; }
  .preset-picker ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .related-card, .dedicated-guide { padding: 18px; }
}

/* Responsive: (max-width: 720px) */
@media (max-width: 720px) {
  .primary-button, .secondary-button { padding: 10px; }
  .section-heading { flex-direction: column; gap: 4px; margin-bottom: 22px; }
  .section-heading h2 { font-size: 25px; }
  .section-heading > p { margin: 6px 0; }
  .hero { flex-direction: column; align-items: flex-start; }
  .editor-grid { grid-template-columns: 1fr; }
  .source-editor { border-right: 0; border-bottom: 1px solid var(--line); }
  .editor-top { min-height: 52px; }
  .stats-row { padding: 12px 16px; display: grid; }
  .stat { flex-direction: column; align-items: flex-start; gap: 3px; }
  .stat:first-child { padding-left: 0; }
  .stat:last-of-type { padding-left: 10px; }
  .stat span { line-height: 1.5; }
  .stat-hint { grid-column: 1 / -1; }
  .result-actions { flex-direction: column-reverse; }
  .export-actions { display: grid; grid-template-columns: 1fr 1.25fr; }
  .status-line { min-height: 38px; }
  .status-line > span { display: none; }
  .transformations { padding: 20px 16px 0; }
  .tabs { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px; }
  .tools-heading { gap: 13px; margin-bottom: 14px; }
  .how-section { padding-top: 25px; padding-bottom: 35px; }
  .faq-section h2 { font-size: 25px; }
  .steps-grid { grid-template-columns: 1fr; gap: 25px; }
  .step p { max-width: 420px; }
  .faq-section { grid-template-columns: 1fr; gap: 25px; padding: 32px 0 42px; }
  .faq-list summary { font-size: 13px; min-height: 52px; }
  .footer-inner { align-items: flex-start; flex-direction: column; gap: 20px; }
  .footer-links { justify-content: flex-start; gap: 18px; }
  .footer-links span { text-align: left; }
  .document h1 { font-size: 35px; }
  .document-lead { font-size: 16px; }
}

/* Responsive: (max-width: 640px) */
@media (max-width: 640px) {
  .stats-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .analysis-results { margin: 0.7rem; padding: 0.8rem; }
}

/* Responsive: (max-width: 600px) */
@media (max-width: 600px) {
  .quick-toolbar { display: grid; grid-template-columns: 1fr; }
  .quick-buttons { display: none; }
  #quick-tool {
    display: block;
    width: 100%;
    min-width: 0;
    min-height: 44px;
    padding: 9px 12px;
    font-size: 16px;
    background: var(--surface);
    color: var(--ink);
    border: 1px solid var(--line);
    border-radius: 8px;
  }
  .work-extras { padding: 0 0.8rem 0.7rem; }
  .unicode-table { min-width: 480px; }
  .work-detail .recipe-actions button { max-width: 100%; white-space: normal; }
}

/* Responsive: (max-width: 520px) */
@media (max-width: 520px) {
  .field input, .field select { font-size: 16px; }
  .editor-top > label { white-space: normal; }
  .editor-actions { gap: 10px; }
  .history-actions .small-button { font-size: 12px; padding-inline: 6px; }
  .search-results { grid-template-columns: 1fr; }
  .tool-button > span:nth-child(2) { font-size: 13px; }
  .search-input-row input { font-size: 16px; }
  .preset-picker ol, .diff-split { grid-template-columns: 1fr; }
}

/* Responsive: (max-width: 400px) */
@media (max-width: 400px) {
  .brand { font-size: 16px; gap: 8px; }
  .header-actions { gap: 6px; }
  .language-menu > summary { padding: 10px; }
  .related-grid { grid-template-columns: 1fr; }
}

/* Responsive: (max-width: 380px) */
@media (max-width: 380px) {
  .shell { width: calc(100% - 24px); }
  .small-button { gap: 3px; }
  .brand-mark { width: 31px; height: 34px; font-size: 29px; }
  .icon-button { width: 33px; }
  .language-switch a { padding: 8px; }
}

/* Print */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-soft: #fff; --ink: #000; --muted: #333; }
  .shell { width: 100%; }
  .site-header, .hero, .history-actions, .editor-actions, .result-actions, .status-line { display: none; }
  .workspace { border: 0; box-shadow: none; }
  .drop-hint, .transformations, .tool-search, .preset-picker, .site-footer, .how-section, .faq-section, #offline-panel { display: none; }
}

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