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

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

/* Options */

.options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.opt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  flex: 1 1 220px;
  transition: border-color 0.15s ease;
}

.opt:hover { border-color: #3a4048; }

.opt input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.box {
  flex: none;
  width: 16px;
  height: 16px;
  border: 1px solid var(--text-faint);
  border-radius: var(--radius-soft);
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.opt input:checked + .box {
  background: var(--accent);
  border-color: var(--accent);
}

.opt input:checked + .box::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #14161c;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.opt input:focus-visible + .box {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.opt-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.opt-title { font-size: 13.5px; color: var(--text); }
.opt-sub { font-size: 12px; color: var(--text-faint); }

.select-opt {
  cursor: default;
  justify-content: space-between;
  gap: 16px;
}

#char {
  background: var(--panel-alt);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-family: var(--mono);
  font-size: 15px;
  cursor: pointer;
}

#char:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Panes */

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

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

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

textarea:focus { outline: none; }

#text { min-height: 260px; }

#output.output-area {
  min-height: 260px;
}

.legend {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
  margin-bottom: 24px;
}

.swatch {
  padding: 8px 0;
  text-align: center;
  border-radius: var(--radius);
  font-size: 12px;
}

/* Footer */

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

/* Responsive */

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

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