/* Tokens mirror brighter.fi: light is the base, [data-theme=dark] (the
   default, set before paint in index.html) overrides it. */
:root {
  --brand: #fc0;
  --brand-hover: #e6b800;
  --brand-dim: #ffcc0014;
  --accent: #07f;
  --danger: #ff3b30;
  --success: #00b341;
  --warn: #b45309;
  --warn-dim: #f59e0b1f;
  --surface-0: #fff;
  --surface-1: #f9fafb;
  --surface-2: #f3f4f6;
  --surface-3: #e8eaed;
  --border: #eeeff2;
  --text: #1a1a1a;
  --text-2: #6b7280;
  --text-3: #9ca3af;
  --on-brand: #000;
  --radius-sm: 4px;
  --radius: 6px;
  --radius-lg: 10px;
  --sans: "YS Text", "Golos Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --display: "YS Display", "YS Text", "Golos Text", -apple-system, BlinkMacSystemFont, sans-serif;
  color-scheme: light;
}
[data-theme="dark"] {
  --brand-dim: #ffcc001f;
  --accent: #3b9eff;
  --danger: #ff5b52;
  --success: #00c94a;
  --warn: #fbbf24;
  --warn-dim: #fbbf241f;
  --surface-0: #0b0b0e;
  --surface-1: #141418;
  --surface-2: #1c1c22;
  --surface-3: #2a2a33;
  --border: #23232b;
  --text: #f4f4f5;
  --text-2: #a1a1aa;
  --text-3: #71717a;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scrollbar-gutter: stable; }
body {
  margin: 0; background: var(--surface-0); color: var(--text);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale;
}
a { color: inherit; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }

/* header */
.top { border-bottom: 1px solid var(--border); background: var(--surface-0); position: sticky; top: 0; z-index: 2; }
.top-row { display: flex; align-items: center; gap: 16px; min-height: 60px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; margin: 0 auto 0 0; font: 600 17px/1 var(--display); letter-spacing: -.01em; }
.brand img { width: 26px; height: 26px; border-radius: var(--radius); }
.brand span { color: var(--text-2); font-weight: 500; }
.profiles { display: inline-flex; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 3px; }
.profiles button {
  font-size: 14px; font-weight: 500; color: var(--text-2); background: none; border: 0;
  padding: 7px 14px; border-radius: 7px; cursor: pointer;
}
.profiles button:hover { color: var(--text); }
.profiles button[aria-selected="true"] { background: var(--brand); color: var(--on-brand); }
.theme {
  width: 36px; height: 36px; display: grid; place-items: center; cursor: pointer;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg); color: var(--text-2);
}
.theme:hover { color: var(--text); background: var(--surface-2); }
.theme svg { width: 18px; height: 18px; }
[data-theme="dark"] .theme .moon, [data-theme="light"] .theme .sun { display: none; }

/* intro */
.intro { padding: 40px 0 8px; }
.lede { font: 600 28px/1.25 var(--display); letter-spacing: -.02em; max-width: 30ch; margin: 0 0 10px; }
.meta { color: var(--text-2); margin: 0; font-size: 14px; min-height: 21px; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: center; padding: 20px 0; border-bottom: 1px solid var(--border); }
.filters input[type="search"] {
  flex: 1 1 220px; padding: 9px 12px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.filters input[type="search"]::placeholder { color: var(--text-3); }
.filters input[type="search"]:focus { outline: none; border-color: var(--brand); }
.kinds { border: 0; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.kinds label {
  font-size: 13.5px; font-weight: 500; padding: 6px 11px; border: 1px solid var(--border);
  border-radius: var(--radius-lg); cursor: pointer; user-select: none; background: var(--surface-1); color: var(--text-2);
}
.kinds label:hover { color: var(--text); }
.kinds input { position: absolute; opacity: 0; pointer-events: none; }
.kinds label:has(input:checked) { border-color: var(--brand); background: var(--brand-dim); color: var(--text); }
.kinds label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.fit { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-2); }
.fit input { accent-color: var(--brand); width: 110px; }
.fit output { font-variant-numeric: tabular-nums; color: var(--text); font-weight: 600; min-width: 2ch; }
.filters select {
  font-size: 14px; padding: 8px 10px;
  background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg);
}

