* { box-sizing: border-box; }

:root {
  --bg: #f5f7ee;
  --text: #152018;
  --muted: #667064;
  --card: rgba(255,255,255,.82);
  --line: rgba(21,32,24,.12);
  --green: #16a34a;
  --red: #ef4444;
  --yellow: #f59e0b;
  --lime: #a3e635;
  --dark: #111827;
  --shadow: 0 24px 80px rgba(17,24,39,.12);
}

body {
  margin: 0;
  font-family: Inter, Arial, sans-serif;
  background:
    radial-gradient(circle at 15% 10%, rgba(163,230,53,.35), transparent 28%),
    radial-gradient(circle at 85% 20%, rgba(45,212,191,.24), transparent 24%),
    linear-gradient(135deg, #f8fafc, var(--bg));
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

.bg-blob {
  position: fixed;
  width: 340px;
  height: 340px;
  border-radius: 999px;
  filter: blur(30px);
  opacity: .35;
  z-index: -1;
  animation: float 9s ease-in-out infinite;
}

.bg-blob.one {
  left: -120px;
  top: 260px;
  background: #bef264;
}

.bg-blob.two {
  right: -130px;
  bottom: 80px;
  background: #5eead4;
  animation-delay: -3s;
}

@keyframes float {
  0%,100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-28px) scale(1.08); }
}

.shell {
  width: min(1440px, calc(100% - 28px));
  margin: 0 auto;
  padding: 28px 0 70px;
}

.hero {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 24px;
}

.eyebrow {
  font-weight: 900;
  color: #3f6212;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-size: 12px;
}

h1 {
  font-size: clamp(42px, 7vw, 92px);
  line-height: .9;
  margin: 12px 0 18px;
  letter-spacing: -0.07em;
}

h2, h3 { margin: 0 0 12px; }

.hero p {
  max-width: 800px;
  color: var(--muted);
  font-size: 20px;
  line-height: 1.5;
}

.scale-card, .card, .stat-card {
  background: var(--card);
  backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.7);
  box-shadow: var(--shadow);
  border-radius: 32px;
}

.scale-card {
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 230px;
}

.scale-face {
  font-size: 72px;
  animation: wiggle 2.8s ease-in-out infinite;
}

@keyframes wiggle {
  0%,100% { transform: rotate(0); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(7deg); }
  60% { transform: rotate(-4deg); }
}

.scale-card strong {
  font-size: 24px;
  margin: 12px 0 8px;
}

.scale-card span, .muted {
  color: var(--muted);
  line-height: 1.45;
}

.auth-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  align-items: start;
}

.auth-card, .profile-card, .board-card {
  padding: 24px;
}

label {
  display: grid;
  gap: 8px;
  font-weight: 800;
  font-size: 14px;
  margin: 14px 0;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255,255,255,.92);
  border-radius: 18px;
  padding: 14px 15px;
  font: inherit;
  outline: none;
}

input:focus {
  border-color: #84cc16;
  box-shadow: 0 0 0 4px rgba(132,204,22,.18);
}

button {
  border: 0;
  border-radius: 18px;
  background: var(--dark);
  color: white;
  padding: 14px 18px;
  font-weight: 900;
  cursor: pointer;
  transition: .18s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px rgba(17,24,39,.2);
}

button.ghost {
  background: rgba(17,24,39,.07);
  color: var(--dark);
  box-shadow: none;
}

button.danger {
  color: #991b1b;
  background: rgba(239,68,68,.12);
}

