* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  max-width: 100%;
  overflow-x: clip;
  background: #0f1419;
  color: #f4f7fb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  padding: 28px 20px 48px;
}

h1,
p {
  margin: 0;
}

.copy {
  max-width: min(28rem, 100%);
  margin: 0 auto;
}

h1 {
  font-size: 22px;
  line-height: 1.25;
}

p {
  margin-top: 14px;
  color: #c5d0dc;
  font-size: 17px;
  line-height: 1.5;
}

.meter strong {
  color: #8fd0ff;
}

/*
  The QR stays in flow, so the text wraps around it.
  The slot is full-bleed: body padding is not part of the measurement.
  The green bars clip before the white square.
*/
.qr-slot {
  display: flex;
  justify-content: center;
  width: 100vw;
  max-width: 100vw;
  margin: 28px calc(50% - 50vw);
  overflow: hidden;
}

/*
  The only region that rejects pinch: touch-action belongs with pinch-lock.js.
  physical-size.js writes --qr-px and --qr-zoom. The same module writes the
  transform, and only to shrink the QR during a pinch.
*/
.qr-item {
  --qr-zoom: 1;
  --qr-px: 271.65;
  display: flex;
  align-items: stretch;
  gap: 8px;
  width: max-content;
  max-width: 100%;
  min-width: 0;
  transform-origin: center center;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  will-change: transform;
}

.bar {
  width: 10px;
  flex: 1 1 10px;
  min-width: 0;
  border-radius: 999px;
  background: #1e4630;
  position: relative;
  overflow: hidden;
}

.bar::before {
  content: "";
  position: absolute;
  left: 0;
  width: 100%;
  height: 38%;
  border-radius: inherit;
  background: linear-gradient(#b6ffcf, #2fce6b);
  animation: sweep 1.6s ease-in-out infinite;
}

.bar.right::before {
  animation-delay: -0.8s;
}

.qr-item.expired .bar {
  background: #3a2a2e;
}

.qr-item.expired .bar::before {
  top: 0;
  height: 100%;
  animation: none;
  background: #8a4a55;
}

.qr-frame {
  flex: 0 0 auto;
  width: calc(var(--qr-px) * var(--qr-zoom) * 1px);
  aspect-ratio: 1;
  height: auto;
  display: grid;
  place-items: center;
  background: #fff;
}

.qr-frame img {
  width: 100%;
  height: 100%;
  max-width: 100%;
  object-fit: contain;
  display: block;
}

.dock {
  width: min(28rem, 100%);
  max-width: 100%;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: 20px;
  background: #172029;
  border: 1px solid #2a3642;
  touch-action: manipulation;
}

.dock div {
  padding: 8px 10px;
  border-radius: 12px;
  background: #10181f;
}

.dock span {
  display: block;
  color: #93a3b3;
  font-size: 12px;
}

.dock strong {
  display: block;
  margin-top: 4px;
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.countdown {
  color: #8ee7ad;
}

.dock.expired .countdown {
  color: #ffb4be;
}

button {
  grid-column: 1 / -1;
  border: 0;
  border-radius: 999px;
  padding: 14px 16px;
  background: #d7f5e3;
  color: #102117;
  font: inherit;
  font-size: 16px;
  font-weight: 650;
}

.after {
  margin-top: 28px;
}

.size-control {
  display: block;
  margin-top: 18px;
  color: #c5d0dc;
  font-size: 14px;
}

.size-control input {
  display: block;
  width: 100%;
  margin-top: 8px;
  accent-color: #2fce6b;
  touch-action: manipulation;
}

.size-readout {
  margin-top: 10px;
  font-variant-numeric: tabular-nums;
}

.size-note {
  margin-top: 8px;
  color: #93a3b3;
  font-size: 13px;
}

.size-scale {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.size-scale button {
  padding: 8px 10px;
  background: #243140;
  color: #f4f7fb;
  font-size: 13px;
  font-weight: 600;
}

.size-scale button[aria-pressed="true"] {
  background: #d7f5e3;
  color: #102117;
}

@keyframes sweep {
  0% {
    top: -40%;
  }
  100% {
    top: 100%;
  }
}
