:root {
  --bg: #f7f9f6;
  --surface: #ffffff;
  --surface-soft: #eef5ef;
  --ink: #141b22;
  --muted: #596672;
  --line: #d8e0d9;
  --accent: #0b7a49;
  --accent-dark: #065f39;
  --amber: #b7791f;
  --amber-soft: #fff4da;
  --shadow: 0 18px 50px rgba(26, 38, 31, 0.1);
  --mono: "IBM Plex Mono", "SFMono-Regular", Consolas, monospace;
  --sans: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  color: var(--ink);
  background: var(--bg);
  font-family: var(--sans);
}

body {
  margin: 0;
}

button,
textarea,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  width: min(1460px, calc(100% - 48px));
  margin: 0 auto;
  padding: 32px 0 48px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 410px);
  gap: 24px;
  align-items: end;
  margin-bottom: 20px;
}

.hero-copy h1 {
  margin: 0;
  font-family: var(--mono);
  font-size: clamp(2.5rem, 5vw, 5rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.hero-copy p {
  max-width: 860px;
  margin: 14px 0 0;
  color: #34424e;
  font-size: 1.05rem;
  line-height: 1.65;
}

.eyebrow,
.step-label {
  margin: 0 0 8px;
  color: var(--accent-dark);
  font-family: var(--mono);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
}

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

.keyword-pills span {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.75);
  color: #34424e;
  padding: 8px 11px;
  font-family: var(--mono);
  font-size: 0.78rem;
}

.trust-note {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 12px;
  align-items: start;
  border: 1px solid #ead7a9;
  border-radius: 8px;
  background: var(--amber-soft);
  padding: 16px;
  color: #4c3a16;
}

.trust-note p {
  margin: 0;
  line-height: 1.55;
}

.note-dot {
  width: 10px;
  height: 10px;
  margin-top: 7px;
  border-radius: 50%;
  background: var(--amber);
}

.tool-grid {
  display: grid;
  grid-template-columns: minmax(360px, 0.95fr) minmax(420px, 1.05fr);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel {
  padding: 24px;
}

.input-panel {
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #ffffff 0%, #f8fbf7 100%);
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: start;
  margin-bottom: 18px;
}

.panel-heading h2 {
  margin: 0;
  font-family: var(--mono);
  font-size: 1.05rem;
}

.panel-heading p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

#character-count,
.status-pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8faf8;
  color: var(--muted);
  padding: 7px 10px;
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: nowrap;
}

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

.field-label {
  color: #2d3832;
  font-weight: 700;
}

textarea {
  width: 100%;
  min-height: 178px;
  resize: vertical;
  border: 1px solid #aeb9b2;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 14px;
  font-family: var(--mono);
  font-size: 0.98rem;
  line-height: 1.6;
}

textarea:focus,
button:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(11, 122, 73, 0.24);
  outline-offset: 2px;
}

.preset-group {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0;
}

.preset-button,
.primary-button,
.secondary-button,
.ghost-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 700;
}

.preset-button {
  border: 1px solid var(--line);
  background: #fff;
  color: #26322b;
}

.preset-button.is-active {
  border-color: var(--accent);
  background: var(--surface-soft);
  color: var(--accent-dark);
}

.control-stack {
  display: grid;
  gap: 16px;
}

.range-row {
  display: grid;
  grid-template-columns: 90px 1fr 74px;
  gap: 12px;
  align-items: center;
  color: #26322b;
  font-weight: 700;
}

input[type="range"] {
  accent-color: var(--accent);
}

.toggle-fieldset {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  border: 0;
  padding: 0;
}

.toggle-fieldset legend {
  width: 100%;
  margin-bottom: 2px;
  color: #26322b;
  font-weight: 700;
}

.toggle-fieldset label,
.check-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
}

.check-row {
  width: fit-content;
  max-width: 100%;
}

.action-row,
.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.primary-button {
  border: 1px solid var(--accent);
  background: var(--accent);
  color: #fff;
}

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

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--accent-dark);
}

.ghost-button {
  border: 1px solid #ead7a9;
  background: var(--amber-soft);
  color: #6f4a05;
}

.preview-box {
  display: grid;
  min-height: 250px;
  align-items: center;
  border: 1px solid #aeb9b2;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(11, 122, 73, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, rgba(11, 122, 73, 0.04) 1px, transparent 1px),
    #fbfdfb;
  background-size: 28px 28px;
  padding: 26px;
}

#glitch-output {
  display: block;
  width: 100%;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  font-family: var(--mono);
  font-size: clamp(1.35rem, 3vw, 2.3rem);
  line-height: 1.75;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 14px;
}

.stats-grid span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
  padding: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.78rem;
}

.stats-grid strong {
  color: var(--ink);
}

.compat-note {
  margin: 14px 0 0;
  border-left: 3px solid var(--amber);
  padding-left: 12px;
  color: var(--muted);
  line-height: 1.55;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-top: 22px;
}

.info-card,
.faq-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 22px;
}

.wide-card {
  grid-column: 1 / -1;
}

.info-card h2,
.faq-section h2 {
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 1.08rem;
}

.info-card p,
.info-card li,
.faq-item p {
  color: #3f4d58;
  line-height: 1.7;
}

.info-card p {
  margin: 0 0 12px;
}

.info-card p:last-child {
  margin-bottom: 0;
}

.info-card ol,
.check-list {
  margin: 0 0 14px;
  padding-left: 20px;
}

.example-list {
  display: grid;
  gap: 10px;
}

.example-list p,
.check-list li {
  margin: 0;
}

.faq-list {
  display: grid;
  gap: 12px;
}

.faq-item {
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.faq-item h3 {
  margin: 0 0 6px;
  font-size: 1rem;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  max-width: min(360px, calc(100vw - 48px));
  transform: translateY(18px);
  opacity: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101812;
  color: #fff;
  padding: 12px 14px;
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  transform: translateY(0);
  opacity: 1;
}

@media (max-width: 940px) {
  .page-shell {
    width: min(100% - 28px, 760px);
    padding-top: 22px;
  }

  .hero,
  .tool-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .input-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .hero-copy h1 {
    font-size: clamp(2.35rem, 12vw, 4.2rem);
  }
}

@media (max-width: 560px) {
  .panel,
  .info-card,
  .faq-section {
    padding: 18px;
  }

  .panel-heading,
  .range-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .panel-heading {
    display: grid;
  }

  #character-count,
  .status-pill {
    width: fit-content;
  }

  .preset-button,
  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .check-row,
  .toggle-fieldset label {
    width: 100%;
  }

  .preview-box {
    min-height: 210px;
    padding: 18px;
  }

  .toast {
    right: 14px;
    bottom: 14px;
  }
}
