/* Team 8 · Step Challenge — styles */

:root {
  color-scheme: light;
  --bg: #f3f5fa;
  --surface: #ffffff;
  --surface-2: #f1f3f8;
  --surface-3: #e5e9f2;
  --ink: #0e1222;
  --ink-2: #4a5068;
  --muted: #767c93;
  --hair: #e3e6ef;
  --axis: #c3c8d7;
  --ring-track: #e6e9f2;
  --brand: #1650d0;
  --brand-text: #1650d0;
  --brand-soft: rgba(22, 80, 208, 0.07);
  --brand-soft-strong: rgba(22, 80, 208, 0.16);
  --good: #0ca30c;
  --good-ink: #067a06;
  --warn: #b97800;
  --danger: #d03b3b;
  /* chart roles (validated: blue/orange pass CVD + contrast in both modes) */
  --series-1: #2a78d6;
  --series-emph: #eb6834;
  --context: #8d93a8;
  --pace: #8d93a8;
  --h1: #cde2fb; --h2: #9ec5f4; --h3: #6da7ec; --h4: #3987e5; --h5: #1c5cab; --h6: #0d366b;
  --heat-dot: #ffffff;
  --tip-bg: #0e1222;
  --tip-ink: #ffffff;
  --tip-muted: #b9bfd3;
  --nav-bg: rgba(255, 255, 255, 0.84);
  --shadow: 0 1px 2px rgba(16, 24, 48, 0.04), 0 8px 24px rgba(16, 24, 48, 0.06);
  --radius: 22px;
  --grad: linear-gradient(135deg, #0f2f86 0%, #1650d0 36%, #0a9fe0 70%, #12c990 100%);
  --grad-btn: linear-gradient(135deg, #1650d0, #0a8fe0);
  --badge-bg: linear-gradient(160deg, #fff6d9, #ffe9f1);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0f1a; --surface: #151a28; --surface-2: #1c2233; --surface-3: #262d42;
    --ink: #f2f4fa; --ink-2: #b7bdd0; --muted: #868da4; --hair: #252c3f; --axis: #3a4359; --ring-track: #262d42;
    --brand-text: #7aa7ff; --brand-soft: rgba(122, 167, 255, 0.08); --brand-soft-strong: rgba(122, 167, 255, 0.2);
    --good-ink: #3fcf55; --warn: #f0b429;
    --series-1: #3987e5; --series-emph: #d95926; --context: #8a91a8; --pace: #8a91a8;
    --h1: #0d366b; --h2: #184f95; --h3: #256abf; --h4: #3987e5; --h5: #6da7ec; --h6: #b7d3f6;
    --heat-dot: #0b0f1a;
    --tip-bg: #eef1f8; --tip-ink: #0e1222; --tip-muted: #4a5068;
    --nav-bg: rgba(21, 26, 40, 0.84);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --badge-bg: linear-gradient(160deg, rgba(255, 197, 61, 0.16), rgba(214, 81, 127, 0.14));
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0f1a; --surface: #151a28; --surface-2: #1c2233; --surface-3: #262d42;
  --ink: #f2f4fa; --ink-2: #b7bdd0; --muted: #868da4; --hair: #252c3f; --axis: #3a4359; --ring-track: #262d42;
  --brand-text: #7aa7ff; --brand-soft: rgba(122, 167, 255, 0.08); --brand-soft-strong: rgba(122, 167, 255, 0.2);
  --good-ink: #3fcf55; --warn: #f0b429;
  --series-1: #3987e5; --series-emph: #d95926; --context: #8a91a8; --pace: #8a91a8;
  --h1: #0d366b; --h2: #184f95; --h3: #256abf; --h4: #3987e5; --h5: #6da7ec; --h6: #b7d3f6;
  --heat-dot: #0b0f1a;
  --tip-bg: #eef1f8; --tip-ink: #0e1222; --tip-muted: #4a5068;
  --nav-bg: rgba(21, 26, 40, 0.84);
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --badge-bg: linear-gradient(160deg, rgba(255, 197, 61, 0.16), rgba(214, 81, 127, 0.14));
}

/* ── Base ── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; background: var(--bg); }
body {
  font: 15px/1.45 var(--font); background: var(--bg); color: var(--ink);
  min-height: 100vh; min-height: 100dvh; -webkit-tap-highlight-color: transparent; overflow-x: hidden;
}
body.no-scroll { overflow: hidden; }
body.booting #view { opacity: 0; }
button { font: inherit; color: inherit; }
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; letter-spacing: -0.01em; }
code { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
:focus-visible { outline: 2px solid var(--brand-text); outline-offset: 2px; border-radius: 6px; }
.ic { flex: none; }
.muted { color: var(--muted); }
.sm { font-size: 12.5px; }
.center { text-align: center; }
.link { color: var(--brand-text); font-weight: 650; text-decoration: none; }

/* ── Top bar ── */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 10px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 84%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand img { width: 36px; height: 36px; border-radius: 11px; box-shadow: 0 4px 12px -4px rgba(22, 80, 208, 0.6); }
.brand b { display: block; font-size: 17px; font-weight: 850; letter-spacing: -0.02em; }
.brand small { display: block; font-size: 12px; color: var(--muted); font-weight: 650; margin-top: -2px; }
.top-right { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.day-chip { font-size: 12px; font-weight: 750; padding: 7px 11px; border-radius: 999px; background: var(--surface); box-shadow: var(--shadow); white-space: nowrap; }
.day-chip:empty { display: none; }
.icon-btn {
  width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none;
  background: var(--surface); color: var(--ink-2); border: 0; box-shadow: var(--shadow); cursor: pointer;
}
#refresh-btn.spin svg { animation: spin 0.9s linear infinite; }
#refresh-btn.offline { color: var(--warn); }
#settings-btn.on { color: var(--brand-text); box-shadow: 0 0 0 2px var(--brand-soft-strong), var(--shadow); }
@media (max-width: 359px) { .brand small { display: none; } }

/* ── Layout ── */
#view {
  max-width: 640px; margin: 0 auto; display: grid; gap: 14px;
  padding: 4px 16px calc(116px + env(safe-area-inset-bottom)); transition: opacity 0.2s;
}
#view > * { min-width: 0; animation: rise 0.45s both; }
#view > *:nth-child(2) { animation-delay: 0.04s; } #view > *:nth-child(3) { animation-delay: 0.08s; }
#view > *:nth-child(4) { animation-delay: 0.12s; } #view > *:nth-child(5) { animation-delay: 0.16s; }
@media (min-width: 1000px) {
  #view { max-width: 1120px; grid-template-columns: 1fr 1fr; align-items: start; gap: 16px; }
  #view > .hero, #view > .banner, #view > .page-h, #view > .kpis, #view > .chips-scroll, #view > .podium,
  #view > .board, #view > .hof, #view > .stat-grid, #view > .foot-note, #view > .wide, #view > .empty { grid-column: 1 / -1; }
}

/* ── Cards ── */
.card { background: var(--surface); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); border: 1px solid var(--hair); }
.card-h { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.card-h h2 { font-size: 17px; font-weight: 800; }
.card-sub { font-size: 13px; color: var(--muted); margin-top: 2px; }
.card-foot { display: flex; justify-content: flex-end; margin-top: 4px; }
.muted-card { opacity: 0.85; }
.mini-h { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); margin: 16px 0 8px; }
.mini-h b { color: var(--ink); }
.foot-note { font-size: 12px; color: var(--muted); text-align: center; padding: 4px 8px; }

/* ── Buttons & controls ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 14px;
  padding: 12px 16px; font-weight: 750; font-size: 15px; color: #fff; background: var(--grad-btn);
  box-shadow: 0 6px 16px -6px rgba(22, 80, 208, 0.55); cursor: pointer; text-decoration: none;
  transition: transform 0.1s, opacity 0.2s; white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 11px; }
.btn.lg { padding: 15px 22px; font-size: 16px; }
.btn.full { width: 100%; }
.btn.ghost { background: var(--surface-2); color: var(--ink); box-shadow: none; }
.btn.busy, .btn:disabled { opacity: 0.55; pointer-events: none; }
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }
.btn-row > * { flex: 1 1 auto; }
.btn-row.wrap { flex-wrap: wrap; }
.link-btn { background: none; border: 0; color: var(--brand-text); font-size: 13px; font-weight: 700; display: inline-flex; gap: 6px; align-items: center; cursor: pointer; padding: 6px 0; }
.seg { display: inline-flex; background: var(--surface-2); padding: 3px; border-radius: 12px; gap: 2px; flex: none; }
.seg button { border: 0; background: transparent; color: var(--ink-2); font-size: 13px; font-weight: 700; padding: 6px 11px; border-radius: 9px; cursor: pointer; white-space: nowrap; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.chips-scroll { overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 2px 16px; }
.chips-scroll::-webkit-scrollbar { display: none; }
.chip { border: 1px solid var(--hair); background: var(--surface-2); color: var(--ink); font-size: 14px; font-weight: 700; padding: 8px 14px; border-radius: 999px; cursor: pointer; }
.chip.on { background: var(--brand); color: #fff; border-color: transparent; }
.chip.select { position: relative; display: inline-flex; align-items: center; }
.chip.select select { position: absolute; inset: 0; opacity: 0; cursor: pointer; font-size: 16px; }
.tag { display: inline-block; font-size: 12px; font-weight: 750; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); margin: 4px 6px 0 0; }
.bar { height: 8px; border-radius: 999px; background: var(--ring-track); overflow: hidden; margin-top: 8px; }
.bar i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--series-1), #12c990); }
.bar.thin { height: 5px; width: 72%; margin: 6px auto 0; }
input, select {
  font: inherit; font-size: 16px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--hair);
  background: var(--surface-2); color: var(--ink); width: 100%; min-width: 0;
}

/* ── Banners ── */
.banner {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 18px; width: 100%;
  background: var(--surface); box-shadow: var(--shadow); border: 1px solid var(--hair); font-size: 13.5px; text-align: left;
}
.banner > span:not(.banner-emoji) { flex: 1; min-width: 0; }
.banner-emoji { font-size: 26px; flex: none; }
.banner .btn { flex: none; }
.banner .icon-btn { box-shadow: none; background: transparent; width: 32px; height: 32px; }
.banner.demo { padding: 9px 14px; background: #fff7e6; border-color: #ffe0a3; color: #5e4300; }
.banner.warn { background: #fff4e5; border-color: #ffd8a8; color: #7a4a00; }
.banner.join { cursor: pointer; background: linear-gradient(135deg, #fff1ea, #fbe9ff); border-color: #f5d4f0; color: #3b1d4a; }
:root[data-theme="dark"] .banner.demo, :root[data-theme="dark"] .banner.warn { background: #2a2312; border-color: #4a3a12; color: #f6d58e; }
:root[data-theme="dark"] .banner.join { background: linear-gradient(135deg, #2a1d33, #1d2240); border-color: #3a2d4f; color: #f0e2ff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .banner.demo, :root:not([data-theme="light"]) .banner.warn { background: #2a2312; border-color: #4a3a12; color: #f6d58e; }
  :root:not([data-theme="light"]) .banner.join { background: linear-gradient(135deg, #2a1d33, #1d2240); border-color: #3a2d4f; color: #f0e2ff; }
}

/* ── Hero ── */
.hero {
  position: relative; overflow: hidden; isolation: isolate; border-radius: 28px; padding: 18px; color: #fff;
  background: var(--grad); box-shadow: 0 20px 40px -20px rgba(22, 80, 208, 0.7);
}
.hero::before, .hero::after { content: ""; position: absolute; border-radius: 50%; z-index: -1; background: rgba(255, 255, 255, 0.1); }
.hero::before { width: 260px; height: 260px; right: -80px; top: -110px; }
.hero::after { width: 180px; height: 180px; left: -60px; bottom: -90px; background: rgba(255, 255, 255, 0.07); }
.hero-top { display: flex; gap: 8px; flex-wrap: wrap; }
.pill { font-size: 12px; font-weight: 750; padding: 5px 10px; border-radius: 999px; background: rgba(255, 255, 255, 0.2); }
.pill.ghost { background: transparent; border: 1px solid rgba(255, 255, 255, 0.4); }
.hero-main { display: flex; align-items: center; gap: 16px; margin: 16px 0 14px; }
.hero-stats { flex: 1; min-width: 0; order: -1; }
.hero-ring { position: relative; flex: none; width: 112px; height: 112px; }
.hero-ring svg { width: 100%; height: 100%; }
.ring-center { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; line-height: 1.1; }
.hero-ring .ring-center b { font-size: 24px; font-weight: 850; }
.hero-ring .ring-center small { font-size: 11px; opacity: 0.85; }
.hero-label { display: block; font-size: 12px; font-weight: 750; opacity: 0.85; text-transform: uppercase; letter-spacing: 0.08em; }
.hero-num { display: block; font-size: clamp(32px, 9vw, 54px); font-weight: 850; letter-spacing: -0.035em; line-height: 1.05; margin: 2px 0 4px; }
.hero-sub { display: block; font-size: 12.5px; opacity: 0.88; }
.hero-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-glass { font-size: 12.5px; padding: 6px 9px; border-radius: 11px; background: rgba(255, 255, 255, 0.16); white-space: nowrap; }
.hero-foot { margin-top: 12px; font-size: 13.5px; font-weight: 650; background: rgba(4, 16, 48, 0.2); padding: 10px 12px; border-radius: 14px; }
@media (min-width: 1000px) { .hero { padding: 24px 28px; } .hero-ring { width: 140px; height: 140px; } .hero-ring .ring-center b { font-size: 30px; } }

/* ── Rings ── */
.ring-track { stroke: var(--ring-track); }
.ring-fill { stroke: var(--series-1); animation: ring-in 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.ring.done .ring-fill { stroke: var(--good); }
.ring.on-dark .ring-track { stroke: rgba(255, 255, 255, 0.24); }
.ring.on-dark .ring-fill { stroke: #fff; }

/* ── Avatars ── */
.avatar {
  --s: 40px; position: relative; width: var(--s); height: var(--s); border-radius: 50%; flex: none;
  display: inline-grid; place-items: center; color: #fff; font-weight: 800; font-size: calc(var(--s) * 0.36);
  background: linear-gradient(140deg, color-mix(in srgb, var(--av) 70%, #fff), var(--av));
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12); letter-spacing: 0.02em;
}
.av-flag { position: absolute; right: -3px; bottom: -3px; font-size: calc(var(--s) * 0.34); line-height: 1; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.3)); }
.avatar.pic { background: color-mix(in srgb, var(--av, var(--brand)) 20%, var(--surface)); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--av, var(--brand)) 22%, transparent); }
.avatar.pic > img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.av-cc { position: absolute; right: -5px; bottom: -3px; font-size: max(8px, calc(var(--s) * 0.19)); font-weight: 800; line-height: 1; letter-spacing: 0.02em; padding: 2px 3px; border-radius: 5px; background: var(--surface); color: var(--ink-2); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2); }

/* ── Today (team) ── */
.mates { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px 4px; }
.mate { display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; padding: 6px 2px; border-radius: 16px; cursor: pointer; min-width: 0; }
.mate:hover { background: var(--surface-2); }
.mate-ring { position: relative; width: 70px; height: 70px; display: grid; place-items: center; }
.mate-ring svg { position: absolute; inset: 0; }
.mate-name { font-size: 13px; font-weight: 750; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mate-steps { font-size: 12.5px; color: var(--ink-2); font-weight: 650; }
.mate.me .mate-name { color: var(--brand-text); }
.mate.idle .avatar { filter: grayscale(0.7); opacity: 0.6; }
.mate.idle .mate-steps { color: var(--muted); font-weight: 500; }
@media (min-width: 1000px) { #view > section:has(.mates) { grid-column: 1 / -1; } .mates { grid-template-columns: repeat(9, 1fr); } }

/* ── KPI tiles ── */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (min-width: 1000px) { .kpis { grid-template-columns: repeat(4, 1fr); } }
.kpi { background: var(--surface); border: 1px solid var(--hair); box-shadow: var(--shadow); border-radius: 20px; padding: 14px; display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.kpi-ic { font-size: 19px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); margin-bottom: 6px; }
.kpi-label { font-size: 12.5px; color: var(--muted); font-weight: 700; }
.kpi-value { font-size: 21px; font-weight: 850; letter-spacing: -0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kpi-sub { font-size: 12.5px; color: var(--ink-2); }

/* ── Charts ── */
.chart { position: relative; width: 100%; min-height: 40px; touch-action: pan-y; border-radius: 8px; }
.chart:focus { outline: none; }
.chart:focus-visible { box-shadow: 0 0 0 2px var(--brand-text); }
.chart svg { display: block; width: 100%; height: auto; overflow: visible; user-select: none; -webkit-user-select: none; }
.grid { stroke: var(--hair); stroke-width: 1; }
.axis { stroke: var(--axis); stroke-width: 1; }
.tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.tick.strong { fill: var(--ink); font-weight: 750; }
.bar { fill: var(--series-1); transition: opacity 0.15s; }
.bar.emph { fill: var(--series-emph); }
svg.hovering .bar:not(.on) { opacity: 0.42; }
.future-dot { fill: var(--axis); }
.goal { stroke: var(--ink-2); stroke-width: 1.25; stroke-dasharray: 4 4; opacity: 0.75; }
.goal-label { fill: var(--ink-2); font-size: 11px; font-weight: 750; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.val-label { fill: var(--ink); font-size: 11.5px; font-weight: 800; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; }
.series-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-line.k-series { stroke: var(--series-1); }
.series-line.k-context { stroke: var(--context); }
.series-line.k-pace { stroke: var(--pace); stroke-dasharray: 5 4; }
.area.k-series { fill: var(--series-1); opacity: 0.1; }
.end-dot, .xhair-dot { stroke: var(--surface); stroke-width: 2; }
.end-dot.k-series, .xhair-dot.k-series { fill: var(--series-1); }
.xhair-dot.k-pace { fill: var(--pace); }
.xhair-line { stroke: var(--axis); stroke-width: 1; }
.hit { fill: transparent; cursor: crosshair; }
.hc-1 { fill: var(--h1); } .hc-2 { fill: var(--h2); } .hc-3 { fill: var(--h3); }
.hc-4 { fill: var(--h4); } .hc-5 { fill: var(--h5); } .hc-6 { fill: var(--h6); }
.hc-n { fill: var(--surface); stroke: var(--axis); stroke-width: 1; }
.hc-f { fill: var(--surface-2); }
.hc { cursor: pointer; }
.hc.on { stroke: var(--ink); stroke-width: 1.5; }
.hc-dot { fill: var(--heat-dot); pointer-events: none; }
.me-band { fill: var(--brand-soft-strong); opacity: 0.6; }
.hm-member { cursor: pointer; }
.hm-ini { fill: #fff; font-size: 9.5px; font-weight: 800; pointer-events: none; }
.hm-name { fill: var(--ink-2); font-size: 12.5px; font-weight: 700; }
.mini-bar { fill: var(--axis); }
.mini-bar.hit-goal { fill: var(--series-1); }
.mini-goal { stroke: var(--hair); stroke-width: 1; }

.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 10px; font-size: 12px; color: var(--ink-2); align-items: center; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg-box { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-box.k-series { background: var(--series-1); }
.lg-box.k-emph { background: var(--series-emph); }
.lg-line { width: 16px; height: 2px; border-radius: 2px; display: inline-block; }
.lg-line.k-series { background: var(--series-1); }
.lg-line.k-context { background: var(--context); }
.lg-line.k-pace { background: repeating-linear-gradient(90deg, var(--pace) 0 5px, transparent 5px 8px); }
.lg-dash { width: 16px; border-top: 1.5px dashed var(--ink-2); display: inline-block; }
.heat-legend { gap: 4px 4px; }
.heat-legend .sep { width: 10px; }
.hl { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.hl.hc-1 { background: var(--h1); } .hl.hc-2 { background: var(--h2); } .hl.hc-3 { background: var(--h3); }
.hl.hc-4 { background: var(--h4); } .hl.hc-5 { background: var(--h5); } .hl.hc-6 { background: var(--h6); }
.hl.hc-n { border: 1px solid var(--axis); }
.hl-dot { width: 12px; height: 12px; border-radius: 3px; background: var(--h5); position: relative; display: inline-block; }
.hl-dot::after { content: ""; position: absolute; inset: 3.5px; border-radius: 50%; background: var(--heat-dot); }
.heat-legend > span:not(.sep) { margin-right: 6px; }

#tip {
  position: fixed; left: 0; top: 0; z-index: 90; pointer-events: none; background: var(--tip-bg); color: var(--tip-ink);
  padding: 8px 11px; border-radius: 12px; font-size: 12.5px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.22); min-width: 120px; max-width: 250px;
}
.tip-h { font-weight: 700; margin-bottom: 4px; color: var(--tip-muted); font-size: 12px; }
.tip-muted { color: var(--tip-muted); }
.tip-row { display: flex; align-items: center; gap: 7px; line-height: 1.5; }
.tip-row b { font-size: 14px; font-variant-numeric: tabular-nums; }
.tip-row span { color: var(--tip-muted); }
.tip-key { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.tip-key.k-series { background: var(--series-1); }
.tip-key.k-emph { background: var(--series-emph); }
.tip-key.k-context, .tip-key.k-pace { background: var(--context); }

.table-wrap { overflow: auto; margin-top: 10px; border: 1px solid var(--hair); border-radius: 12px; max-height: 340px; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th { position: sticky; top: 0; background: var(--surface-2); text-align: left; padding: 8px 10px; font-weight: 750; white-space: nowrap; }
td { padding: 7px 10px; border-top: 1px solid var(--hair); white-space: nowrap; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Team map (js/worldmap.js) — always a night-sky scene, in both themes ── */
.map-card .card-h { flex-wrap: wrap; }
.wmap-host { margin: 0 -16px; }
.wmap {
  position: relative; overflow: hidden; isolation: isolate; aspect-ratio: 4 / 5; max-height: 74vh; max-height: 74dvh;
  touch-action: pan-y; user-select: none; -webkit-user-select: none; cursor: grab; color: #fff;
  background:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(1px 1px at 78% 12%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 64% 82%, rgba(255, 255, 255, 0.8), transparent 60%),
    radial-gradient(1px 1px at 30% 70%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(1px 1px at 90% 58%, rgba(255, 255, 255, 0.7), transparent 60%),
    radial-gradient(1.5px 1.5px at 44% 34%, rgba(190, 215, 255, 0.8), transparent 60%),
    radial-gradient(1px 1px at 6% 52%, rgba(255, 255, 255, 0.5), transparent 60%),
    radial-gradient(1px 1px at 56% 6%, rgba(255, 255, 255, 0.6), transparent 60%),
    radial-gradient(120% 90% at 50% 45%, #0c1d42 0%, #060c1e 55%, #03050d 100%);
}
@media (min-width: 560px) { .wmap { aspect-ratio: 16 / 10; } }
@media (min-width: 1000px) { .wmap { aspect-ratio: auto; height: 540px; } }
.wmap.grabbing { cursor: grabbing; }
.wmap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wm-gl { opacity: 0; transition: opacity 0.8s; }
.wmap.ready .wm-gl { opacity: 1; }
.wmap::after { content: ""; position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 60px rgba(2, 6, 18, 0.55); z-index: 0; }

.wm-pins { position: absolute; inset: 0; pointer-events: none; opacity: 0; transition: opacity 0.25s; z-index: 1; }
.wm-pins.show { opacity: 1; }
.wm-pin, .wm-stack { position: absolute; left: 0; top: 0; border: 0; padding: 0; background: none; color: inherit; font: inherit; cursor: pointer; will-change: transform; transition: opacity 0.3s; }
.wm-pins.show .wm-pin, .wm-pins.show .wm-stack { pointer-events: auto; }
.wm-pin.off, .wm-stack.off { opacity: 0; pointer-events: none !important; }
.wmap.stacked .wm-pin, .wmap:not(.stacked) .wm-stack { display: none; }
.wm-pin { width: calc(var(--d) + 8px); height: calc(var(--d) + 8px); border-radius: 50%; }
.wm-pin:focus-visible, .wm-stack:focus-visible { outline: 3px solid #ffce5c; outline-offset: 3px; }
.wm-pin-b { position: relative; display: block; width: 100%; height: 100%; }
.wm-pin-c {
  position: relative; display: grid; place-items: center; width: 100%; height: 100%; border-radius: 50%; background: #fff;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.4);
  animation: wm-bob 3.6s ease-in-out infinite; animation-delay: calc(var(--i) * -0.41s);
}
.wm-pin-c .ring { position: absolute; inset: 0; }
.wm-pin-c .ring-track { stroke: #e3e7f0; }
.wm-pin.idle .avatar { filter: grayscale(0.75); opacity: 0.7; }
.wm-pin.me .wm-pin-c { box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5), 0 0 0 3px #ffce5c, 0 0 22px rgba(255, 206, 92, 0.7); }
.wm-pin-b { transition: transform 0.2s; }
.wm-pin:hover .wm-pin-b { transform: scale(1.08); }
.wm-ok {
  position: absolute; right: -3px; top: -3px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  background: var(--good); color: #fff; font-size: 10px; font-weight: 900; box-shadow: 0 0 0 2px #fff;
}
.wm-name {
  position: absolute; left: 50%; top: calc(100% + 3px); transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  font-size: 10.5px; font-weight: 800; line-height: 1; letter-spacing: 0.01em; padding: 3px 7px; border-radius: 999px;
  background: rgba(6, 11, 26, 0.78); color: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.wm-pin.me .wm-name { background: #ffce5c; color: #2b1d00; }
.wm-pins.drop .wm-pin-b { animation: wm-drop 0.85s cubic-bezier(0.2, 1.45, 0.45, 1) both; animation-delay: calc(var(--i) * 90ms + 0.1s); }
.wm-burst {
  position: absolute; left: 50%; bottom: 100%; z-index: 2; white-space: nowrap; pointer-events: none; padding: 4px 8px; border-radius: 999px;
  background: var(--good); color: #fff; font-size: 11px; font-weight: 850; line-height: 1; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  animation: wm-burst 2.6s ease-out forwards;
}
.wm-stack {
  display: inline-flex; align-items: center; padding: 3px; border-radius: 999px; background: #fff; color: #0e1222;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.5);
}
.wm-faces { display: inline-flex; }
.wm-faces .avatar { box-shadow: 0 0 0 2px #fff; }
.wm-faces .avatar + .avatar { margin-left: -11px; }
.wm-stack b { font-size: 12px; font-weight: 850; padding: 0 7px 0 5px; }

.wm-live, .wm-hint, .wm-zoom { position: absolute; z-index: 3; background: rgba(6, 11, 26, 0.6); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px); }
.wm-live { left: 10px; bottom: 8px; display: inline-flex; align-items: center; gap: 7px; padding: 5px 10px 5px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 750; pointer-events: none; }
.wm-live i { width: 7px; height: 7px; border-radius: 50%; background: #ffce5c; animation: wm-live 2s ease-out infinite; }
.wm-zoom { right: 10px; top: 10px; display: grid; border-radius: 12px; overflow: hidden; }
.wm-zoom button { width: 34px; height: 32px; border: 0; background: transparent; color: #fff; font-size: 19px; font-weight: 600; line-height: 1; cursor: pointer; }
.wm-zoom button + button { border-top: 1px solid rgba(255, 255, 255, 0.14); }
.wm-zoom button:hover { background: rgba(255, 255, 255, 0.1); }
.wmap[data-mode="world"] .wm-zoom { display: none; }
.wm-hint { left: 50%; top: 12px; transform: translateX(-50%); padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; pointer-events: none; opacity: 0; transition: opacity 0.4s; }
.wmap[data-mode="world"]:not(.spun) .wm-hint { opacity: 1; transition-delay: 1.4s; }
.wm-credit { position: absolute; right: 9px; bottom: 9px; max-width: 46%; text-align: right; line-height: 1.25; z-index: 3; font-size: 9.5px; color: rgba(255, 255, 255, 0.55); pointer-events: none; text-shadow: 0 1px 2px #000; }
.wm-loading { position: absolute; inset: 0; z-index: 4; display: grid; place-content: center; justify-items: center; gap: 12px; font-size: 13px; color: rgba(255, 255, 255, 0.8); transition: opacity 0.5s, visibility 0.5s; }
.wm-spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, 0.18); border-top-color: #ffce5c; animation: spin 0.9s linear infinite; }
.wmap.ready .wm-loading { opacity: 0; visibility: hidden; }
.wmap.failed .wm-spinner { display: none; }

.wm-cc { display: grid; gap: 8px; }
@media (min-width: 700px) { .wm-cc { grid-template-columns: 1fr 1fr; } }
.wm-c {
  display: grid; grid-template-columns: 32px minmax(0, 1fr) auto; align-items: center; column-gap: 10px; row-gap: 8px; width: 100%;
  padding: 10px 12px; border: 1px solid var(--hair); border-radius: 16px; background: var(--surface-2); color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.15s;
}
.wm-c:active { transform: scale(0.985); }
.wm-c.on { border-color: var(--brand-text); box-shadow: 0 0 0 2px var(--brand-soft-strong); }
.wm-c-flag { font-size: 24px; line-height: 1; text-align: center; }
.wm-c-cc { display: inline-block; font-size: 11px; font-weight: 850; letter-spacing: 0.04em; padding: 4px 5px; border-radius: 6px; background: var(--surface); color: var(--ink-2); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15); }
.wm-c-name { display: grid; min-width: 0; }
.wm-c-name b { font-size: 14px; font-weight: 800; }
.wm-c-name small, .wm-c-val small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wm-c-val { display: grid; text-align: right; }
.wm-c-val b { font-size: 16px; font-weight: 850; font-variant-numeric: tabular-nums; }
.wm-c-bar { grid-column: 1 / -1; display: block; height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; }
.wm-c-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--grad-btn); transform-origin: left; animation: wm-bar 1.1s cubic-bezier(0.2, 0.8, 0.2, 1) both; }

/* ── Expedition, facts, foods ── */
.exp-next { display: flex; gap: 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface-2); margin-bottom: 10px; }
.exp-next > div { flex: 1; min-width: 0; }
.exp-emoji { font-size: 30px; flex: none; }
.exp-next b { display: block; font-size: 14.5px; }
.exp-next span { font-size: 12.5px; color: var(--ink-2); }
.trail { list-style: none; position: relative; display: grid; }
.trail::before { content: ""; position: absolute; left: 16px; top: 22px; bottom: 22px; width: 2px; background: var(--hair); }
.trail li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 6px 0; position: relative; }
.trail-dot { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: 16px; position: relative; z-index: 1; border: 2px solid var(--surface); }
.trail li.done .trail-dot { background: var(--good); color: #fff; }
.trail li.next .trail-dot { background: var(--surface); box-shadow: 0 0 0 2px var(--brand-text); }
.trail-name { font-weight: 700; font-size: 13.5px; min-width: 0; }
.trail-name small { display: block; font-weight: 500; color: var(--muted); font-size: 11.5px; }
.trail li:not(.done) .trail-name { color: var(--ink-2); }
.trail-km { text-align: right; font-weight: 750; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.trail-km small { display: block; color: var(--good-ink); font-weight: 700; font-size: 11px; }
.facts { display: grid; gap: 10px; }
.fact { display: flex; gap: 12px; align-items: center; }
.fact > span { font-size: 22px; width: 42px; height: 42px; display: grid; place-items: center; background: var(--surface-2); border-radius: 12px; flex: none; }
.fact p { font-size: 13.5px; color: var(--ink-2); }
.fact b { color: var(--ink); }
.foods { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.food { background: var(--surface-2); border-radius: 14px; padding: 10px 4px; text-align: center; display: flex; flex-direction: column; align-items: center; }
.food span { font-size: 24px; }
.food b { font-size: 16px; font-weight: 850; }
.food small { font-size: 11px; color: var(--muted); }

/* ── Page headers ── */
.page-h { padding: 4px 2px 0; }
.page-h h1 { font-size: 28px; font-weight: 850; letter-spacing: -0.025em; }
.page-h h2 { font-size: 19px; font-weight: 800; }
.page-h p { color: var(--ink-2); font-size: 14px; margin-top: 2px; }
.page-h.sm { padding-top: 8px; }

/* ── Ranking ── */
.podium { display: grid; grid-template-columns: 1fr 1.15fr 1fr; align-items: end; gap: 8px; padding-top: 6px; }
.podium-col { display: flex; flex-direction: column; align-items: center; gap: 3px; background: none; border: 0; cursor: pointer; min-width: 0; }
.podium-medal { font-size: 26px; line-height: 1; margin-bottom: 2px; }
.podium-name { font-weight: 800; font-size: 14px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium-val { font-size: 13px; color: var(--ink-2); font-weight: 700; }
.podium-base { width: 100%; margin-top: 6px; border-radius: 16px 16px 6px 6px; display: grid; place-items: center; font-size: 24px; font-weight: 900; color: rgba(255, 255, 255, 0.95); text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.p1 .podium-base { height: 96px; background: linear-gradient(180deg, #ffd166, #f59e0b); }
.p2 .podium-base { height: 70px; background: linear-gradient(180deg, #d5dce6, #94a3b8); }
.p3 .podium-base { height: 52px; background: linear-gradient(180deg, #f6b38b, #d97745); }
.p1 .podium-col, .podium-col.p1 { animation: pop 0.6s 0.15s both; }
.board { list-style: none; display: grid; gap: 8px; }
.row {
  width: 100%; display: grid; grid-template-columns: 26px 42px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 10px 12px; border-radius: 18px; background: var(--surface); border: 1px solid var(--hair); box-shadow: var(--shadow); text-align: left; cursor: pointer;
}
.row.me { border-color: var(--brand-text); box-shadow: 0 0 0 2px var(--brand-soft-strong); }
.row-rank { font-weight: 850; text-align: center; font-size: 15px; color: var(--muted); }
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.row-name { font-weight: 750; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-name em { font-style: normal; font-size: 10.5px; font-weight: 800; background: var(--brand); color: #fff; padding: 1px 6px; border-radius: 6px; margin-left: 4px; vertical-align: 1px; }
.row-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-bar { height: 4px; border-radius: 4px; background: var(--ring-track); margin-top: 5px; overflow: hidden; }
.row-bar i { display: block; height: 100%; background: var(--series-1); border-radius: inherit; }
.row.me .row-bar i { background: var(--series-emph); }
.row-spark { display: none; }
.row-val { text-align: right; }
.row-val b { display: block; font-size: 16px; font-weight: 850; font-variant-numeric: tabular-nums; }
.row-val small { font-size: 11px; color: var(--muted); }
@media (min-width: 440px) { .row { grid-template-columns: 26px 42px minmax(0, 1fr) 64px auto; } .row-spark { display: block; } }
.hof { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 1000px) { .hof { grid-template-columns: repeat(5, 1fr); } }
.hof-card { display: flex; flex-direction: column; gap: 4px; padding: 14px; border-radius: 18px; background: var(--surface); border: 1px solid var(--hair); box-shadow: var(--shadow); text-align: left; cursor: pointer; min-width: 0; }
.hof-emoji { font-size: 26px; }
.hof-title { font-size: 11.5px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.hof-who { display: flex; align-items: center; gap: 8px; font-size: 15px; }
.hof-val { font-size: 18px; font-weight: 850; }
.hof-val small { display: block; font-size: 11.5px; color: var(--muted); font-weight: 650; }
.empty { text-align: center; padding: 28px 16px; font-size: 42px; background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--hair); }
.empty p { font-size: 14px; color: var(--ink-2); margin-top: 6px; }

/* ── Me ── */
.me-head { display: flex; gap: 14px; align-items: center; }
.me-id { min-width: 0; flex: 1; }
.me-gear { align-self: flex-start; box-shadow: none; background: var(--surface-2); }
.me-av { position: relative; flex: none; padding: 0; border: 0; background: none; border-radius: 50%; cursor: pointer; }
.me-av-edit { position: absolute; left: -3px; bottom: -3px; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; background: var(--brand); color: #fff; border: 2px solid var(--surface); }
.page-h.with-action { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.settings-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--ink); }
.settings-link > span:nth-child(2) { flex: 1; min-width: 0; }
.settings-link b { display: block; font-size: 15px; }
.settings-link small { display: block; font-size: 12.5px; color: var(--muted); }
.settings-link > .ic { color: var(--muted); }
.settings-ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand-text); flex: none; }
.me-id h1 { font-size: 21px; font-weight: 850; }
.today-me { text-align: center; }
.today-ring { position: relative; width: 176px; height: 176px; margin: 4px auto 10px; }
.today-ring .ring-center b { font-size: 34px; font-weight: 900; letter-spacing: -0.03em; }
.today-ring .ring-center small { font-size: 12px; color: var(--muted); font-weight: 650; }
.today-msg { font-size: 15px; color: var(--ink-2); margin-bottom: 12px; min-height: 22px; }
.today-msg b { color: var(--ink); }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (min-width: 1000px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--surface); border-radius: 18px; padding: 12px 14px; box-shadow: var(--shadow); border: 1px solid var(--hair); display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: 12px; color: var(--muted); font-weight: 700; }
.stat-value { font-size: 21px; font-weight: 850; letter-spacing: -0.02em; }
.stat-sub { font-size: 12px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.health-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
@media (min-width: 520px) { .health-grid { grid-template-columns: repeat(3, 1fr); } }
.hm { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; display: flex; flex-direction: column; min-width: 0; }
.hm-ic { font-size: 19px; }
.hm-label { font-size: 12px; color: var(--muted); font-weight: 700; }
.hm b { font-size: 17px; font-weight: 850; }
.hm small { font-size: 11.5px; color: var(--ink-2); }
.who { display: flex; gap: 14px; align-items: center; margin-top: 12px; padding: 12px; border-radius: 16px; background: var(--surface-2); }
.who p { font-size: 13px; color: var(--ink-2); }
.level-h { font-size: 14px; color: var(--ink-2); margin: 16px 0 8px; }
.level-h b { color: var(--ink); }
.level-track { position: relative; display: grid; grid-template-columns: repeat(5, 1fr); gap: 3px; margin-top: 2px; }
.level-track span { height: 32px; display: grid; place-items: center; font-size: 15px; background: var(--surface-2); filter: grayscale(1); opacity: 0.55; }
.level-track span:first-child { border-radius: 10px 0 0 10px; }
.level-track span:nth-child(5) { border-radius: 0 10px 10px 0; }
.level-track span.on { filter: none; opacity: 1; background: var(--brand-soft-strong); }
.level-marker { position: absolute; top: -5px; width: 3px; height: 42px; background: var(--ink); border-radius: 2px; transform: translateX(-50%); box-shadow: 0 0 0 2px var(--surface); }
.level-scale { display: grid; grid-template-columns: repeat(5, 1fr); font-size: 11px; color: var(--muted); margin: 4px 0 6px; font-variant-numeric: tabular-nums; }
.insights { display: grid; gap: 10px; }
@media (min-width: 1000px) { .insights { grid-template-columns: 1fr 1fr; } }
.insight { display: flex; gap: 12px; padding: 12px; border-radius: 16px; background: var(--surface-2); }
.insight-emoji { font-size: 24px; flex: none; }
.insight h3 { font-size: 14.5px; font-weight: 800; }
.insight p { font-size: 13px; color: var(--ink-2); margin-top: 2px; }
.insight .insight-you { color: var(--ink); font-weight: 700; margin-top: 6px; }
.insight cite { display: block; font-size: 11.5px; color: var(--muted); font-style: normal; margin-top: 6px; }
.badges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (min-width: 560px) { .badges { grid-template-columns: repeat(4, 1fr); } }
.badge { text-align: center; padding: 12px 6px; border-radius: 16px; background: var(--surface-2); display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 0; }
.badge-emoji { font-size: 28px; filter: grayscale(1); opacity: 0.4; }
.badge b { font-size: 12.5px; }
.badge small { font-size: 10.5px; color: var(--muted); line-height: 1.3; }
.badge.earned { background: var(--badge-bg); }
.badge.earned .badge-emoji { filter: none; opacity: 1; animation: pop 0.5s both; }
.center-card { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.center-card .btn { margin-top: 6px; }
.big-emoji { font-size: 50px; line-height: 1.1; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form label { font-size: 12.5px; font-weight: 700; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }
.form label:nth-child(3), .form button { grid-column: 1 / -1; }
.input-unit { position: relative; display: block; }
.input-unit i { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); font-style: normal; color: var(--muted); font-size: 13px; pointer-events: none; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 12px; border-top: 1px solid var(--hair); margin-top: 12px; font-size: 14px; flex-wrap: wrap; }
.setting-row > span { display: inline-flex; gap: 8px; align-items: center; }
.setting-row.first { border-top: 0; margin-top: 0; padding-top: 0; }

/* ── Settings: language & avatar ── */
.lang-list { display: grid; gap: 8px; width: 100%; }
.lang-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; border-radius: 14px; cursor: pointer; text-align: left;
  border: 1px solid var(--hair); background: var(--surface-2); font-size: 15px;
}
.lang-opt b { flex: 1; font-weight: 750; }
.lang-opt .ic { color: var(--brand-text); }
.lang-opt.on { border-color: var(--brand-text); background: var(--brand-soft); box-shadow: inset 0 0 0 1px var(--brand-text); }
.lang-code { font-size: 11px; font-weight: 850; letter-spacing: 0.04em; padding: 4px 6px; border-radius: 7px; background: var(--surface); color: var(--ink-2); }
.lang-opt.on .lang-code { background: var(--brand); color: #fff; }
.lang-list.lang-row { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.lang-list.lang-row .lang-opt { flex-direction: column; gap: 4px; padding: 8px 4px; text-align: center; font-size: 13px; }
.lang-list.lang-row .lang-opt .ic { display: none; }
.av-current { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.av-current b { display: block; font-size: 16px; }
.av-current small { display: block; font-size: 12.5px; color: var(--muted); }
.av-signin { margin-top: 10px; }
.av-pick-h { display: flex; gap: 14px; align-items: center; padding-right: 36px; }
.av-pick h2 { font-size: 21px; font-weight: 850; }
.av-pick-h .muted { font-size: 13px; margin-top: 2px; }
.av-tabs { display: flex; gap: 8px; margin: 16px 0 14px; }
.av-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; }
@media (min-width: 520px) { .av-grid { grid-template-columns: repeat(6, 1fr); } }
.av-opt { aspect-ratio: 1; padding: 0; border: 0; border-radius: 50%; cursor: pointer; background: color-mix(in srgb, var(--av, var(--brand)) 16%, var(--surface)); box-shadow: 0 0 0 1px var(--hair); transition: transform 0.12s, box-shadow 0.12s; min-width: 0; }
.av-opt img { width: 100%; height: 100%; display: block; border-radius: 50%; object-fit: cover; pointer-events: none; }
.av-opt:hover { transform: scale(1.05); }
.av-opt.on { box-shadow: 0 0 0 3px var(--brand-text); }
.av-opt.saving, .av-none.saving { animation: pulse 0.8s ease-in-out infinite; }
.sheet-body.busy .av-opt, .sheet-body.busy .av-none { pointer-events: none; }
.av-none { margin-top: 18px; }
.av-none.on { box-shadow: inset 0 0 0 2px var(--brand-text); }

/* ── Sync page ── */
.sync-status { display: flex; align-items: center; gap: 12px; }
.sync-status > div { flex: 1; min-width: 0; }
.sync-emoji { font-size: 32px; }
.sync-status p { font-size: 13px; color: var(--ink-2); }
.sync-status.on { background: linear-gradient(135deg, rgba(18, 201, 144, 0.14), rgba(10, 165, 224, 0.1)); border-color: rgba(18, 201, 144, 0.4); }
.guide { margin-top: 14px; }
.steps { counter-reset: s; list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.steps > li { counter-increment: s; position: relative; padding-left: 40px; font-size: 14px; color: var(--ink-2); min-width: 0; }
.steps > li::before { content: counter(s); position: absolute; left: 0; top: -3px; width: 28px; height: 28px; border-radius: 50%; background: var(--brand); color: #fff; font-weight: 850; display: grid; place-items: center; font-size: 13px; }
.steps > li > b:first-child { display: block; color: var(--ink); margin-bottom: 6px; }
.steps > li > .btn { margin-top: 2px; }
.steps.compact { gap: 10px; }
.steps.compact > li > b:first-child, .steps.compact b { display: inline; margin: 0; color: var(--ink); }
.steps.left { text-align: left; width: 100%; margin: 6px 0; }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border-radius: 12px; padding: 6px 6px 6px 12px; margin: 6px 0; }
.linkbox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.flow { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; margin-top: 8px; }
.flow-step > div { min-width: 0; }
.card, .guide, .callout { min-width: 0; }
.flow-step { display: flex; gap: 10px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface-2); border-left: 4px solid var(--series-1); }
.flow-step > span { font-size: 17px; width: 24px; text-align: center; font-weight: 900; color: var(--brand-text); flex: none; }
.flow-step b { color: var(--ink); font-size: 13.5px; }
.flow-step small { display: block; font-size: 12px; color: var(--ink-2); }
.flow-step i { font-style: normal; font-weight: 750; color: var(--ink); }
.flow-step em { font-size: 11px; color: var(--muted); font-style: normal; }
.flow-step.opt { border-left-color: var(--axis); }
.callout { margin-top: 16px; padding: 14px; border-radius: 16px; background: linear-gradient(135deg, rgba(42, 120, 214, 0.1), rgba(18, 201, 144, 0.1)); font-size: 14px; }
.callout ol { margin: 8px 0 6px 18px; display: grid; gap: 4px; color: var(--ink-2); }
.callout p { margin-top: 6px; font-size: 13.5px; color: var(--ink-2); }
details.callout summary { cursor: pointer; }
.guide > .btn { margin-top: 14px; }
.flow-tip { margin-top: 8px; }
.calc { list-style: none; display: grid; gap: 8px; font-size: 13.5px; color: var(--ink-2); margin-bottom: 10px; }
.calc b { color: var(--ink); }

/* ── Bottom nav ── */
.nav {
  position: fixed; left: 50%; bottom: calc(10px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30;
  width: min(460px, calc(100% - 20px)); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  padding: 6px; border-radius: 24px; background: var(--nav-bg); border: 1px solid var(--hair);
  -webkit-backdrop-filter: saturate(1.8) blur(18px); backdrop-filter: saturate(1.8) blur(18px); box-shadow: 0 10px 30px rgba(16, 24, 48, 0.16);
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 700; color: var(--muted); text-decoration: none; border-radius: 16px; }
.nav a.on { color: var(--brand-text); }
.nav a.on .ic { stroke-width: 2.5; }
.fab {
  width: 58px; height: 58px; margin: -28px auto 0; border-radius: 20px; display: grid; place-items: center; color: #fff; cursor: pointer;
  background: linear-gradient(135deg, #1650d0, #0aa5e0 60%, #12c990); box-shadow: 0 10px 24px -6px rgba(22, 80, 208, 0.75); border: 4px solid var(--bg);
  transition: transform 0.15s;
}
.fab:active { transform: scale(0.94); }

/* ── Sheets ── */
.sheet-wrap { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(8, 12, 28, 0.45); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); opacity: 0; transition: opacity 0.25s; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92vh; max-height: 92dvh; overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); border-radius: 26px 26px 0 0; padding: 4px 18px calc(22px + env(safe-area-inset-bottom));
  transform: translateY(100%); transition: transform 0.3s cubic-bezier(0.2, 0.9, 0.25, 1); box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.2);
}
.sheet-wrap.in .sheet { transform: none; }
.sheet-wrap.in .sheet-backdrop { opacity: 1; }
.sheet-handle { width: 100%; height: 22px; display: grid; place-items: center; cursor: grab; touch-action: none; }
.sheet-handle::after { content: ""; width: 42px; height: 5px; border-radius: 3px; background: var(--axis); }
.sheet-close { position: absolute; right: 12px; top: 12px; box-shadow: none; background: var(--surface-2); width: 34px; height: 34px; z-index: 2; }
.sheet-body { padding-top: 6px; }
@media (min-width: 700px) {
  .sheet-wrap { align-items: center; }
  .sheet { border-radius: 26px; padding-bottom: 22px; transform: translateY(24px) scale(0.98); opacity: 0; transition: transform 0.25s, opacity 0.2s; }
  .sheet-wrap.in .sheet { transform: none; opacity: 1; }
}

/* Log sheet */
.log-h { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; padding-right: 40px; }
.log-h h2 { font-size: 21px; font-weight: 850; }
.date-chips, .quick { display: flex; gap: 8px; flex-wrap: wrap; }
.log-current { font-size: 13px; color: var(--muted); margin: 12px 0 8px; min-height: 18px; }
.log-current b { color: var(--ink); }
.steps-input { display: flex; align-items: baseline; justify-content: center; gap: 8px; padding: 14px; border-radius: 20px; background: var(--surface-2); margin-bottom: 12px; }
.steps-input:focus-within { box-shadow: 0 0 0 2px var(--brand-text); }
.steps-input input { font-size: 46px; font-weight: 900; text-align: center; border: 0; background: transparent; width: 100%; max-width: 260px; padding: 0; letter-spacing: -0.03em; color: var(--ink); outline: none; }
.steps-input span { font-size: 15px; color: var(--muted); font-weight: 700; }
.quick { justify-content: center; margin-bottom: 14px; }
.quick .chip { padding: 6px 12px; font-size: 13px; }
.quick.alt { justify-content: flex-start; margin: 8px 0 0; align-items: center; font-size: 12.5px; }
.ocr-status { background: var(--surface-2); border-radius: 14px; padding: 10px 12px; font-size: 13.5px; margin-bottom: 12px; }
.progress { height: 6px; background: var(--ring-track); border-radius: 6px; overflow: hidden; margin-bottom: 6px; }
.progress i { display: block; height: 100%; background: var(--series-1); transition: width 0.3s; }
.log .btn-row { margin-bottom: 12px; }

/* Sign-in, device approval */
.signin h2, .member-h h2 { font-size: 21px; font-weight: 850; padding-right: 36px; }
.who-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 16px 0; }
.who-grid .who { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 4px; border-radius: 18px; border: 1px solid var(--hair); background: var(--surface-2); cursor: pointer; margin: 0; min-width: 0; }
.who-grid .who b { font-size: 14px; }
.who-grid .who small { font-size: 11px; color: var(--muted); }
.claim { padding: 6px 4px 2px; }
.claim h2 { font-size: 21px; font-weight: 850; padding: 0 30px; }
.claim .btn.full { margin-top: 10px; }
.claim-tip { font-size: 13px; text-align: left; background: var(--brand-soft); color: var(--ink-2); padding: 10px 12px; border-radius: 14px; }
.code { display: flex; gap: 10px; margin: 10px 0 4px; }
.code span { width: 52px; height: 64px; display: grid; place-items: center; border-radius: 14px; background: var(--surface-2); font-size: 32px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--brand-text); box-shadow: inset 0 0 0 1px var(--hair); }
.live-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--good); vertical-align: 1px; animation: pulse 1.4s ease-in-out infinite; }
.approvals h2 { font-size: 21px; font-weight: 850; padding-right: 36px; }
.req-list { list-style: none; display: grid; gap: 10px; margin-top: 14px; }
.req { display: grid; grid-template-columns: 1fr auto; gap: 10px 12px; align-items: center; padding: 12px; border-radius: 16px; background: var(--surface-2); }
.req-who { display: flex; gap: 10px; align-items: center; min-width: 0; }
.req-who b { display: block; font-size: 14.5px; }
.req-who small { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.req-code { text-align: right; font-size: 22px; font-weight: 900; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; color: var(--brand-text); line-height: 1; }
.req-code small { display: block; font-size: 10px; letter-spacing: 0.04em; font-weight: 750; color: var(--muted); text-transform: uppercase; margin-bottom: 3px; }
.req-btns { grid-column: 1 / -1; display: flex; gap: 8px; justify-content: flex-end; }
.device-list, .captain-list { list-style: none; display: grid; gap: 2px; }
.device-list li, .captain-list li { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hair); }
.device-list li:first-child, .captain-list li:first-child { border-top: 0; }
.captain-list { margin-top: 8px; }
.device-ic { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; background: var(--surface-2); color: var(--brand-text); flex: none; }
.device-name { flex: 1; min-width: 0; }
.device-name b { display: block; font-size: 14px; }
.device-name b em { font-style: normal; font-size: 10.5px; font-weight: 800; background: var(--brand); color: #fff; padding: 1px 6px; border-radius: 6px; margin-left: 4px; vertical-align: 1px; }
.device-name small { display: block; font-size: 12px; color: var(--muted); }
.banner.approve { cursor: pointer; background: linear-gradient(135deg, #eaf2ff, #e9fbf4); border-color: #cfe0fb; color: #0e2a5c; text-align: left; }
:root[data-theme="dark"] .banner.approve { background: linear-gradient(135deg, #16233f, #12302a); border-color: #24365a; color: #dbe7ff; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .banner.approve { background: linear-gradient(135deg, #16233f, #12302a); border-color: #24365a; color: #dbe7ff; } }
.linkbox.empty { justify-content: flex-start; padding: 6px; }
.link-btn.inline { display: inline; padding: 0; font-size: inherit; }

/* Welcome & options */
.welcome { text-align: center; display: flex; flex-direction: column; gap: 10px; align-items: center; padding-top: 8px; }
.welcome-lang { width: 100%; padding-right: 40px; margin-bottom: 4px; }
.lang-prompt .lang-list { margin: 6px 0 4px; }
.welcome-art img { border-radius: 24px; box-shadow: 0 16px 34px -12px rgba(22, 80, 208, 0.65); animation: bob 3s ease-in-out infinite; }
.welcome h2 { font-size: 26px; font-weight: 900; letter-spacing: -0.02em; }
.welcome-dates { font-weight: 750; color: var(--brand-text); font-size: 14px; }
.welcome-flags { color: var(--ink-2); font-size: 14px; }
.welcome-list { list-style: none; display: grid; gap: 8px; text-align: left; width: 100%; margin: 6px 0; }
.welcome-list li { display: flex; gap: 12px; align-items: center; padding: 12px; background: var(--surface-2); border-radius: 14px; font-size: 14px; }
.welcome-list span { font-size: 22px; }
.option { display: flex; gap: 12px; align-items: center; width: 100%; padding: 14px; border-radius: 16px; background: var(--surface-2); border: 0; text-align: left; text-decoration: none; cursor: pointer; margin-top: 4px; }
.option > span { font-size: 24px; }
.option > div { flex: 1; }
.option small { display: block; color: var(--muted); font-size: 12.5px; }
.next .option { margin-top: 2px; }

/* Member sheet */
.member-h { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.member-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 14px; }
.member-stats div { background: var(--surface-2); border-radius: 14px; padding: 10px 4px; text-align: center; }
.member-stats b { display: block; font-size: 17px; font-weight: 850; }
.member-stats small { font-size: 11px; color: var(--muted); }
.badge-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.badge-chip { font-size: 12.5px; padding: 5px 10px; border-radius: 999px; background: var(--badge-bg); font-weight: 700; }
.member .btn.full { margin-top: 12px; }

/* ── Toasts & confetti ── */
#toasts { position: fixed; top: calc(env(safe-area-inset-top) + 12px); left: 50%; transform: translateX(-50%); z-index: 95; display: grid; gap: 8px; width: min(420px, calc(100% - 24px)); pointer-events: none; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; justify-content: space-between; padding: 12px 14px; border-radius: 16px;
  background: var(--tip-bg); color: var(--tip-ink); font-size: 14px; font-weight: 650; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.22);
  transform: translateY(-16px); opacity: 0; transition: transform 0.25s, opacity 0.25s;
}
.toast.in { transform: none; opacity: 1; }
.toast.badge { background: linear-gradient(135deg, #ffb703, #fb5607); color: #fff; }
.toast-btn { border: 0; background: rgba(127, 127, 127, 0.25); font-weight: 800; padding: 6px 12px; border-radius: 10px; cursor: pointer; flex: none; }
.confetti { position: fixed; inset: 0; z-index: 96; pointer-events: none; width: 100%; height: 100%; }

/* ── Motion ── */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes ring-in { from { stroke-dashoffset: var(--c); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes pop { 0% { transform: scale(0.6); opacity: 0; } 70% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
@keyframes bob { 50% { transform: translateY(-6px) rotate(-2deg); } }
@keyframes pulse { 50% { opacity: 0.45; } }
@keyframes wm-drop { 0% { transform: translateY(-70px) scale(0.3); opacity: 0; } 45% { opacity: 1; } 100% { transform: none; opacity: 1; } }
@keyframes wm-bob { 50% { transform: translateY(-3px); } }
@keyframes wm-burst { 0% { opacity: 0; transform: translate(-50%, 8px) scale(0.5); } 14% { opacity: 1; transform: translate(-50%, -6px) scale(1.05); } 70% { opacity: 1; } 100% { opacity: 0; transform: translate(-50%, -40px); } }
@keyframes wm-live { 0% { box-shadow: 0 0 0 0 rgba(255, 206, 92, 0.75); } 100% { box-shadow: 0 0 0 9px rgba(255, 206, 92, 0); } }
@keyframes wm-bar { from { transform: scaleX(0); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media (forced-colors: active) {
  .bar, .hc { forced-color-adjust: none; }
}
