:root {
  color-scheme: light dark;
  --bg: #f7f7f5;
  --panel: #ffffff;
  --fg: #1f1f1d;
  --muted: #6b6a66;
  --line: #e4e3df;
  --accent: #2f6fdf;
  --muted-bar: #c9c7c1;
  --grid: #ecebe7;
  --warn: #b26a00;
  --bad: #c2362c;
  --c1: #2f6fdf; --c2: #d9822b; --c3: #2a9d6f; --c4: #8e5bd6; --c5: #c2362c;
  --radius: 10px;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161615; --panel: #1f1f1e; --fg: #ecebe7; --muted: #a09f99; --line: #34332f;
    --accent: #6c9cff; --muted-bar: #55534d; --grid: #2b2a27; --warn: #f0a442; --bad: #ff7b6e;
    --c1: #6c9cff; --c2: #f0a442; --c3: #4cc79a; --c4: #b48cff; --c5: #ff7b6e;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font-family: var(--sans); font-size: 15px; line-height: 1.45; }
a { color: inherit; }

.ct { max-width: 1280px; margin: 0 auto; padding: 28px 16px 48px; display: grid; gap: 20px; }
.ct-titlebar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; }
.ct-head h1 { font-family: var(--serif); font-weight: 400; font-size: 32px; margin: 0; }
.ct-asof { color: var(--muted); font-size: 13px; }
.ct-take { margin: 6px 0 0; color: var(--muted); max-width: 60rem; }

.ct-tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); }
.ct-tile, .ct-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; min-width: 0; }
.ct-tile .lbl { font-size: 12px; color: var(--muted); }
.ct-tile .num { font-family: var(--serif); font-size: 34px; font-variant-numeric: tabular-nums; margin-top: 4px; min-height: 1.2em; }
.ct-tile .sub { font-size: 12px; color: var(--muted); margin-top: 4px; }

.ct-section { font-size: 18px; font-weight: 600; margin: 12px 0 0; }
.ct-sectionbar { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 12px; }
.ct-filter { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.ct-filter select { font: inherit; color: var(--fg); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; }

.ct-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 26rem), 1fr)); }
.ct-card.wide { grid-column: 1 / -1; }
.ct-card h3 { font-size: 16px; font-weight: 600; margin: 0; }
.ct-card .note { font-size: 12px; color: var(--muted); margin: 4px 0 12px; }

.ct-tablebox { max-height: 28rem; overflow: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th { text-align: left; font-weight: 600; color: var(--muted); position: sticky; top: 0; background: var(--panel); padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.n, th.n { text-align: right; }
td.wrap { min-width: 12rem; overflow-wrap: anywhere; }
.who { color: var(--muted); font-size: 12px; margin-top: 2px; }
td.nowrap { white-space: nowrap; }
tr.us td { font-weight: 600; }
.tag { display: inline-block; padding: 0 6px; border: 1px solid var(--line); border-radius: 6px; white-space: nowrap; font-size: 12px; }
.tag.added { color: var(--c3); border-color: currentColor; }
.tag.removed { color: var(--bad); border-color: currentColor; }
.stars { color: var(--warn); white-space: nowrap; }
.empty { color: var(--muted); font-size: 13px; padding: 12px 0 4px; }

.ct-chart { position: relative; min-height: 200px; }
.ct-chart svg { display: block; }
.tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 16px rgba(0,0,0,.12); padding: 4px 8px; font-size: 12px; display: none; white-space: nowrap; }
.tip .d { color: var(--muted); }

.skeleton { display: inline-block; width: 6em; border-radius: 6px; background: var(--grid); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .5; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } }
.error { color: var(--bad); }

.ct-foot { color: var(--muted); font-size: 12px; margin-top: 8px; }

