/* ============================================================
   STEPUP — bold, dark, arcade-energy walking challenge
   ============================================================ */

:root {
  color-scheme: dark;

  --page:        #08090d;
  --surface:     #14151d;
  --surface-2:   #1c1e28;
  --surface-3:   #262936;
  --hairline:    rgba(255,255,255,.10);
  --hairline-2:  rgba(255,255,255,.18);

  --ink:         #ffffff;
  --ink-2:       #b9bcc9;
  --ink-3:       #7e8398;

  --lime:        #c8f94a;
  --lime-deep:   #a5d629;
  --violet:      #8b7bf0;
  --coral:       #ff7a4d;
  --gold:        #ffc93c;
  --good:        #3ddc84;
  --bad:         #ff5d5d;

  --grid:        rgba(255,255,255,.07);
  --axis:        rgba(255,255,255,.16);

  --r-sm: 10px;
  --r:    16px;
  --r-lg: 24px;
  --r-xl: 32px;

  --shadow: 0 18px 50px -20px rgba(0,0,0,.9);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--page);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow-x: hidden;
}

/* aurora backdrop */
body::before {
  content: "";
  position: fixed; inset: -20% -20% auto -20%; height: 70vh;
  background:
    radial-gradient(48% 60% at 18% 0%, rgba(200,249,74,.16), transparent 70%),
    radial-gradient(42% 55% at 82% 8%, rgba(139,123,240,.18), transparent 70%),
    radial-gradient(40% 50% at 50% 40%, rgba(255,122,77,.08), transparent 70%);
  pointer-events: none; z-index: 0;
  filter: blur(4px);
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--lime); }

.num { font-variant-numeric: tabular-nums; }
.hidden { display: none !important; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- layout ---------- */

.shell { position: relative; z-index: 1; max-width: 760px; margin: 0 auto; padding: 0 16px 120px; }

/* ---------- header ---------- */

.topbar {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 14px 0 12px;
  background: linear-gradient(to bottom, var(--page) 55%, transparent);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: -.02em; }
.brand-mark {
  width: 34px; height: 34px; border-radius: 11px; display: grid; place-items: center;
  background: var(--lime); color: #10130a; font-size: 19px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 8px 24px -8px rgba(200,249,74,.7);
}
.brand-name { font-size: 17px; }
.brand-day { font-size: 11px; font-weight: 700; color: var(--ink-3); letter-spacing: .12em; text-transform: uppercase; }
.topbar-spacer { flex: 1; }

.avatar-btn {
  width: 38px; height: 38px; border-radius: 50%; overflow: hidden;
  background: var(--surface-2); border: 1px solid var(--hairline-2);
  display: grid; place-items: center; font-weight: 800; font-size: 14px; color: var(--ink-2);
  flex: none;
}
.avatar-btn img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* ---------- tabs ---------- */

.tabbar {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 50;
  display: flex; gap: 4px; padding: 6px;
  background: rgba(28,30,40,.86); backdrop-filter: blur(18px);
  border: 1px solid var(--hairline-2); border-radius: 999px;
  box-shadow: var(--shadow);
  width: calc(100% - 32px); max-width: 420px;
}
.tab {
  flex: 1; padding: 11px 8px; border-radius: 999px; font-size: 12.5px; font-weight: 800;
  color: var(--ink-3); letter-spacing: .01em; display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: background .18s, color .18s;
}
.tab[aria-selected="true"] { background: var(--lime); color: #10130a; }
.tab .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--coral); }

/* ---------- cards ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  padding: 20px;
  margin-bottom: 14px;
}
.card-tight { padding: 16px; }
.card-title {
  font-size: 11px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 14px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.card-head .card-title { margin: 0; }

/* ---------- hero / log card ---------- */

.hero {
  background: linear-gradient(160deg, #1a1d27 0%, #14151d 60%);
  border: 1px solid var(--hairline-2);
  border-radius: var(--r-xl);
  padding: 24px 20px;
  margin-bottom: 14px;
  position: relative; overflow: hidden;
}
.hero::after {
  content: ""; position: absolute; right: -60px; top: -60px; width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(200,249,74,.18), transparent 65%); pointer-events: none;
}
.hero-eyebrow { font-size: 11px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--lime); }
.hero-q { font-size: clamp(22px, 6vw, 30px); font-weight: 900; letter-spacing: -.03em; line-height: 1.12; margin: 8px 0 20px; }

