:root {
  color-scheme: dark;
  --bg: #080d15;
  --surface: #101824;
  --surface-2: #151f2e;
  --surface-3: #1b2738;
  --line: #29384c;
  --line-bright: #3c506a;
  --ink: #eef4fb;
  --muted: #96a6ba;
  --accent: #76a9ff;
  --accent-strong: #4f8df7;
  --accent-ink: #081325;
  --deleted: #ffb3bf;
  --deleted-bg: #4d2933;
  --deleted-row: #251923;
  --added: #9be7b8;
  --added-bg: #174b34;
  --added-row: #13251e;
  --error: #ff9daa;
  --shadow: 0 24px 70px rgba(0, 0, 0, .28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 15% -10%, rgba(78, 141, 247, .14), transparent 34rem),
    radial-gradient(circle at 90% 18%, rgba(78, 216, 178, .07), transparent 28rem),
    var(--bg);
  color: var(--ink);
  font: 14px/1.5 Inter, "Segoe UI", system-ui, -apple-system, sans-serif;
}
button, input, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.site-header {
  height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 1440px;
  margin: auto;
  padding: 0 28px;
  border-bottom: 1px solid rgba(110, 139, 173, .16);
}
.brand { display: inline-flex; gap: 11px; align-items: center; color: var(--ink); text-decoration: none; }
.brand-mark {
  width: 42px; height: 42px; display: block; object-fit: contain;
  box-sizing: border-box; padding: 2px; border-radius: 11px;
  background: linear-gradient(145deg, #edf5ff, #8fbcff);
  box-shadow: 0 8px 22px rgba(79, 141, 247, .22);
}
.brand-name { font-size: 18px; font-weight: 750; letter-spacing: -.3px; }
.header-actions { display: flex; align-items: center; gap: 16px; }
.privacy-badge { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }
.privacy-dot { display: inline-block; width: 7px; height: 7px; margin-right: 8px; border-radius: 50%; background: #64dca2; box-shadow: 0 0 0 4px rgba(100,220,162,.1); }
.language-picker { position: relative; }
.language-button { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 7px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); color: var(--ink); cursor: pointer; }
.language-button:hover { border-color: var(--line-bright); background: var(--surface-2); }
.language-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.language-button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.language-button span { color: var(--muted); font-size: 11px; font-weight: 800; }
.language-menu { position: absolute; z-index: 40; top: calc(100% + 8px); right: 0; width: 170px; padding: 6px; border: 1px solid var(--line-bright); border-radius: 11px; background: #111b29; box-shadow: 0 18px 50px rgba(0,0,0,.5); }
.language-menu[hidden] { display: none; }
.language-menu button { width: 100%; display: flex; justify-content: space-between; align-items: center; padding: 9px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--ink); cursor: pointer; text-align: left; }
.language-menu button:hover, .language-menu button.active { background: var(--surface-3); }
.language-menu small { color: var(--muted); }

.app-shell { width: min(1400px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 40px; }
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 32px; margin-bottom: 28px; }
.eyebrow { margin: 0 0 7px; color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .13em; }
h1 { margin: 0; font-size: clamp(34px, 4vw, 54px); line-height: 1.02; letter-spacing: -.045em; }
.subtitle { margin: 12px 0 0; color: var(--muted); font-size: 16px; }
.privacy-note { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; }
.privacy-note > span { display: grid; place-items: center; width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 12px; color: #6ee2ad; background: rgba(110,226,173,.05); }
.privacy-note p { margin: 0; }
.privacy-note strong { color: var(--ink); font-weight: 650; }

.settings-card, .editor-card, .result-card, .download-card {
  border: 1px solid var(--line);
  border-radius: 15px;
  background: rgba(16, 24, 36, .94);
  box-shadow: var(--shadow);
}
.settings-card { display: grid; grid-template-columns: minmax(280px, .85fr) 1.15fr; gap: 28px; align-items: center; padding: 14px; }
.exceptions { position: relative; }
.exceptions summary { list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 5px 8px; cursor: pointer; border-radius: 9px; }
.exceptions summary::-webkit-details-marker { display: none; }
.exceptions summary:hover { background: var(--surface-2); }
.exceptions summary span:first-child { display: flex; flex-direction: column; }
.exceptions small { color: var(--muted); font-size: 12px; font-weight: 400; }
.count-pill { min-width: 31px; padding: 3px 9px; border: 1px solid var(--line); border-radius: 99px; color: var(--accent); text-align: center; font-weight: 700; }
.exceptions-panel { position: absolute; z-index: 20; top: calc(100% + 12px); left: 0; width: min(440px, calc(100vw - 64px)); padding: 17px; border: 1px solid var(--line-bright); border-radius: 13px; background: #111b29; box-shadow: 0 22px 60px rgba(0,0,0,.55); }
.muted { color: var(--muted); }
.exceptions-list { max-height: 210px; overflow: auto; }
.exception-item { display: grid; grid-template-columns: 1fr auto auto; gap: 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.exception-value { font: 16px ui-monospace, SFMono-Regular, Consolas, monospace; }
.exception-code { color: var(--muted); font-size: 11px; }
.remove-symbol { border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.remove-symbol:hover { color: var(--deleted); }
.field-label { display: block; margin: 15px 0 6px; font-weight: 650; }
.add-symbol-row { display: flex; gap: 8px; }
.add-symbol-row input { min-width: 0; flex: 1; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); outline: 0; }
.add-symbol-row input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(118,169,255,.12); }
.error { min-height: 20px; margin: 7px 0 0; color: var(--error); font-size: 12px; }
.switches { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 24px; }
.switch { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; white-space: nowrap; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track { position: relative; flex: 0 0 auto; width: 40px; height: 22px; border-radius: 99px; background: #314055; transition: .2s ease; }
.switch-track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #dfe9f7; transition: .2s ease; }
.switch input:checked + .switch-track { background: var(--accent-strong); }
.switch input:checked + .switch-track::after { transform: translateX(18px); background: white; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--accent); outline-offset: 3px; }

.source-section, .results-section { margin-top: 26px; }
.section-bar, .results-toolbar, .status-line { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-bar { margin-bottom: 10px; }
.section-bar > p { margin: 0; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .12em; }
.compact-actions, .actions, .legend { display: flex; align-items: center; gap: 8px; }
.button { min-height: 40px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); color: var(--ink); text-decoration: none; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.button:hover:not(:disabled) { border-color: var(--line-bright); background: var(--surface-3); }
.button:active:not(:disabled) { transform: translateY(1px); }
.button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.button:disabled { opacity: .42; cursor: default; }
.button.primary { border-color: var(--accent-strong); background: var(--accent); color: var(--accent-ink); font-weight: 800; }
.button.primary:hover:not(:disabled) { background: #91baff; border-color: #91baff; }
.button.ghost { background: transparent; }
.button.icon { width: 40px; padding: 0; }
.editors { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.editor-card { min-width: 0; overflow: hidden; }
.card-heading { display: flex; justify-content: space-between; gap: 10px; padding: 11px 14px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.card-heading span { color: var(--muted); font-size: 12px; }
.card-heading span.over-limit { color: var(--error); }
textarea { display: block; width: 100%; min-height: 238px; resize: vertical; padding: 14px; border: 0; outline: 0; background: var(--surface); color: var(--ink); font: 14px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; tab-size: 4; }
textarea::placeholder { color: #617186; }

.results-toolbar { margin-bottom: 12px; }
.legend span { padding: 5px 9px; border-radius: 6px; font-size: 12px; }
.legend .deleted { color: var(--deleted); background: var(--deleted-bg); }
.legend .added { color: var(--added); background: var(--added-bg); }
.result-card { min-height: 270px; overflow: hidden; }
.result-head { display: grid; grid-template-columns: 1fr 1fr; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.result-head strong { padding: 11px 14px; }
.result-head strong + strong { border-left: 1px solid var(--line); }
.empty-state { min-height: 220px; display: grid; place-items: center; padding: 30px; color: var(--muted); text-align: center; }
.empty-state[hidden] { display: none; }
.result-rows:empty { display: none; }
.result-row { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); scroll-margin-top: 16px; }
.result-row:last-child { border-bottom: 0; }
.result-row.selected { outline: 2px solid var(--accent); outline-offset: -2px; }
.result-cell { min-width: 0; display: grid; grid-template-columns: 50px 1fr; min-height: 34px; padding: 6px 10px 6px 0; background: var(--surface); }
.result-cell + .result-cell { border-left: 1px solid var(--line); }
.result-row.different .left-cell { background: var(--deleted-row); }
.result-row.different .right-cell { background: var(--added-row); }
.line-number { padding: 2px 10px 0 5px; color: #71839a; text-align: right; font: 12px ui-monospace, SFMono-Regular, Consolas, monospace; user-select: none; }
.cell-text { min-width: 0; white-space: pre-wrap; overflow-wrap: anywhere; font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.cell-text mark { padding: 1px 0; border-radius: 2px; color: inherit; }
.left-cell mark { color: var(--deleted); background: var(--deleted-bg); }
.right-cell mark { color: var(--added); background: var(--added-bg); }
.missing { color: var(--muted); font-style: italic; }
.break-mark { margin-left: 3px; color: inherit; opacity: .85; }
.status-line { min-height: 31px; color: var(--muted); font-size: 12px; }

.download-card { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 20px; margin-top: 34px; padding: 22px; overflow: hidden; background: linear-gradient(120deg, rgba(21,31,46,.98), rgba(12,31,41,.98)); }
.download-card::before { content: ""; position: absolute; }
.download-icon { width: 48px; height: 48px; display: grid; place-items: center; border: 1px solid rgba(118,169,255,.34); border-radius: 14px; background: rgba(118,169,255,.09); color: var(--accent); font-size: 24px; }
.download-card h2 { margin: 0; font-size: 20px; }
.download-card p:not(.eyebrow) { margin: 4px 0 0; color: var(--muted); }
.button.download { padding: 12px 18px; border-color: #6e9ff2; background: transparent; color: #dceaff; font-weight: 750; }
.button.download span { display: block; color: var(--muted); font-size: 11px; font-weight: 400; text-align: center; }
.button.download .download-label { color: inherit; font-size: inherit; font-weight: inherit; }
.seo-section { margin-top: 58px; padding: 50px 0 18px; border-top: 1px solid var(--line); }
.seo-heading { max-width: 760px; }
.seo-heading h2 { margin: 0; font-size: clamp(28px, 3vw, 40px); letter-spacing: -.035em; }
.seo-heading > p:last-child { margin: 15px 0 0; color: var(--muted); font-size: 16px; line-height: 1.7; }
.seo-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 12px; margin-top: 28px; }
.seo-grid article { padding: 22px; border: 1px solid var(--line); border-radius: 14px; background: rgba(16,24,36,.76); }
.seo-grid h3 { margin: 0 0 10px; font-size: 17px; }
.seo-grid p { margin: 0; color: var(--muted); line-height: 1.65; }
.seo-faq { display: grid; gap: 10px; margin-top: 28px; }
.seo-faq details { padding: 0 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(16,24,36,.76); }
.seo-faq summary { padding: 16px 0; cursor: pointer; font-weight: 700; }
.seo-faq p { margin: 0; padding: 0 0 17px; color: var(--muted); line-height: 1.65; }
footer { display: flex; justify-content: space-between; max-width: 1400px; margin: auto; padding: 22px 28px 34px; border-top: 1px solid rgba(110,139,173,.16); color: var(--muted); font-size: 12px; }

@media (max-width: 900px) {
  .settings-card { grid-template-columns: 1fr; }
  .switches { justify-content: flex-start; }
  .hero { align-items: flex-start; flex-direction: column; }
  .privacy-note { display: none; }
  .download-card { grid-template-columns: auto 1fr; }
  .download-card .download { grid-column: 1 / -1; text-align: center; }
  .seo-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .site-header { padding: 0 16px; }
  .privacy-badge { display: none; }
  .app-shell { width: min(100% - 24px, 1400px); padding-top: 34px; }
  .editors { grid-template-columns: 1fr; }
  textarea { min-height: 190px; }
  .section-bar, .results-toolbar { align-items: stretch; flex-direction: column; }
  .compact-actions, .actions { display: grid; grid-template-columns: 1fr 1fr; }
  .actions .primary, .actions .secondary { grid-column: span 2; }
  .legend { justify-content: flex-end; }
  .result-card { overflow-x: auto; }
  .result-head, .result-row { min-width: 700px; }
  .status-line { align-items: flex-start; flex-direction: column; padding-top: 8px; }
  .seo-grid { grid-template-columns: 1fr; }
  footer { padding-inline: 16px; }
}

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