/* Same palette as the cauldron timer, so the tools feel like one site. */
:root {
  --bg: #0e1013;
  --panel: #171a20;
  --panel-2: #1f232b;
  --line: #2b313b;
  --text: #f3f5f8;
  --muted: #9aa4b2;
  --belt: #f4c430; /* set from the belt on screen */
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* ---------- sticky top: title and belt tabs ---------- */
.top {
  position: sticky; top: 0; z-index: 2;
  padding: max(0.5rem, env(safe-area-inset-top)) 1rem 0;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.title-row { display: flex; align-items: center; gap: 0.6rem; min-height: 2.75rem; }
.title-row .app { flex: none; margin: 0; font-size: 1.15rem; font-weight: 700; }
.link {
  flex: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  min-width: 2.75rem; min-height: 2.75rem; padding: 0 0.8rem;
  color: var(--text); text-decoration: none; font-size: 0.9rem; font-weight: 600;
  background: var(--panel); border: 1px solid var(--line); border-radius: 0.6rem;
}
.link svg { width: 1.1rem; height: 1.1rem; fill: currentColor; }
/* Phones: the home and Test Prep links are just their icons, so the search box gets the room. */
@media (max-width: 559px) {
  .link { padding: 0; }
  .link span { display: none; }
}
/* The narrowest phones drop the title too; the belt heading below says where you are. */
@media (max-width: 379px) {
  .title-row .app { display: none; }
}

.search { position: relative; flex: 1 1 auto; min-width: 0; display: flex; align-items: center; }
.search > svg { position: absolute; left: 0.7rem; width: 1.15rem; height: 1.15rem; fill: var(--muted); pointer-events: none; }
.search input {
  width: 100%; min-height: 2.75rem; padding: 0 2.6rem 0 2.3rem;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 0.6rem;
  font: inherit; font-size: 1rem; /* 16px or more, or iPhones zoom the page on focus */
}
.search input::placeholder { color: var(--muted); }
.search input::-webkit-search-cancel-button { display: none; }
.search input:focus-visible { outline: 2px solid var(--belt); outline-offset: 1px; }
.search .clear {
  position: absolute; right: 0.2rem;
  display: flex; align-items: center; justify-content: center;
  width: 2.4rem; height: 2.4rem; padding: 0;
  background: none; border: 0; border-radius: 0.5rem; color: var(--muted); cursor: pointer;
}
.search .clear[hidden] { display: none; }
.search .clear svg { width: 1.2rem; height: 1.2rem; fill: currentColor; }
.search .clear:focus-visible { outline: 2px solid var(--belt); }

/* Six belts don't fit a phone's width, so the tab row scrolls sideways on its own. */
.tabs {
  display: flex; gap: 0.4rem;
  margin: 0.4rem -1rem 0; padding: 0 1rem 0.6rem;
  overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none;
  display: inline-flex; align-items: center; gap: 0.45rem;
  min-height: 2.75rem; padding: 0 0.8rem;
  background: var(--panel); color: var(--muted);
  border: 1px solid var(--line); border-radius: 999px;
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.tab .swatch { width: 0.8rem; height: 0.8rem; border-radius: 50%; background: var(--belt); }
.tab .tab-count { font-size: 0.75rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.tab[aria-pressed="true"] { color: var(--text); background: var(--panel-2); border-color: var(--belt); }
.tab .tab-count.hits { color: var(--text); }
.tab.none { opacity: 0.45; } /* no matches on this belt */
.tab:focus-visible, .link:focus-visible { outline: 2px solid var(--belt); outline-offset: 2px; }

.warning {
  margin: 0.75rem 1rem 0; padding: 0.6rem 0.8rem; border-radius: 0.6rem;
  background: #3a2a12; color: #ffcf8a; font-size: 0.9rem;
}
.warning[hidden] { display: none; }

/* ---------- one belt ---------- */
main { max-width: 46rem; margin: 0 auto; padding: 1rem 1rem calc(3rem + env(safe-area-inset-bottom)); }

.belt-head h1 { margin: 0; font-size: clamp(1.6rem, 6vw, 2.2rem); line-height: 1.15; }
.bar { margin-top: 0.8rem; height: 0.6rem; background: var(--panel-2); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--belt); border-radius: 999px; }
.belt-head .total { margin: 0.4rem 0 0; color: var(--muted); font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.belt-actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.act {
  min-height: 2.75rem; padding: 0 1rem;
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 0.6rem;
  font: inherit; font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.act:disabled { opacity: 0.4; cursor: default; }
.act:focus-visible { outline: 2px solid var(--belt); outline-offset: 2px; }
.belt-actions { flex-wrap: wrap; }
.switch {
  display: inline-flex; align-items: center; gap: 0.55rem;
  min-height: 2.75rem; padding: 0 0.9rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 0.6rem;
  font-size: 0.9rem; font-weight: 600; cursor: pointer;
}
.switch input { width: 1.15rem; height: 1.15rem; margin: 0; accent-color: var(--belt); cursor: pointer; }
.switch:has(input:checked) { border-color: var(--belt); }
.switch:has(input:focus-visible) { outline: 2px solid var(--belt); outline-offset: 2px; }

/* With "unchecked only" on, whatever is checked while working stays in place but fades back. */
.unchecked-only .row.done { opacity: 0.4; }
.note { margin: 1rem 0 0; padding: 0.7rem 0.9rem; border-left: 3px solid var(--belt); background: var(--panel); color: var(--muted); font-size: 0.9rem; line-height: 1.45; }

.found { margin: 1.2rem 0 0; color: var(--muted); font-size: 0.95rem; }
.found[hidden], .sec[hidden], li[hidden] { display: none; }
mark { background: color-mix(in srgb, var(--belt) 38%, transparent); color: inherit; border-radius: 2px; }

.sec { margin-top: 1.6rem; }
.sec h2 {
  display: flex; align-items: baseline; justify-content: space-between; gap: 1rem;
  margin: 0 0 0.4rem; padding-bottom: 0.35rem; border-bottom: 1px solid var(--line);
  font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700;
}
.sec.complete h2 .count { color: var(--belt); }
.count { flex: none; font-size: 0.8rem; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; letter-spacing: 0; }

.items { list-style: none; margin: 0; padding: 0; }
/* Parts of a group sit indented under it, joined by a guide line. */
.items .items { margin-left: 0.7rem; padding-left: 0.9rem; border-left: 1px solid var(--line); }

.row {
  display: flex; align-items: flex-start; gap: 0.7rem;
  min-height: 2.75rem; padding: 0.55rem 0.2rem;
  cursor: pointer; line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}
.row input {
  flex: none; width: 1.3rem; height: 1.3rem; margin: 0.05rem 0 0;
  accent-color: var(--belt); cursor: pointer;
}
.row input:focus-visible { outline: 2px solid var(--belt); outline-offset: 2px; }
.row .lbl { flex: none; min-width: 1.4rem; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.row .txt { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.row.group .txt { font-weight: 650; }
.row .count { margin-top: 0.1rem; }
.row.done .txt, .row.done .lbl { color: var(--muted); }
@media (hover: hover) { .row:hover { background: var(--panel); border-radius: 0.5rem; } }