/* groups */
.group > h2 { font-size: 13.5px; font-weight: 500; color: var(--text-2); margin: 32px 0 8px; display: flex; gap: 8px; align-items: baseline; }
.group > h2 .count { color: var(--text-3); }
.group.urgent > h2 { color: var(--warn); }

/* rows */
.list { display: flex; flex-direction: column; }
.group { display: flex; flex-direction: column; gap: 8px; }
.row {
  display: grid; grid-template-columns: 88px minmax(0, 1fr) 150px; gap: 20px;
  padding: 18px 20px; background: var(--surface-1); border: 1px solid var(--border); border-radius: var(--radius-lg);
}
.row:hover { border-color: var(--surface-3); }
.clock { display: flex; flex-direction: column; align-items: flex-start; line-height: 1; padding-top: 2px; }
.clock .n { font: 600 40px/0.95 var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.03em; }
.clock .u { font-size: 12.5px; color: var(--text-2); margin-top: 8px; }
.row.soon .clock .n { color: var(--warn); }
.row.rolling .clock .n { font-size: 22px; line-height: 1.1; color: var(--text-2); letter-spacing: -.01em; }
.title { font-size: 16.5px; line-height: 1.35; font-weight: 600; margin: 0 0 3px; letter-spacing: -.01em; }
.title a { text-decoration: none; }
.title a:hover { color: var(--brand); }
[data-theme="light"] .title a:hover { color: var(--accent); }
.org { margin: 0; color: var(--text-2); font-size: 13.5px; }
.desc { margin: 8px 0 0; font-size: 14px; color: var(--text-2); max-width: 68ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.desc:empty { display: none; }
.topics { list-style: none; padding: 0; margin: 12px 0 0; display: flex; flex-wrap: wrap; gap: 6px; }
.topics li { font-size: 12px; font-weight: 500; padding: 3px 8px; border-radius: var(--radius-sm); background: var(--surface-2); color: var(--text-2); }
.topics li:first-child { background: var(--brand-dim); color: var(--text); }
.side { text-align: right; font-size: 14px; }
.fitbar { height: 4px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin: 8px 0 6px auto; width: 100%; }
.fitbar span { display: block; height: 100%; background: var(--brand); border-radius: 2px; }
.side .fitlabel { color: var(--text-2); margin: 0 0 12px; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.prize { font-weight: 600; margin: 0; font-variant-numeric: tabular-nums; }
.kind { color: var(--text-3); margin: 2px 0 0; text-transform: capitalize; font-size: 13px; }

.empty { padding: 48px 0; max-width: 46ch; }
.empty h2 { font-size: 18px; margin: 0 0 6px; }
.empty p { color: var(--text-2); margin: 0; }
.more {
  margin: 24px auto; font-weight: 600; font-size: 14px; padding: 10px 20px; border-radius: var(--radius-lg);
  border: 0; background: var(--brand); color: var(--on-brand); cursor: pointer;
}
.more:hover { background: var(--brand-hover); }

/* footer */
.foot { padding: 48px 16px 56px; color: var(--text-2); font-size: 13.5px; }
.foot p { max-width: 70ch; }
.foot a { color: var(--text); }
#health table { border-collapse: collapse; width: 100%; font-size: 13px; margin-top: 12px; }
#health td, #health th { text-align: left; padding: 6px 8px 6px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
#health th { color: var(--text-3); font-weight: 500; }
#health .bad { color: var(--danger); }

.loading .row { opacity: .5; }

@media (max-width: 720px) {
  .row { grid-template-columns: 60px minmax(0, 1fr); gap: 14px; padding: 16px; }
  .clock .n { font-size: 30px; }
  .row.rolling .clock .n { font-size: 17px; }
  .side { grid-column: 2; text-align: left; display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
  .fitbar { width: 72px; margin: 0; }
  .side .fitlabel { margin: 0; }
  .lede { font-size: 22px; }
  .brand span { display: none; }
  #health { overflow-x: auto; }
}
@media (prefers-reduced-motion: no-preference) {
  .fitbar span { transition: width .3s ease-out; }
  .row, .profiles button, .kinds label { transition: border-color .15s, background-color .15s, color .15s; }
}