.seg { display: flex; gap: 4px; padding: 4px; background: var(--surface-3); border-radius: 999px; margin-bottom: 18px; }
.seg button {
  flex: 1; padding: 10px; border-radius: 999px; font-size: 13px; font-weight: 800; color: var(--ink-3);
  transition: background .16s, color .16s;
}
.seg button[aria-pressed="true"] { background: var(--ink); color: #0d0e13; }

.bignum-row { display: flex; align-items: center; gap: 12px; }
.step-btn {
  width: 52px; height: 52px; flex: none; border-radius: 16px; background: var(--surface-3);
  border: 1px solid var(--hairline); font-size: 24px; font-weight: 700; color: var(--ink-2);
  display: grid; place-items: center; transition: transform .1s, background .16s;
}
.step-btn:active { transform: scale(.92); }
.bignum {
  display: block; width: 100%; min-width: 0; text-align: center; background: transparent; border: none;
  font-size: clamp(44px, 14vw, 68px); font-weight: 900; letter-spacing: -.05em; color: var(--ink);
  font-variant-numeric: tabular-nums; padding: 0; outline: none;
  -moz-appearance: textfield;
}
.bignum::-webkit-outer-spin-button, .bignum::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.bignum-unit { text-align: center; font-size: 12px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; color: var(--ink-3); margin-top: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 4px; }
.chip {
  padding: 9px 14px; border-radius: 999px; background: var(--surface-3); border: 1px solid var(--hairline);
  font-size: 13px; font-weight: 700; color: var(--ink-2); transition: transform .1s, border-color .16s, color .16s;
}
.chip:hover { border-color: var(--hairline-2); color: var(--ink); }
.chip:active { transform: scale(.95); }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; padding: 17px; border-radius: 18px;
  background: var(--lime); color: #10130a; font-size: 16px; font-weight: 900; letter-spacing: -.01em;
  box-shadow: 0 14px 34px -14px rgba(200,249,74,.85);
  transition: transform .1s, filter .16s;
}
.btn:hover { filter: brightness(1.06); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; box-shadow: none; cursor: not-allowed; }
.btn-ghost {
  background: var(--surface-3); color: var(--ink); box-shadow: none;
  border: 1px solid var(--hairline);
}
.btn-sm { padding: 11px 16px; font-size: 13.5px; border-radius: 13px; width: auto; }

.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 12px; text-align: center; line-height: 1.5; }
.err { color: var(--bad); font-size: 13px; font-weight: 600; margin-top: 12px; text-align: center; }

/* logged state */
.logged-badge {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 13px; border-radius: 999px;
  background: rgba(61,220,132,.12); border: 1px solid rgba(61,220,132,.35);
  color: var(--good); font-size: 12.5px; font-weight: 800;
}

/* ---------- stat tiles ---------- */

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 560px) { .tiles { grid-template-columns: repeat(4, 1fr); } }
.tile {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--r);
  padding: 15px 14px;
}
.tile-v { font-size: 26px; font-weight: 900; letter-spacing: -.035em; line-height: 1; font-variant-numeric: tabular-nums; }
.tile-l { font-size: 10.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); margin-top: 7px; }
.tile-fire .tile-v { color: var(--coral); }
.tile-rank .tile-v { color: var(--gold); }

/* ---------- thermometer ---------- */

.thermo-num {
  font-size: clamp(46px, 15vw, 78px); font-weight: 900; letter-spacing: -.05em; line-height: .92;
  font-variant-numeric: tabular-nums;
}
.thermo-goal { font-size: 14px; font-weight: 700; color: var(--ink-3); margin-top: 8px; }
.thermo-track {
  position: relative; height: 26px; border-radius: 999px; background: var(--surface-3);
  overflow: hidden; margin: 20px 0 10px; border: 1px solid var(--hairline);
}
.thermo-fill {
  position: absolute; inset: 0 auto 0 0; border-radius: 999px;
  background: linear-gradient(90deg, var(--lime-deep), var(--lime));
  box-shadow: 0 0 26px -2px rgba(200,249,74,.6);
  width: 0; transition: width 1.1s cubic-bezier(.2,.8,.2,1);
}
.thermo-fill::after {
  content: ""; position: absolute; inset: 0;
  background: repeating-linear-gradient(115deg, rgba(255,255,255,.16) 0 10px, transparent 10px 22px);
  animation: slide 1.1s linear infinite;
}
@keyframes slide { to { background-position: 44px 0; } }
.thermo-marker {
  position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink-2);
  opacity: .8;
}
.thermo-legend { display: flex; justify-content: space-between; font-size: 11.5px; font-weight: 700; color: var(--ink-3); }

