* { 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;
  }
}

/* Compact event feed */
.feed-card {
  padding: 18px 22px !important;
  margin-bottom: 16px !important;
}

.feed-card .board-head {
  margin-bottom: 12px !important;
}

.feed-card h3 {
  margin-bottom: 4px !important;
}

.feed-list {
  gap: 8px !important;
  max-height: 260px;
  overflow: auto;
  padding-right: 2px;
}

.feed-item {
  grid-template-columns: 38px 1fr auto !important;
  padding: 10px 12px !important;
  border-radius: 18px !important;
}

.feed-icon {
  width: 38px !important;
  height: 38px !important;
  font-size: 18px !important;
}

.feed-title {
  font-size: 15px !important;
}

.feed-subtitle {
  font-size: 12px !important;
}

.feed-date {
  font-size: 13px !important;
}

.feed-more-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 8px 2px 0;
}

.feed-more-count {
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
}

.feed-more-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.feed-more-btn,
.feed-collapse-btn {
  padding: 10px 14px !important;
  border-radius: 14px !important;
  font-size: 13px !important;
}

.feed-collapse-btn {
  opacity: .82;
}

@media (max-width: 760px) {
  .feed-more-row {
    align-items: stretch;
    flex-direction: column;
  }

  .feed-more-actions button {
    width: 100%;
  }
}

/* Feed grows by button, no inner scroll */
.feed-list {
  max-height: none !important;
  overflow: visible !important;
}

/* Leaderboard v2 */
.leaderboard-card {
  padding: 18px 22px !important;
  margin-bottom: 18px;
}

.leaderboard-card .board-head {
  margin-bottom: 12px !important;
}

.leaderboard-card h3 {
  margin-bottom: 4px !important;
}

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

.rating-tile {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border-radius: 22px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(17,24,39,.08);
}

.rating-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(132,204,22,.16);
  font-size: 22px;
}

.rating-tile h4 {
  margin: 0 0 5px;
  font-size: 14px;
  color: var(--muted);
}

.rating-tile strong {
  display: block;
  font-size: 18px;
  line-height: 1.15;
  font-weight: 950;
}

.rating-tile p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

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

.rating-tile.goal .rating-icon {
  background: rgba(59,130,246,.12);
}

.rating-tile.discipline .rating-icon {
  background: rgba(132,204,22,.18);
}

.rating-tile.empty {
  opacity: .72;
}

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

/* Personal achievements */
.achievements-personal-card {
  padding: 18px 22px !important;
  margin-bottom: 18px;
}

.achievements-personal-card .board-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 12px !important;
}

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

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

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

.achievements-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.achievement-medal {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border-radius: 20px;
  background: rgba(255,255,255,.72);
  border: 1px solid rgba(17,24,39,.08);
}

.achievement-medal-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(132,204,22,.16);
  font-size: 22px;
}

.achievement-medal strong {
  display: block;
  font-size: 15px;
  line-height: 1.15;
  font-weight: 950;
}

.achievement-medal p {
  margin: 5px 0 0;
  font-size: 12px;
  line-height: 1.25;
  color: var(--muted);
}

.achievement-medal.locked {
  opacity: .56;
}

.achievement-medal.locked .achievement-medal-icon {
  background: rgba(17,24,39,.06);
}

/* Fireworks */
.p24-fireworks {
  position: fixed;
  inset: 0;
  z-index: 99999;
  pointer-events: none;
  overflow: hidden;
  animation: p24FireworksFade 6.2s ease-in-out forwards;
}

.p24-fireworks-card {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translateX(-50%);
  width: min(460px, calc(100vw - 32px));
  padding: 24px;
  border-radius: 30px;
  background: rgba(255,255,255,.92);
  box-shadow: 0 30px 90px rgba(15,23,42,.22);
  text-align: center;
  border: 1px solid rgba(17,24,39,.08);
  animation: p24FireworksCard 6.2s ease-in-out forwards;
}

.p24-fireworks-emoji {
  font-size: 48px;
  line-height: 1;
  margin-bottom: 10px;
}

.p24-fireworks-card strong {
  display: block;
  font-size: 24px;
  line-height: 1.08;
  font-weight: 950;
  color: var(--dark);
}

.p24-fireworks-card span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-weight: 800;
}

