:root {
  color-scheme: light;
  --bg: #f3f6f4; --panel: #fff; --soft: #eef3f2; --ink: #061b31; --muted: #526a78;
  --line: #c8d9dd; --accent: #176c4d; --teal: #087f83; --action: #0a305f; --action-ink: #fff;
  --focus: #0b8c76; --shadow: #dce7e4; --danger: #a4382b; --danger-bg: #fff1ee; --grid: rgba(18,64,122,.04);
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Code", "Roboto Mono", Consolas, monospace;
  --sans: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #07111c; --panel: #0b1a26; --soft: #0e2130; --ink: #f3fcfd; --muted: #9bb2ba;
  --line: #294753; --accent: #62d7a9; --teal: #37ced0; --action: #0eebc5; --action-ink: #03151c;
  --focus: #0eebc5; --shadow: #04101a; --danger: #ff9b8c; --danger-bg: #291b20; --grid: rgba(213,239,243,.025);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 24px; }
body { margin: 0; color: var(--ink); background: radial-gradient(ellipse at 85% 0, color-mix(in srgb, var(--accent) 10%, transparent), transparent 650px), var(--bg); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
body::before { content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none; background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 48px 48px; mask-image: linear-gradient(#000, transparent 90%); }
a { color: inherit; }
button, select, textarea { font: inherit; }
button, select { touch-action: manipulation; }
button { cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
button, a, select { -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }
[hidden] { display: none !important; }
svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
.shell { display: grid; grid-template-rows: auto 1fr auto; min-height: 100svh; }
.site-footer { width: min(1120px, calc(100% - 40px)); margin-inline: auto; }
main { width: min(1560px, calc(100% - 40px)); min-width: 0; margin: 0 auto; padding: 24px 0 36px; }
.intro { margin-bottom: 18px; }
.eyebrow { display: flex; align-items: center; gap: 9px; margin: 0 0 8px; color: var(--accent); font: 600 11px/1.6 var(--mono); letter-spacing: 1.3px; }
.status-dot { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; flex: 0 0 auto; }
h1 { font-size: clamp(28px, 3vw, 40px); line-height: 1.13; letter-spacing: -1.5px; margin: 0; font-weight: 750; }
.tool-card { position: relative; padding: 24px; background: var(--panel); border: 1px solid var(--line); box-shadow: 8px 8px 0 var(--shadow); }
.tool-card::before { content: ""; position: absolute; width: 54px; height: 3px; top: -1px; left: 24px; background: var(--accent); }
.converter-workspace { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; align-items: start; }
.input-section, .results-section { min-width: 0; }
.section-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
h2 { display: flex; align-items: center; gap: 12px; font-size: 18px; line-height: 1.4; margin: 0; letter-spacing: -.3px; }
.input-section .section-top { gap: 8px 12px; }
.input-section .examples { margin-left: auto; }
.input-controls .button { min-height: 30px; padding: 5px 10px; font-size: 11px; }
.input-toolbar { display: grid; grid-template-columns: minmax(260px, 330px) minmax(0, 1fr); align-items: center; gap: 12px; margin: 8px 0; }
.format-field { display: flex; align-items: center; gap: 8px; min-width: 0; }
.format-field select { flex: 1 1 auto; min-width: 0; }
.detection-slot { min-width: 0; height: calc(3em + 8px); font: 12px/1.5 var(--mono); }
.detection-slot > p { height: 100%; margin: 0; padding: 3px 6px; border: 1px solid transparent; overflow: auto; scrollbar-gutter: stable; font: inherit; overflow-wrap: anywhere; }
.detection-slot .error { border-color: var(--danger); }
.detection-slot .detected-format { display: flex; align-items: center; color: var(--teal); white-space: nowrap; overflow-x: auto; overflow-y: hidden; overflow-wrap: normal; scrollbar-gutter: auto; }
.format-field label, .select-option > span { display: block; color: var(--muted); font-size: 12px; margin: 0 0 6px; }
.format-field label { flex: 0 0 auto; margin: 0; white-space: nowrap; }
select { background: var(--panel); color: var(--ink); border: 1px solid var(--line); min-height: 38px; padding: 7px 28px 7px 10px; border-radius: 3px; width: 100%; font-size: 13px; }
.button-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; border: 1px solid var(--line); border-radius: 3px; padding: 7px 12px; color: var(--ink); background: var(--panel); font: 600 12px/1.4 var(--mono); text-decoration: none; }
.button:hover:not(:disabled) { background: var(--soft); border-color: var(--teal); }
.button.primary { color: var(--action-ink); background: var(--action); border-color: var(--action); }
.button.primary:hover:not(:disabled) { filter: brightness(1.12); }
.button.quiet { color: var(--muted); background: transparent; }
textarea { display: block; width: 100%; resize: vertical; min-width: 0; border: 1px solid var(--line); border-radius: 3px; color: var(--ink); background: var(--soft); padding: 16px; font: 16px/1.65 var(--mono); tab-size: 4; overflow-wrap: anywhere; }
#source { height: calc(7em + 18px); min-height: calc(2.8em + 18px); max-height: calc(7em + 18px); padding: 8px 10px; line-height: 1.4; background: color-mix(in srgb, var(--accent) 4%, var(--panel)); }
textarea::placeholder { color: var(--muted); opacity: .75; }
textarea[aria-invalid="true"] { border-color: var(--danger); }
.hint { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.examples { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; color: var(--muted); font-size: 11px; }
.examples button { min-height: 32px; padding: 4px 2px; background: none; color: var(--teal); border: 0; font-size: 11px; text-decoration: underline; text-underline-offset: 4px; }
.error { color: var(--danger); background: var(--danger-bg); border: 1px solid var(--danger); padding: 12px 14px; margin: 16px 0 0; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.options { margin-top: 16px; border-top: 1px solid var(--line); }
summary { cursor: pointer; min-height: 44px; padding: 12px 0; font-size: 13px; color: var(--ink); }
summary::marker { color: var(--teal); }
.options-body { padding: 0 0 8px; }
.options-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; margin-bottom: 12px; }
.options-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; gap: 16px; }
.select-option { min-width: 0; }
.options-note { margin-top: 12px; }
.check { display: flex; gap: 9px; align-items: center; font-size: 13px; min-height: 44px; }
input[type="checkbox"] { margin: 0; width: 18px; height: 18px; flex: 0 0 auto; accent-color: var(--teal); }
.results-top { margin-bottom: 12px; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border: 1px solid var(--line); background: var(--soft); margin-bottom: 12px; }
.stats > div { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-right: 1px solid var(--line); }
.stats > div:last-child { border-right: 0; }
.stats strong { color: var(--teal); font: 600 20px/1.3 var(--mono); overflow-wrap: anywhere; min-width: 0; }
.stats span { color: var(--muted); font-size: 10px; line-height: 1.4; }
.results-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.result-card { min-width: 0; border: 1px solid var(--line); background: var(--panel); padding: 10px; }
.result-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 17px; margin-bottom: 8px; }
.result-heading h3 { min-width: 0; margin: 0; font: 650 12px/1.4 var(--sans); overflow-wrap: anywhere; }
.result-card textarea { height: calc(4.5em + 16px); min-height: calc(4.5em + 16px); max-height: 50vh; font-size: 14px; line-height: 1.5; padding: 7px 9px; }
.result-actions { display: flex; align-items: center; flex: 0 0 auto; gap: 10px; }
.result-actions .button { width: 15px; height: 15px; min-height: 15px; padding: 0; border-radius: 2px; font-size: 12px; line-height: 1; color: #0a305f; background: #eef3f2; border-color: #8aa9ad; }
.result-actions .button:hover:not(:disabled), .result-actions .button:focus-visible { color: #061b31; background: #d5ede6; border-color: #087f83; filter: none; }
.button-icon { display: block; font-size: inherit; line-height: 1; }
.result-note { color: var(--muted); font-size: 11px; line-height: 1.5; margin: 10px 0 0; }
.disclosure { border-top: 1px solid var(--line); margin-top: 16px; }
.disclosure > summary { padding: 12px 0; font-weight: 650; }
.summary-note { font-weight: 400; font-size: 11px; color: var(--muted); margin-left: 12px; }
.disclosure > .results-grid { padding-bottom: 20px; }
.inspector-body { padding-bottom: 20px; }
.table-scroll { overflow-x: auto; margin: 16px 0 10px; }
table { border-collapse: collapse; width: 100%; font: 12px/1.6 var(--mono); text-align: left; }
th { color: var(--muted); font-size: 11px; font-weight: 500; white-space: nowrap; }
td, th { padding: 10px 12px; border-bottom: 1px solid var(--line); }
td { white-space: nowrap; }
.character-cell { text-align: center; font: 22px var(--sans); min-width: 50px; }
.invisible-character { font: 10px var(--mono); padding: 3px 5px; color: var(--teal); border: 1px dashed var(--line); border-radius: 3px; }
.help-section { padding-top: 24px; }
.help-section h2 { font-size: 18px; }
.help-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 28px; margin-top: 16px; }
.help-grid h3 { font-size: 13px; margin: 0 0 7px; }
.help-grid p { color: var(--muted); font-size: 12px; line-height: 1.7; margin: 0; }
.site-footer { border-top: 1px solid var(--line); min-height: 72px; padding-block: 20px; display: flex; align-items: center; justify-content: space-between; gap: 18px; font: 400 .65rem/1.5 var(--mono); color: var(--muted); }
.site-footer a { display: inline-flex; align-items: center; gap: 7px; text-decoration: none; }
.site-footer a:hover { color: var(--teal); }
.footer-glyph { display: inline-block; width: 1em; text-align: center; font-size: inherit; line-height: 1; color: var(--teal); }
.clss-external-arrow { display: block; width: 1em; height: 1em; flex: 0 0 auto; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.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; }
.feedback:not(:empty) { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 5; margin: 0; padding: 12px 20px; max-width: calc(100% - 32px); background: var(--ink); color: var(--panel); box-shadow: 0 5px 24px #0003; border-radius: 5px; font-size: 13px; text-align: center; }
.skip-link { position: absolute; left: 20px; top: -100px; z-index: 10; background: var(--panel); padding: 12px 20px; }
.skip-link:focus { top: 12px; }
@media (max-width: 800px) {
  .input-toolbar { grid-template-columns: minmax(0, 1fr); gap: 6px; }
  .format-field { max-width: 480px; }
  .detection-slot .detected-format { display: block; white-space: normal; overflow: auto; overflow-wrap: anywhere; scrollbar-gutter: stable; }
  .results-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .help-grid { grid-template-columns: 1fr; gap: 22px; }
  .summary-note { display: block; margin: 5px 0 0 16px; }
}
@media (max-width: 600px) {
  .site-footer, main { width: calc(100% - 28px); }
  main { padding-top: 20px; }
  h1 { letter-spacing: -1.4px; }
  .eyebrow { font-size: 9px; letter-spacing: .8px; }
  .tool-card { padding: 16px; box-shadow: 5px 5px 0 var(--shadow); }
  .tool-card::before { left: 16px; }
  .format-field { flex-direction: column; align-items: stretch; max-width: none; gap: 4px; }
  .input-controls { margin-left: auto; }
  .input-controls .button { min-height: 44px; }
  .input-section .examples { order: 3; flex-basis: 100%; margin-left: 0; }
  select, .result-card textarea { font-size: 16px; }
  .button, select, .examples button { min-height: 44px; }
  .options-checks, .options-grid, .results-grid { grid-template-columns: minmax(0, 1fr); }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats > div { padding: 10px 12px; }
  .stats > div:nth-child(2) { border-right: 0; }
  .stats > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
  .result-card { padding: 10px; }
  .result-actions .button { width: 22px; height: 22px; min-height: 22px; font-size: 14px; }
  .site-footer { min-height: 86px; gap: 10px; font-size: .6rem; }
}
@media (max-width: 340px) {
  .site-footer { font-size: .56rem; }
  .site-footer a { gap: 4px; }
}
@media (pointer: coarse) {
  .button, select, .examples button { min-height: 44px; }
  .input-controls .button { min-height: 44px; }
  .result-actions .button { width: 22px; height: 22px; min-height: 22px; font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
@media (prefers-contrast: more) { :root { --line: #637e88; --muted: #344957; } html[data-theme="dark"] { --line: #6f949f; --muted: #c7dade; } }