.pace {
  display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap;
}
.pace-pill {
  flex: 1; min-width: 120px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--hairline);
}
.pace-pill b { display: block; font-size: 19px; font-weight: 900; letter-spacing: -.03em; font-variant-numeric: tabular-nums; }
.pace-pill span { font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.status-good b { color: var(--good); }
.status-warn b { color: var(--gold); }

/* ---------- charts ---------- */

.chart-wrap { position: relative; width: 100%; overflow-x: auto; }
svg.chart { display: block; width: 100%; height: auto; }
.chart text { font-family: var(--font); }
.tick { fill: var(--ink-3); font-size: 10px; font-weight: 600; }
.gridline { stroke: var(--grid); stroke-width: 1; }
.baseline { stroke: var(--axis); stroke-width: 1; }
.bar { fill: var(--lime); }
.bar-empty { fill: rgba(255,255,255,.07); }
.bar-today { fill: var(--coral); }
.bar-hit { fill: transparent; cursor: pointer; }
.series-line { fill: none; stroke: var(--lime); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.series-area { fill: url(#limeFade); }
.target-line { fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-dasharray: 5 5; opacity: .75; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; margin-top: 12px; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 7px; }

.tip {
  position: absolute; pointer-events: none; z-index: 20;
  background: #0a0b10; border: 1px solid var(--hairline-2); border-radius: 11px;
  padding: 9px 12px; font-size: 12px; font-weight: 600; color: var(--ink);
  box-shadow: var(--shadow); white-space: nowrap; opacity: 0; transition: opacity .12s;
}
.tip b { font-weight: 900; font-variant-numeric: tabular-nums; }
.tip small { display: block; color: var(--ink-3); font-weight: 700; font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; }

/* ---------- badges ---------- */

.badges { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.badge {
  aspect-ratio: 1; border-radius: var(--r); background: var(--surface-2);
  border: 1px solid var(--hairline); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; padding: 8px; text-align: center;
  opacity: .38; filter: grayscale(1); transition: transform .18s, opacity .18s, filter .18s;
}
.badge.earned {
  opacity: 1; filter: none; background: linear-gradient(160deg, #232634, #191b24);
  border-color: var(--hairline-2);
}
.badge.earned:hover { transform: translateY(-3px); }
.badge-icon { font-size: 26px; line-height: 1; }
.badge-name { font-size: 10.5px; font-weight: 800; letter-spacing: .02em; line-height: 1.25; }
.badge-hint { font-size: 9.5px; color: var(--ink-3); font-weight: 600; line-height: 1.25; }

/* ---------- leaderboard ---------- */

.lb { display: flex; flex-direction: column; gap: 6px; }
.lb-row {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px;
  border-radius: 14px; background: var(--surface-2); border: 1px solid transparent;
}
.lb-row.me { background: rgba(200,249,74,.10); border-color: rgba(200,249,74,.4); }
.lb-rank {
  width: 30px; flex: none; text-align: center; font-size: 14px; font-weight: 900;
  color: var(--ink-3); font-variant-numeric: tabular-nums;
}
.lb-row:nth-child(1) .lb-rank { color: var(--gold); }
.lb-row:nth-child(2) .lb-rank { color: #d5d8e2; }
.lb-row:nth-child(3) .lb-rank { color: var(--coral); }
.lb-av { width: 32px; height: 32px; border-radius: 50%; flex: none; background: var(--surface-3); overflow: hidden; display: grid; place-items: center; font-size: 12px; font-weight: 800; color: var(--ink-3); }
.lb-av img { width: 100%; height: 100%; object-fit: cover; }
.lb-name { flex: 1; min-width: 0; font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-sub { font-size: 11px; color: var(--ink-3); font-weight: 600; }
.lb-min { font-size: 15px; font-weight: 900; font-variant-numeric: tabular-nums; }
.lb-min span { font-size: 10px; font-weight: 700; color: var(--ink-3); margin-left: 3px; }

/* ---------- sign in ---------- */

.signin { min-height: 100dvh; display: grid; place-items: center; padding: 24px; position: relative; z-index: 1; }
.signin-inner { width: 100%; max-width: 400px; text-align: center; }
.signin-mark {
  width: 76px; height: 76px; border-radius: 24px; margin: 0 auto 22px; display: grid; place-items: center;
  background: var(--lime); font-size: 40px;
  box-shadow: 0 0 0 1px rgba(255,255,255,.14), 0 24px 60px -20px rgba(200,249,74,.75);
}
.signin h1 { font-size: clamp(34px, 10vw, 46px); font-weight: 900; letter-spacing: -.045em; margin: 0 0 10px; line-height: 1; }
.signin p.tag { color: var(--ink-2); font-size: 15px; margin: 0 0 28px; line-height: 1.5; }
.signin-stats { display: flex; gap: 10px; margin-bottom: 28px; }
.signin-stats .tile { flex: 1; }
.gbtn-wrap { display: flex; justify-content: center; min-height: 44px; }
.setup-banner {
  text-align: left; padding: 15px 17px; border-radius: var(--r); margin-bottom: 20px;
  background: rgba(255, 201, 60, .09); border: 1px solid rgba(255, 201, 60, .38);
  font-size: 13px; line-height: 1.6; color: var(--ink-2);
}
.setup-banner b { color: var(--gold); display: block; margin-bottom: 5px; font-size: 13.5px; }
.setup-banner code {
  background: rgba(0,0,0,.4); padding: 1px 6px; border-radius: 5px;
  font-size: 12px; color: var(--ink);
}
.dev-label {
  font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 9px;
}
.legal { font-size: 11.5px; color: var(--ink-3); margin-top: 20px; line-height: 1.6; }

/* ---------- sheet / modal ---------- */

.sheet-bg {
  position: fixed; inset: 0; z-index: 90; background: rgba(4,5,8,.72);
  backdrop-filter: blur(6px); display: grid; place-items: end center;
  animation: fade .2s ease;
}
@keyframes fade { from { opacity: 0; } }
.sheet {
  width: 100%; max-width: 520px; background: var(--surface);
  border: 1px solid var(--hairline-2); border-bottom: none;
  border-radius: var(--r-xl) var(--r-xl) 0 0; padding: 22px 20px calc(24px + env(safe-area-inset-bottom));
  max-height: 88dvh; overflow-y: auto;
  animation: up .26s cubic-bezier(.2,.9,.25,1);
}
@keyframes up { from { transform: translateY(40px); opacity: .4; } }
.sheet h2 { font-size: 20px; font-weight: 900; letter-spacing: -.03em; margin: 0 0 4px; }
.sheet .sub { color: var(--ink-3); font-size: 13px; margin: 0 0 20px; line-height: 1.5; }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 7px; }
.field input, .field select {
  width: 100%; padding: 13px 14px; border-radius: 13px; background: var(--surface-2);
  border: 1px solid var(--hairline); outline: none; font-size: 15px; font-weight: 600;
  transition: border-color .16s;
}
.field input:focus, .field select:focus { border-color: var(--lime); }
.field .note { font-size: 11.5px; color: var(--ink-3); margin-top: 6px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 20px; }
.sheet-actions .btn { flex: 1; }

/* ---------- toast + confetti ---------- */

.toast-wrap { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; width: calc(100% - 32px); max-width: 420px; }
.toast {
  background: #0a0b10; border: 1px solid var(--hairline-2); border-radius: 15px;
  padding: 13px 16px; box-shadow: var(--shadow); font-size: 14px; font-weight: 700;
  display: flex; align-items: center; gap: 11px;
  animation: drop .3s cubic-bezier(.2,.9,.25,1);
}
@keyframes drop { from { transform: translateY(-16px); opacity: 0; } }
.toast .em { font-size: 22px; }
.toast.win { border-color: rgba(200,249,74,.5); background: linear-gradient(120deg, #1c2214, #0a0b10); }
.toast small { display: block; font-weight: 600; color: var(--ink-3); font-size: 12px; margin-top: 2px; }

#confetti { position: fixed; inset: 0; pointer-events: none; z-index: 300; }

/* ---------- misc ---------- */

.empty { text-align: center; padding: 30px 16px; color: var(--ink-3); font-size: 13.5px; line-height: 1.6; }
.spinner {
  width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid rgba(0,0,0,.25);
  border-top-color: #10130a; animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-page { display: grid; place-items: center; min-height: 100dvh; color: var(--ink-3); font-weight: 700; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 620px; }
table.data th {
  text-align: left; font-size: 10.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--hairline); white-space: nowrap;
}
table.data td { padding: 11px 12px; border-bottom: 1px solid rgba(255,255,255,.05); vertical-align: middle; }
table.data td.n { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
table.data tr:hover td { background: rgba(255,255,255,.025); }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}
