:root {
  color-scheme: light dark;
  --accent: #5b5ceb;
  --accent-hover: #4e4fd5;
  --bg: #f7f7f8;
  --surface: #ffffff;
  --surface-soft: #f7f7fa;
  --text: #202126;
  --muted: #6d707b;
  --border: #e2e3e8;
  --focus: rgba(91, 92, 235, 0.16);
  --shadow: 0 18px 45px rgba(25, 27, 38, 0.07);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  animation: page-in 180ms ease-out both;
}

button, textarea { font: inherit; }

button { -webkit-tap-highlight-color: transparent; }

::selection { color: white; background: var(--accent); }

.site-header {
  width: min(92vw, 1320px);
  margin: 0 auto;
  padding: 34px 0;
}

.brand {
  color: var(--text);
  font-size: 1.06rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  text-decoration: none;
}

main {
  padding: 78px 0 140px;
}

.hero {
  width: min(92vw, 1320px);
  margin: 0 auto 72px;
  text-align: center;
}

h1, h2, h3 { line-height: 1.18; letter-spacing: -0.035em; }

h1 { margin: 0; font-size: clamp(2.65rem, 5vw, 4.75rem); font-weight: 780; }

.hero p {
  max-width: 720px;
  margin: 24px auto 0;
  color: var(--muted);
  font-size: clamp(1.05rem, 1.7vw, 1.22rem);
  line-height: 1.65;
}

.tool {
  width: min(92vw, 1320px);
  margin: 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.mode-selector {
  display: flex;
  width: fit-content;
  max-width: 100%;
  margin: 0 auto 42px;
  padding: 5px;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
  scrollbar-width: none;
}

.mode-selector::-webkit-scrollbar { display: none; }

.mode {
  flex: 0 0 auto;
  padding: 9px 14px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.82rem;
  font-weight: 650;
  white-space: nowrap;
  transition: color 150ms ease, background 150ms ease, transform 100ms ease;
}

.mode:hover { color: var(--text); }
.mode.active { color: #fff; background: var(--accent); }

.panels {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 34px;
}

.panel {
  padding: 30px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(25, 27, 38, 0.045);
  transition: border-color 150ms ease, box-shadow 150ms ease;
}

.panel:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--focus), 0 8px 24px rgba(25, 27, 38, 0.045);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
}
.panel-heading label { font-size: 0.98rem; font-weight: 750; }
.panel-heading > span { color: var(--muted); font-size: 0.78rem; }
.panel-title { display: flex; align-items: center; gap: 8px; }
.panel-title .mode-badge {
  padding: 3px 7px;
  border: 1px solid rgba(91, 92, 235, 0.22);
  border-radius: 6px;
  background: rgba(91, 92, 235, 0.08);
  color: var(--accent);
  font-size: 0.67rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

textarea {
  display: block;
  width: 100%;
  min-height: clamp(360px, 42vh, 500px);
  resize: vertical;
  padding: 14px 4px 6px;
  border: 0;
  border-radius: 0;
  outline: none;
  background: transparent;
  color: var(--text);
  caret-color: var(--accent);
  font-size: 1.06rem;
  line-height: 1.75;
  transition: opacity 120ms ease;
}

textarea::placeholder { color: var(--muted); opacity: 0.72; }
textarea[readonly] { cursor: text; }
textarea.updating { opacity: 0.7; }

.actions {
  display: flex;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 38px;
}

.button {
  min-width: 104px;
  padding: 10px 18px;
  border: 1px solid transparent;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 700;
  transition: background 150ms ease, border-color 150ms ease, transform 100ms ease;
}

.button:hover, .mode:hover { transform: translateY(-1px); }
.button:active, .mode:active { transform: scale(0.98); }
.button.primary { color: white; background: var(--accent); }
.button.primary:hover { background: var(--accent-hover); }
.button.secondary { color: var(--text); border-color: var(--border); background: var(--surface-soft); }
.button.secondary:hover { border-color: #c9cad2; }

button:focus-visible, summary:focus-visible, .brand:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }

.content {
  width: min(88vw, 860px);
  margin: 156px auto 0;
}
.content section + section { margin-top: 64px; }
h2 { margin: 0 0 15px; font-size: clamp(1.55rem, 2.5vw, 2.05rem); }
h3 { margin: 0 0 7px; font-size: 1rem; letter-spacing: -0.015em; }
.content p, .content li { color: var(--muted); }
.content p { margin: 0; }
.content p a, .legal-content a { color: var(--accent); text-underline-offset: 3px; }
.content ol { margin: 0 0 14px; padding-left: 1.35rem; }

.examples-table {
  width: 100%;
  border-spacing: 0;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  text-align: left;
}
.examples-table th,
.examples-table td { width: 50%; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.examples-table th { background: var(--surface-soft); font-size: 0.8rem; letter-spacing: 0.02em; text-transform: uppercase; }
.examples-table td { color: var(--muted); }
.examples-table tbody tr:last-child td { border-bottom: 0; }
.examples-table th + th,
.examples-table td + td { border-left: 1px solid var(--border); }

.option-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.option-grid article { padding: 20px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }

.faq details { border-bottom: 1px solid var(--border); }
.faq summary { padding: 18px 2px; cursor: pointer; font-weight: 680; }
.faq details p { padding: 0 2px 18px; }

.tool-links nav { display: flex; flex-wrap: wrap; gap: 10px; }
.tool-links a {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-size: 0.9rem;
  text-decoration: none;
  transition: border-color 150ms ease, color 150ms ease;
}
.tool-links a:hover { border-color: var(--accent); color: var(--accent); }

.site-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  width: min(92vw, 1320px);
  margin: 0 auto;
  padding: 36px 0;
  border-top: 1px solid var(--border);
}
.site-footer p { max-width: 560px; margin: 8px 0 0; color: var(--muted); font-size: 0.88rem; }
.site-footer nav { display: flex; gap: 20px; }
.site-footer nav a { color: var(--muted); text-decoration: none; }
.site-footer nav a:hover { color: var(--accent); }
.legal-content { width: min(88vw, 760px); margin: 0 auto; }
.legal-content h1 { margin-bottom: 32px; }
.legal-content h2 { margin-top: 48px; }
.legal-content p, .legal-content li { color: var(--muted); }

.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; }

