:root {
  --bg: #12141a;
  --panel: #181c24;
  --panel-alt: #1e232c;
  --border: #2a3038;
  --border-soft: #232830;
  --text: #e9e7de;
  --text-muted: #8b93a1;
  --text-faint: #565d6b;
  --accent: #e0b23c;
  --accent-soft: rgba(224, 178, 60, 0.14);
  --accent-2: #4fb3a9;
  --accent-2-soft: rgba(60, 224, 197, 0.14);
  --danger: #e0605c;
  --danger-soft: rgba(224, 96, 92, 0.14);
  --clr-comparison: #b98eff;
  --clr-input: var(--accent);
  --clr-matcher: #5ea0f5;
  --clr-ifmatch: #5fd68f;
  --clr-else: var(--danger);
  --radius: 12px;
  --radius-soft: 999px;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  --display: 'Space Grotesk', var(--mono);
}

* { box-sizing: border-box; }

html { color-scheme: dark; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--mono);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

code {
  font-family: var(--mono);
  background: var(--panel-alt);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 0 4px;
  font-size: 0.92em;
  color: var(--accent-2);
}

.grid-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(255,255,255,0.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255,255,255,0.025) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: radial-gradient(ellipse 80% 55% at 50% 0%, #000 40%, transparent 100%);
}

.wrap {
  position: relative;
  z-index: 1;
  max-width: 920px;
  margin: 0 auto;
  padding: 64px 24px 48px;
}

/* Hero */

.hero { margin-bottom: 40px; }

.kicker {
  margin: 0 0 14px;
  font-size: 13px;
  letter-spacing: 0.02em;
}

.kicker a {
  color: var(--accent);
  text-decoration: none;
}

.kicker a:hover { color: var(--text-muted); }

h1 {
  margin: 0 0 16px;
  font-family: var(--display);
  font-weight: 600;
  font-size: clamp(32px, 5vw, 46px);
  letter-spacing: -0.01em;
  color: #fff;
}

.cursor {
  display: inline-block;
  color: var(--accent);
  animation: blink 1.1s steps(1) infinite;
}

@keyframes blink { 50% { opacity: 0; } }

.lede {
  margin: 0;
  max-width: 58ch;
  color: var(--text-muted);
  font-size: 15px;
  line-height: 1.65;
}

.hint {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 14px 0 0;
  padding: 7px 14px;
  border-radius: var(--radius);
  background: rgba(94, 160, 245, 0.12);
  border: 1px solid rgba(94, 160, 245, 0.3);
  max-width: fit-content;
}

.hint-icon {
  flex: none;
  color: #5ea0f5;
  font-size: 15px;
}

.hint-text {
  margin: 0;
  color: #5ea0f5;
  font-size: 13px;
  line-height: 1.6;
}

@media (max-width: 560px) {
  .hint {
    max-width: none;
    align-items: flex-start;
    padding: 14px 16px;
  }
  .hint-icon { margin-top: 2px; }
}

/* Panes */

.panes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 28px;
  align-items: start;
}

.pane {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pane-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--panel-alt);
}

.pane-label {
  font-size: 12px;
  color: var(--text-muted);
}

.pane-hint {
  font-size: 11px;
  color: var(--text-faint);
}

.pane-head-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#copy {
  border: 1px solid var(--border);
  border-radius: var(--radius-soft);
  background: var(--panel);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 12px;
  padding: 4px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

#copy:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); }
#copy:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
#copy.done { color: var(--accent-2); border-color: var(--accent-2); }
#copy.done:hover { background: var(--accent-2-soft); }

/* Form fields */

.fields {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field { display: flex; flex-direction: column; }

.field-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 5px;
}

.field-label { color: var(--text-faint); }
.field-label.comparison { color: var(--clr-comparison); }
.field-label.input { color: var(--clr-input); }
.field-label.matcher { color: var(--clr-matcher); }
.field-label.ifmatch { color: var(--clr-ifmatch); }
.field-label.else { color: var(--clr-else); }

.field-desc {
  margin: 0 0 8px;
  font-size: 12px;
  color: var(--text-faint);
  line-height: 1.5;
}

.field input[type="text"],
.field select {
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 11px;
  font-family: var(--mono);
  font-size: 14px;
  width: 100%;
  transition: border-color 0.15s ease;
}

.field select { cursor: pointer; }

.field input[type="text"]:hover,
.field select:hover { border-color: #3a4048; }

.field input[type="text"]:focus,
.field select:focus {
  outline: none;
  border-color: var(--accent);
}

/* Result */

.result-body {
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-faint);
  font-size: 11px;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border-soft);
}

textarea {
  width: 100%;
  resize: vertical;
  background: transparent;
  color: var(--text);
  border: none;
  padding: 0;
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.6;
}

textarea:focus { outline: none; }

#outputPreview.output-area {
  min-height: 96px;
  background: var(--panel-alt);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius);
  padding: 12px;
  white-space: pre-wrap;
  word-break: break-word;
}

#outputPreview.output-area:empty::before {
  content: "Complete Input and Matcher to generate the placeholder.";
  color: var(--text-faint);
}

.seg-comparison { color: var(--clr-comparison); }
.seg-input { color: var(--clr-input); }
.seg-matcher { color: var(--clr-matcher); }
.seg-ifmatch { color: var(--clr-ifmatch); }
.seg-else { color: var(--clr-else); }

.output-raw {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Presets */

.presets-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--radius-soft);
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--mono);
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.15s ease;
}

.chip i { color: var(--text-faint); font-size: 12px; }

.chip:hover {
  border-color: var(--accent);
  color: var(--text);
  transform: translateY(-2px);
}

.chip:hover i { color: var(--accent); }

.chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Footer */

.foot {
  color: var(--text-faint);
  font-size: 12px;
  text-align: center;
}

/* Responsive */

@media (max-width: 720px) {
  .panes { grid-template-columns: 1fr; }
  .wrap { padding: 44px 18px 36px; }
}

@media (prefers-reduced-motion: reduce) {
  .cursor { animation: none; }
}