/* guide */
.guide-chip { margin-left: auto; font: inherit; font-size: 13px; font-weight: 600; color: #fff; background: var(--accent); border: 0; border-radius: 999px; padding: 6px 14px 6px 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 35%, transparent); }
.guide-chip span { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: rgba(255,255,255,.25); font-size: 12px; }
.guide-chip:hover { filter: brightness(1.08); }
.guide-chip:focus-visible { outline: 2px solid var(--fg); outline-offset: 2px; }
@media (prefers-color-scheme: dark) { .guide-chip { color: #10131a; } .guide-chip span { background: rgba(0,0,0,.18); } }
dialog.guide { width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 48px); padding: 0; border: 1px solid var(--line); border-radius: 14px; background: var(--panel); color: var(--fg); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog.guide::backdrop { background: rgba(0,0,0,.45); }
dialog.guide[open] { display: flex; flex-direction: column; }
.guide-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px 8px; }
.guide-head h2 { margin: 0; font-family: var(--serif); font-weight: 400; font-size: 26px; }
.guide-close { font: inherit; font-size: 16px; background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--fg); width: 32px; height: 32px; cursor: pointer; }
.guide-toc { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 20px 12px; border-bottom: 1px solid var(--line); }
.guide-toc a { font-size: 12px; text-decoration: none; padding: 2px 10px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.guide-body { overflow: auto; padding: 4px 20px 20px; font-size: 14px; }
.guide-body section { padding-top: 14px; }
.guide-body h3 { font-size: 16px; margin: 0 0 6px; }
.guide-body p, .guide-body li { margin: 6px 0; }
.guide-body ul { padding-left: 20px; margin: 6px 0; }
.guide-body table { margin: 8px 0; }
.guide-body code { font-size: 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
.guide-body .muted { color: var(--muted); font-size: 13px; }
.guide-body .kv { grid-template-columns: minmax(7rem, max-content) 1fr; gap: 8px 16px; }
.guide-body .kv dt { font-weight: 600; color: var(--fg); }
.flow { list-style: none; padding: 0; margin: 12px 0 4px; display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: 8px; counter-reset: step; }
.flow li { margin: 0; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); display: grid; gap: 2px; counter-increment: step; position: relative; }
.flow li b::before { content: counter(step) ". "; color: var(--accent); }
.flow li span { font-size: 12px; color: var(--muted); }
@media (max-width: 560px) { .guide-chip { margin-left: 0; } .guide-body .kv { grid-template-columns: 1fr; } .guide-body .kv dd { margin-bottom: 6px; } }

/* update feed */
.updates { display: grid; gap: 0; }
.update { display: grid; grid-template-columns: 6.5rem 1fr; gap: 4px 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.update:first-child { border-top: 0; padding-top: 0; }
.update .when { font-size: 12px; color: var(--muted); white-space: nowrap; }
.update .what { min-width: 0; }
.update .title { font-weight: 600; }
.update .app { color: var(--muted); font-weight: 400; }
.update .detail { font-size: 13px; color: var(--muted); margin-top: 2px; overflow-wrap: anywhere; }
.update .links { font-size: 13px; margin-top: 4px; display: flex; gap: 12px; flex-wrap: wrap; }
.update .links a { color: var(--accent); text-decoration: none; }
.update .links a:hover { text-decoration: underline; }
.type { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 6px; margin-right: 6px; vertical-align: 1px; border: 1px solid currentColor; }
.type.feature { color: var(--c3); }
.type.release { color: var(--c4); }
.type.pricing { color: var(--warn); }
.type.docs, .type.listing { color: var(--c1); }
.type.content, .type.platform { color: var(--muted); }
.type.review { color: var(--bad); }
.ct-bar-filters { display: flex; gap: 12px; flex-wrap: wrap; }
details.ct-card > summary { cursor: pointer; list-style: revert; }
@media (max-width: 560px) { .update { grid-template-columns: 1fr; } }

/* tabs */
.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; padding-top: 6px; }
.tabs button { font: inherit; font-size: 14px; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; padding: 8px 12px; cursor: pointer; margin-bottom: -1px; }
.tabs button[aria-selected="true"] { color: var(--fg); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.tabpanel { display: grid; gap: 16px; }
.tabpanel[hidden] { display: none; }

/* insights */
.insights { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.insights li { display: grid; grid-template-columns: 1.4rem 1fr; gap: 6px; font-size: 14px; }
.insights li::before { content: "→"; color: var(--accent); font-weight: 600; }
.insights b { font-weight: 600; }

/* feature matrix */
.matrix td.mark, .matrix th.mark { text-align: center; width: 1%; white-space: nowrap; }
.yes { color: var(--c3); font-weight: 700; }
.no { color: var(--muted); opacity: .5; }
tr.gap td { background: color-mix(in srgb, var(--warn) 9%, transparent); }
tr.grouprow td { font-weight: 600; color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; background: var(--bg); }
.toggle { font-size: 13px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }

/* plan cards */
.plans { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 17rem), 1fr)); }
.plan-app h4 { margin: 0 0 8px; font-size: 15px; }
.plan { border-top: 1px solid var(--line); padding: 10px 0; }
.plan:first-of-type { border-top: 0; padding-top: 0; }
.plan .pname { font-weight: 600; font-size: 13px; }
.plan .price { font-family: var(--serif); font-size: 24px; font-variant-numeric: tabular-nums; }
.plan .price small { font-family: var(--sans); font-size: 12px; color: var(--muted); }
.plan .meta { font-size: 12px; color: var(--muted); }
.plan ul { margin: 6px 0 0; padding-left: 18px; font-size: 12px; }
.plan li { margin: 2px 0; }

/* chips */
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 12px; padding: 1px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); }
.chip.edit { border-color: var(--warn); color: var(--warn); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13px; margin: 8px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.pos h4 { margin: 0; font-size: 16px; }
.pos .tagline { font-style: italic; margin: 6px 0 8px; }
.pos ul { margin: 4px 0 0; padding-left: 18px; font-size: 13px; }
.badge { display: inline-block; font-size: 11px; padding: 1px 6px; border-radius: 6px; background: color-mix(in srgb, var(--c3) 16%, transparent); color: var(--c3); margin-left: 6px; vertical-align: middle; }
.quote { font-size: 13px; border-left: 3px solid var(--line); padding-left: 10px; margin: 8px 0 0; color: var(--fg); }
.quote .who { margin-bottom: 2px; }

/* heat table + stacked bars */
.heat td.cell { text-align: center; font-variant-numeric: tabular-nums; }
.stack { display: flex; height: 18px; border-radius: 4px; overflow: hidden; min-width: 8rem; }
.stack span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 12px; color: var(--muted); margin-top: 8px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.bars .row { display: grid; grid-template-columns: minmax(7rem, 11rem) 1fr 2.5rem; gap: 8px; align-items: center; font-size: 13px; margin: 4px 0; }
.bars .bar { height: 14px; border-radius: 4px; background: var(--muted-bar); }
.bars .val { color: var(--muted); font-variant-numeric: tabular-nums; text-align: right; }