.p24-spark {
  position: fixed;
  left: 50%;
  top: 46%;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: hsl(var(--h), 90%, 58%);
  box-shadow: 0 0 16px hsl(var(--h), 90%, 58%);
  opacity: 0;
  animation: p24Spark 1.7s ease-out infinite;
  animation-delay: var(--delay);
}

@keyframes p24Spark {
  0% {
    opacity: 0;
    transform: translate(0, 0) scale(.2);
  }

  12% {
    opacity: 1;
  }

  100% {
    opacity: 0;
    transform: translate(var(--x), var(--y)) scale(.05);
  }
}

@keyframes p24FireworksFade {
  0%, 82% {
    opacity: 1;
  }

  100% {
    opacity: 0;
  }
}

@keyframes p24FireworksCard {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(16px) scale(.94);
  }

  12%, 78% {
    opacity: 1;
    transform: translateX(-50%) translateY(0) scale(1);
  }

  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(-10px) scale(.96);
  }
}

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

  .achievements-grid-v2 {
    grid-template-columns: 1fr;
  }
}

/* Team weight chart */
.chart-card {
  padding: 20px 24px !important;
}

.chart-head-v2 {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 14px !important;
}

.team-chart-legend {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 560px;
}

.team-chart-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.75);
  border: 1px solid rgba(17,24,39,.08);
  font-size: 13px;
  white-space: nowrap;
}

.team-chart-dot {
  width: 11px;
  height: 11px;
  border-radius: 999px;
  box-shadow: 0 0 0 3px rgba(255,255,255,.8);
}

.team-chart-legend-item strong {
  font-weight: 950;
}

.team-chart-legend-item em {
  font-style: normal;
  color: var(--muted);
  font-weight: 850;
}

.team-chart-wrap {
  overflow-x: auto;
  padding-bottom: 4px;
}

.team-chart-svg {
  display: block;
  width: 100%;
  min-width: 760px;
  height: auto;
}

.team-chart-bg {
  fill: rgba(255,255,255,.54);
  stroke: rgba(17,24,39,.08);
}

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

.team-chart-axis {
  stroke: rgba(17,24,39,.14);
  stroke-width: 1.5;
}

.team-chart-tick,
.team-chart-date {
  fill: rgba(17,24,39,.62);
  font-size: 14px;
  font-weight: 850;
}

.team-chart-line {
  filter: drop-shadow(0 4px 8px rgba(15,23,42,.12));
}

.team-chart-point circle {
  stroke: white;
  stroke-width: 3;
}

.team-chart-summary {
  margin-top: 10px;
  color: var(--muted);
  font-weight: 850;
  font-size: 14px;
}

.team-chart-empty {
  padding: 26px;
  border-radius: 24px;
  background: rgba(255,255,255,.65);
  color: var(--muted);
  font-weight: 900;
}

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

  .team-chart-legend {
    justify-content: flex-start;
  }
}

/* Weight table v2 */
.weight-table-card,
#weightTableCard {
  padding: 20px 24px !important;
}

.table-head-v2 {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.table-head-v2 h3 {
  margin: 0 0 6px;
}

.table-head-v2 .muted {
  margin: 0;
}

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

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

.table-range-btn {
  border: 0;
  cursor: pointer;
  padding: 10px 15px;
  border-radius: 14px;
  background: transparent;
  color: var(--dark);
  font-weight: 950;
}

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

.weight-legend {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-weight: 900;
  font-size: 13px;
}

.weight-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.weight-legend .dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  display: inline-block;
}

.weight-legend .dot.minus {
  background: var(--green);
}

.weight-legend .dot.plus {
  background: var(--red);
}

.weight-legend .dot.same {
  background: #9ca3af;
}

.weight-table-scroll {
  max-height: 620px;
  overflow: auto;
  border-radius: 24px;
  border: 1px solid rgba(17,24,39,.08);
  background: rgba(255,255,255,.55);
}

.weight-table-v2 {
  width: 100%;
  min-width: 760px;
  border-collapse: separate;
  border-spacing: 0;
}

.weight-table-v2 th,
.weight-table-v2 td {
  padding: 10px 12px;
  border-bottom: 1px solid rgba(17,24,39,.07);
  border-right: 1px solid rgba(17,24,39,.05);
  background: rgba(255,255,255,.72);
  vertical-align: middle;
}

.weight-table-v2 thead th {
  position: sticky;
  top: 0;
  z-index: 7;
  background: rgba(248,250,252,.96);
  backdrop-filter: blur(10px);
  font-size: 13px;
  font-weight: 950;
  text-align: center;
}

