:root {
  --ink: #1a0d3d;
  --yellow: #f4e400;
  --yellow-soft: #fff4a3;
  --magenta: #e2187c;
  --cream: #fbf7ee;
  --white: #ffffff;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--ink);
  color: var(--cream);
  font-family: "Outfit", "Segoe UI", system-ui, sans-serif;
  cursor: none;
}

body {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  height: 100dvh;
  max-height: 100dvh;
  padding: clamp(10px, 2vh, 28px) clamp(20px, 2.5vw, 64px) clamp(12px, 2.6vh, 32px);
  gap: clamp(6px, 1vh, 14px);
}

button,
img { cursor: none; }

.top {
  position: absolute;
  top: clamp(10px, 2vh, 28px);
  right: clamp(20px, 2.5vw, 64px);
  z-index: 3;
}

.brand,
.event,
.status {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.event { justify-content: flex-end; text-align: right; }

.bottom .brand,
.bottom .event {
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  text-align: center;
  gap: clamp(6px, 1vh, 12px);
}

.status {
  justify-content: flex-end;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.brand img { width: clamp(81px, min(14.45vh, 8.125vw), 156px); height: clamp(81px, min(14.45vh, 8.125vw), 156px); }

.brand-name,
.event-name {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(16px, min(2.4vh, 1.4vw), 26px);
  line-height: 1;
  font-weight: 700;
  color: var(--white);
}

.brand-sub {
  margin: 4px 0 0;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--yellow);
}

.event img.woc-badge {
  display: block;
  width: clamp(104px, min(18.5vh, 10.4vw), 200px);
  height: clamp(104px, min(18.5vh, 10.4vw), 200px);
  max-width: none;
  background: none;
  border-radius: 50%;
  padding: 0;
  object-fit: contain;
}

.link {
  margin: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--yellow);
}

.dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #3da83a;
  box-shadow: 0 0 0 0 rgba(61, 168, 58, 0.7);
  animation: pulse 1.6s infinite;
}

body.is-offline .dot { background: var(--magenta); animation: none; }
body.is-offline .link { color: #ffd0e6; }

.hero {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding-top: clamp(16px, 4vh, 56px);
}

.figure {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
}

h1 {
  margin: 0;
  max-width: min(1680px, calc(100vw - 2 * clamp(20px, 2.5vw, 64px) - 2 * 170px));
  font-family: "Fraunces", Georgia, serif;
  font-size: clamp(22px, min(5.4vh, 3.3vw), 66px);
  font-weight: 700;
  line-height: 1.05;
  color: var(--white);
}

.total {
  margin: 0;
  font-size: clamp(72px, min(30vh, 21vw), 420px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.03em;
  white-space: nowrap;
  color: var(--yellow);
  font-variant-numeric: tabular-nums;
}

.empty {
  margin: 4vh 0 0;
  max-width: 1600px;
  font-size: clamp(32px, min(10vh, 6vw), 120px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--yellow);
}

.unit {
  margin: clamp(20px, 6vh, 80px) 0 0;
  max-width: 1680px;
  font-size: clamp(16px, min(4vh, 2.5vw), 48px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--white);
}

.last {
  margin: 1.5vh 0 0;
  font-size: clamp(15px, min(3.8vh, 2.4vw), 46px);
  font-weight: 700;
  line-height: 1.2;
  color: var(--yellow-soft);
}

.total[hidden],
.empty[hidden],
.unit[hidden],
.last[hidden] { display: none; }

.bottom {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 28px;
}

#fs {
  border: 0;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font: 700 15px/1 "Outfit", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 10px 14px;
}

#fs:focus { outline: 4px solid var(--white); }

.flash {
  position: fixed;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  border: 16px solid transparent;
}

.flash.is-on { animation: ring 1.15s ease; }

.delta {
  position: fixed;
  z-index: 5;
  left: 50%;
  top: 18%;
  margin: 0;
  padding: 12px 28px;
  border-radius: 999px;
  background: var(--yellow);
  color: var(--ink);
  font-size: clamp(36px, 4vw, 64px);
  font-weight: 700;
  pointer-events: none;
  opacity: 0;
}

.delta.is-on { animation: rise 2.4s ease forwards; }
.total.is-new { animation: pop 0.7s cubic-bezier(0.2, 1.4, 0.4, 1); }
.total.is-down { animation: dip 0.7s ease; }

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

.noscript {
  position: fixed;
  inset: auto 40px 40px 40px;
  background: var(--magenta);
  color: var(--white);
  font-size: 28px;
  padding: 16px 20px;
  border-radius: 16px;
}

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(61, 168, 58, 0.65); }
  70% { box-shadow: 0 0 0 12px rgba(61, 168, 58, 0); }
  100% { box-shadow: 0 0 0 0 rgba(61, 168, 58, 0); }
}

@keyframes ring {
  0% { border-color: var(--yellow); }
  100% { border-color: transparent; }
}

@keyframes rise {
  0% { opacity: 0; transform: translateX(-50%) translateY(20px) scale(0.92); }
  14% { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-28px); }
}

@keyframes pop {
  0% { transform: scale(0.9); }
  55% { transform: scale(1.05); }
  100% { transform: scale(1); }
}

@keyframes dip {
  0% { color: #ff8ec4; }
  100% { color: var(--yellow); }
}

.total::after {
  content: "\00a0kg";
  font-size: 0.38em;
  letter-spacing: 0;
}
