:root {
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #1b1f24;
  --muted: #5a626d;
  --border: #e1e4e8;
  --accent: #0f766e;
  --accent-ink: #ffffff;
  --accent-soft: #e8f5f3;
  --radius: 10px;
  --max: 1040px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14171a;
    --surface: #1c2024;
    --text: #e8eaed;
    --muted: #a0a8b2;
    --border: #2f343a;
    --accent: #5eead4;
    --accent-ink: #062a26;
    --accent-soft: #10302c;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

a { color: var(--accent); }

.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

.site-header { border-bottom: 1px solid var(--border); background: var(--surface); }
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 56px; flex-wrap: wrap; }
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); text-decoration: none; }
.nav { display: flex; gap: 14px; font-size: 0.95rem; overflow-x: auto; white-space: nowrap; max-width: 100%; padding-bottom: 2px; }
.nav a { color: var(--muted); text-decoration: none; }
.nav a:hover { color: var(--text); }

main { padding: 24px 0 48px; }

h1 { font-size: 1.9rem; line-height: 1.2; margin: 8px 0 8px; }
h2 { font-size: 1.3rem; margin: 32px 0 12px; }
h3 { font-size: 1.05rem; margin: 20px 0 8px; }
.lead { color: var(--muted); margin: 0 0 20px; }

.breadcrumbs { font-size: 0.85rem; color: var(--muted); }
.breadcrumbs a { color: var(--muted); }

/* The big answer at the top of generated pages and under each tool */
.answer {
  background: var(--accent-soft); border: 1px solid var(--accent); border-radius: var(--radius);
  padding: 18px 20px; margin: 16px 0;
}
.answer .label { font-size: 0.9rem; color: var(--muted); margin: 0; }
.answer .value { font-size: 1.7rem; font-weight: 700; line-height: 1.25; margin: 4px 0; }
.answer .sub { margin: 0; color: var(--muted); }