.weight-table-v2 .date-sticky {
  position: sticky;
  left: 0;
  z-index: 6;
  width: 150px;
  min-width: 150px;
  text-align: left;
  font-weight: 950;
  background: rgba(248,250,252,.97);
  backdrop-filter: blur(10px);
}

.weight-table-v2 thead .date-sticky {
  z-index: 9;
}

.weight-table-v2 .own-col {
  background: rgba(236,252,203,.42);
}

.weight-table-v2 thead .own-col {
  background: rgba(217,249,157,.82);
}

.weight-user-name {
  display: inline-block;
  font-weight: 950;
}

.table-you {
  margin-left: 6px;
  padding: 3px 7px;
  font-size: 10px;
}

.weight-cell {
  min-width: 160px;
  text-align: center;
}

.weight-cell.minus {
  box-shadow: inset 0 0 0 999px rgba(34,197,94,.035);
}

.weight-cell.plus {
  box-shadow: inset 0 0 0 999px rgba(239,68,68,.035);
}

.table-weight-input {
  width: 100%;
  height: 42px;
  border-radius: 16px;
  border: 1px solid rgba(17,24,39,.10);
  background: rgba(255,255,255,.88);
  text-align: center;
  font-weight: 950;
  font-size: 15px;
}

.table-weight-input:focus {
  outline: none;
  border-color: rgba(132,204,22,.75);
  box-shadow: 0 0 0 4px rgba(132,204,22,.16);
}

.table-weight-input::placeholder {
  color: rgba(17,24,39,.28);
}

.readonly-weight {
  min-height: 42px;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: rgba(255,255,255,.62);
  font-weight: 950;
}

.readonly-weight.empty {
  color: rgba(17,24,39,.28);
  background: rgba(255,255,255,.28);
}

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

  .table-tools-v2 {
    justify-items: start;
  }

  .range-tabs {
    width: 100%;
  }

  .table-range-btn {
    flex: 1;
  }
}

.weight-invalid {
  border-color: rgba(239,68,68,.85) !important;
  box-shadow: 0 0 0 4px rgba(239,68,68,.16) !important;
  background: rgba(254,242,242,.95) !important;
}

/* Guest CTA: registration should be visible */
#guestActions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

#guestActions button,
#guestActions a {
  min-height: 48px;
  padding: 14px 22px !important;
  border-radius: 18px !important;
  font-size: 15px !important;
  font-weight: 950 !important;
}

/* usually: first is login, last is registration */
#guestActions button:first-child,
#guestActions a:first-child {
  background: rgba(255,255,255,.72) !important;
  color: var(--dark) !important;
  border: 1px solid rgba(17,24,39,.08) !important;
}

#guestActions button:last-child,
#guestActions a:last-child {
  background: var(--dark) !important;
  color: #fff !important;
  box-shadow: 0 14px 34px rgba(15,23,42,.18) !important;
  transform: translateZ(0);
}

#guestActions button:last-child::after,
#guestActions a:last-child::after {
  content: " →";
}

/* Weight table: page scrolls vertically, table only horizontally */
.weight-table-scroll {
  max-height: none !important;
  overflow-x: auto !important;
  overflow-y: clip !important;
  overscroll-behavior: auto !important;
  scrollbar-gutter: stable;
}

/* make the table less tall now that page handles vertical scroll */
.weight-table-v2 th,
.weight-table-v2 td {
  padding-top: 8px !important;
  padding-bottom: 8px !important;
}

/* keep header/date useful without trapping wheel */
.weight-table-v2 thead th {
  position: sticky;
  top: 0;
}

.weight-table-v2 .date-sticky {
  position: sticky;
  left: 0;
}

@media (max-width: 760px) {
  #guestActions {
    width: 100%;
  }

  #guestActions button,
  #guestActions a {
    flex: 1 1 160px;
  }
}

/* Final fix: table must not trap vertical mouse wheel */
.weight-table-scroll,
.table-scroll,
.table-wrap,
.weights-table-scroll,
.weights-table-wrap {
  max-height: none !important;
  overflow-x: auto !important;
  overflow-y: hidden !important;
  overscroll-behavior-y: auto !important;
}

/* Keep page scroll normal around the table */
#weightTableCard,
.weight-table-card {
  overflow: visible !important;
}

