:root {
  --bg: #f5f5f7; --card: #ffffff; --text: #1d1d1f; --muted: #6e6e73; --line: #d2d2d7;
  --accent: #0071e3; --accent-text: #ffffff; --owned: #e7f0fd; --owned-line: #0071e3;
  --good: #1a7f37; --chip: #e8e8ed; --focus: #0071e3;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #000; --card: #1c1c1e; --text: #f5f5f7; --muted: #98989d; --line: #38383a;
    --accent: #2997ff; --accent-text: #000; --owned: #0f2a47; --owned-line: #2997ff;
    --good: #3fb950; --chip: #2c2c2e; --focus: #2997ff; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", sans-serif; }
a { color: var(--accent); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.site { padding: 14px 0; }
.site a.brand { color: var(--text); text-decoration: none; font-weight: 700; font-size: 17px; letter-spacing: -0.01em; }
h1 { font-size: clamp(28px, 5vw, 40px); line-height: 1.1; letter-spacing: -0.02em; margin: 12px 0 8px; }
h2 { font-size: 22px; letter-spacing: -0.01em; margin: 32px 0 8px; }
h3 { font-size: 17px; margin: 20px 0 8px; }
.lede { font-size: 19px; color: var(--muted); margin: 0 0 20px; max-width: 42em; }
.card { background: var(--card); border-radius: 16px; padding: 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }

/* Buttons and controls */
button, .button { font: inherit; border: 0; border-radius: 10px; min-height: 44px; padding: 0 16px;
  background: var(--chip); color: var(--text); cursor: pointer; }
button.primary, .button.primary { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.button { display: inline-flex; align-items: center; text-decoration: none; }
input[type="search"], input[type="text"], select { font: inherit; min-height: 44px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 0 12px; }
label.check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; }
.controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.controls input[type="search"] { flex: 1 1 220px; }
.segmented { display: inline-flex; background: var(--chip); border-radius: 10px; padding: 2px; }
.segmented button { background: transparent; min-height: 40px; }
.segmented button[aria-pressed="true"] { background: var(--card); box-shadow: 0 1px 3px rgba(0,0,0,.12); font-weight: 600; }

/* Summary */
.summary { display: grid; gap: 10px; }
.bar { height: 10px; border-radius: 5px; background: var(--chip); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); width: 0; transition: width .2s; }
.count { font-size: 20px; font-weight: 700; }
.gens { display: flex; flex-wrap: wrap; gap: 6px; }
.gen-chip { font-size: 13px; background: var(--chip); border-radius: 8px; padding: 3px 8px; font-variant-numeric: tabular-nums; }
.gen-chip.done { color: var(--good); font-weight: 600; }

/* Tabs */
.tabs { display: flex; gap: 2px; overflow-x: auto; margin: 16px 0 0; border-bottom: 1px solid var(--line);
  scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { background: transparent; border-radius: 10px 10px 0 0; white-space: nowrap; color: var(--muted); padding: 0 12px; }
.tabs button[aria-selected="true"] { color: var(--text); font-weight: 600; box-shadow: inset 0 -3px 0 var(--accent); }
[role="tabpanel"] { padding-top: 8px; }

/* Checklist grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 6px; }
.tile { text-align: left; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 6px 8px; min-height: 56px; display: flex; flex-direction: column; justify-content: center; }
.tile .num { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tile .name { font-size: 14px; font-weight: 600; overflow-wrap: break-word; line-height: 1.2; }
.tile[aria-pressed="true"] { background: var(--owned); border-color: var(--owned-line); }
.tile[aria-pressed="true"] .num::after { content: " ✓"; color: var(--owned-line); font-weight: 700; }
.group-head { grid-column: 1 / -1; margin: 14px 0 2px; font-weight: 700; display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.group-head button { min-height: 32px; font-size: 13px; padding: 0 10px; font-weight: 400; }

/* Binder pages */
.pages { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.page { background: var(--card); border-radius: 12px; padding: 10px; }
.page h4 { margin: 0 0 8px; font-size: 14px; }
.pockets { display: grid; gap: 4px; grid-template-columns: repeat(var(--cols), 1fr); }
.pocket { aspect-ratio: 63 / 88; border: 1px dashed var(--line); border-radius: 6px; padding: 4px;
  font-size: 11px; line-height: 1.15; display: flex; flex-direction: column; justify-content: flex-end; overflow: hidden; }
.pocket.owned { background: var(--owned); border: 1px solid var(--owned-line); }
.pocket.empty { border-style: dotted; opacity: .5; }
.pocket.hit { outline: 3px solid var(--accent); }
.pocket b { font-variant-numeric: tabular-nums; }

/* Lists */
.missing-list { list-style: none; padding: 0; margin: 0; }
.missing-list li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 0; border-top: 1px solid var(--line); }
.missing-list li span.who { flex: 1 1 160px; }
.missing-list a { font-size: 14px; min-height: 44px; display: inline-flex; align-items: center; padding: 0 6px; }
details.gen { background: var(--card); border-radius: 12px; padding: 4px 14px; margin: 8px 0; }
details.gen summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; font-weight: 600; }
textarea.ranges { width: 100%; min-height: 90px; font: 14px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
  border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--text); padding: 10px; }
.disclosure { font-size: 13px; color: var(--muted); }
.status { margin: 6px 0 0; font-size: 14px; color: var(--good); }

/* Account */
.account { border-bottom: 1px solid var(--line); padding-bottom: 16px; margin-bottom: 8px; }
.account h3 { margin-top: 4px; }
.signin { display: grid; gap: 8px; max-width: 360px; margin: 12px 0; }
.signin a { display: flex; align-items: center; justify-content: center; min-height: 48px; border-radius: 10px;
  text-decoration: none; font-weight: 600; font-size: 17px; }
.signin a.apple { background: #000; color: #fff; }
.signin a.google { background: #fff; color: #1f1f1f; border: 1px solid #747775; }
@media (prefers-color-scheme: dark) { .signin a.apple { background: #fff; color: #000; } }
.sync-state { font-size: 14px; color: var(--muted); margin-left: 8px; }
.sync-state.ok { color: var(--good); }

/* Guide */
.guide { max-width: 46em; }
table { border-collapse: collapse; width: 100%; font-size: 15px; font-variant-numeric: tabular-nums; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); }
footer.site-foot { margin: 48px 0 24px; font-size: 13px; color: var(--muted); }
footer.site-foot a { color: var(--muted); }

/* Printing placeholders — real card size, nine to a page */
#print-root { display: none; }
@media print {
  body { background: #fff; color: #000; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { display: block; }
  .print-page { display: grid; grid-template-columns: repeat(3, 63mm); grid-auto-rows: 88mm;
    justify-content: center; break-after: page; }
  .print-page:last-child { break-after: auto; }
  .ph { border: 0.2mm dashed #999; padding: 5mm; display: flex; flex-direction: column; justify-content: center;
    align-items: center; text-align: center; font-family: -apple-system, "Helvetica Neue", Arial, sans-serif; color: #444; }
  .ph .n { font-size: 22pt; font-weight: 700; color: #bbb; }
  .ph .nm { font-size: 13pt; font-weight: 600; margin-top: 2mm; }
  .ph .g { font-size: 8pt; margin-top: 2mm; color: #888; }
}
