:root {
  color-scheme: light;
  --bg: #f4f5f7;
  --panel: #ffffff;
  --ink: #202226;
  --muted: #707782;
  --line: #e0e4e8;
  --soft-line: #edf0f2;
  --accent: #009dff;
  --gain: #20a36b;
  --loss: #de4f45;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  width: 100%;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
}

body {
  overflow: hidden;
}

.shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  width: min(1560px, calc(100vw - 20px));
  height: 100dvh;
  margin: 0 auto;
  padding: 8px 0;
}

.totals article,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 1px 2px rgba(20, 24, 32, 0.04);
}

h1,
h2 {
  margin: 0;
  font-weight: 400;
}

h2 {
  font-size: 13px;
}

.totals {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.totals article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(72px, auto);
  grid-template-areas:
    "label delta"
    "value delta";
  align-items: center;
  column-gap: 12px;
  padding: 10px 12px;
}

.totals article.live-bump {
  animation: metric-bump 620ms ease-out;
}

.totals span,
.panel-head span,
.muted,
.stat-label {
  color: var(--muted);
}

.totals strong {
  grid-area: value;
  display: block;
  margin-top: 3px;
  font-size: clamp(22px, 3vw, 30px);
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.total-label {
  grid-area: label;
}

.total-value.ticker-roll {
  animation: ticker-roll 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
  transform-origin: center bottom;
  will-change: transform, opacity;
}

.total-delta {
  grid-area: delta;
  justify-self: end;
  min-width: 72px;
  color: var(--gain) !important;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  text-align: right;
  opacity: 0;
  transform: translateY(6px);
  white-space: nowrap;
  pointer-events: none;
}

.total-delta.has-value {
  opacity: 1;
  transform: none;
}

.content {
  display: grid;
  grid-template-columns: minmax(360px, 0.62fr) minmax(680px, 1.38fr);
  grid-template-rows: minmax(0, 1fr);
  grid-template-areas:
    "side graph";
  align-items: stretch;
  gap: 8px;
  height: 100%;
  min-height: 0;
}

.side-stack {
  grid-area: side;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  align-content: stretch;
  align-self: stretch;
  gap: 8px;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.graph-stack {
  grid-area: graph;
  display: grid;
  grid-template-rows: minmax(220px, 1fr) auto;
  align-self: stretch;
  gap: 8px;
  height: 100%;
  min-width: 0;
  min-height: 0;
}

.panel {
  min-height: 0;
  padding: 10px;
  overflow: hidden;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 28px;
  margin-bottom: 8px;
}

.join-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 6px;
  padding: 0 10px;
  background: #93e7c4;
  color: #081018;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.graph-head {
  align-items: flex-start;
}

.panel-title-stack {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.updated-at-label {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.control-stack {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 5px;
}

.range-control {
  position: relative;
  display: flex;
  align-items: center;
  gap: 5px;
}

.custom-range {
  position: absolute;
  top: calc(100% + 5px);
  right: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(20, 24, 32, 0.12);
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.custom-range[hidden] {
  display: none;
}

.custom-range::before {
  content: "";
  position: absolute;
  top: -6px;
  right: 18px;
  width: 10px;
  height: 10px;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: inherit;
  transform: rotate(45deg);
}

.custom-range-field {
  display: flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fbfbfa;
}

.custom-range-field input {
  width: 48px;
  min-height: 24px;
  border: 0;
  border-radius: 999px 0 0 999px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 12px;
  text-align: center;
}

.custom-range-field input:focus-visible {
  outline: none;
}

.custom-range:focus-within,
.custom-range:has(input.active) {
  border-color: color-mix(in srgb, var(--accent), var(--line) 36%);
  background: color-mix(in srgb, var(--accent), #fff 94%);
  box-shadow:
    0 8px 20px rgba(20, 24, 32, 0.12),
    0 0 0 2px color-mix(in srgb, var(--accent), transparent 82%);
}

.custom-range:has(input[aria-invalid="true"]) {
  border-color: color-mix(in srgb, var(--loss), var(--line) 24%);
  background: color-mix(in srgb, var(--loss), #fff 94%);
  box-shadow:
    0 8px 20px rgba(20, 24, 32, 0.12),
    0 0 0 2px color-mix(in srgb, var(--loss), transparent 84%);
}

.custom-range-unit {
  padding-right: 9px;
}

.custom-range-actions {
  display: flex;
  gap: 4px;
}

.custom-range-action {
  min-height: 26px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

.custom-range-action:hover,
.custom-range-action:focus-visible {
  border-color: var(--line);
  color: var(--ink);
}

.custom-range-action.primary {
  border-color: color-mix(in srgb, var(--accent), var(--line) 34%);
  background: color-mix(in srgb, var(--accent), #fff 90%);
  color: var(--ink);
}

.range-label,
.range-status {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
}

.range-status:empty,
.range-status[hidden] {
  display: none;
}

.toggle-group {
  display: flex;
  align-items: center;
}

.segmented,
.toggle-group select {
  min-height: 26px;
  border: 1px solid var(--line);
  background: #fbfbfa;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
}

.segmented {
  padding: 0 9px;
  cursor: pointer;
}

.toggle-group .segmented {
  border-radius: 0;
}

.toggle-group .segmented + .segmented {
  margin-left: -1px;
}

.toggle-group .segmented:first-child {
  border-radius: 999px 0 0 999px;
}

.toggle-group .segmented:last-child {
  border-radius: 0 999px 999px 0;
}

.toggle-group .segmented:focus-visible {
  position: relative;
  z-index: 1;
}

.segmented.active {
  position: relative;
  z-index: 1;
  border-color: color-mix(in srgb, var(--accent), var(--line) 36%);
  background: color-mix(in srgb, var(--accent), #fff 90%);
  color: var(--ink);
}

.segmented.open {
  position: relative;
  z-index: 2;
  border-color: color-mix(in srgb, var(--accent), var(--line) 36%);
  color: var(--ink);
}

.sound-toggle {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fafaf8;
  color: var(--muted);
  cursor: pointer;
}

.sound-toggle svg {
  width: 16px;
  height: 16px;
}

.sound-toggle path {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.sound-toggle[aria-pressed="true"] {
  border-color: color-mix(in srgb, var(--accent), var(--line) 36%);
  background: color-mix(in srgb, var(--accent), #fff 90%);
  color: var(--accent);
}

.leaderboard {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
  overflow: auto;
  max-height: calc(100% - 36px);
}

.leaderboard li {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) minmax(76px, auto);
  grid-template-areas:
    "rank name cost"
    "rank name tokens";
  gap: 3px 8px;
  align-items: center;
  min-height: 48px;
  padding: 7px 8px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--person-color, var(--line));
  border-radius: 7px;
  background: var(--panel);
}

.leaderboard li.selected {
  border-color: color-mix(in srgb, var(--person-color), var(--line) 40%);
  background: var(--person-fade, #f6fbff);
}

.leaderboard li span:first-child,
.person-name {
  color: var(--person-color, var(--muted));
}

.leaderboard li span:first-child {
  grid-area: rank;
}

.person-name {
  grid-area: name;
  display: block;
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.person-name strong {
  min-width: 0;
  display: block;
  font-weight: 500;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.person-name:hover,
.person-name:focus-visible {
  text-decoration: underline;
  outline: none;
}

.leaderboard li span:nth-child(3),
.leaderboard li span:nth-child(4) {
  justify-self: end;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.leaderboard li span:nth-child(3) {
  grid-area: tokens;
  color: var(--muted);
  font-size: 12px;
}

.leaderboard li span:nth-child(4) {
  grid-area: cost;
  font-size: 13px;
}

.leaderboard li.bump {
  border-color: color-mix(in srgb, var(--gain), var(--line) 50%);
  animation: row-bump 760ms ease-out;
}

.person-detail {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "title"
    "body";
  gap: 8px;
  align-items: stretch;
  height: 100%;
  min-height: 0;
}

.person-title {
  grid-area: title;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  padding: 1px 0 2px;
}

.person-heading {
  display: grid;
  min-width: 0;
}

.person-title strong {
  color: var(--person-color, var(--ink));
  font-size: 15px;
  font-weight: 500;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.personal-stat-body {
  grid-area: body;
  display: grid;
  grid-template-columns: minmax(320px, 1.08fr) minmax(250px, 0.92fr);
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-areas:
    "primary insights"
    "primary activity";
  gap: 8px;
  min-height: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--soft-line);
  border-radius: 6px;
  background: var(--soft-line);
}

.stat-grid-primary {
  grid-area: primary;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-self: stretch;
}

.stat {
  min-width: 0;
  padding: 9px 10px;
  background: #fbfcfd;
}

.stat-label {
  display: block;
  font-size: 10px;
  line-height: 1.1;
}

.stat strong {
  display: block;
  margin-top: 2px;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.stat-delta {
  display: block;
  min-height: 13px;
  margin-top: 2px;
  color: var(--gain);
  font-size: 10px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.stat-delta.empty {
  color: transparent;
}

.stat-delta.negative {
  color: var(--loss);
}

.stat-meta {
  color: var(--muted);
}

.personal-insights,
.personal-activity-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--person-color), var(--soft-line) 72%);
  border-radius: 6px;
  background: color-mix(in srgb, var(--person-color), var(--soft-line) 76%);
}

.personal-insights {
  grid-area: insights;
}

.personal-activity-strip {
  grid-area: activity;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-self: stretch;
}

.compact-stat {
  min-width: 0;
  padding: 8px 9px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.94)),
    var(--person-fade, #fbfcfd);
}

.compact-stat strong {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 14px;
  font-weight: 500;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.compact-stat .stat-meta {
  display: block;
  min-height: 13px;
  margin-top: 2px;
  font-size: 10px;
  line-height: 1.1;
  overflow-wrap: anywhere;
}

.graph-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.person-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.graph {
  display: grid;
  grid-template-rows: minmax(164px, 1fr) auto;
  gap: 8px;
  min-height: 0;
}

.graph svg {
  width: 100%;
  height: 100%;
  min-height: 164px;
}

.graph.graph-bump svg {
  animation: graph-bump 700ms ease-out;
}

.grid-line {
  stroke: var(--soft-line);
  stroke-width: 1;
}

.axis-line {
  stroke: var(--line);
  stroke-width: 1;
}

.axis-label {
  fill: var(--muted);
  font-size: 12px;
  letter-spacing: 0;
}

.axis-label.end {
  text-anchor: end;
}

.y-axis-label {
  font-size: 10px;
}

.line-label {
  font-size: 12px;
  letter-spacing: 0;
}

.dense-trace-line {
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 7;
}

.line-label-leader {
  fill: none;
  stroke-linecap: round;
  stroke-width: 1;
}

.activity-panel {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 0;
}

.activity-summary {
  display: grid;
  min-height: 0;
  overflow: hidden;
}

.activity-console {
  display: grid;
  grid-template-rows: repeat(var(--activity-row-count, 32), minmax(19px, 24px));
  align-content: start;
  gap: 2px;
  min-height: 0;
  height: 100%;
  padding: 8px;
  border: 1px solid #dfe5dc;
  border-radius: 7px;
  background: #f7f9f4;
  color: #243026;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.25;
  overflow: hidden;
}

.activity-line {
  display: grid;
  grid-template-columns: auto auto auto auto auto minmax(0, 1fr) max-content;
  align-items: center;
  min-width: 0;
  margin: 0;
  gap: 5px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-height: 0;
}

.activity-line::before {
  flex: 0 0 auto;
  color: var(--muted);
  content: ">";
}

.activity-line strong {
  flex: 0 0 auto;
  color: var(--person-color, var(--ink));
  font-weight: 500;
}

.activity-action {
  flex: 0 0 auto;
  color: #243026;
}

.activity-additions {
  flex: 0 0 auto;
  color: var(--gain);
}

.activity-deletions {
  flex: 0 0 auto;
  color: var(--loss);
}

.activity-context {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
}

.activity-time {
  justify-self: end;
  color: var(--muted);
}

.commit-indicators {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  overflow: hidden;
}

.commit-pop {
  position: fixed;
  min-width: 74px;
  transform: translate(-50%, -50%);
  animation: commit-pop 1500ms ease-out forwards;
  color: var(--gain);
  font-size: 13px;
  line-height: 1.1;
  text-align: center;
  text-shadow: 0 1px 0 var(--panel);
  white-space: nowrap;
}

.commit-pop[data-size="medium"] {
  font-size: 16px;
}

.commit-pop[data-size="large"] {
  font-size: 20px;
}

.commit-pop small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.onboarding-page {
  min-height: 100dvh;
  overflow: auto;
}

.onboarding-shell {
  display: grid;
  grid-template-rows: auto auto;
  align-content: start;
  gap: 8px;
  width: min(520px, calc(100vw - 20px));
  min-height: 100dvh;
  margin: 0 auto;
  padding: clamp(8px, 2.5vh, 18px) 0 24px;
}

.onboarding-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 2px;
}

.brand-link,
.dashboard-link {
  color: var(--ink);
  text-decoration: none;
}

.brand-link {
  font-size: 15px;
  font-weight: 500;
}

.dashboard-link {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 10px;
  background: #fbfbfa;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-link:hover,
.dashboard-link:focus-visible {
  border-color: color-mix(in srgb, var(--accent), var(--line) 36%);
  color: var(--ink);
}

.onboarding-panel {
  display: grid;
  gap: 14px;
  align-self: start;
  padding: 14px;
}

.onboarding-head {
  display: grid;
  gap: 6px;
}

.onboarding-head h1 {
  font-size: clamp(26px, 5vw, 36px);
  line-height: 1;
  letter-spacing: 0;
}

.onboarding-head p {
  max-width: 58ch;
  margin: 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}

.onboarding-updated {
  line-height: 1.2;
}

.stack {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.onboarding-page input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfbfa;
  color: var(--ink);
  padding: 10px 12px;
  font: inherit;
  font-size: 16px;
  outline: none;
}

.onboarding-page input::placeholder {
  color: #9aa2ad;
}

.onboarding-page input:hover {
  border-color: #cbd2da;
}

.onboarding-page input:focus-visible {
  border-color: color-mix(in srgb, var(--accent), var(--line) 22%);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent), transparent 82%);
}

.onboarding-page input:invalid:not(:placeholder-shown) {
  border-color: color-mix(in srgb, var(--loss), var(--line) 24%);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.onboarding-page button {
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 0 14px;
  background: #93e7c4;
  color: #081018;
  font: inherit;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.onboarding-page button:hover,
.onboarding-page button:focus-visible {
  background: #7ddfb7;
}

.onboarding-page button:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent), transparent 65%);
  outline-offset: 2px;
}

.onboarding-page button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.onboarding-page button.secondary {
  border-color: var(--line);
  background: #fbfbfa;
  color: var(--ink);
}

.onboarding-page button.secondary:hover,
.onboarding-page button.secondary:focus-visible {
  border-color: color-mix(in srgb, var(--accent), var(--line) 36%);
  background: color-mix(in srgb, var(--accent), #fff 92%);
}

#result:empty {
  display: none;
}

.status-card {
  display: grid;
  gap: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcfd;
}

.status-card p {
  margin: 0;
  line-height: 1.45;
}

.status-card.pending {
  border-color: color-mix(in srgb, var(--accent), var(--line) 40%);
  background: color-mix(in srgb, var(--accent), #fff 94%);
}

.status-card.error {
  border-color: color-mix(in srgb, var(--loss), var(--line) 35%);
  background: color-mix(in srgb, var(--loss), #fff 93%);
  color: #7a211b;
}

.status-card.approved {
  border-color: color-mix(in srgb, var(--gain), var(--line) 36%);
  background: color-mix(in srgb, var(--gain), #fff 94%);
}

.approval-code {
  display: inline-flex;
  width: fit-content;
  border: 1px solid color-mix(in srgb, var(--gain), var(--line) 34%);
  border-radius: 7px;
  padding: 8px 10px;
  background: #fff;
  color: var(--ink);
  font-size: 24px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  letter-spacing: 0;
}

.onboarding-page pre {
  margin: 0;
  border: 1px solid #dfe5dc;
  border-radius: 7px;
  padding: 12px;
  background: #f7f9f4;
  color: #243026;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

@keyframes commit-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -30%) scale(0.94);
  }

  18% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(-50%, -118%) scale(1.05);
  }
}

@keyframes metric-bump {
  0% {
    border-color: var(--line);
    transform: translateY(0);
  }

  28% {
    border-color: color-mix(in srgb, var(--accent), var(--line) 32%);
    transform: translateY(-1px);
    box-shadow: 0 6px 18px rgba(0, 157, 255, 0.12);
  }

  100% {
    border-color: var(--line);
    transform: translateY(0);
  }
}

@keyframes ticker-roll {
  0% {
    opacity: 0.72;
    transform: translateY(0.38em);
  }

  38% {
    opacity: 1;
    transform: translateY(-0.08em);
  }

  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes row-bump {
  0% {
    background: var(--panel);
    transform: translateX(0);
  }

  24% {
    background: var(--person-fade, #f6fbff);
    transform: translateX(2px);
  }

  100% {
    background: var(--panel);
    transform: translateX(0);
  }
}

@keyframes graph-bump {
  0% {
    transform: scale(1);
  }

  30% {
    transform: scale(1.006);
  }

  100% {
    transform: scale(1);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

@media (max-width: 980px) {
  body {
    overflow: auto;
  }

  .shell {
    height: auto;
    min-height: 100dvh;
  }

  .content {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    grid-template-areas:
      "side"
      "graph";
  }

  .side-stack {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
    align-content: start;
  }

  .activity-panel {
    min-height: 0;
  }

  .graph-stack {
    grid-template-rows: auto auto;
  }

  .person-detail {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto;
  }

  .personal-stat-body {
    grid-template-columns: 1fr;
    grid-template-rows: auto auto auto;
    grid-template-areas:
      "primary"
      "insights"
      "activity";
  }

  .graph svg {
    min-height: 220px;
  }

}

@media (max-width: 700px) {
  .shell {
    width: min(100vw - 12px, 1560px);
    gap: 6px;
    padding: 6px 0;
  }

  .totals,
  .side-stack {
    grid-template-columns: 1fr;
    gap: 6px;
  }

  .content {
    gap: 6px;
  }

  .panel {
    padding: 8px;
  }

  .leaderboard li {
    grid-template-columns: 30px minmax(0, 1fr);
    grid-template-areas:
      "rank name"
      "rank name"
      ". cost"
      ". tokens";
    gap: 4px 8px;
    padding: 7px 8px;
  }

  .leaderboard li span:nth-child(3),
  .leaderboard li span:nth-child(4) {
    justify-self: start;
    text-align: left;
  }

  .graph-head {
    display: grid;
  }

  .control-stack {
    justify-content: start;
  }

  .range-control {
    width: 100%;
    flex-wrap: wrap;
  }

  .custom-range {
    position: static;
    grid-template-columns: minmax(0, 1fr) auto;
    width: 100%;
    margin-top: 1px;
  }

  .custom-range::before {
    display: none;
  }

  .custom-range-field input {
    width: 50px;
  }

  .segmented {
    padding: 0 8px;
  }

  .totals article {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "label"
      "value"
      "delta";
    row-gap: 4px;
  }

  .total-delta {
    justify-self: start;
    min-width: 0;
  }

  .personal-activity-strip {
    grid-template-columns: 1fr;
  }

  .graph svg {
    min-height: 240px;
  }

}

@media (max-width: 520px) {
  .onboarding-shell {
    width: min(100% - 16px, 760px);
    padding: 8px 0 16px;
  }

  .onboarding-top {
    min-height: 38px;
  }

  .onboarding-panel {
    padding: 12px;
  }

  .onboarding-head h1 {
    font-size: 32px;
  }

  .onboarding-page .actions,
  .onboarding-page button {
    width: 100%;
  }
}