/* On desktop the table grows with the page, not inside its own vertical scroll */
.weight-table-v2,
.weight-table,
.weights-table {
  margin-bottom: 0 !important;
}

/* Smooth table scroll: vertical wheel belongs to the page */
.weight-table-scroll,
.table-scroll,
.table-wrap,
.weights-table-scroll,
.weights-table-wrap {
  max-height: none !important;
  overflow-x: auto !important;
  overflow-y: visible !important;
  overscroll-behavior: auto !important;
  scroll-behavior: auto !important;
}

#weightTableCard,
.weight-table-card {
  overflow: visible !important;
}

.weight-table-scroll {
  -webkit-overflow-scrolling: touch;
}

/* Mobile UX final layer */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

img,
svg,
canvas {
  max-width: 100%;
}

/* iPhone / mobile */
@media (max-width: 760px) {
  html,
  body {
    width: 100%;
    overflow-x: hidden !important;
  }

  body {
    font-size: 15px;
  }

  main,
  header,
  section,
  .page,
  .app,
  .shell,
  .container,
  .wrap {
    max-width: 100% !important;
  }

  .container,
  .wrap,
  .shell {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }

  /* HERO */
  .hero,
  .hero-grid,
  .hero-inner,
  .hero-row,
  .top-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 16px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  h1,
  .hero h1 {
    font-size: clamp(52px, 16vw, 72px) !important;
    line-height: .9 !important;
    letter-spacing: -0.06em !important;
    max-width: 100% !important;
    overflow-wrap: normal !important;
  }

  .eyebrow,
  .hero-kicker {
    font-size: 13px !important;
    letter-spacing: .18em !important;
    white-space: normal !important;
  }

  .hero p,
  .hero-lead,
  .lead {
    max-width: 100% !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    font-size: 17px !important;
    line-height: 1.35 !important;
  }

  #guestActions,
  #userActions,
  .hero-actions {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    width: 100% !important;
    max-width: 100% !important;
  }

  #guestActions button,
  #guestActions a,
  #userActions button,
  #userActions a,
  .hero-actions button,
  .hero-actions a {
    width: 100% !important;
    min-width: 0 !important;
    max-width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
    padding: 15px 18px !important;
    border-radius: 18px !important;
    font-size: 16px !important;
  }

  /* Scale animation card */
  .scale-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    padding: 22px !important;
    border-radius: 28px !important;
    margin: 0 !important;
  }

  .scale-card strong,
  #heroMood {
    font-size: 24px !important;
    line-height: 1.08 !important;
  }

  .scale-card span {
    font-size: 15px !important;
    line-height: 1.35 !important;
  }

  .p24-scale-scene {
    transform: scale(.92);
    transform-origin: left center;
    margin-bottom: 4px;
  }

  /* Cards and grids */
  .card,
  section.card,
  .profile-card,
  .leaderboard-card,
  .achievements-personal-card,
  #weightTableCard,
  .weight-table-card,
  .chart-card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    border-radius: 26px !important;
    padding: 18px !important;
  }

  .stats-grid,
  .summary-grid,
  .metrics-grid,
  .cards-grid,
  .participants-grid,
  .rating-grid,
  .achievements-grid-v2 {
    grid-template-columns: 1fr !important;
    width: 100% !important;
  }

  /* Profile compact */
  #profileSection,
  .profile-section {
    width: 100% !important;
    max-width: 100% !important;
  }

  /* Today weight form */
  #todayWeightForm,
  .today-weight-form,
  .daily-entry-form {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 10px !important;
    width: 100% !important;
  }

  #todayWeightForm input,
  #todayWeightForm button,
  .daily-entry-form input,
  .daily-entry-form button {
    width: 100% !important;
    min-width: 0 !important;
  }

  /* Feed */
  .feed-item {
    grid-template-columns: 42px 1fr !important;
    gap: 10px !important;
  }

  .feed-date {
    grid-column: 2;
    justify-self: start !important;
    margin-top: 4px;
    font-size: 12px !important;
  }

  /* Chart */
  .chart-head-v2 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 12px !important;
  }

  .team-chart-legend {
    max-width: 100% !important;
    justify-content: flex-start !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    padding-bottom: 4px;
  }

  .team-chart-legend-item {
    flex: 0 0 auto;
    font-size: 13px !important;
  }

  .team-chart-wrap {
    width: 100% !important;
    overflow-x: hidden !important;
  }

  .team-chart-svg {
    min-width: 0 !important;
    width: 100% !important;
    height: 250px !important;
  }

  .team-chart-summary {
    font-size: 13px !important;
    line-height: 1.35 !important;
  }

  /* Weight table head */
  .table-head-v2 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    width: 100% !important;
  }

  .table-tools-v2 {
    width: 100% !important;
    justify-items: stretch !important;
    overflow: hidden !important;
  }

  .range-tabs {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 4px !important;
    padding: 4px !important;
    overflow: hidden !important;
  }

  .table-range-btn {
    min-width: 0 !important;
    width: 100% !important;
    padding: 11px 8px !important;
    font-size: 13px !important;
    white-space: nowrap !important;
  }

  .weight-legend {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px 12px !important;
    font-size: 13px !important;
  }

  /* Weight table itself */
  .weight-table-scroll {
    width: 100% !important;
    max-width: 100% !important;
    overflow-x: auto !important;
    overflow-y: visible !important;
    border-radius: 22px !important;
  }

  .weight-table-v2 {
    width: 100% !important;
    min-width: 0 !important;
    table-layout: fixed !important;
  }

  .weight-table-v2 .date-sticky {
    width: 42% !important;
    min-width: 118px !important;
    max-width: 150px !important;
    left: 0;
    font-size: 15px !important;
  }

  .weight-table-v2 th,
  .weight-table-v2 td {
    padding: 12px 10px !important;
  }

  .weight-cell {
    min-width: 0 !important;
    width: auto !important;
  }

  .table-weight-input,
  .readonly-weight {
    height: 42px !important;
    min-height: 42px !important;
    font-size: 15px !important;
    border-radius: 15px !important;
  }

  .weight-user-name {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  /* Footer */
  footer,
  .footer {
    padding-left: 14px !important;
    padding-right: 14px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
  }
}

