:root {
  color-scheme: light;
  --background: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #f8f9fd;
  --text: #172033;
  --muted: #667085;
  --border: #dfe3ec;
  --border-strong: #c8cfdd;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --primary-soft: #eef0ff;
  --full: #7c3aed;
  --full-soft: #f1eafe;
  --half: #087f5b;
  --half-soft: #e7f7f1;
  --warning: #9a6700;
  --warning-soft: #fff6d8;
  --shadow: 0 24px 60px rgba(31, 42, 68, 0.10);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 16% 5%, rgba(79, 70, 229, 0.09), transparent 28rem),
    var(--background);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
}
button, textarea, input { font: inherit; }
button { color: inherit; }
a { color: inherit; }
.shell { width: min(1180px, calc(100% - 40px)); margin-inline: auto; }
.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;
}

.site-header {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-weight: 750;
  letter-spacing: -0.02em;
}
.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: var(--text);
  color: #fff;
  font-size: 13px;
  letter-spacing: -0.08em;
}
.header-link {
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 650;
}
.header-link:hover { color: var(--text); }

.hero { padding-top: 30px; padding-bottom: 82px; }
.hero-copy { max-width: 820px; margin: 0 auto 34px; text-align: center; }
.hero-copy h1 {
  margin: 0;
  font-size: clamp(38px, 6vw, 68px);
  line-height: 1.03;
  letter-spacing: -0.055em;
}
.hero-copy p {
  max-width: 760px;
  margin: 20px auto 0;
  color: var(--muted);
  font-size: clamp(17px, 2vw, 20px);
}