.two-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.hidden { display: none !important; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin: 10px 0 18px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

.stat-card {
  padding: 24px;
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 10px;
}

.stat-card strong {
  display: block;
  font-size: clamp(32px, 5vw, 58px);
  letter-spacing: -0.05em;
}

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

.stat-card.good {
  background: linear-gradient(135deg, rgba(220,252,231,.92), rgba(255,255,255,.82));
}

.profile-card {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 18px;
  align-items: end;
  margin-bottom: 18px;
}

.profile-form {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.profile-form label {
  margin: 0;
}

.participants {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.person-card {
  padding: 18px;
  border-radius: 26px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(255,255,255,.8);
  box-shadow: 0 14px 40px rgba(17,24,39,.08);
}

.person-card strong {
  display: block;
  font-size: 21px;
  margin-bottom: 8px;
}

.person-card .delta {
  font-size: 34px;
  font-weight: 950;
  letter-spacing: -0.05em;
}

.person-card .mini {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(132,204,22,.16);
  font-weight: 900;
  font-size: 12px;
}

.board-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: start;
  margin-bottom: 18px;
}

.legend {
  white-space: nowrap;
  color: var(--muted);
  font-weight: 800;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 99px;
  margin-left: 10px;
}

.dot.green { background: var(--green); }
.dot.red { background: var(--red); }
.dot.gray { background: #9ca3af; }

.table-wrap {
  overflow: auto;
  max-height: 72vh;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: white;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 880px;
}

th, td {
  border-bottom: 1px solid rgba(17,24,39,.08);
  border-right: 1px solid rgba(17,24,39,.06);
  padding: 10px;
  text-align: center;
  min-width: 130px;
}

th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: #f8fafc;
  font-size: 14px;
}

th:first-child, td:first-child {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #f8fafc;
  min-width: 130px;
  text-align: left;
  font-weight: 900;
}

th:first-child {
  z-index: 4;
}

td.weight-cell {
  font-weight: 950;
  font-size: 18px;
}

td.down {
  background: rgba(34,197,94,.14);
  color: #166534;
}

td.up {
  background: rgba(239,68,68,.12);
  color: #991b1b;
}

td.same {
  background: rgba(156,163,175,.12);
  color: #374151;
}

td.empty {
  color: #9ca3af;
}

.weight-input {
  text-align: center;
  padding: 10px;
  border-radius: 14px;
  font-weight: 900;
}

.today-row td:first-child {
  background: #ecfccb;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #111827;
  color: white;
  border-radius: 20px;
  padding: 15px 18px;
  font-weight: 900;
  box-shadow: 0 18px 40px rgba(0,0,0,.22);
  z-index: 20;
  max-width: min(420px, calc(100vw - 36px));
}

.emoji-pop {
  position: fixed;
  pointer-events: none;
  z-index: 30;
  font-size: 30px;
  animation: pop 1.1s ease-out forwards;
}

@keyframes pop {
  0% { transform: translateY(0) scale(.5) rotate(0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translateY(-120px) scale(1.4) rotate(24deg); opacity: 0; }
}

@media (max-width: 980px) {
  .hero, .auth-grid, .profile-card, .stats-grid {
    grid-template-columns: 1fr;
  }

  .profile-form {
    grid-template-columns: 1fr;
  }

  .participants {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 560px) {
  .participants {
    grid-template-columns: 1fr;
  }

  .two-cols {
    grid-template-columns: 1fr;
  }

  .shell {
    width: min(100% - 18px, 1440px);
  }
}

/* Sex buttons */
.sex-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.sex-btn {
  border: 2px solid transparent;
  border-radius: 18px;
  padding: 15px 18px;
  font-size: 20px;
  font-weight: 950;
  box-shadow: none;
}

.sex-btn.male {
  background: #dbeafe;
  color: #1d4ed8;
}

.sex-btn.female {
  background: #fce7f3;
  color: #be185d;
}

.sex-btn.active {
  border-color: currentColor;
  box-shadow: 0 10px 26px rgba(17,24,39,.14);
  transform: translateY(-1px);
}

.sex-btn:hover {
  box-shadow: 0 10px 26px rgba(17,24,39,.12);
}

/* Performance fixes */
.scale-card,
.card,
.stat-card {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

.bg-blob {
  animation: none !important;
  filter: none !important;
  opacity: .14 !important;
}

.table-wrap {
  overscroll-behavior: contain;
}

th,
td {
  padding-top: 8px;
  padding-bottom: 8px;
}

@media (max-width: 560px) {
  .sex-btn {
    font-size: 18px;
    padding: 14px;
  }
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: var(--dark);
  color: white;
  padding: 14px 18px;
  font-weight: 900;
  text-decoration: none;
}

.button-link.ghost {
  background: rgba(17,24,39,.07);
  color: var(--dark);
}

.admin-shell h1 {
  font-size: clamp(42px, 6vw, 72px);
}

.admin-table-wrap {
  max-height: none;
}

.admin-table-wrap table {
  min-width: 1200px;
}

.admin-table-wrap input,
.admin-table-wrap select {
  min-width: 100px;
  padding: 10px 12px;
  border-radius: 14px;
}

.admin-email {
  font-weight: 900;
  text-align: left;
}

.admin-sex {
  display: grid;
  grid-template-columns: 44px 44px;
  gap: 6px;
  justify-content: center;
}

.admin-sex .sex-btn {
  padding: 9px;
  border-radius: 14px;
  font-size: 15px;
}

.p24-dev-footer {
  margin: 34px 0 0;
  padding: 22px 0 0;
  border-top: 1px solid rgba(17,24,39,.12);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.7;
}

.p24-dev-footer a {
  color: var(--dark);
  font-weight: 900;
  text-decoration: none;
  border-bottom: 1px solid rgba(17,24,39,.25);
}

.p24-dev-footer a:hover {
  border-bottom-color: var(--dark);
}

.p24-dev-footer__note {
  color: var(--muted);
}

.you-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(132,204,22,.18);
  color: #3f6212;
  font-size: 11px;
  font-weight: 950;
  vertical-align: middle;
}

.chart-card {
  padding: 24px;
  margin-bottom: 18px;
}

.chart-select-label {
  min-width: 220px;
  margin: 0;
}

.chart-wrap {
  width: 100%;
  overflow: hidden;
  border: 1px solid rgba(17,24,39,.08);
  border-radius: 24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.95), rgba(248,250,252,.9));
  padding: 10px;
}

#weightChart {
  display: block;
  width: 100%;
  height: 320px;
}

.chart-axis {
  stroke: rgba(17,24,39,.18);
  stroke-width: 1;
}

.chart-grid {
  stroke: rgba(17,24,39,.08);
  stroke-width: 1;
}

.chart-line {
  fill: none;
  stroke: #16a34a;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart-area {
  fill: rgba(22,163,74,.10);
}

.chart-dot {
  fill: white;
  stroke: #16a34a;
  stroke-width: 4;
}

.chart-label {
  fill: #667064;
  font-size: 13px;
  font-weight: 800;
}

.chart-value {
  fill: #152018;
  font-size: 14px;
  font-weight: 950;
}

.chart-empty {
  fill: #667064;
  font-size: 22px;
  font-weight: 900;
}

.chart-caption {
  margin-top: 12px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 760px) {
  .chart-select-label {
    width: 100%;
  }

  #weightChart {
    height: 260px;
  }
}

.daily-entry {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 18px;
  align-items: end;
  padding: 24px;
  margin-bottom: 18px;
}

.daily-entry-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.daily-entry-form label {
  margin: 0;
}

.board-tools {
  display: grid;
  gap: 10px;
  justify-items: end;
}

.table-range {
  display: inline-flex;
  gap: 8px;
  padding: 6px;
  border-radius: 18px;
  background: rgba(17,24,39,.06);
}

.table-range button {
  padding: 9px 12px;
  border-radius: 14px;
  background: transparent;
  color: var(--dark);
  box-shadow: none;
}

.table-range button.active {
  background: var(--dark);
  color: white;
}

@media (max-width: 980px) {
  .daily-entry,
  .daily-entry-form {
    grid-template-columns: 1fr;
  }

  .board-tools {
    justify-items: start;
  }

  .table-range {
    flex-wrap: wrap;
  }
}

.achievements-card {
  padding: 24px;
  margin-bottom: 18px;
}

.achievements-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.achievement-person {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(17,24,39,.08);
}

.achievement-person h4 {
  margin: 0 0 12px;
  font-size: 20px;
}

.achievement-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.achievement-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 11px;
  border-radius: 999px;
  background: rgba(132,204,22,.17);
  color: #365314;
  font-weight: 950;
  font-size: 13px;
}

.achievement-badge.locked {
  background: rgba(17,24,39,.06);
  color: rgba(17,24,39,.38);
}

.achievement-note {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

@media (max-width: 980px) {
  .achievements-grid {
    grid-template-columns: 1fr;
  }
}

.leaderboard-card {
  padding: 24px;
  margin-bottom: 18px;
}

.leaderboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.leaderboard-box {
  padding: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(17,24,39,.08);
}

.leaderboard-box h4 {
  margin: 0 0 12px;
  font-size: 18px;
}

.leaderboard-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 9px 0;
  border-bottom: 1px solid rgba(17,24,39,.07);
  font-weight: 900;
}

.leaderboard-row:last-child {
  border-bottom: 0;
}

.leaderboard-place {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(132,204,22,.18);
  color: #365314;
  font-size: 13px;
}

.leaderboard-value {
  color: var(--muted);
  white-space: nowrap;
}

.leaderboard-empty {
  color: var(--muted);
  line-height: 1.45;
}

@media (max-width: 980px) {
  .leaderboard-grid {
    grid-template-columns: 1fr;
  }
}