/* Very small mobile */
@media (max-width: 420px) {
  h1,
  .hero h1 {
    font-size: clamp(48px, 15vw, 62px) !important;
  }

  .scale-card strong,
  #heroMood {
    font-size: 22px !important;
  }

  .team-chart-svg {
    height: 230px !important;
  }

  .table-range-btn {
    font-size: 12px !important;
    padding-left: 5px !important;
    padding-right: 5px !important;
  }
}


/* Hide public admin button */
#adminLink { display: none !important; }

/* Mobile fix v2: hidden must always win */
.hidden,
#guestActions.hidden,
#userActions.hidden,
#profileSection.hidden,
#authPanel.hidden,
#adminLink.hidden,
#adminLink {
  display: none !important;
}

/* Mobile fix v2: no horizontal overflow */
@media (max-width: 760px) {
  html,
  body {
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }

  body {
    position: relative;
  }

  .container,
  .wrap,
  .shell,
  main,
  header,
  section,
  .card {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .hero,
  .hero-grid,
  .hero-inner,
  .hero-row,
  .top-grid {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    overflow: hidden !important;
  }

  h1,
  .hero h1 {
    font-size: clamp(42px, 12.5vw, 56px) !important;
    line-height: .92 !important;
    letter-spacing: -0.055em !important;
    max-width: 100% !important;
  }

  .hero p,
  .hero-lead,
  .lead,
  #heroSubtitle,
  #heroLead {
    width: 100% !important;
    max-width: 100% !important;
    white-space: normal !important;
    overflow: visible !important;
    text-overflow: unset !important;
    font-size: 16px !important;
    line-height: 1.35 !important;
  }

  #guestActions:not(.hidden),
  #userActions:not(.hidden),
  .hero-actions:not(.hidden) {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    gap: 10px !important;
  }

  #guestActions button,
  #guestActions a,
  #userActions button,
  #userActions a,
  .hero-actions button,
  .hero-actions a {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    white-space: normal !important;
  }

  .scale-card {
    overflow: hidden !important;
  }
}

@media (max-width: 420px) {
  h1,
  .hero h1 {
    font-size: clamp(40px, 11.8vw, 52px) !important;
  }
}

/* Mobile table as cards */
.mobile-weight-list-v2 {
  display: none;
}

