/* Dark-first, GitHub-like palette. The sponsor uses its own amber palette in both modes. */
:root {
  --bg: #0d1117;
  --bg-2: #010409;
  --card: #0d1117;
  --card-hover: #161b22;
  --ink: #f0f6fc;
  --text: #c9d1d9;
  --muted: #8b949e;
  --line: #30363d;
  --line-soft: #21262d;
  --cell: #161b22;
  --green: #3fb950;
  --green-fill: #2ea043;
  --red: #f85149;
  --red-fill: #da3633;
  --blue: #58a6ff;
  --blue-line: #1f6feb;
  --purple: #bc8cff;
  --sp-bg: #f2b935;
  --sp-bg-2: #f7cd5e;
  --sp-ink: #2b1d00;
  --sp-ink-2: #5c4300;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei",
    "Noto Sans CJK SC", Roboto, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --bg: #ffffff;
    --bg-2: #f6f8fa;
    --card: #ffffff;
    --card-hover: #f6f8fa;
    --ink: #1f2328;
    --text: #1f2328;
    --muted: #59636e;
    --line: #d1d9e0;
    --line-soft: #e5e9ed;
    --cell: #eff2f5;
    --green: #1a7f37;
    --green-fill: #2da44e;
    --red: #cf222e;
    --red-fill: #e5534b;
    --blue: #0969da;
    --blue-line: #54aeff;
    --purple: #8250df;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.6 var(--font); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
.wrap { max-width: 780px; margin: 0 auto; padding: 0 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.muted { color: var(--muted); font-size: 13px; }

/* header */
.top { border-bottom: 1px solid var(--line-soft); background: color-mix(in srgb, var(--bg) 85%, transparent); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.top-in { display: flex; align-items: center; justify-content: space-between; height: 54px; }
.brand { font-weight: 700; color: var(--ink); text-decoration: none; display: flex; align-items: center; gap: 8px; letter-spacing: -0.01em; }
.logo { color: var(--green); }
.top-nav { display: flex; gap: 14px; align-items: center; font-size: 14px; }
.top-nav a { color: var(--muted); text-decoration: none; }
.top-nav a:hover { color: var(--ink); }
.top-nav .lang { border: 1px solid var(--line); border-radius: 999px; padding: 1px 10px; font-family: var(--mono); font-size: 12px; color: var(--text); }

/* hero */
.hero { padding: 28px 0 4px; }
.hero h1 { color: var(--ink); font-size: clamp(26px, 6vw, 40px); line-height: 1.15; letter-spacing: -0.025em; margin: 0 0 10px; text-wrap: balance; }
.h1-sub { display: block; font-size: 0.5em; font-weight: 600; color: var(--text); margin-top: 8px; letter-spacing: -0.01em; }
.lead { color: var(--muted); margin: 0 0 14px; max-width: 64ch; }
.eyebrow { font: 12px var(--mono); color: var(--muted); margin: 0 0 6px; display: flex; align-items: center; gap: 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 25%, transparent); }
.crumbs { margin: 18px 0 0; font-size: 14px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--blue); }

.stats { display: flex; flex-wrap: wrap; gap: 6px 18px; font: 13px var(--mono); color: var(--muted); margin: 6px 0 0; }
.stats b { color: var(--ink); font-size: 15px; }
.stats b.ok { color: var(--green); }
.stats b.bad { color: var(--red); }

/* 28-day contribution grid */
.days { display: grid; grid-template-columns: repeat(14, 1fr); gap: 4px; margin: 18px 0 6px; max-width: 520px; }
@media (max-width: 520px) { .days { gap: 3px; } .d { font-size: 9px; border-radius: 3px; } }
.d { aspect-ratio: 1; display: grid; place-items: center; border-radius: 4px; font: 600 11px var(--mono); text-decoration: none; background: var(--cell); border: 1px solid var(--line-soft); color: var(--muted); }
.d.shipped { background: var(--green-fill); border-color: var(--green-fill); color: #fff; }
.d.reset { background: var(--red-fill); border-color: var(--red-fill); color: #fff; }
.d { position: relative; }
.d.has-reset::after { content: ''; position: absolute; top: 2px; right: 2px; width: 5px; height: 5px; border-radius: 50%; background: var(--red-fill); box-shadow: 0 0 0 1px var(--bg); }
.d.today { border: 1px dashed var(--green); color: var(--green); background: transparent; }
.d.missing { color: var(--muted); }
.d.future { opacity: 0.4; }
.d.active { outline: 2px solid var(--ink); outline-offset: 2px; }
a.d:hover { filter: brightness(1.15); }

/* tabs */
.board-head { position: sticky; top: 54px; z-index: 5; background: var(--bg); padding: 12px 0 8px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tab { border: 1px solid var(--line); background: transparent; border-radius: 999px; padding: 4px 14px; font-size: 14px; cursor: pointer; white-space: nowrap; color: var(--muted); }
.tab:hover { color: var(--ink); }
.tab.on { background: var(--ink); color: var(--bg); border-color: var(--ink); font-weight: 600; }

/* cards (commit style) */
.list { display: flex; flex-direction: column; gap: 10px; margin: 6px 0 28px; }
.card { display: flex; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px 12px 6px; scroll-margin-top: 120px; transition: background 0.15s; }
.card:hover { background: var(--card-hover); }
.card:target { border-color: var(--blue-line); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue-line) 30%, transparent); }
.vote { display: flex; flex-direction: column; align-items: center; min-width: 44px; }
.vb { width: 40px; height: 34px; border: 0; background: transparent; border-radius: 8px; cursor: pointer; color: var(--muted); font-size: 14px; line-height: 1; touch-action: manipulation; }
.vb:hover { background: var(--cell); color: var(--ink); }
.vb.up.on { color: var(--green); background: color-mix(in srgb, var(--green) 15%, transparent); }
.vb.down.on { color: var(--red); background: color-mix(in srgb, var(--red) 15%, transparent); }
.vb:active { transform: scale(0.9); }
.net { font: 700 14px var(--mono); color: var(--ink); }
.cbody { flex: 1; min-width: 0; padding-top: 2px; }
.meta { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; font-size: 12px; color: var(--muted); }
.day { font-weight: 600; color: var(--text); text-decoration: none; }
.day:hover { color: var(--blue); }
.meta time { font-family: var(--mono); }
.type { border: 1px solid var(--line); border-radius: 999px; padding: 0 8px; font-size: 11px; line-height: 18px; }
.t-feature { color: var(--green); border-color: color-mix(in srgb, var(--green) 50%, transparent); }
.t-model { color: var(--blue); border-color: color-mix(in srgb, var(--blue) 50%, transparent); }
.t-limits { color: var(--purple); border-color: color-mix(in srgb, var(--purple) 50%, transparent); }
.t-reset { color: var(--red); border-color: color-mix(in srgb, var(--red) 50%, transparent); }
.ctitle { color: var(--ink); font-size: 16px; line-height: 1.4; margin: 5px 0 3px; font-weight: 600; letter-spacing: -0.005em; }
.csum { margin: 0 0 6px; color: var(--muted); font-size: 14px; }
.cfoot { display: flex; align-items: center; gap: 10px; font-size: 12px; color: var(--muted); }
.counts { font-family: var(--mono); }
.counts .plus { color: var(--green); }
.counts .minus { color: var(--red); margin-left: 4px; }
.counts .pct { margin-left: 6px; }
.src { margin-left: auto; text-decoration: none; }
.src:hover { color: var(--blue); }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }

/* ---------- sponsor: deliberately loud and different ---------- */
.sponsor {
  display: flex; gap: 18px; align-items: center;
  background: linear-gradient(135deg, var(--sp-bg-2), var(--sp-bg) 55%);
  color: var(--sp-ink); border-radius: 14px; padding: 16px 18px;
  box-shadow: 0 6px 24px -8px color-mix(in srgb, var(--sp-bg) 60%, transparent);
}
.sp-text { flex: 1; min-width: 0; }
.sp-tag { margin: 0; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; color: var(--sp-ink-2); }
.sp-title { margin: 2px 0 2px; font-size: 19px; font-weight: 800; line-height: 1.3; letter-spacing: -0.01em; }
.sp-sub { margin: 0 0 8px; font-size: 13px; color: var(--sp-ink-2); }
.sp-from { margin: 0 0 10px; font-size: 14px; }
.sp-from b { font-size: 22px; font-weight: 800; }
.sp-plans { display: none; list-style: none; padding: 0; margin: 0 0 12px; font: 13px var(--mono); max-width: 280px; }
.sp-plans li { display: flex; justify-content: space-between; padding: 3px 0; border-bottom: 1px dashed color-mix(in srgb, var(--sp-ink) 25%, transparent); }
.sp-plans li:last-child { border-bottom: 0; }
.sp-plans b { font-weight: 800; }
.sp-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0; }
.sp-btn { display: inline-flex; align-items: center; background: var(--sp-ink); color: var(--sp-bg); text-decoration: none; font-weight: 800; border-radius: 999px; padding: 8px 18px; font-size: 15px; white-space: nowrap; }
.sp-btn:hover { filter: brightness(1.3); }
.sp-btn-lg { padding: 12px 28px; font-size: 16px; width: 100%; justify-content: center; }
.sp-code { font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.sp-code code { font: 700 13px var(--mono); border: 1.5px dashed currentColor; border-radius: 6px; padding: 1px 7px; letter-spacing: 0.05em; }
.sp-code button { border: 0; background: none; cursor: pointer; padding: 0; font-size: 13px; text-decoration: underline; text-underline-offset: 3px; color: inherit; }
.sp-qr { display: none; flex-direction: column; align-items: center; gap: 4px; text-decoration: none; font-size: 12px; font-weight: 700; }
.sp-qr img { width: 120px; height: 120px; background: #fff; border-radius: 10px; padding: 6px; }
@media (min-width: 640px) {
  .sp-plans { display: block; }
  .sp-from { display: none; }
  .sp-qr { display: flex; }
}

/* mobile bottom bar (sponsor, always visible) */
.sbar { display: none; }
@media (max-width: 760px) {
  body.has-bar { padding-bottom: calc(64px + env(safe-area-inset-bottom)); }
  .sbar {
    display: flex; align-items: center; gap: 10px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    background: var(--sp-bg); color: var(--sp-ink);
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    font-size: 14px; line-height: 1.3; font-weight: 700;
    box-shadow: 0 -6px 20px -6px rgb(0 0 0 / 0.35);
  }
  .sbar-text { flex: 1; min-width: 0; }
  .sbar-tag { font-size: 10px; font-weight: 700; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; margin-right: 6px; vertical-align: 1px; opacity: 0.75; }
  .sbar .sp-btn { padding: 7px 16px; font-size: 14px; }
}

/* hub feature box */
.feature { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin: 16px 0; background: var(--bg-2); }
.feature h2 { margin: 0 0 6px; font-size: 22px; letter-spacing: -0.015em; color: var(--ink); }
.feature h2 a { text-decoration: none; }
.feature p { color: var(--muted); margin: 0 0 10px; }
.btn { display: inline-flex; align-items: center; background: var(--green-fill); color: #fff; text-decoration: none; font-weight: 600; border-radius: 8px; padding: 7px 16px; font-size: 14px; margin-top: 12px; }
.btn:hover { filter: brightness(1.1); }

/* day nav */
.daynav { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; margin: 0 0 28px; }
.daynav a { color: var(--muted); text-decoration: none; }
.daynav a:hover { color: var(--blue); }

/* faq */
.faq { margin: 8px 0 32px; }
.faq h2 { font-size: 18px; color: var(--ink); }
.faq details { border-top: 1px solid var(--line-soft); padding: 12px 0; }
.faq summary { cursor: pointer; font-weight: 600; color: var(--ink); }
.faq p { color: var(--muted); margin: 8px 0 0; font-size: 15px; }

/* deal page */
.deal { padding: 24px 0 32px; }
.deal-hero { background: linear-gradient(135deg, var(--sp-bg-2), var(--sp-bg) 55%); color: var(--sp-ink); border-radius: 16px; padding: 22px 20px; margin-bottom: 12px; }
.deal-hero h1 { font-size: clamp(26px, 6vw, 36px); line-height: 1.2; margin: 6px 0 12px; letter-spacing: -0.02em; font-weight: 800; }
.points { display: flex; flex-wrap: wrap; gap: 8px; padding: 0; list-style: none; margin: 0; }
.points li { background: var(--sp-ink); color: var(--sp-bg); padding: 3px 12px; border-radius: 999px; font-size: 13px; font-weight: 700; }
.deal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 12px; }
@media (max-width: 600px) { .deal-grid { grid-template-columns: 1fr; } .deal-qr { order: -1; } }
.deal-box { border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; background: var(--bg-2); }
.deal-box h2 { font-size: 13px; color: var(--muted); margin: 0 0 6px; font-weight: 600; font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.06em; }
.plans { list-style: none; padding: 0; margin: 0 0 8px; }
.plans li { display: flex; justify-content: space-between; padding: 12px 0; border-bottom: 1px solid var(--line-soft); font-size: 16px; color: var(--ink); }
.plans li:last-child { border-bottom: 0; }
.plans b { font: 700 18px var(--mono); }
.deal-qr { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.deal-qr img { width: 180px; height: 180px; border-radius: 12px; background: #fff; padding: 8px; }
.deal-qr p { margin: 4px 0; }
.deal-scan { font-weight: 700; color: var(--ink); font-size: 17px; }
.deal-qr .sp-code { color: var(--ink); }
.deal-qr .sp-btn { margin-top: 8px; background: var(--sp-bg); color: var(--sp-ink); }

/* footer */
.foot { border-top: 1px solid var(--line-soft); padding: 18px 16px 28px; font-size: 12px; color: var(--muted); }
.foot p { margin: 4px 0; }

/* toast */
.toast {
  position: fixed; left: 50%; bottom: calc(80px + env(safe-area-inset-bottom)); transform: translate(-50%, 16px);
  background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 30;
  width: max-content; max-width: calc(100% - 32px); display: flex; gap: 10px; align-items: center;
  box-shadow: 0 10px 30px rgb(0 0 0 / 0.35);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.toast a { background: var(--sp-bg); color: var(--sp-ink); font-weight: 800; white-space: nowrap; text-decoration: none; padding: 3px 10px; border-radius: 999px; }
.toast .tag { font-size: 10px; font-weight: 700; border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; opacity: 0.7; }
@media (min-width: 761px) { .toast { bottom: 24px; } }

.ts-box { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 40; }

.langbar { background: var(--bg-2); border-bottom: 1px solid var(--line-soft); text-align: center; font-size: 13px; padding: 6px 16px; }
.langbar a { color: var(--blue); font-weight: 600; }
.langbar button { border: 0; background: none; cursor: pointer; margin-left: 8px; color: var(--muted); }