/* Tool forms */
.tool { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.fields { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.fields label { display: flex; flex-direction: column; gap: 4px; font-size: 0.85rem; color: var(--muted); }
.tool input, .tool select {
  font: inherit; font-size: 1.05rem; padding: 9px 10px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--bg); color: var(--text); width: 100%;
}
.tool input:focus, .tool select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.tool .check { flex-direction: row; align-items: center; gap: 8px; font-size: 0.95rem; color: var(--text); }
.tool .check input { width: auto; }
.tool .row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }
.tool button {
  font: inherit; font-weight: 600; padding: 9px 16px; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer;
}
.tool button.ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); }
.tabs { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.tabs button[aria-pressed='true'] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.error { color: #c0392b; margin: 8px 0 0; }

/* Fact tables */
table.facts { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
table.facts th, table.facts td { text-align: left; padding: 9px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
table.facts tr:last-child th, table.facts tr:last-child td { border-bottom: 0; }
table.facts th { font-weight: 500; color: var(--muted); width: 42%; }
table.facts td { font-weight: 600; }

/* Ads: reserve space so the page doesn't jump when an ad loads */
.ad-slot { margin: 24px 0; min-height: 100px; display: flex; justify-content: center; }

.link-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px 16px; padding: 0; list-style: none; }
.num-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(56px, 1fr)); gap: 6px; padding: 0; list-style: none; }
.num-grid a {
  display: block; text-align: center; padding: 6px 0; border: 1px solid var(--border); border-radius: 6px;
  background: var(--surface); text-decoration: none; font-weight: 600; font-variant-numeric: tabular-nums;
}
.num-grid a:hover { border-color: var(--accent); }
.pill-list { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.pill-list a { display: inline-block; padding: 4px 10px; border: 1px solid var(--border); border-radius: 999px; text-decoration: none; background: var(--surface); }

.faq dt { font-weight: 600; margin-top: 12px; }
.faq dd { margin: 4px 0 0; color: var(--muted); }

.site-footer { border-top: 1px solid var(--border); padding: 24px 0; color: var(--muted); font-size: 0.9rem; }
.site-footer nav { display: flex; gap: 16px; flex-wrap: wrap; margin-bottom: 8px; }
.site-footer a { color: var(--muted); }

.prose p, .prose li { max-width: 70ch; }
.muted { color: var(--muted); }

.data-table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.data-table th, .data-table td { text-align: left; padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.data-table th { font-size: 0.85rem; color: var(--muted); font-weight: 500; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table td.num { font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; }
.pager { display: flex; justify-content: space-between; gap: 12px; margin: 32px 0 0; flex-wrap: wrap; }
.result:empty { display: none; }
.result { margin-top: 16px; }

/* Rhymes Box */
.brand { display: inline-flex; align-items: center; gap: 8px; }
.logo { width: 22px; height: 22px; border-radius: 6px; background: var(--accent); color: var(--accent-ink); font-size: 0.8rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; }
.search { display: flex; gap: 6px; flex: 1 1 220px; max-width: 320px; }
.search input { flex: 1; min-width: 0; font: inherit; font-size: 0.95rem; padding: 6px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); }
.search button, .btn {
  font: inherit; font-size: 0.9rem; font-weight: 600; padding: 6px 12px; border: 0; border-radius: 8px;
  background: var(--accent); color: var(--accent-ink); cursor: pointer; text-decoration: none; display: inline-block;
}
.big-search { display: flex; gap: 8px; margin: 12px 0 8px; }
.big-search input { flex: 1; min-width: 0; font: inherit; font-size: 1.25rem; padding: 12px 14px; border: 2px solid var(--accent); border-radius: 10px; background: var(--surface); color: var(--text); }
.big-search button { font: inherit; font-size: 1.05rem; font-weight: 700; padding: 0 20px; border: 0; border-radius: 10px; background: var(--accent); color: var(--accent-ink); cursor: pointer; }
.words { display: flex; flex-wrap: wrap; gap: 6px 8px; padding: 0; margin: 6px 0 12px; list-style: none; }
.words a { display: inline-block; padding: 3px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--surface); text-decoration: none; color: var(--text); }
.words a:hover { border-color: var(--accent); color: var(--accent); }
.words li.top a { font-weight: 700; border-color: var(--accent); }
.words span { display: inline-block; padding: 3px 10px; border: 1px dashed var(--border); border-radius: 999px; color: var(--muted); }
details.rare { margin: 0 0 12px; }
details.rare summary { cursor: pointer; color: var(--accent); font-size: 0.92rem; }
.syl-group h3 { font-size: 0.95rem; color: var(--muted); font-weight: 600; margin: 14px 0 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.sound { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.92em; }
.stress { font-weight: 700; letter-spacing: 0.02em; }
.split { font-size: 2rem; font-weight: 700; letter-spacing: 0.02em; }
.split .dot { color: var(--accent); padding: 0 0.08em; }
.tool textarea { font: inherit; font-size: 1rem; line-height: 1.6; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--bg); color: var(--text); width: 100%; min-height: 220px; resize: vertical; }
.tool textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.lines { list-style: none; padding: 0; margin: 0; font-variant-numeric: tabular-nums; }
.lines li { display: grid; grid-template-columns: 3.2em minmax(0, 1fr) auto; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); align-items: baseline; }
.lines li:last-child { border-bottom: 0; }
.lines .tag { font-weight: 800; text-align: center; border-radius: 6px; padding: 0 4px; }
.lines .count { color: var(--muted); font-size: 0.9rem; white-space: nowrap; }
.lines .text { overflow-wrap: anywhere; }
.lines .ok { color: #15803d; }
.lines .off { color: #b91c1c; }
@media (prefers-color-scheme: dark) { .lines .ok { color: #4ade80; } .lines .off { color: #f87171; } }
.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; padding: 0; list-style: none; }
.tool-grid a { display: block; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); text-decoration: none; color: var(--text); font-weight: 600; }
.tool-grid a:hover { border-color: var(--accent); }
.tool-grid span { display: block; font-size: 0.85rem; font-weight: 400; color: var(--muted); }
.letters { display: flex; flex-wrap: wrap; gap: 6px; padding: 0; list-style: none; }
.letters a, .letters span { display: inline-block; min-width: 34px; text-align: center; padding: 4px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); text-decoration: none; font-weight: 600; }
.letters span { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.small { font-size: 0.88rem; }