@media (max-width: 760px) {
  #weightTableCard .table-head-v2,
  .weight-table-card .table-head-v2 {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 14px !important;
  }

  #weightTableCard .table-tools-v2,
  .weight-table-card .table-tools-v2 {
    width: 100% !important;
    justify-items: stretch !important;
  }

  #weightTableCard .range-tabs,
  .weight-table-card .range-tabs {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }

  #weightTableCard .table-range-btn,
  .weight-table-card .table-range-btn {
    min-width: 0 !important;
    width: 100% !important;
    font-size: 12px !important;
    padding: 11px 5px !important;
  }

  #weightTableCard .weight-legend,
  .weight-table-card .weight-legend {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px 12px !important;
    font-size: 12px !important;
  }

  #weightTableCard .weight-table-scroll,
  .weight-table-card .weight-table-scroll {
    display: none !important;
  }

  .mobile-weight-list-v2 {
    display: grid !important;
    gap: 12px;
    margin-top: 16px;
  }

  .mobile-weight-date-card {
    border-radius: 22px;
    background: rgba(255,255,255,.72);
    border: 1px solid rgba(17,24,39,.08);
    overflow: hidden;
  }

  .mobile-weight-date {
    padding: 13px 15px;
    font-size: 18px;
    font-weight: 950;
    background: rgba(248,250,252,.82);
    border-bottom: 1px solid rgba(17,24,39,.07);
  }

  .mobile-weight-people {
    display: grid;
  }

  .mobile-weight-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 130px;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(17,24,39,.06);
  }

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

  .mobile-weight-row strong {
    display: block;
    font-size: 15px;
    font-weight: 950;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .mobile-weight-row em {
    display: inline-flex;
    margin-top: 4px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(132,204,22,.18);
    color: #3f6212;
    font-style: normal;
    font-size: 11px;
    font-weight: 950;
  }

  .mobile-weight-row b {
    justify-self: end;
    font-size: 15px;
    font-weight: 950;
  }

  .mobile-weight-input {
    width: 130px !important;
    height: 42px !important;
    justify-self: end;
    text-align: center;
  }

  .mobile-weight-empty {
    padding: 14px;
    color: var(--muted);
    font-weight: 850;
  }
}

