main.weight-index-screen {
  min-height: 100dvh;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: var(--app-width);
  margin: 0 auto;
  padding: 0;
  padding-bottom: calc(env(safe-area-inset-bottom) + 80px);
  align-items: stretch !important;
  justify-content: flex-start;
}

.weight-index-screen header {
  position: static;
  padding: 0;
}

html:has(main.weight-entry-screen),
body:has(main.weight-entry-screen) {
  overflow: hidden;
}

.weight-date-pill {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  min-height: 44px;
  background: var(--gray-900);
  border: 1px solid var(--gray-800);
  border-radius: 999px;
  color: var(--gray-300);
  font-size: var(--type-label);
  font-weight: 600;
  font-family: var(--font-mono);
  cursor: pointer;
  margin-bottom: var(--space-5);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.weight-date-pill:hover {
  background: var(--gray-800);
  color: var(--text);
}

.weight-date-pill:active {
  border-color: var(--gray-700);
}

.weight-date-pill svg:last-child {
  color: var(--gray-500);
}

.weight-step-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--gray-900);
  border: 1px solid var(--gray-800);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

.weight-step-btn:hover {
  background: var(--gray-800);
  border-color: var(--gray-700);
}

.weight-step-btn:active {
  transform: scale(0.92);
  background: var(--gray-800);
  border-color: var(--blue-500);
}

.weight-stepper-value {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: var(--space-2);
  min-width: 0;
  max-width: 100%;
}

.weight-stepper-caption {
  margin: var(--space-2) 0 0;
  font-size: var(--type-label);
  font-weight: 500;
  color: var(--gray-500);
  font-family: var(--font-mono);
  min-height: 1.2em;
}

.weight-stepper-value .weight-value-input {
  width: 5ch;
  max-width: 100%;
  background: none;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: var(--type-display);
  font-weight: 700;
  letter-spacing: -0.03em;
  text-align: center;
  caret-color: var(--blue-500);
  -moz-appearance: textfield;
  appearance: textfield;
}

.weight-stepper-value .weight-value-input:focus {
  outline: none;
  background: none;
  border: none;
  box-shadow: none;
}

.weight-stepper-value .weight-value-input::-webkit-outer-spin-button,
.weight-stepper-value .weight-value-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.weight-stepper-unit {
  font-size: var(--type-heading);
  font-weight: 500;
  color: var(--gray-500);
  font-family: var(--font-mono);
}

.weight-entry-errors {
  margin: 0 var(--space-6) var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: color-mix(in srgb, var(--danger) 8%, transparent);
  border: 1px solid color-mix(in srgb, var(--danger) 25%, transparent);
  border-radius: var(--radius-md);
}

.weight-entry-errors p {
  margin: 0;
  color: var(--danger);
  font-size: var(--type-label);
  font-family: var(--font-mono);
}

.weight-calendar-modal {
  position: fixed;
  inset: 0;
  max-width: var(--app-width);
  margin: 0 auto;
  z-index: 200;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.weight-calendar-modal.open {
  opacity: 1;
  pointer-events: auto;
}

.weight-calendar-backdrop {
  position: absolute;
  inset: 0;
  background: var(--backdrop);
}

.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 0;
}

.weight-index-screen .weight-index-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  padding: calc(env(safe-area-inset-top) + var(--space-5)) var(--space-4) var(--space-4);
  flex-shrink: 0;
}

.weight-index-title {
  font-size: var(--type-title);
  font-weight: 700;
  color: var(--text);
  margin: 0;
}

.weight-chart-wrap {
  padding: var(--space-2) 0;
  background: var(--bg);
}

.weight-chart-svg {
  width: 100%;
  height: 160px;
  display: block;
}

.weight-current-display {
  padding: var(--space-8) var(--space-6) var(--space-4);
  text-align: center;
}

.weight-current-value {
  font-size: var(--type-display);
  font-weight: 700;
  color: var(--text);
  margin: 0 0 var(--space-2);
  font-family: var(--font-mono);
  letter-spacing: -0.03em;
}

.weight-current-change {
  font-size: var(--type-body);
  font-weight: 500;
  margin: 0;
  font-family: var(--font-mono);
}

.weight-current-change.positive {
  color: var(--blue-500);
}

.weight-current-change.negative {
  color: var(--danger);
}