.feed-card {
  padding: 24px;
  margin-bottom: 18px;
}

.feed-list {
  display: grid;
  gap: 10px;
}

.feed-item {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 13px 14px;
  border-radius: 20px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(17,24,39,.08);
}

.feed-icon {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(132,204,22,.18);
  font-size: 20px;
}

.feed-title {
  font-weight: 950;
}

.feed-subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.feed-date {
  color: var(--muted);
  font-weight: 900;
  white-space: nowrap;
}

.feed-item.down .feed-icon {
  background: rgba(34,197,94,.16);
}

.feed-item.up .feed-icon {
  background: rgba(239,68,68,.12);
}

.feed-item.same .feed-icon {
  background: rgba(156,163,175,.14);
}

@media (max-width: 760px) {
  .feed-item {
    grid-template-columns: 36px 1fr;
  }

  .feed-date {
    grid-column: 2;
  }
}

.goal-progress {
  margin-top: 12px;
  height: 10px;
  border-radius: 999px;
  background: rgba(17,24,39,.08);
  overflow: hidden;
}

.goal-progress span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #84cc16, #16a34a);
}

/* Compact profile card */
.profile-card {
  grid-template-columns: 260px 1fr;
  align-items: center;
}

.profile-form {
  display: grid;
  grid-template-columns: 1.4fr .8fr .8fr .8fr 1fr auto;
  gap: 12px;
  align-items: end;
}

.profile-form label {
  margin: 0;
}

.profile-form input {
  height: 52px;
}

.profile-form .sex-picker {
  height: 52px;
  grid-template-columns: 1fr 1fr;
}

.profile-form .sex-btn {
  height: 52px;
  padding: 10px 14px;
  font-size: 18px;
}

.profile-form button[type="submit"] {
  height: 52px;
  min-width: 170px;
}

@media (max-width: 1180px) {
  .profile-card {
    grid-template-columns: 1fr;
  }

  .profile-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-form button[type="submit"] {
    grid-column: 1 / -1;
  }
}

@media (max-width: 640px) {
  .profile-form {
    grid-template-columns: 1fr;
  }
}

/* Compact funny top block */
.shell {
  padding-top: 18px;
}

.hero {
  grid-template-columns: 1fr 300px;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.hero h1 {
  font-size: clamp(54px, 6vw, 92px);
  margin: 8px 0 10px;
  line-height: .86;
}

.hero p {
  max-width: 720px;
  font-size: 18px;
  line-height: 1.35;
  margin: 0;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: .1em;
}

.hero-actions {
  margin-top: 16px;
}

.hero-actions button,
.hero-actions .button-link {
  padding: 12px 18px;
  border-radius: 16px;
}

.scale-card {
  min-height: 170px;
  padding: 22px;
  border-radius: 28px;
}

.scale-face {
  font-size: 52px;
  line-height: 1;
}

.scale-card strong {
  font-size: 22px;
  line-height: 1.08;
  margin: 10px 0 8px;
}

.scale-card span {
  font-size: 14px;
  line-height: 1.35;
}

.stats-grid {
  gap: 14px;
  margin-bottom: 14px;
}

.stat-card {
  padding: 20px 22px;
  border-radius: 28px;
  min-height: 128px;
}

.stat-card span {
  margin-bottom: 8px;
  font-size: 14px;
}

.stat-card strong {
  font-size: clamp(34px, 4vw, 56px);
  line-height: .95;
}

.stat-card small {
  font-size: 13px;
}

/* Make the third card less gigantic when text is long */
.stat-card #bestUser,
#bestUser {
  font-size: clamp(30px, 3.4vw, 48px);
  line-height: 1.05;
}

@media (max-width: 980px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .scale-card {
    min-height: auto;
  }

  .stats-grid {
    grid-template-columns: 1fr;
  }

  .stat-card {
    min-height: auto;
  }
}

@media (max-width: 560px) {
  .hero h1 {
    font-size: 48px;
  }

  .hero p {
    font-size: 16px;
  }

  .stat-card strong,
  .stat-card #bestUser,
  #bestUser {
    font-size: 34px;
  }
}

/* Smaller top result cards */
.stats-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 12px !important;
  margin-bottom: 12px !important;
}

.stat-card {
  min-height: 88px !important;
  padding: 14px 18px !important;
  border-radius: 22px !important;
}

.stat-card span {
  font-size: 13px !important;
  margin-bottom: 5px !important;
}

.stat-card strong,
.stat-card #bestUser,
#bestUser {
  font-size: 34px !important;
  line-height: 1 !important;
  letter-spacing: -0.04em;
}

.stat-card small {
  font-size: 12px !important;
  line-height: 1.15 !important;
}

/* tighter top hero */
.hero {
  margin-bottom: 12px !important;
}

.hero h1 {
  font-size: clamp(56px, 5.2vw, 86px) !important;
  margin-bottom: 8px !important;
}

.hero p {
  font-size: 17px !important;
  max-width: 650px !important;
}

.scale-card {
  min-height: 145px !important;
  padding: 18px 20px !important;
}

.scale-face {
  font-size: 44px !important;
}

.scale-card strong {
  font-size: 20px !important;
}

.scale-card span {
  font-size: 13px !important;
}

@media (max-width: 980px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }

  .stat-card {
    min-height: auto !important;
  }
}

/* Hero subtitle: one line only, no height jump */
#heroSubtitle {
  display: block;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  max-width: min(900px, calc(100vw - 520px));
}

@media (max-width: 980px) {
  #heroSubtitle {
    max-width: 100%;
  }
}

/* Cartoon floor scale animation */
.p24-scale-scene {
  position: relative;
  width: 128px;
  height: 92px;
  margin-bottom: 10px;
}