@media (max-width: 420px) {
  .mobile-weight-row {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .mobile-weight-input {
    width: 112px !important;
  }
}

/* Weight table mobile v3 */
.p24-wt-mobile {
  display: none;
}

.p24-wt-head {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 18px;
  align-items: start;
  margin-bottom: 16px;
}

.p24-wt-title h3 {
  margin: 0 0 6px;
}

.p24-wt-title .muted {
  margin: 0;
}

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

@media (max-width: 760px) {
  #weightTableCard,
  .weight-table-card {
    padding: 20px !important;
    overflow: hidden !important;
  }

  .p24-wt-head {
    grid-template-columns: 1fr !important;
    gap: 14px !important;
    margin-bottom: 16px !important;
  }

  .p24-wt-title h3 {
    font-size: 30px !important;
    line-height: 1.05 !important;
  }

  .p24-wt-title .muted {
    font-size: 15px !important;
    line-height: 1.35 !important;
    max-width: 100% !important;
  }

  .p24-wt-tools {
    width: 100% !important;
    justify-items: stretch !important;
    overflow: hidden !important;
  }

  .p24-wt-ranges {
    width: 100% !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 5px !important;
    padding: 5px !important;
    border-radius: 18px !important;
  }

  .p24-wt-ranges .table-range-btn {
    width: 100% !important;
    min-width: 0 !important;
    padding: 12px 6px !important;
    font-size: 12px !important;
    white-space: nowrap !important;
    border-radius: 14px !important;
  }

  .p24-wt-legend {
    width: 100% !important;
    display: flex !important;
    flex-wrap: wrap !important;
    gap: 8px 12px !important;
    font-size: 12px !important;
    line-height: 1.2 !important;
  }

  .p24-wt-desktop {
    display: none !important;
  }

  .p24-wt-mobile {
    display: grid !important;
    gap: 12px;
    width: 100%;
    max-width: 100%;
  }

  .p24-mobile-date-card {
    width: 100%;
    max-width: 100%;
    border-radius: 22px;
    overflow: hidden;
    background: rgba(255,255,255,.74);
    border: 1px solid rgba(17,24,39,.08);
  }

  .p24-mobile-date-card header {
    padding: 13px 15px;
    font-size: 18px;
    font-weight: 950;
    background: rgba(248,250,252,.86);
    border-bottom: 1px solid rgba(17,24,39,.07);
  }

  .p24-mobile-people {
    display: grid;
  }

  .p24-mobile-weight-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 118px;
    gap: 10px;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid rgba(17,24,39,.06);
  }

  .p24-mobile-weight-row:last-child {
    border-bottom: 0;
  }

  .p24-mobile-weight-row.minus {
    background: rgba(34,197,94,.045);
  }

  .p24-mobile-weight-row.plus {
    background: rgba(239,68,68,.045);
  }

  .p24-mobile-weight-row.same {
    background: rgba(148,163,184,.035);
  }

  .p24-mobile-person {
    min-width: 0;
  }

  .p24-mobile-person strong {
    display: block;
    font-size: 16px;
    line-height: 1.1;
    font-weight: 950;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .p24-mobile-person em {
    display: inline-flex;
    margin-top: 5px;
    padding: 3px 8px;
    border-radius: 999px;
    background: rgba(132,204,22,.18);
    color: #3f6212;
    font-size: 11px;
    line-height: 1;
    font-style: normal;
    font-weight: 950;
  }

  .p24-mobile-weight-row b {
    justify-self: end;
    font-size: 15px;
    font-weight: 950;
    white-space: nowrap;
  }

  .p24-mobile-weight-input {
    width: 118px !important;
    height: 42px !important;
    min-height: 42px !important;
    justify-self: end;
    text-align: center;
    border-radius: 15px !important;
    font-size: 15px !important;
  }

  .p24-mobile-empty {
    padding: 14px;
    color: var(--muted);
    font-weight: 850;
  }
}

@media (max-width: 420px) {
  .p24-mobile-weight-row {
    grid-template-columns: minmax(0, 1fr) 104px;
    padding: 11px 12px;
  }

  .p24-mobile-weight-input {
    width: 104px !important;
  }

  .p24-wt-ranges .table-range-btn {
    font-size: 11px !important;
    padding-left: 4px !important;
    padding-right: 4px !important;
  }
}

/* Mobile table: many participants v4 */
@media (max-width: 760px) {
  .p24-mobile-date-card.many .p24-mobile-people {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 10px !important;
  }

  .p24-mobile-date-card.many .p24-mobile-weight-row {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    align-items: start !important;
    padding: 11px !important;
    border: 1px solid rgba(17,24,39,.07) !important;
    border-radius: 16px !important;
    background: rgba(255,255,255,.72);
  }

  .p24-mobile-date-card.many .p24-mobile-weight-row.own {
    grid-column: 1 / -1 !important;
    grid-template-columns: minmax(0, 1fr) 118px !important;
    align-items: center !important;
    background: rgba(132,204,22,.09) !important;
    border-color: rgba(132,204,22,.22) !important;
  }

  .p24-mobile-date-card.many .p24-mobile-weight-row:not(.own) b {
    justify-self: start !important;
    font-size: 16px !important;
  }

  .p24-mobile-date-card.many .p24-mobile-person strong {
    font-size: 15px !important;
  }

  .p24-mobile-date-card.many .p24-mobile-weight-input {
    width: 118px !important;
  }
}

@media (max-width: 420px) {
  .p24-mobile-date-card.many .p24-mobile-people {
    grid-template-columns: 1fr !important;
  }

  .p24-mobile-date-card.many .p24-mobile-weight-row.own {
    grid-template-columns: minmax(0, 1fr) 108px !important;
  }

  .p24-mobile-date-card.many .p24-mobile-weight-input {
    width: 108px !important;
  }
}

/* Mobile table: keep many participants compact on iPhone */
@media (max-width: 760px) {
  .p24-mobile-date-card.many .p24-mobile-people {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 8px !important;
    padding: 10px !important;
  }

  .p24-mobile-date-card.many .p24-mobile-weight-row.own {
    grid-column: 1 / -1 !important;
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) 118px !important;
    align-items: center !important;
  }

  .p24-mobile-date-card.many .p24-mobile-weight-row:not(.own) {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 7px !important;
    min-width: 0 !important;
    padding: 10px !important;
  }

  .p24-mobile-date-card.many .p24-mobile-weight-row:not(.own) .p24-mobile-person strong {
    font-size: 14px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
  }

  .p24-mobile-date-card.many .p24-mobile-weight-row:not(.own) b {
    justify-self: start !important;
    font-size: 15px !important;
  }
}

/* Only very tiny screens fall back to one column */
@media (max-width: 350px) {
  .p24-mobile-date-card.many .p24-mobile-people {
    grid-template-columns: 1fr !important;
  }
}