.weight-entry-list {
  padding: var(--space-2) var(--space-4) 0;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.weight-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: var(--gray-900);
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-lg);
  padding: var(--space-4) var(--space-5);
  min-height: 60px;
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.weight-list-row:hover {
  border-color: var(--gray-700);
  color: var(--text);
}

.weight-list-row:active {
  background: var(--gray-800);
}

.weight-list-chevron {
  color: var(--gray-600);
  flex-shrink: 0;
}

.weight-list-date {
  font-size: var(--type-body);
  font-weight: 500;
  color: var(--text);
  font-family: var(--font-mono);
}

.weight-list-right {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.weight-list-value {
  font-size: var(--type-body);
  color: var(--gray-400);
  font-family: var(--font-mono);
}

.weight-fab {
  position: fixed;
  bottom: calc(84px + env(safe-area-inset-bottom));
  right: calc(var(--app-gutter) + var(--space-5));
  width: 52px;
  height: 52px;
  background: var(--btn-primary-bg);
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--btn-primary-text);
  box-shadow: 0 4px 14px var(--shadow-color);
  transition: transform 0.1s ease;
  z-index: 50;
}

.weight-fab:hover {
  color: var(--btn-primary-text);
  transform: translateY(-1px);
}

.weight-fab:active {
  transform: scale(0.96);
}

.weight-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-5);
  padding: var(--space-16) var(--space-6);
  color: var(--gray-500);
  font-size: var(--type-body);
  text-align: center;
}

.weight-chart-region {
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.35s ease;
  max-height: 400px;
  opacity: 1;
  transform: translateY(0);
  overflow: hidden;
}

.weight-table-region {
  transition: opacity 0.3s ease, transform 0.3s ease, max-height 0.35s ease;
  max-height: 0;
  opacity: 0;
  transform: translateY(-12px);
  overflow: hidden;
  pointer-events: none;
}

.weight-list-region {
  transition: opacity 0.25s ease;
  opacity: 1;
}

[data-view="table"] .weight-chart-region {
  max-height: 0;
  opacity: 0;
  transform: translateY(-8px);
}

[data-view="table"] .weight-table-region {
  max-height: 2000px;
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

[data-view="table"] .weight-list-region {
  opacity: 0;
  pointer-events: none;
}

.weight-table-wrap {
  padding: var(--space-3) var(--space-4) var(--space-4);
}

.weight-weeks {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.wt-week {
  border: 1px solid var(--gray-800);
  border-radius: var(--radius-lg);
  background: var(--gray-900);
  overflow: hidden;
}

.wt-summary-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 64px 56px;
  gap: var(--space-2);
  align-items: center;
  width: 100%;
  min-height: 52px;
  padding: 0 var(--space-4) 0 var(--space-3);
  border: none;
  background: none;
  color: var(--gray-500);
  font: inherit;
  font-size: var(--type-label);
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.wt-col-week {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--gray-600);
  font-size: var(--type-caption);
  font-weight: 500;
}

.wt-col-week::after {
  content: "";
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4.5px solid var(--gray-600);
  transition: transform 0.22s ease;
}

.wt-summary-row--open .wt-col-week::after {
  transform: rotate(180deg);
}

.wt-col-period {
  color: var(--gray-400);
  font-size: var(--type-caption);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.wt-col-avg {
  color: var(--text);
  font-size: var(--type-label);
  font-weight: 700;
  text-align: right;
}

.wt-col-diff {
  font-weight: 700;
  text-align: right;
}

.wt-diff-up { color: var(--blue-500); }
.wt-diff-down { color: var(--danger); }
.wt-diff-neutral { color: var(--gray-500); }
.wt-empty { color: var(--gray-700); font-weight: 400; }

.wt-detail-grid {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.26s ease;
}

.wt-detail-row--open .wt-detail-grid {
  grid-template-rows: 1fr;
}

.wt-detail-inner {
  overflow: hidden;
}

.wt-detail-days {
  display: flex;
  padding: var(--space-3) var(--space-3) var(--space-4);
}

.wt-day-pill {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 0;
}

.wt-day-name {
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gray-600);
}

.wt-day-value {
  font-size: var(--type-label);
  font-weight: 600;
}

.wt-day-pill--has-value .wt-day-value { color: var(--text); }
.wt-day-pill--empty     .wt-day-value { color: var(--gray-700); }

.weight-calendar-sheet {
  position: relative;
  z-index: 1;
  background: var(--bg);
  border-top: 1px solid var(--gray-800);
  border-radius: 24px 24px 0 0;
  padding: var(--space-3) var(--space-4);
  padding-bottom: calc(var(--space-4) + env(safe-area-inset-bottom));
  transform: translateY(30px);
  transition: transform 0.3s ease;
  user-select: none;
  -webkit-user-select: none;
}

.weight-calendar-modal.open .weight-calendar-sheet {
  transform: translateY(0);
}

.weight-calendar-sheet .pi-sheet-header {
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--gray-800);
}

