/* One stylesheet, no framework, no CDN. Light and dark both come from
   prefers-color-scheme: the palette is a set of custom properties defined
   light-first and redefined once for dark, so nothing is coloured twice. */

:root {
  color-scheme: light dark;
  --bg: #fbfaf7;
  --panel: #ffffff;
  --ink: #1b1a17;
  --muted: #6a675f;
  --line: #ddd9d0;
  --accent: #7a4b2a;
  --accent-ink: #ffffff;
  --chip: #f1ede5;
  --chip-on: #7a4b2a;
  --error: #a3231b;
  --row-hover: #f5f2ea;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #16151a;
    --panel: #1e1d23;
    --ink: #eceae4;
    --muted: #9c988e;
    --line: #33313a;
    --accent: #d8a06a;
    --accent-ink: #1b1a17;
    --chip: #2a2831;
    --chip-on: #d8a06a;
    --error: #ff8a80;
    --row-hover: #24232b;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0 1.25rem 4rem;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

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

.bar { padding: 1.5rem 0 0.75rem; }
.bar h1 { margin: 0; font-size: 1.4rem; letter-spacing: -0.01em; }
.bar .sub { margin: 0.25rem 0 0; color: var(--muted); max-width: 60ch; }

#nodb {
  max-width: 60ch;
  margin: 2rem 0;
  padding: 1.25rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}
#nodb h2 { margin-top: 0; font-size: 1.1rem; }
pre, code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
pre { background: var(--chip); padding: 0.6rem 0.8rem; border-radius: 6px; overflow-x: auto; }

form {
  margin: 1rem 0;
  padding: 0.9rem 1rem 1rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.row { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: end; margin-bottom: 0.75rem; }
.row:last-child { margin-bottom: 0; }

label { display: flex; flex-direction: column; gap: 0.2rem; font-size: 0.82rem; color: var(--muted); }
label.grow { flex: 1 1 16rem; }
label.narrow input { width: 7.5rem; }
label.check { flex-direction: row; align-items: center; gap: 0.35rem; padding-bottom: 0.4rem; }

input, select, button {
  font: inherit;
  color: var(--ink);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.35rem 0.5rem;
}
input[type="checkbox"] { padding: 0; accent-color: var(--accent); }
select { max-width: 15rem; }

button { cursor: pointer; }
button:hover { border-color: var(--accent); }
.linkish {
  border: none; background: none; color: var(--accent);
  padding: 0 0.2rem; text-decoration: underline;
}

fieldset.feels { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 0.75rem; padding: 0.5rem 0.75rem 0.75rem; }
fieldset.feels legend { font-size: 0.82rem; color: var(--muted); display: flex; align-items: center; gap: 0.5rem; }
#feelmode {
  font-size: 0.72rem; letter-spacing: 0.06em; padding: 0.1rem 0.45rem;
  background: var(--chip); border-radius: 999px;
}
#feelmode[aria-pressed="false"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.chips { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.chip {
  border-radius: 999px; background: var(--chip); border: 1px solid transparent;
  padding: 0.2rem 0.65rem; font-size: 0.85rem;
}
.chip .n { color: var(--muted); font-size: 0.78em; margin-left: 0.35rem; }
.chip[aria-pressed="true"] { background: var(--chip-on); color: var(--accent-ink); }
.chip[aria-pressed="true"] .n { color: inherit; opacity: 0.75; }
.chip.odd { font-style: italic; }

.error { color: var(--error); font-weight: 600; }

.results-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; flex-wrap: wrap; }
#count { color: var(--muted); }
.playing { color: var(--accent); font-size: 0.85rem; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 0.4rem 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
th.play, td.play { width: 2.4rem; }
tbody tr:hover { background: var(--row-hover); }
td.feels { color: var(--muted); font-size: 0.85rem; }
td.title a { text-decoration: none; }
td.title a:hover { text-decoration: underline; }
td.title .desc { display: block; color: var(--muted); font-size: 0.82rem; max-width: 60ch; }

.playbtn { width: 2rem; padding: 0.1rem 0; text-align: center; }
.playbtn[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

.pager { display: flex; gap: 0.75rem; align-items: center; margin: 1rem 0; }
.pager span { color: var(--muted); font-size: 0.85rem; }
button:disabled { opacity: 0.4; cursor: default; }

footer { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); }
.credit { margin: 0 0 0.25rem; font-weight: 600; }
.meta { margin: 0; color: var(--muted); font-size: 0.85rem; }

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

@media (max-width: 640px) {
  td.feels, th:nth-child(7), td:nth-child(7) { display: none; }
  select { max-width: 100%; }
}