.p24-scale {
  position: absolute;
  left: 16px;
  bottom: 4px;
  width: 96px;
  height: 54px;
  border: 4px solid #111827;
  border-radius: 24px 24px 18px 18px;
  background:
    radial-gradient(circle at 50% 88%, rgba(17,24,39,.10), transparent 34%),
    linear-gradient(180deg, #f8fafc, #d9f99d);
  box-shadow: 0 10px 0 rgba(17,24,39,.12);
  transform-origin: center bottom;
  animation: p24ScaleShake 5.8s ease-in-out infinite;
}

.p24-scale::before,
.p24-scale::after {
  content: "";
  position: absolute;
  bottom: -9px;
  width: 18px;
  height: 8px;
  border-radius: 999px;
  background: #111827;
}

.p24-scale::before { left: 14px; }
.p24-scale::after { right: 14px; }

.p24-scale-display {
  position: absolute;
  left: 50%;
  top: 9px;
  transform: translateX(-50%);
  width: 58px;
  height: 22px;
  border: 3px solid #111827;
  border-radius: 10px;
  background: #ecfccb;
  overflow: hidden;
  font-size: 12px;
  font-weight: 950;
  color: #166534;
  display: grid;
  place-items: center;
}

.p24-scale-display .num {
  position: absolute;
  opacity: 0;
  animation: p24ScaleNumbers 5.8s steps(1, end) infinite;
}

.p24-scale-display .n1 { animation-delay: 0s; }
.p24-scale-display .n2 { animation-delay: .7s; }
.p24-scale-display .n3 { animation-delay: 1.4s; color: #dc2626; }
.p24-scale-display .n4 { animation-delay: 2.1s; color: #111827; }

.p24-scale-smile {
  position: absolute;
  left: 50%;
  top: 35px;
  width: 24px;
  height: 10px;
  transform: translateX(-50%);
  border-bottom: 4px solid #111827;
  border-radius: 0 0 999px 999px;
  animation: p24ScaleMouth 5.8s ease-in-out infinite;
}

.p24-scale-person {
  position: absolute;
  left: 31px;
  top: -10px;
  width: 66px;
  height: 60px;
  transform-origin: center top;
  animation: p24PersonStep 5.8s ease-in-out infinite;
}

.p24-leg {
  position: absolute;
  bottom: 0;
  width: 22px;
  height: 54px;
  border-radius: 999px 999px 12px 12px;
  background: linear-gradient(180deg, #fed7aa, #fb923c);
  border: 4px solid #111827;
}

.p24-leg.left { left: 5px; transform: rotate(4deg); }
.p24-leg.right { right: 5px; transform: rotate(-4deg); }

.p24-leg::after {
  content: "";
  position: absolute;
  left: -8px;
  bottom: -8px;
  width: 36px;
  height: 16px;
  border-radius: 999px;
  background: #111827;
}

.p24-scale-panic {
  position: absolute;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #fef3c7;
  border: 3px solid #111827;
  color: #dc2626;
  font-weight: 950;
  opacity: 0;
  animation: p24PanicPop 5.8s ease-in-out infinite;
}

.p24-scale-panic.p1 {
  right: 2px;
  top: 16px;
}

.p24-scale-panic.p2 {
  left: 0;
  top: 24px;
  animation-delay: .12s;
}

@keyframes p24PersonStep {
  0%, 10% {
    transform: translateY(-74px) scale(.95);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  28%, 70% {
    transform: translateY(0) scale(1);
    opacity: 1;
  }
  82%, 100% {
    transform: translateY(-74px) scale(.95);
    opacity: 0;
  }
}

@keyframes p24ScaleShake {
  0%, 22%, 74%, 100% {
    transform: translateY(0) rotate(0deg) scaleY(1);
  }
  28% {
    transform: translateY(6px) rotate(0deg) scaleY(.86);
  }
  32% {
    transform: translateY(4px) rotate(-4deg) scaleY(.9);
  }
  36% {
    transform: translateY(5px) rotate(4deg) scaleY(.88);
  }
  40% {
    transform: translateY(4px) rotate(-3deg) scaleY(.9);
  }
  44% {
    transform: translateY(5px) rotate(3deg) scaleY(.88);
  }
  50% {
    transform: translateY(3px) rotate(0deg) scaleY(.92);
  }
}

@keyframes p24ScaleNumbers {
  0%, 24% { opacity: 1; }
  25%, 100% { opacity: 0; }
}

@keyframes p24ScaleMouth {
  0%, 25%, 72%, 100% {
    width: 24px;
    height: 10px;
    border-bottom: 4px solid #111827;
    border-top: 0;
    border-radius: 0 0 999px 999px;
  }
  34%, 52% {
    width: 18px;
    height: 18px;
    border: 4px solid #111827;
    border-radius: 999px;
  }
}

@keyframes p24PanicPop {
  0%, 30%, 65%, 100% {
    opacity: 0;
    transform: scale(.4) translateY(8px);
  }
  36%, 52% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Let the old icon styles not affect the new animation */
.scale-card .p24-scale-scene + strong {
  margin-top: 2px;
}

/* Clearer cartoon scale scene v2 */
.p24-scale-scene-v2 {
  width: 150px !important;
  height: 112px !important;
  margin: 0 0 8px !important;
  position: relative;
}

.p24-chubby {
  position: absolute;
  left: 45px;
  top: -42px;
  width: 62px;
  height: 92px;
  transform-origin: center bottom;
  animation: p24ChubbyStep 5.8s ease-in-out infinite;
  z-index: 3;
}

.p24-head {
  position: absolute;
  top: 0;
  left: 17px;
  width: 28px;
  height: 28px;
  border: 4px solid #111827;
  border-radius: 999px;
  background: #fed7aa;
}

.p24-body {
  position: absolute;
  top: 24px;
  left: 4px;
  width: 54px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 4px solid #111827;
  border-radius: 999px 999px 22px 22px;
  background: linear-gradient(180deg, #fde68a, #fb923c);
  font-size: 20px;
  box-shadow: 0 8px 0 rgba(17,24,39,.10);
}

.p24-feet {
  position: absolute;
  left: 5px;
  bottom: 0;
  display: flex;
  gap: 8px;
}

.p24-feet span {
  width: 24px;
  height: 12px;
  border-radius: 999px;
  background: #111827;
}

.p24-floor-scale {
  position: absolute;
  left: 15px;
  bottom: 6px;
  width: 120px;
  height: 62px;
  border: 5px solid #111827;
  border-radius: 26px 26px 20px 20px;
  background:
    radial-gradient(circle at 50% 90%, rgba(17,24,39,.12), transparent 35%),
    linear-gradient(180deg, #f8fafc, #bbf7d0);
  box-shadow: 0 12px 0 rgba(17,24,39,.14);
  transform-origin: center bottom;
  animation: p24FloorScalePanic 5.8s ease-in-out infinite;
  z-index: 2;
}

.p24-floor-screen {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 72px;
  height: 26px;
  transform: translateX(-50%);
  border: 4px solid #111827;
  border-radius: 12px;
  background: #ecfccb;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-weight: 950;
  font-size: 14px;
  color: #166534;
}

.p24-floor-screen .v {
  position: absolute;
  opacity: 0;
  animation: p24ScreenSwap 5.8s steps(1, end) infinite;
}

.p24-floor-screen .v1 {
  color: #166534;
  animation-delay: 0s;
}

.p24-floor-screen .v2 {
  color: #dc2626;
  animation-delay: .9s;
}

.p24-floor-screen .v3 {
  color: #111827;
  animation-delay: 1.8s;
}

.p24-floor-face {
  position: absolute;
  left: 50%;
  bottom: 11px;
  width: 30px;
  height: 12px;
  transform: translateX(-50%);
  border-bottom: 5px solid #111827;
  border-radius: 0 0 999px 999px;
  animation: p24FloorFace 5.8s ease-in-out infinite;
}

.p24-boom {
  position: absolute;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border: 3px solid #111827;
  border-radius: 999px;
  background: #fef3c7;
  color: #dc2626;
  font-weight: 950;
  opacity: 0;
  z-index: 4;
  animation: p24BoomPop 5.8s ease-in-out infinite;
}

.p24-boom.b1 {
  right: 2px;
  top: 30px;
}

.p24-boom.b2 {
  left: 2px;
  top: 42px;
  animation-delay: .14s;
}

/* hide old version details if old CSS still exists */
.p24-scale-scene-v2 .p24-scale,
.p24-scale-scene-v2 .p24-scale-person,
.p24-scale-scene-v2 .p24-scale-panic {
  display: none !important;
}

@keyframes p24ChubbyStep {
  0%, 12% {
    transform: translateY(-58px) scale(.92);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  30%, 70% {
    transform: translateY(21px) scale(1);
    opacity: 1;
  }
  82%, 100% {
    transform: translateY(-58px) scale(.92);
    opacity: 0;
  }
}

@keyframes p24FloorScalePanic {
  0%, 24%, 72%, 100% {
    transform: translateY(0) rotate(0deg) scaleY(1);
  }
  30% {
    transform: translateY(8px) rotate(0deg) scaleY(.82);
  }
  35% {
    transform: translateY(6px) rotate(-5deg) scaleY(.86);
  }
  40% {
    transform: translateY(7px) rotate(5deg) scaleY(.84);
  }
  45% {
    transform: translateY(6px) rotate(-4deg) scaleY(.86);
  }
  50% {
    transform: translateY(7px) rotate(4deg) scaleY(.84);
  }
  56% {
    transform: translateY(4px) rotate(0deg) scaleY(.9);
  }
}

@keyframes p24ScreenSwap {
  0%, 30% { opacity: 1; }
  31%, 100% { opacity: 0; }
}

@keyframes p24FloorFace {
  0%, 28%, 72%, 100% {
    width: 30px;
    height: 12px;
    border: 0;
    border-bottom: 5px solid #111827;
    border-radius: 0 0 999px 999px;
  }
  38%, 55% {
    width: 22px;
    height: 22px;
    border: 5px solid #111827;
    border-radius: 999px;
  }
}

@keyframes p24BoomPop {
  0%, 31%, 62%, 100% {
    opacity: 0;
    transform: scale(.35) translateY(8px);
  }
  38%, 54% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* Scale animation v3: clearer timing and readable character */
.p24-scale-scene-v3 {
  position: relative;
  width: 168px;
  height: 122px;
  margin: -4px 0 8px;
}

/* person */
.p24-v3-person {
  position: absolute;
  left: 51px;
  top: -20px;
  width: 68px;
  height: 96px;
  z-index: 4;
  transform-origin: center bottom;
  animation: p24v3Person 6.2s ease-in-out infinite;
}

.p24-v3-head {
  position: absolute;
  top: 0;
  left: 19px;
  width: 31px;
  height: 31px;
  border-radius: 999px;
  background: #fed7aa;
  border: 4px solid #111827;
}

.p24-v3-head .eye {
  position: absolute;
  top: 10px;
  width: 4px;
  height: 4px;
  background: #111827;
  border-radius: 999px;
}

.p24-v3-head .eye.left { left: 8px; }
.p24-v3-head .eye.right { right: 8px; }

.p24-v3-head .mouth {
  position: absolute;
  left: 50%;
  bottom: 7px;
  width: 10px;
  height: 5px;
  transform: translateX(-50%);
  border-bottom: 3px solid #111827;
  border-radius: 0 0 999px 999px;
}

.p24-v3-belly {
  position: absolute;
  top: 27px;
  left: 3px;
  width: 62px;
  height: 52px;
  display: grid;
  place-items: center;
  border-radius: 999px 999px 22px 22px;
  background: linear-gradient(180deg, #fde68a, #fb923c);
  border: 4px solid #111827;
  box-shadow: 0 8px 0 rgba(17,24,39,.12);
}

.p24-v3-belly .burger {
  font-size: 22px;
  line-height: 1;
}

.p24-v3-legs {
  position: absolute;
  left: 9px;
  bottom: 2px;
  display: flex;
  gap: 8px;
}

.p24-v3-legs span {
  width: 25px;
  height: 13px;
  border-radius: 999px;
  background: #111827;
}

/* scale */
.p24-v3-scale {
  position: absolute;
  left: 17px;
  bottom: 7px;
  width: 132px;
  height: 64px;
  border-radius: 26px 26px 20px 20px;
  background: linear-gradient(180deg, #f8fafc, #bbf7d0);
  border: 5px solid #111827;
  box-shadow: 0 13px 0 rgba(17,24,39,.16);
  transform-origin: center bottom;
  animation: p24v3Scale 6.2s ease-in-out infinite;
  z-index: 2;
}

.p24-v3-scale::before,
.p24-v3-scale::after {
  content: "";
  position: absolute;
  bottom: -10px;
  width: 22px;
  height: 9px;
  border-radius: 999px;
  background: #111827;
}

.p24-v3-scale::before { left: 20px; }
.p24-v3-scale::after { right: 20px; }

.p24-v3-screen {
  position: absolute;
  top: 9px;
  left: 50%;
  width: 78px;
  height: 27px;
  transform: translateX(-50%);
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 12px;
  background: #ecfccb;
  border: 4px solid #111827;
  font-size: 14px;
  font-weight: 950;
  color: #166534;
}

.p24-v3-screen .d {
  position: absolute;
  opacity: 0;
}

/* IMPORTANT: ERR appears only after person lands */
.p24-v3-screen .d0 { animation: p24v3D0 6.2s steps(1, end) infinite; }
.p24-v3-screen .d1 { animation: p24v3D1 6.2s steps(1, end) infinite; }
.p24-v3-screen .d2 { animation: p24v3D2 6.2s steps(1, end) infinite; color: #dc2626; }
.p24-v3-screen .d3 { animation: p24v3D3 6.2s steps(1, end) infinite; color: #111827; }

.p24-v3-face {
  position: absolute;
  left: 50%;
  bottom: 11px;
  width: 30px;
  height: 12px;
  transform: translateX(-50%);
  border-bottom: 5px solid #111827;
  border-radius: 0 0 999px 999px;
  animation: p24v3Face 6.2s ease-in-out infinite;
}

.p24-v3-shout {
  position: absolute;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: #fef3c7;
  border: 3px solid #111827;
  color: #dc2626;
  font-weight: 950;
  opacity: 0;
  z-index: 6;
  animation: p24v3Shout 6.2s ease-in-out infinite;
}

.p24-v3-shout.s1 {
  right: 2px;
  top: 40px;
}

.p24-v3-shout.s2 {
  left: 4px;
  top: 48px;
  animation-delay: .14s;
}

/* animations */
@keyframes p24v3Person {
  0%, 12% {
    transform: translateY(-68px) scale(.88);
    opacity: 0;
  }
  18% {
    opacity: 1;
  }
  28%, 60% {
    transform: translateY(24px) scale(1);
    opacity: 1;
  }
  72%, 100% {
    transform: translateY(-68px) scale(.88);
    opacity: 0;
  }
}

@keyframes p24v3Scale {
  0%, 23%, 68%, 100% {
    transform: translateY(0) rotate(0deg) scaleY(1);
  }
  29% {
    transform: translateY(8px) rotate(0deg) scaleY(.82);
  }
  34% {
    transform: translateY(7px) rotate(-5deg) scaleY(.84);
  }
  39% {
    transform: translateY(7px) rotate(5deg) scaleY(.84);
  }
  44% {
    transform: translateY(7px) rotate(-4deg) scaleY(.86);
  }
  50% {
    transform: translateY(6px) rotate(4deg) scaleY(.86);
  }
  58% {
    transform: translateY(4px) rotate(0deg) scaleY(.9);
  }
}

/* screen timing */
@keyframes p24v3D0 {
  0%, 27%, 70%, 100% { opacity: 1; }
  28%, 69% { opacity: 0; }
}

@keyframes p24v3D1 {
  0%, 27%, 40%, 100% { opacity: 0; }
  28%, 39% { opacity: 1; }
}

@keyframes p24v3D2 {
  0%, 39%, 53%, 100% { opacity: 0; }
  40%, 52% { opacity: 1; }
}

@keyframes p24v3D3 {
  0%, 52%, 66%, 100% { opacity: 0; }
  53%, 65% { opacity: 1; }
}

@keyframes p24v3Face {
  0%, 28%, 68%, 100% {
    width: 30px;
    height: 12px;
    border: 0;
    border-bottom: 5px solid #111827;
    border-radius: 0 0 999px 999px;
  }
  40%, 57% {
    width: 22px;
    height: 22px;
    border: 5px solid #111827;
    border-radius: 999px;
  }
}

@keyframes p24v3Shout {
  0%, 39%, 63%, 100% {
    opacity: 0;
    transform: scale(.35) translateY(8px);
  }
  44%, 57% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

.p24-scale-scene-v3 .p24-scale,
.p24-scale-scene-v3 .p24-scale-person,
.p24-scale-scene-v3 .p24-scale-panic,
.p24-scale-scene-v3 .p24-chubby,
.p24-scale-scene-v3 .p24-floor-scale,
.p24-scale-scene-v3 .p24-boom {
  display: none !important;
}

/* Clean cartoon floor scale animation */
.p24-scale-clean {
  position: relative;
  width: 166px;
  height: 104px;
  margin: -2px 0 8px;
}

.p24-clean-scale {
  position: absolute;
  left: 12px;
  bottom: 6px;
  width: 138px;
  height: 72px;
  border: 5px solid #111827;
  border-radius: 30px 30px 22px 22px;
  background:
    radial-gradient(circle at 50% 92%, rgba(17,24,39,.10), transparent 34%),
    linear-gradient(180deg, #f8fafc, #bbf7d0);
  box-shadow: 0 14px 0 rgba(17,24,39,.14);
  transform-origin: center bottom;
  animation: p24CleanScale 5.6s ease-in-out infinite;
}

.p24-clean-scale::before,
.p24-clean-scale::after {
  content: "";
  position: absolute;
  bottom: -11px;
  width: 24px;
  height: 9px;
  border-radius: 999px;
  background: #111827;
}

.p24-clean-scale::before {
  left: 22px;
}

.p24-clean-scale::after {
  right: 22px;
}

.p24-clean-screen {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 84px;
  height: 30px;
  transform: translateX(-50%);
  border: 4px solid #111827;
  border-radius: 13px;
  background: #ecfccb;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 15px;
  font-weight: 950;
  color: #166534;
}

.p24-clean-screen .c {
  position: absolute;
  opacity: 0;
}

/* timing: сначала 0.0, потом 105, потом ERR/ОЙ */
.p24-clean-screen .c0 {
  animation: p24CleanC0 5.6s steps(1, end) infinite;
}

.p24-clean-screen .c1 {
  color: #166534;
  animation: p24CleanC1 5.6s steps(1, end) infinite;
}

.p24-clean-screen .c2 {
  color: #dc2626;
  animation: p24CleanC2 5.6s steps(1, end) infinite;
}

.p24-clean-screen .c3 {
  color: #111827;
  animation: p24CleanC3 5.6s steps(1, end) infinite;
}

.p24-clean-eyes {
  position: absolute;
  left: 50%;
  top: 45px;
  width: 44px;
  transform: translateX(-50%);
  display: flex;
  justify-content: space-between;
}

.p24-clean-eyes span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #111827;
  animation: p24CleanEyes 5.6s ease-in-out infinite;
}

.p24-clean-mouth {
  position: absolute;
  left: 50%;
  bottom: 11px;
  width: 30px;
  height: 12px;
  transform: translateX(-50%);
  border-bottom: 5px solid #111827;
  border-radius: 0 0 999px 999px;
  animation: p24CleanMouth 5.6s ease-in-out infinite;
}

.p24-clean-weight {
  position: absolute;
  left: 65px;
  top: -8px;
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  font-size: 24px;
  opacity: 0;
  transform-origin: center;
  animation: p24CleanImpact 5.6s ease-in-out infinite;
  z-index: 4;
}

.p24-clean-alert {
  position: absolute;
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  border: 3px solid #111827;
  background: #fef3c7;
  color: #dc2626;
  font-weight: 950;
  opacity: 0;
  z-index: 5;
  animation: p24CleanAlert 5.6s ease-in-out infinite;
}

.p24-clean-alert.a1 {
  right: 0;
  top: 28px;
}

.p24-clean-alert.a2 {
  left: 0;
  top: 36px;
  animation-delay: .12s;
}

@keyframes p24CleanScale {
  0%, 24%, 72%, 100% {
    transform: translateY(0) rotate(0deg) scaleY(1);
  }

  30% {
    transform: translateY(9px) rotate(0deg) scaleY(.80);
  }

  35% {
    transform: translateY(7px) rotate(-5deg) scaleY(.84);
  }

  40% {
    transform: translateY(7px) rotate(5deg) scaleY(.84);
  }

  45% {
    transform: translateY(7px) rotate(-4deg) scaleY(.86);
  }

  50% {
    transform: translateY(6px) rotate(4deg) scaleY(.86);
  }

  58% {
    transform: translateY(3px) rotate(0deg) scaleY(.92);
  }
}

@keyframes p24CleanImpact {
  0%, 22%, 72%, 100% {
    opacity: 0;
    transform: translateY(-20px) scale(.6) rotate(0deg);
  }

  28%, 56% {
    opacity: 1;
    transform: translateY(24px) scale(1) rotate(12deg);
  }
}

@keyframes p24CleanC0 {
  0%, 27%, 72%, 100% { opacity: 1; }
  28%, 71% { opacity: 0; }
}

@keyframes p24CleanC1 {
  0%, 27%, 39%, 100% { opacity: 0; }
  28%, 38% { opacity: 1; }
}

@keyframes p24CleanC2 {
  0%, 38%, 54%, 100% { opacity: 0; }
  39%, 53% { opacity: 1; }
}

@keyframes p24CleanC3 {
  0%, 53%, 69%, 100% { opacity: 0; }
  54%, 68% { opacity: 1; }
}

@keyframes p24CleanEyes {
  0%, 28%, 70%, 100% {
    transform: scaleY(1);
  }

  39%, 58% {
    transform: scaleY(.35);
  }
}

@keyframes p24CleanMouth {
  0%, 28%, 70%, 100% {
    width: 30px;
    height: 12px;
    border: 0;
    border-bottom: 5px solid #111827;
    border-radius: 0 0 999px 999px;
  }

  39%, 58% {
    width: 22px;
    height: 22px;
    border: 5px solid #111827;
    border-radius: 999px;
  }
}

@keyframes p24CleanAlert {
  0%, 38%, 64%, 100% {
    opacity: 0;
    transform: scale(.35) translateY(8px);
  }

  43%, 58% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

/* ===== Elephant scale animation ===== */
.p24-ele-scene {
  position: relative;
  width: 170px;
  height: 114px;
  margin: -2px 0 8px;
}

.p24-elephant {
  position: absolute;
  left: 54px;
  top: -8px;
  font-size: 46px;
  line-height: 1;
  z-index: 4;
  transform-origin: center bottom;
  animation: p24EleDrop 5.8s ease-in-out infinite;
}

.p24-ele-scale {
  position: absolute;
  left: 14px;
  bottom: 7px;
  width: 140px;
  height: 72px;
  border: 5px solid #111827;
  border-radius: 30px 30px 22px 22px;
  background:
    radial-gradient(circle at 50% 92%, rgba(17,24,39,.10), transparent 34%),
    linear-gradient(180deg, #f8fafc, #bbf7d0);
  box-shadow: 0 14px 0 rgba(17,24,39,.14);
  transform-origin: center bottom;
  animation: p24EleScale 5.8s ease-in-out infinite;
  z-index: 2;
}

.p24-ele-scale::before,
.p24-ele-scale::after {
  content: "";
  position: absolute;
  bottom: -11px;
  width: 24px;
  height: 9px;
  border-radius: 999px;
  background: #111827;
}

.p24-ele-scale::before { left: 22px; }
.p24-ele-scale::after  { right: 22px; }

.p24-ele-screen {
  position: absolute;
  top: 10px;
  left: 50%;
  width: 84px;
  height: 30px;
  transform: translateX(-50%);
  border: 4px solid #111827;
  border-radius: 13px;
  background: #ecfccb;
  display: grid;
  place-items: center;
  overflow: hidden;
  font-size: 15px;
  font-weight: 950;
  color: #166534;
}

.p24-ele-screen .d {
  position: absolute;
  opacity: 0;
}

.p24-ele-screen .d0 {
  animation: p24EleD0 5.8s steps(1, end) infinite;
}

.p24-ele-screen .d1 {
  color: #166534;
  animation: p24EleD1 5.8s steps(1, end) infinite;
}

.p24-ele-screen .d2 {
  color: #dc2626;
  animation: p24EleD2 5.8s steps(1, end) infinite;
}

.p24-ele-eyes {
  position: absolute;
  left: 50%;
  top: 46px;
  width: 44px;
  transform: translateX(-50%);
  display: flex;
  justify-content: space-between;
}

.p24-ele-eyes span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #111827;
  animation: p24EleEyes 5.8s ease-in-out infinite;
}

.p24-ele-mouth {
  position: absolute;
  left: 50%;
  bottom: 11px;
  width: 30px;
  height: 12px;
  transform: translateX(-50%);
  border-bottom: 5px solid #111827;
  border-radius: 0 0 999px 999px;
  animation: p24EleMouth 5.8s ease-in-out infinite;
}

.p24-ele-burst {
  position: absolute;
  left: 70px;
  top: 20px;
  font-size: 22px;
  opacity: 0;
  z-index: 5;
  animation: p24EleBurst 5.8s ease-in-out infinite;
}

.p24-ele-alert {
  position: absolute;
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border: 3px solid #111827;
  border-radius: 999px;
  background: #fef3c7;
  color: #dc2626;
  font-weight: 950;
  opacity: 0;
  z-index: 5;
  animation: p24EleAlert 5.8s ease-in-out infinite;
}

.p24-ele-alert.a1 {
  right: 2px;
  top: 28px;
}

.p24-ele-alert.a2 {
  left: 2px;
  top: 36px;
  animation-delay: .12s;
}

/* Elephant falls only first, then scale reacts */
@keyframes p24EleDrop {
  0%, 14% {
    transform: translateY(-54px) scale(.92);
    opacity: 0;
  }
  15% {
    opacity: 1;
  }
  24%, 58% {
    transform: translateY(18px) scale(1);
    opacity: 1;
  }
  72%, 100% {
    transform: translateY(-54px) scale(.92);
    opacity: 0;
  }
}

@keyframes p24EleScale {
  0%, 22%, 68%, 100% {
    transform: translateY(0) rotate(0deg) scaleY(1);
  }
  26% {
    transform: translateY(10px) rotate(0deg) scaleY(.78);
  }
  31% {
    transform: translateY(8px) rotate(-4deg) scaleY(.84);
  }
  36% {
    transform: translateY(8px) rotate(4deg) scaleY(.84);
  }
  41% {
    transform: translateY(7px) rotate(-3deg) scaleY(.87);
  }
  46% {
    transform: translateY(7px) rotate(3deg) scaleY(.87);
  }
  54% {
    transform: translateY(4px) rotate(0deg) scaleY(.93);
  }
}

@keyframes p24EleBurst {
  0%, 24%, 52%, 100% {
    opacity: 0;
    transform: scale(.5);
  }
  28%, 44% {
    opacity: 1;
    transform: scale(1);
  }
}

@keyframes p24EleAlert {
  0%, 32%, 58%, 100% {
    opacity: 0;
    transform: scale(.4) translateY(8px);
  }
  38%, 52% {
    opacity: 1;
    transform: scale(1) translateY(0);
  }
}

@keyframes p24EleD0 {
  0%, 23%, 70%, 100% { opacity: 1; }
  24%, 69% { opacity: 0; }
}

@keyframes p24EleD1 {
  0%, 23%, 36%, 100% { opacity: 0; }
  24%, 35% { opacity: 1; }
}

@keyframes p24EleD2 {
  0%, 35%, 68%, 100% { opacity: 0; }
  36%, 67% { opacity: 1; }
}

@keyframes p24EleEyes {
  0%, 24%, 68%, 100% {
    transform: scaleY(1);
  }
  36%, 56% {
    transform: scaleY(.35);
  }
}

@keyframes p24EleMouth {
  0%, 24%, 68%, 100% {
    width: 30px;
    height: 12px;
    border: 0;
    border-bottom: 5px solid #111827;
    border-radius: 0 0 999px 999px;
  }
  36%, 56% {
    width: 22px;
    height: 22px;
    border: 5px solid #111827;
    border-radius: 999px;
  }
}

/* Top stats: only burned + leader */
.stats-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
}

@media (max-width: 760px) {
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
}

/* Collapsible profile block */
.profile-card {
  padding: 18px 22px !important;
}

.profile-intro {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  width: 100%;
}

.profile-intro h3 {
  margin-bottom: 4px;
}

.profile-intro .muted {
  margin: 0;
}

.profile-card.profile-collapsed {
  grid-template-columns: 1fr !important;
}

.profile-card.profile-collapsed .profile-form {
  display: none !important;
}

.profile-card:not(.profile-collapsed) {
  grid-template-columns: 1fr !important;
}

.profile-card:not(.profile-collapsed) .profile-intro {
  margin-bottom: 16px;
}

.profile-card:not(.profile-collapsed) .profile-form {
  display: grid;
}

@media (max-width: 760px) {
  .profile-intro {
    grid-template-columns: 1fr;
  }

  .profile-intro button {
    width: 100%;
  }
}

/* Daily weight entry v2 */
.daily-entry-v2 {
  grid-template-columns: 1fr 1.9fr !important;
  align-items: center !important;
  padding: 18px 22px !important;
  gap: 18px !important;
}

.daily-entry-main {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 12px;
  align-items: center;
}

.daily-icon {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: rgba(132,204,22,.18);
  font-size: 24px;
}

.daily-entry-main h3 {
  margin: 0 0 4px;
  font-size: 22px;
}

.daily-entry-main .muted {
  margin: 0;
  line-height: 1.35;
}

.daily-entry-form-v2 {
  display: grid !important;
  grid-template-columns: 1fr 1fr auto !important;
  gap: 12px !important;
  align-items: end !important;
}

.daily-entry-form-v2 label {
  margin: 0 !important;
}

.daily-entry-form-v2 label span {
  display: block;
  margin: 0 0 6px;
  font-weight: 950;
  font-size: 13px;
}

.daily-entry-form-v2 input {
  height: 52px;
  font-weight: 950;
}

.daily-entry-form-v2 input[type="date"] {
  cursor: pointer;
}

.daily-entry-form-v2 button {
  height: 52px;
  min-width: 170px;
  white-space: nowrap;
}

@media (max-width: 980px) {
  .daily-entry-v2,
  .daily-entry-form-v2 {
    grid-template-columns: 1fr !important;
  }

  .daily-entry-form-v2 button {
    width: 100%;
  }
}

/* Make the whole date field feel clickable */
.daily-entry-form-v2 label:has(input[type="date"]) {
  cursor: pointer;
}

.daily-entry-form-v2 input[type="date"] {
  cursor: pointer;
}

.daily-entry-form-v2 input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
}

/* Participants public cards v2 */
.participants {
  display: block !important;
  margin-bottom: 18px;
}

.participants-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
  margin: 0 0 10px;
}

.participants-head h3 {
  margin: 0 0 4px;
  font-size: 22px;
}

.participants-head .muted {
  margin: 0;
}

.participants-count {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(132,204,22,.18);
  color: #365314;
  font-weight: 950;
  white-space: nowrap;
}

.participants-grid-inner {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}

.person-card-v2 {
  padding: 18px !important;
  border-radius: 26px !important;
  min-height: 178px;
  max-width: 390px;
}

.person-card-v2.down {
  box-shadow: inset 0 0 0 1px rgba(34,197,94,.18), 0 18px 50px rgba(15,23,42,.06);
}

.person-card-v2.up {
  box-shadow: inset 0 0 0 1px rgba(239,68,68,.14), 0 18px 50px rgba(15,23,42,.06);
}

.person-card-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 10px;
}

.person-card-top strong {
  font-size: 20px;
}

.person-main-delta {
  font-size: 38px;
  line-height: 1;
  font-weight: 950;
  letter-spacing: -0.05em;
  margin-bottom: 4px;
}

.person-card-v2.down .person-main-delta {
  color: var(--green);
}

.person-card-v2.up .person-main-delta {
  color: var(--red);
}

.person-delta-caption {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 12px;
}

.person-route {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--dark);
  font-weight: 900;
  font-size: 13px;
}

.route-arrow {
  color: var(--muted);
}

.goal-progress-v2 {
  margin: 10px 0 10px !important;
  height: 9px !important;
}

.person-bottom-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.person-bottom-row span {
  display: inline-flex;
  padding: 7px 10px;
  border-radius: 999px;
  background: rgba(132,204,22,.14);
  color: #4d5f3c;
  font-size: 13px;
  font-weight: 950;
}

.person-empty {
  color: var(--muted);
  font-weight: 800;
  line-height: 1.4;
}

@media (max-width: 760px) {
  .participants-head {
    grid-template-columns: 1fr;
  }

  .participants-grid-inner {
    grid-template-columns: 1fr;
  }

  .person-card-v2 {
    max-width: none;
  }
}