.cal-nav {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.cal-month-year {
  flex: 1;
  font-size: var(--type-heading);
  font-weight: 500;
  color: var(--text);
}

.cal-prev,
.cal-next {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  background: none;
  border: none;
  color: var(--gray-400);
  cursor: pointer;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

.cal-next:disabled {
  color: var(--gray-700);
  cursor: default;
}

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

.cal-header {
  padding: var(--space-2) 0;
  font-size: var(--type-body);
  font-weight: 500;
  color: var(--text);
  text-align: center;
}

.cal-day {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 1;
  max-height: 46px;
  border-radius: 50%;
  font-size: var(--type-body);
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s ease;
  -webkit-tap-highlight-color: transparent;
}

.cal-day:not(.cal-future):not(.cal-outside):hover {
  background: var(--gray-800);
}

.cal-day.cal-future,
.cal-day.cal-outside {
  color: var(--gray-500);
  cursor: default;
}

.cal-day.cal-today {
  font-weight: 700;
}

.cal-day.cal-selected {
  background: var(--btn-primary-bg);
  color: var(--btn-primary-text);
  font-weight: 700;
}

.cal-today-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 56px;
  margin-top: var(--space-4);
  border: none;
  border-radius: var(--radius-lg);
  background: var(--gray-800);
  color: var(--text);
  font-size: var(--type-body);
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.weight-sheet .pi-panel {
  background: var(--bg);
}

.weight-sheet-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
}

.weight-sheet-form .weight-date-pill {
  margin: 0 auto;
}

.weight-sheet-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  width: 100%;
  margin-top: var(--space-2);
}

.weight-sheet .weight-step-btn {
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.weight-sheet .weight-stepper-value {
  flex: 1;
  max-width: 200px;
}

.weight-sheet .weight-value-input {
  font-size: var(--type-display);
}

.weight-sheet .weight-stepper-caption {
  min-height: 1.25rem;
  margin: 0;
}

.weight-sheet .pi-btn-save {
  width: 100%;
  margin-top: var(--space-3);
}

.weight-entry-trash {
  color: var(--danger);
}

.weight-entry-trash--hidden {
  visibility: hidden;
}

body {
  --weigh-in: var(--green-500);
}

.weight-chart-area {
  opacity: 0;
  animation: wc-fade 0.9s ease-out 0.55s forwards;
}

.weight-chart-glow,
.weight-chart-line {
  stroke-dasharray: 1;
  stroke-dashoffset: 1;
  animation: wc-draw 1.4s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.weight-chart-glow {
  animation-delay: 0.05s;
}

.weight-chart-label,
.weight-chart-grid {
  opacity: 0;
  animation: wc-fade 0.6s ease-out 0.3s forwards;
}

.weight-chart-dot,
.weight-chart-halo {
  transform-box: fill-box;
  transform-origin: center;
}

.weight-chart-dot {
  transform: scale(0);
  animation: wc-pop 0.45s cubic-bezier(0.2, 1.4, 0.4, 1) 1.3s forwards;
}

.weight-chart-halo {
  opacity: 0;
  animation: wc-halo 2.4s ease-out 1.6s infinite;
}

.weight-current-display,
.weight-current-change {
  animation: wi-rise 0.6s ease-out both;
}

.weight-current-change {
  animation-delay: 0.35s;
}

.weigh-years {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  padding: var(--space-4) var(--space-4) var(--space-6);
}

.weigh-year {
  animation: wi-rise 0.6s ease-out 0.2s both;
}

.weigh-year-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: var(--space-3);
}

.weigh-year-title {
  margin: 0;
  font-size: var(--type-heading);
  font-weight: 700;
  color: var(--text);
}

.weigh-year-count {
  font-size: var(--type-label);
  color: var(--gray-500);
}

.weigh-year-card {
  padding: var(--space-4) var(--space-3) var(--space-3);
  border-radius: 16px;
  background: var(--gray-900);
  border: 1px solid var(--gray-800);
}

.weigh-grid {
  display: block;
  width: 100%;
  height: auto;
}

.wg-cell {
  fill: var(--gray-800);
}

.wg-cell--on {
  fill: var(--weigh-in);
  transform-box: fill-box;
  transform-origin: center;
  transform: scale(0);
  animation: wc-pop 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) calc(0.4s + var(--i, 0) * 18ms) forwards;
}

