:root {
  --ink: #ece9e2;
  --paper: #171614;
  --line: #322f2b;
  --good: #6fbf94;
  --bad: #e08469;
  --muted: #8f8c84;
  --field-bg: #201f1c;
  --accent: var(--ink);
}

:root[data-theme="light"] {
  --ink: #1c1b1a;
  --paper: #faf9f6;
  --line: #d8d5cd;
  --good: #2f6d4f;
  --bad: #a33d2c;
  --muted: #8a877e;
  --field-bg: transparent;
}

:root[data-theme="sepia"] {
  --ink: #4a3826;
  --paper: #f4ecd8;
  --line: #d8c8a4;
  --good: #5f7a1f;
  --bad: #a0522d;
  --muted: #8a7756;
  --field-bg: #ece0c4;
}

:root[data-theme="solarized-light"] {
  --ink: #586e75;
  --paper: #fdf6e3;
  --line: #eee8d5;
  --good: #859900;
  --bad: #dc322f;
  --muted: #93a1a1;
  --field-bg: #eee8d5;
}

:root[data-theme="solarized-dark"] {
  --ink: #93a1a1;
  --paper: #002b36;
  --line: #073642;
  --good: #859900;
  --bad: #dc322f;
  --muted: #586e75;
  --field-bg: #073642;
}

:root[data-theme="dracula"] {
  --ink: #f8f8f2;
  --paper: #282a36;
  --line: #44475a;
  --good: #50fa7b;
  --bad: #ff5555;
  --muted: #6272a4;
  --field-bg: #343746;
}

:root[data-theme="nord"] {
  --ink: #eceff4;
  --paper: #2e3440;
  --line: #434c5e;
  --good: #88c0d0;
  --bad: #bf616a;
  --muted: #81a1c1;
  --field-bg: #3b4252;
}

:root[data-theme="github-light"] {
  --ink: #24292f;
  --paper: #ffffff;
  --line: #d0d7de;
  --good: #1a7f37;
  --bad: #cf222e;
  --muted: #57606a;
  --field-bg: #f6f8fa;
}

:root[data-theme="github-dark"] {
  --ink: #c9d1d9;
  --paper: #0d1117;
  --line: #30363d;
  --good: #3fb950;
  --bad: #f85149;
  --muted: #8b949e;
  --field-bg: #161b22;
}

:root[data-theme="monokai"] {
  --ink: #f8f8f2;
  --paper: #272822;
  --line: #49483e;
  --good: #a6e22e;
  --bad: #f92672;
  --muted: #a6a69c;
  --field-bg: #3e3d32;
}

:root[data-theme="one-dark"] {
  --ink: #abb2bf;
  --paper: #282c34;
  --line: #3e4451;
  --good: #98c379;
  --bad: #e06c75;
  --muted: #7f848e;
  --field-bg: #21252b;
}

:root[data-theme="ocean"] {
  --ink: #d9f3f0;
  --paper: #073642;
  --line: #176b75;
  --good: #a8e6cf;
  --bad: #ff8b8b;
  --muted: #83b8bd;
  --field-bg: #0b4652;
  --accent: #5eead4;
}

:root[data-theme="forest"] {
  --ink: #e6f1d8;
  --paper: #17261b;
  --line: #36533b;
  --good: #b9e769;
  --bad: #f29b9b;
  --muted: #98ae91;
  --field-bg: #223a28;
  --accent: #d6f36b;
}

:root[data-theme="sunset"] {
  --ink: #fff0dc;
  --paper: #3a1832;
  --line: #71324e;
  --good: #ffd166;
  --bad: #ff8c82;
  --muted: #d6a6a1;
  --field-bg: #51213b;
  --accent: #ffad69;
}

:root[data-theme="candy"] {
  --ink: #43264f;
  --paper: #ffe5f1;
  --line: #e9a8ca;
  --good: #168f78;
  --bad: #d94770;
  --muted: #956a8e;
  --field-bg: #ffd1e5;
  --accent: #c43d82;
}

:root[data-theme="synthwave"] {
  --ink: #f5e9ff;
  --paper: #17102d;
  --line: #593b86;
  --good: #61f4de;
  --bad: #ff6b9d;
  --muted: #b9a5d6;
  --field-bg: #25164a;
  --accent: #ff7edb;
}

:root[data-theme="citrus"] {
  --ink: #26351c;
  --paper: #f1f5c9;
  --line: #c7d66b;
  --good: #397c3f;
  --bad: #bd4e37;
  --muted: #718047;
  --field-bg: #e4ed9f;
  --accent: #e07a20;
}

:root[data-theme="high-contrast"] {
  --ink: #ffffff;
  --paper: #000000;
  --line: #ffffff;
  --good: #00ff66;
  --bad: #ff3333;
  --muted: #cccccc;
  --field-bg: #000000;
}

@media (prefers-color-scheme: light) {
  :root[data-theme="system"] {
    --ink: #1c1b1a;
    --paper: #faf9f6;
    --line: #d8d5cd;
    --good: #2f6d4f;
    --bad: #a33d2c;
    --muted: #8a877e;
    --field-bg: transparent;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  background: var(--paper);
  color: var(--ink);
  font-family: Georgia, 'Times New Roman', serif;
  padding: 24px;
  transition: background 0.15s ease, color 0.15s ease;
}

main {
  width: 100%;
  max-width: 440px;
}

.status-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-top: 6px;
}

#themeSelect {
  border: 1px solid var(--line);
  background: var(--field-bg);
  color: var(--ink);
  font-family: inherit;
  font-size: 0.8rem;
  padding: 5px 8px;
  border-radius: 2px;
  cursor: pointer;
}

#themeSelect:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

h1 {
  font-size: 1.4rem;
  font-weight: normal;
  margin: 0 0 4px;
  letter-spacing: 0.01em;
  color: var(--accent);
}

h2 {
  font-size: 1rem;
  font-weight: normal;
  font-style: italic;
}

p.sub {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.95rem;
}

form {
  display: flex;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 8px;
}

input[type="text"] {
  flex: 1;
  border: none;
  background: var(--field-bg);
  font-family: inherit;
  font-size: 1.6rem;
  color: var(--ink);
  outline: none;
  padding: 4px 0;
  letter-spacing: 0.02em;
}

input[type="text"]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

input[type="text"]::placeholder {
  color: var(--muted);
}

button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: var(--paper);
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0 18px;
  margin-left: 12px;
  cursor: pointer;
}

button:hover { opacity: 0.85; }
button:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

#result {
  margin-top: 24px;
  min-height: 3.2rem;
  font-size: 1.15rem;
  display: flex;
  align-items: baseline;
  gap: 4px;
}

#result .verdict-word {
  font-weight: bold;
}

#result.is-good .verdict-word { color: var(--good); }
#result.is-bad .verdict-word { color: var(--bad); }

#result .verdict-label {
  color: var(--muted);
  font-size: 0.95rem;
}

#status {
  color: var(--muted);
  font-size: 0.85rem;
}

#status.error { color: var(--bad); }