.converter-card {
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(200, 207, 221, 0.85);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
}
.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 24px;
  background: var(--surface-soft);
  border-bottom: 1px solid var(--border);
}
.settings-title { margin: 0; font-weight: 750; }
.settings-help { margin: 3px 0 0; color: var(--muted); font-size: 13px; }
.option-list { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.option-pill { position: relative; cursor: pointer; }
.option-pill input { position: absolute; opacity: 0; pointer-events: none; }
.option-pill span {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  transition: 160ms ease;
}
.option-pill input:checked + span {
  border-color: #b9b5ff;
  background: var(--primary-soft);
  color: var(--primary-dark);
}
.option-pill input:focus-visible + span { outline: 3px solid rgba(79, 70, 229, 0.2); }

.direction-bar {
  display: flex;
  justify-content: center;
  gap: 12px;
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
}
.button {
  min-height: 46px;
  padding: 0 21px;
  border-radius: 12px;
  border: 1px solid transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 13px;
  font-weight: 750;
  cursor: pointer;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.button:hover { transform: translateY(-1px); }
.button:focus-visible, .text-button:focus-visible { outline: 3px solid rgba(79, 70, 229, 0.22); outline-offset: 2px; }
.button-primary { background: var(--primary); color: #fff; box-shadow: 0 10px 22px rgba(79, 70, 229, 0.22); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { background: #fff; border-color: var(--border-strong); color: var(--text); }
.button-secondary:hover { background: var(--surface-soft); }

.editor-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
.editor-panel { min-width: 0; padding: 24px; }
.input-panel { border-right: 1px solid var(--border); }
.panel-heading { min-height: 48px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.panel-heading h3 { margin: 1px 0 0; font-size: 18px; letter-spacing: -0.02em; }
.panel-kicker, .section-kicker { margin: 0; color: var(--primary); font-size: 11px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; }
.panel-actions { display: flex; gap: 5px; }
.text-button {
  border: 0;
  background: transparent;
  padding: 7px 9px;
  border-radius: 8px;
  color: var(--primary-dark);
  font-size: 13px;
  font-weight: 750;
  cursor: pointer;
}
.text-button:hover { background: var(--primary-soft); }
.text-button:disabled { color: #a3a9b7; cursor: not-allowed; background: transparent; }
.text-editor {
  display: block;
  width: 100%;
  min-height: 260px;
  resize: vertical;
  padding: 18px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: #fff;
  color: var(--text);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 16px;
  line-height: 1.75;
  outline: 0;
  transition: border-color 150ms ease, box-shadow 150ms ease;
}
.text-editor:focus { border-color: var(--primary); box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.11); }
.text-editor[readonly] { background: #fcfcfe; }
.text-editor::placeholder { color: #9aa2b1; }
.editor-meta { min-height: 34px; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }

.detector-card, .change-card { margin-top: 12px; padding: 16px; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-soft); }
.detector-heading, .change-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; }
.detector-heading strong, .change-heading strong { display: block; margin-top: 3px; font-size: 14px; }
.legend { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; color: var(--muted); font-size: 11px; }
.legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 50%; }
.full-dot { background: var(--full); }
.half-dot { background: var(--half); }
.detector-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.detector-stats span { padding: 9px 10px; border: 1px solid var(--border); border-radius: 9px; background: #fff; color: var(--muted); font-size: 11px; }
.detector-stats strong { color: var(--text); font-size: 13px; }
.inspection-block { margin-top: 14px; }
.inspection-block > p { margin: 0 0 6px; color: var(--muted); font-size: 11px; font-weight: 750; }
.highlight-preview {
  min-height: 56px;
  max-height: 150px;
  overflow: auto;
  padding: 11px;
  border: 1px dashed var(--border-strong);
  border-radius: 9px;
  background: #fff;
  color: #9198a6;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 13px;
  line-height: 1.8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.highlight-char { display: inline; border-radius: 3px; }
.highlight-char.full { background: var(--full-soft); color: #5b21b6; box-shadow: inset 0 -2px 0 rgba(124, 58, 237, 0.35); }
.highlight-char.half { background: var(--half-soft); color: #066248; box-shadow: inset 0 -2px 0 rgba(8, 127, 91, 0.3); }

.change-report { min-height: 177px; max-height: 255px; overflow: auto; margin-top: 14px; }
.empty-message { margin: 0; padding: 19px 12px; border: 1px dashed var(--border-strong); border-radius: 9px; color: var(--muted); font-size: 13px; text-align: center; }
.change-list { display: grid; gap: 7px; }
.change-item { display: grid; grid-template-columns: minmax(40px, auto) 18px minmax(40px, auto) 1fr auto; align-items: center; gap: 8px; padding: 8px 9px; border: 1px solid var(--border); border-radius: 9px; background: #fff; font-size: 12px; }
.change-character { min-width: 38px; overflow: hidden; text-overflow: ellipsis; padding: 3px 6px; border-radius: 6px; background: var(--surface-soft); font-family: "SFMono-Regular", Consolas, monospace; text-align: center; white-space: nowrap; }
.change-arrow { color: var(--muted); text-align: center; }
.change-type { color: var(--muted); }
.change-position { color: var(--muted); font-size: 11px; }
.more-changes { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

.content-section, .examples-section { padding-block: 84px; }
.content-section { border-top: 1px solid rgba(200, 207, 221, 0.7); }
.section-heading { max-width: 720px; margin-bottom: 32px; }
.section-heading.compact { margin-bottom: 24px; }
.section-heading h2 { margin: 7px 0 0; font-size: clamp(28px, 4vw, 42px); line-height: 1.12; letter-spacing: -0.04em; }
.section-heading > p:last-child { color: var(--muted); font-size: 17px; }
.feature-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.feature-card { padding: 25px; border: 1px solid var(--border); border-radius: var(--radius-md); background: rgba(255,255,255,0.72); }
.feature-number { color: var(--primary); font-size: 12px; font-weight: 800; }
.feature-card h3 { margin: 28px 0 8px; font-size: 18px; }
.feature-card p { margin: 0; color: var(--muted); font-size: 14px; }
.examples-section { padding-top: 20px; }
.example-table { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.example-row { display: grid; grid-template-columns: 1fr 1.35fr 1.35fr; min-height: 58px; align-items: center; }
.example-row + .example-row { border-top: 1px solid var(--border); }
.example-row > * { padding: 15px 20px; }
.example-row > * + * { border-left: 1px solid var(--border); }
.example-header { min-height: 44px; background: var(--surface-soft); color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; }
.example-row code { font-family: "SFMono-Regular", Consolas, monospace; font-size: 14px; }
.site-footer { min-height: 88px; display: flex; align-items: center; justify-content: space-between; gap: 18px; border-top: 1px solid var(--border); color: var(--muted); font-size: 13px; }
.site-footer a { color: var(--text); font-weight: 700; text-decoration: none; }
.site-footer a:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .settings-row { align-items: flex-start; flex-direction: column; }
  .option-list { justify-content: flex-start; }
  .editor-grid { grid-template-columns: 1fr; }
  .input-panel { border-right: 0; border-bottom: 1px solid var(--border); }
  .feature-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 24px, 1180px); }
  .site-header { min-height: 62px; }
  .brand > span:last-child { display: none; }
  .hero { padding-top: 24px; padding-bottom: 55px; }
  .hero-copy { margin-bottom: 24px; text-align: left; }
  .hero-copy h1 { font-size: 40px; }
  .hero-copy p { margin-top: 14px; font-size: 16px; }
  .settings-row, .direction-bar, .editor-panel { padding-left: 16px; padding-right: 16px; }
  .direction-bar { display: grid; grid-template-columns: 1fr; }
  .button { width: 100%; }
  .panel-heading { min-height: auto; }
  .text-editor { min-height: 220px; }
  .detector-heading { flex-direction: column; }
  .legend { justify-content: flex-start; }
  .detector-stats { grid-template-columns: 1fr; }
  .change-item { grid-template-columns: minmax(40px, auto) 18px minmax(40px, auto) 1fr; }
  .change-position { display: none; }
  .content-section, .examples-section { padding-block: 60px; }
  .example-row { grid-template-columns: 0.85fr 1fr 1fr; }
  .example-row > * { padding: 12px 10px; font-size: 12px; }
  .site-footer { min-height: 100px; align-items: flex-start; justify-content: center; flex-direction: column; gap: 6px; }
}