.weigh-months {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: var(--type-caption);
  color: var(--gray-500);
}

.weight-list-row {
  animation: wi-rise 0.5s ease-out calc(0.3s + var(--i, 0) * 45ms) both;
}

@keyframes wc-draw {
  to { stroke-dashoffset: 0; }
}

@keyframes wc-fade {
  to { opacity: 1; }
}

@keyframes wc-pop {
  to { transform: scale(1); }
}

@keyframes wc-halo {
  0% { opacity: 0.5; transform: scale(1); }
  70% { opacity: 0; transform: scale(3.2); }
  100% { opacity: 0; transform: scale(3.2); }
}

@keyframes wi-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
  .weight-chart-area,
  .weight-chart-glow,
  .weight-chart-line,
  .weight-chart-label,
  .weight-chart-grid,
  .weight-chart-dot,
  .weight-chart-halo,
  .weight-current-display,
  .weight-current-change,
  .weigh-year,
  .wg-cell--on,
  .weight-list-row {
    animation: none;
    opacity: 1;
    transform: none;
    stroke-dashoffset: 0;
  }

  .weight-chart-halo {
    opacity: 0;
  }
}

.weight-streak-stats {
  display: flex;
  gap: var(--space-4);
  margin-left: auto;
}

.weight-streak-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.weight-streak-stat b {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  height: 18px;
  font-size: var(--type-body);
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.weight-streak-stat b svg {
  color: #f97316;
}

.weight-streak-stat span {
  font-size: var(--type-caption);
  letter-spacing: 0.06em;
  margin-right: -0.06em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.weight-saved .pi-panel {
  overflow: hidden;
}

.weight-saved--celebrating .pi-panel {
  min-height: 460px;
}

.weight-saved--month .pi-panel {
  min-height: 540px;
}

.weight-celebrate > * {
  flex-shrink: 0;
}

.weight-saved .weight-date-pill,
.weight-saved-btn {
  pointer-events: none;
}

.weight-step-btn--quiet {
  opacity: 0.35;
}

.weight-saved-value {
  display: inline-block;
  min-width: 3ch;
  text-align: center;
}

.weight-saved-stage {
  display: grid;
}

.weight-saved-stage > * {
  grid-area: 1 / 1;
}

.weight-saved-btn {
  display: flex;
  align-items: center;
  justify-content: center;
}

.play .weight-saved-btn {
  animation: saved-press 0.3s ease both;
}

.play .weight-saved-form {
  animation: saved-form-out 0.34s ease 0.28s both;
}

.weight-saved-moment {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  text-align: center;
  opacity: 0;
  pointer-events: none;
}

.play .weight-saved-moment {
  animation: streak-appear 0.3s ease 0.55s both;
}

.weight-saved-badge {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: color-mix(in srgb, #f97316 16%, transparent);
  color: #f97316;
  opacity: 0;
}

.weight-saved-badge--done {
  background: color-mix(in srgb, var(--green-500) 16%, transparent);
  color: var(--green-500);
}

.play .weight-saved-badge {
  animation: streak-pop 0.6s cubic-bezier(0.2, 1.5, 0.4, 1) 0.6s both;
}

.weight-saved-count {
  margin: var(--space-2) 0 0;
  font-size: var(--type-display);
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.weight-saved-caption {
  margin: 0;
  font-size: var(--type-body);
  font-weight: 600;
  color: var(--gray-400);
}

.weight-saved-note {
  margin: var(--space-3) 0 0;
  font-size: var(--type-label);
  color: var(--gray-500);
}

.play .weight-saved-count,
.play .weight-saved-caption,
.play .weight-saved-note {
  animation: streak-rise 0.4s ease 0.75s both;
}

.weight-saved.closing {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease 0.04s;
}

.weight-saved.closing .pi-panel {
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.4, 0, 1, 1);
}

@keyframes saved-press {
  0% { transform: scale(1); }
  45% { transform: scale(0.96); }
  100% { transform: scale(1); }
}

@keyframes saved-form-out {
  from { opacity: 1; transform: translateY(0) scale(1); }
  to { opacity: 0; transform: translateY(12px) scale(0.97); visibility: hidden; }
}

.weight-streak-pips {
  display: flex;
  gap: 6px;
  margin-top: var(--space-2);
}

.weight-streak-pips i {
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--gray-800);
}

.weight-streak-pips i.is-on {
  background: #f97316;
  opacity: 0;
}

.play .weight-streak-pips i.is-on {
  animation: streak-pip 0.35s cubic-bezier(0.2, 1.4, 0.4, 1) both;
  animation-delay: calc(0.9s + var(--i) * 0.1s);
}

@keyframes streak-pop {
  0% { transform: scale(0.4); opacity: 0; }
  60% { transform: scale(1.25); opacity: 1; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes streak-pip {
  from { transform: scale(0.2); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes streak-rise {
  from { transform: translateY(6px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.weight-celebrate {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-5);
  text-align: center;
  background: var(--bg);
  opacity: 0;
}

.play .weight-celebrate {
  animation: streak-appear 0.4s ease 0.5s both;
}

@keyframes streak-appear {
  from { opacity: 0; }
  to { opacity: 1; }
}

.weight-saved--month .weight-celebrate {
  background: radial-gradient(circle at 50% 38%, color-mix(in srgb, var(--green-500) 22%, transparent), transparent 60%), var(--bg);
}

.weight-celebrate-ring {
  position: relative;
  display: grid;
  place-items: center;
  width: 156px;
  height: 156px;
  margin-bottom: var(--space-4);
}

.weight-saved--month .weight-celebrate-ring {
  width: 176px;
  height: 176px;
}

.weight-celebrate-track {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.weight-celebrate-track circle {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
}

.weight-celebrate-base {
  stroke: var(--gray-800);
}

.weight-celebrate-arc {
  stroke: var(--green-500);
  stroke-dasharray: 377;
  stroke-dashoffset: 377;
}

.play .weight-celebrate-arc {
  animation: streak-draw 1.1s cubic-bezier(0.3, 0, 0.2, 1) 0.7s forwards;
}

@keyframes streak-draw {
  to { stroke-dashoffset: 0; }
}

.weight-celebrate-big {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: var(--type-display);
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--text);
  opacity: 0;
}

.weight-saved--month .weight-celebrate-big {
  font-size: var(--type-display);
}

.weight-celebrate-big small {
  margin-top: 6px;
  font-size: var(--type-caption);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray-500);
}

.weight-celebrate-flame {
  margin-bottom: 4px;
  color: #f97316;
}

.play .weight-celebrate-big {
  animation: streak-pop 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) 0.9s both;
}

.weight-celebrate-spark {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 3px;
  height: 14px;
  border-radius: 2px;
  background: var(--green-500);
  opacity: 0;
  transform-origin: 50% 0;
  transform: rotate(var(--a)) translateY(66px);
}

.play .weight-celebrate-spark {
  animation: streak-spark 0.8s ease-out 1.7s both;
}

@keyframes streak-spark {
  0% { opacity: 0; transform: rotate(var(--a)) translateY(60px) scaleY(0.4); }
  30% { opacity: 1; }
  100% { opacity: 0; transform: rotate(var(--a)) translateY(96px) scaleY(1); }
}

.weight-celebrate-title {
  margin: 0;
  font-size: var(--type-heading);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  opacity: 0;
}

.weight-saved--month .weight-celebrate-title {
  font-size: var(--type-title);
}

.weight-celebrate-sub {
  max-width: 26ch;
  margin: var(--space-2) 0 0;
  font-size: var(--type-label);
  line-height: 1.5;
  color: var(--gray-500);
  opacity: 0;
}

.play .weight-celebrate-title {
  animation: streak-rise 0.5s ease 1.3s both;
}

.play .weight-celebrate-sub {
  animation: streak-rise 0.5s ease 1.5s both;
}

.weight-celebrate-badge {
  display: inline-flex;
  align-items: center;
  margin-top: var(--space-3);
  padding: 5px var(--space-3);
  border-radius: 999px;
  background: color-mix(in srgb, var(--green-500) 18%, transparent);
  font-size: var(--type-caption);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--green-500);
  opacity: 0;
}

.play .weight-celebrate-badge {
  animation: streak-rise 0.5s ease 1.6s both;
}

.weight-celebrate-btn {
  display: grid;
  place-items: center;
  min-height: 44px;
  margin-top: var(--space-5);
  padding: 0 var(--space-6);
  border: 1px solid var(--gray-800);
  border-radius: 999px;
  background: var(--gray-900);
  color: var(--text);
  font: inherit;
  font-size: var(--type-label);
  font-weight: 600;
  cursor: pointer;
  opacity: 0;
  -webkit-tap-highlight-color: transparent;
}

.play .weight-celebrate-btn {
  animation: streak-rise 0.5s ease 1.8s both;
}

.weight-celebrate-glow {
  position: absolute;
  left: 50%;
  top: 42%;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, color-mix(in srgb, var(--green-500) 35%, transparent), transparent 65%);
  opacity: 0;
}

.play .weight-celebrate-glow {
  animation: streak-glow 1.6s ease-out 0.8s both;
}

@keyframes streak-glow {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.4); }
  50% { opacity: 1; }
  100% { opacity: 0.55; transform: translate(-50%, -50%) scale(1.1); }
}

.weight-celebrate-confetti {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.streak-confetti {
  position: absolute;
  top: -12px;
  left: var(--x);
  width: 7px;
  height: 11px;
  border-radius: 2px;
  background: var(--c);
  opacity: 0;
}

.play .streak-confetti {
  animation: streak-fall var(--d) cubic-bezier(0.2, 0.6, 0.4, 1) var(--delay) both;
}

@keyframes streak-fall {
  0% { opacity: 0; transform: translateY(0) rotate(0deg); }
  10% { opacity: 1; }
  100% { opacity: 0; transform: translateY(420px) rotate(var(--r)); }
}

@media (prefers-reduced-motion: reduce) {
  .weight-saved-form {
    visibility: hidden;
    animation: none;
  }

  .weight-saved-badge,
  .weight-saved-moment,
  .weight-streak-pips i.is-on,
  .weight-celebrate,
  .weight-celebrate-big,
  .weight-celebrate-title,
  .weight-celebrate-sub,
  .weight-celebrate-badge,
  .weight-celebrate-btn {
    opacity: 1;
    animation: none;
  }

  .weight-celebrate-arc {
    stroke-dashoffset: 0;
  }
}

.weight-controls {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4) var(--space-3);
}

.weight-views {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  background: var(--gray-900);
  border-radius: var(--radius-md);
}

.weight-view-tab {
  min-height: 38px;
  border: none;
  border-radius: calc(var(--radius-md) - 3px);
  background: none;
  color: var(--gray-500);
  font-family: var(--font-mono);
  font-size: var(--type-label);
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.weight-view-tab[aria-selected="true"] {
  background: var(--gray-800);
  color: var(--text);
  box-shadow: 0 1px 2px var(--shadow-color);
}

.weight-periods {
  display: flex;
  gap: var(--space-2);
}

.weight-period-chip {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 var(--space-3);
  border: 1px solid var(--gray-800);
  border-radius: 999px;
  color: var(--gray-500);
  font-family: var(--font-mono);
  font-size: var(--type-label);
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.weight-period-chip:hover {
  color: var(--text);
}

.weight-period-chip[aria-current="true"],
.weight-period-chip[aria-current="true"]:hover {
  background: var(--text);
  border-color: var(--text);
  color: var(--bg);
}

.weight-today {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin: var(--space-4) var(--space-4) 0;
  padding: var(--space-3) var(--space-3) var(--space-3) var(--space-4);
  background: var(--gray-900);
  border: 1.5px solid transparent;
  border-radius: var(--radius-lg);
  color: var(--text);
  text-decoration: none;
}

.weight-today:hover {
  color: var(--text);
}

.weight-today--empty {
  background: none;
  border: 1.5px dashed var(--gray-700);
}

.weight-today-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.weight-today-label {
  font-size: var(--type-caption);
  font-weight: 600;
  color: var(--gray-500);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.weight-today-value {
  font-size: var(--type-body);
  font-weight: 700;
}

.weight-today--empty .weight-today-value {
  color: var(--gray-500);
  font-weight: 600;
}

.weight-today-action {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  padding: 0 var(--space-4);
  border-radius: 999px;
  background: var(--blue-500);
  color: #fff;
  font-size: var(--type-label);
  font-weight: 700;
  white-space: nowrap;
}

.weight-current-since {
  color: inherit;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

.weight-current-since:hover {
  color: inherit;
}
