:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --border: #e4e0d8;
  --text: #23201b;
  --text-muted: #6b6459;
  --accent: #b5622f;
  --accent-soft: #f1e3d4;
  --code-bg: #211d18;
  --code-text: #f1ece2;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 25, 15, 0.04), 0 8px 24px rgba(30, 25, 15, 0.06);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17140f;
    --surface: #201c16;
    --surface-2: #241f18;
    --border: #38322a;
    --text: #f1ece2;
    --text-muted: #a89e8d;
    --accent: #e08a4f;
    --accent-soft: #3a2c1e;
    --code-bg: #0f0d0a;
    --code-text: #f1ece2;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.3);
  }
}

:root[data-theme="light"] {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --surface-2: #fbfaf8;
  --border: #e4e0d8;
  --text: #23201b;
  --text-muted: #6b6459;
  --accent: #b5622f;
  --accent-soft: #f1e3d4;
  --code-bg: #211d18;
  --code-text: #f1ece2;
}

:root[data-theme="dark"] {
  --bg: #17140f;
  --surface: #201c16;
  --surface-2: #241f18;
  --border: #38322a;
  --text: #f1ece2;
  --text-muted: #a89e8d;
  --accent: #e08a4f;
  --accent-soft: #3a2c1e;
  --code-bg: #0f0d0a;
  --code-text: #f1ece2;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
}

.app {
  max-width: 1120px;
  margin: 0 auto;
  padding: 40px 24px 64px;
}

.hero {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 32px;
}

.badge {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: 999px;
  margin-bottom: 14px;
}

h1 {
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  margin: 0 0 12px;
  letter-spacing: -0.01em;
}

.lede {
  color: var(--text-muted);
  font-size: 1rem;
  margin: 0;
}

.examples {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  justify-content: center;
  margin-bottom: 32px;
}

.examples-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.85rem;
  padding: 7px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.chip:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 860px) {
  .grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.field {
  margin-bottom: 20px;
}

.field-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 600;
  font-size: 0.98rem;
}

.field-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  background: var(--accent);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  flex-shrink: 0;
}

.hint {
  color: var(--text-muted);
  font-size: 0.83rem;
  margin: 4px 0 8px;
}

.hint-bad {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 6px 0 0;
  opacity: 0.75;
  font-style: italic;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.45;
}

textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.toggles {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 18px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.toggle {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  font-size: 0.85rem;
  cursor: pointer;
}

.toggle input {
  margin-top: 3px;
  accent-color: var(--accent);
}

.toggle em {
  display: block;
  color: var(--text-muted);
  font-style: normal;
  font-size: 0.78rem;
}

.btn-ghost, .btn-primary {
  border: none;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 10px 18px;
  cursor: pointer;
  font-family: inherit;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.output-panel {
  position: sticky;
  top: 24px;
}

.output-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.output-head h2 {
  font-size: 1.05rem;
  margin: 0;
}

.stats {
  font-size: 0.78rem;
  color: var(--text-muted);
  display: flex;
  gap: 6px;
}

.output-box {
  background: var(--code-bg);
  color: var(--code-text);
  border-radius: 10px;
  padding: 16px;
  font-family: "SF Mono", "Fira Code", Menlo, monospace;
  font-size: 0.83rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 220px;
  max-height: 420px;
  overflow-y: auto;
  margin: 0 0 14px;
}

.output-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.copy-status {
  font-size: 0.82rem;
  color: var(--accent);
  min-height: 1em;
}

.tips {
  border-top: 1px solid var(--border);
  padding-top: 16px;
}

.tips h3 {
  font-size: 0.9rem;
  margin: 0 0 10px;
}

.tips ul {
  margin: 0;
  padding-left: 18px;
  font-size: 0.83rem;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.foot {
  text-align: center;
  margin-top: 40px;
  color: var(--text-muted);
  font-size: 0.8rem;
}