@keyframes page-in { from { opacity: 0; transform: translateY(4px); } }

@media (max-width: 760px) {
  .site-header { padding: 26px 0; }

  main {
    padding-top: 54px;
    padding-bottom: 110px;
  }

  .hero {
    margin-bottom: 56px;
  }

  .hero p {
    margin-top: 18px;
  }

  .mode-selector {
    flex-wrap: wrap;
    width: 100%;
    margin-bottom: 36px;
    overflow: visible;
  }

  .panels {
    grid-template-columns: 1fr;
    gap: 30px;
  }

  .panel {
    padding: 24px;
  }

  .panel-heading {
    margin-bottom: 18px;
  }

  textarea {
    min-height: 280px;
  }

  .actions {
    margin-top: 32px;
  }

  .actions .button { flex: 1; }

  .content {
    margin-top: 128px;
  }

  .option-grid { grid-template-columns: 1fr; }
  .site-footer { align-items: flex-start; flex-direction: column; }
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #7778ff;
    --accent-hover: #8687ff;
    --bg: #111217;
    --surface: #18191f;
    --surface-soft: #202127;
    --text: #f1f1f3;
    --muted: #a3a5af;
    --border: #303139;
    --focus: rgba(119, 120, 255, 0.22);
    --shadow: 0 18px 45px rgba(0, 0, 0, 0.24);
  }

  .panel { box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16); }
  .panel:focus-within { box-shadow: 0 0 0 4px var(--focus), 0 8px 24px rgba(0, 0, 0, 0.16); }
}

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