:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --line: #dbe6f7;
  --paper: #f5f8ff;
  --panel: #ffffff;
  --accent: #2563eb;
  --accent-strong: #1d4ed8;
  --shadow: 0 18px 45px rgba(37, 99, 235, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-size: 14px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  display: grid;
  grid-template-columns: minmax(300px, 380px) minmax(0, 1fr);
  gap: 18px;
  min-height: 100vh;
  padding: 20px;
}

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.control-panel {
  padding: 18px;
}

.topbar,
.result-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow,
.section-title span,
.result-head span,
.status {
  color: var(--muted);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.15;
  letter-spacing: 0;
}

h2 {
  font-size: 17px;
  line-height: 1.25;
}

.mode-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 18px 0;
  padding: 4px;
  border-radius: 8px;
  background: #eef4ff;
}

.mode-tabs button,
.primary-button,
.secondary-button,
.ghost-button {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid transparent;
  padding: 0 12px;
  font-weight: 800;
}

.mode-tabs button {
  background: transparent;
  color: var(--muted);
}

.mode-tabs button.is-active {
  background: #fff;
  color: var(--accent);
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.12);
}

.mode-panel {
  display: grid;
  gap: 13px;
}

.mode-panel.is-hidden {
  display: none;
}

.section-title {
  display: grid;
  gap: 3px;
}

.check-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.check-grid label,
.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  background: #fbfdff;
  font-weight: 700;
}

.field,
.field-grid {
  display: grid;
  gap: 8px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.field-grid {
  grid-template-columns: 1fr 1fr;
}

input:not([type="checkbox"]),
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
}

input:not([type="checkbox"]) {
  min-height: 38px;
  padding: 0 10px;
}

input[type="checkbox"] {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.24);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.secondary-button,
.ghost-button {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.result-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 18px;
}

textarea {
  min-height: 420px;
  resize: none;
  padding: 14px;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 14px;
  line-height: 1.55;
}

.status {
  min-height: 24px;
  font-size: 13px;
}

@media (max-width: 900px) {
  .app {
    grid-template-columns: 1fr;
    padding: 14px;
  }

  .field-grid,
  .check-grid {
    grid-template-columns: 1fr;
  }

  textarea {
    min-height: 320px;
  }
}
