:root {
  color-scheme: dark;
  --ink: #12273e;
  --cream: #f7f3e6;
  --yellow: #ffd33e;
  --sans: "DM Sans", "Segoe UI", Arial, sans-serif;
  --mono: "IBM Plex Mono", Consolas, "Courier New", monospace;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; min-width: 0; }
body { color: var(--cream); background: #142b40; font-family: var(--sans); }
.counter {
  display: grid; grid-template-rows: auto minmax(0,1fr) auto;
  min-height: 128px; height: 100vh; height: 100svh; overflow: hidden;
}
.top-rail, .bottom-rail { display: flex; align-items: center; justify-content: space-between; min-width: 0; }
.top-rail {
  gap: 1em; padding: clamp(6px,2.2vmin,24px) 5vw;
  background: var(--yellow); color: var(--ink); border-bottom: 2px solid #07182a;
}
.brand {
  display: flex; align-items: center; gap: .4em; white-space: nowrap;
  font: italic 950 clamp(13px,3.5vmin,42px)/1 "Archivo Black","Arial Black",Arial,sans-serif;
  letter-spacing: -.045em;
}
.brand img {
  display: block; width: 4.5em; height: auto;
}
.signal, .eyebrow, .bottom-rail { font-family: var(--mono); font-weight: 700; }
.signal { display: flex; align-items: center; gap: .55em; font-size: clamp(10px,2vmin,22px); }
.signal::before { content: ""; width: .65em; height: .65em; background: currentColor; border-radius: 50%; }
.counter[data-phase="empty"] .signal::before, .counter[data-phase="offline"] .signal::before,
.counter[data-phase="loading"] .signal::before, .counter[data-phase="unavailable"] .signal::before {
  background: transparent; box-shadow: inset 0 0 0 1.5px currentColor;
}
.worktop {
  position: relative; isolation: isolate; display: grid; grid-template-columns: minmax(0,1.05fr) minmax(0,.95fr);
  gap: 2%; align-items: center; padding: 2vmin 5vw; min-height: 0; overflow: hidden;
  background: linear-gradient(115deg,#152d45 10%,#203a50 68%,#1a3048);
}
.worktop::before {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: url("/assets/felt.webp") center/350px; opacity: .075; mix-blend-mode: luminosity;
}
.worktop::after {
  content: ""; position: absolute; right: 0; bottom: 0; pointer-events: none; z-index: -1;
  width: 38%; height: 55%; opacity: .14; background: repeating-linear-gradient(-28deg,transparent 0 2.1vmin,#63809a 2.1vmin 3vmin);
  clip-path: polygon(100% 0,100% 100%,0 100%);
}
.label { min-width: 0; }
.eyebrow {
  margin: 0 0 .7em; color: var(--yellow); font-size: clamp(10px,2.2vmin,26px);
  line-height: 1.2; text-transform: uppercase; letter-spacing: .09em;
}
h1 {
  margin: 0; overflow-wrap: anywhere; text-wrap: balance; color: var(--cream);
  font: italic 900 clamp(21px,min(6.5vw,10.5vh),110px)/.99 "Archivo Black","Arial Black",Arial,sans-serif;
  letter-spacing: -.047em;
}
#detail {
  margin: .75em 0 0; font-size: clamp(12px,3vmin,33px); line-height: 1.3; color: #e4e9e9;
  overflow-wrap: anywhere; max-width: 30em;
}
#detail:empty { display: none; }
.visual { position: relative; min-width: 0; height: 100%; display: grid; place-items: center; }
.return-slot {
  position: relative; width: 90%; height: 18%; max-height: 88px; min-height: 15px; transform: perspective(850px) rotateX(24deg) rotate(-6deg);
  border-radius: 4px; padding: 2%; border: 1px solid #84929b;
  background: linear-gradient(170deg,#8b99a0,#455965 18%,#9eadb6 25%,#758590 66%,#465b6a);
  box-shadow: 0 3px 0 #142433,0 8px 16px #05152688,inset 0 0 0 2px #617581;
}
.return-slot i { display: block; width: 100%; height: 100%; padding: 6px 12%; background: #0b1925; border: 1px solid #213646; box-shadow: inset 0 4px 5px #080e15; }
.return-slot i::after { content: ""; display: block; height: 100%; width: 100%; opacity: .45; background: repeating-linear-gradient(90deg,#6b6140 0 1%, transparent 1% 2.5%); }
.product {
  display: none; position: relative; width: min(84%,42vh); height: 91%; max-height: 680px;
  filter: drop-shadow(3px 8px 5px #07172c99);
}
.product > * { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.packet, .seam { transition: transform .56s cubic-bezier(.2,.78,.21,1), opacity .35s; }
.packet { transform: rotate(-7deg); }
.seam, .ticket, .cartridge { visibility: hidden; }
.ticket, .cartridge {
  display: grid; justify-items: center; align-content: center; transform: perspective(860px) rotateY(-9deg) rotateZ(3deg);
}
.ticket .ticket-print, .cartridge .card-print { flex-direction: column; width: min(100%,35.8vh); height: auto; max-height: 100%; aspect-ratio: .596; }
.ticket .ticket-print { position: relative; display: block; }
.club-back-plate { display: block; width: 100%; height: 100%; object-fit: fill; }
.cartridge .card-print { box-shadow: 2px 1px 0 #697783,4px 2px 0 #354554,6px 3px 0 #162537; color: var(--cream); }
[data-phase="stack"] .product,[data-phase="held"] .product,[data-phase="torn"] .product,
[data-phase="drawn"] .product,[data-phase="revealed"] .product,[data-phase="recent"] .product { display: block; }
[data-phase="stack"] .return-slot,[data-phase="held"] .return-slot,[data-phase="torn"] .return-slot,
[data-phase="drawn"] .return-slot,[data-phase="revealed"] .return-slot,[data-phase="recent"] .return-slot { display: none; }
[data-phase="held"] .packet { transform: rotate(3deg) translateY(-1%); }
[data-phase="torn"] .packet { clip-path: polygon(0 10%,9% 11%,14% 9%,22% 12%,31% 10%,40% 12%,49% 9%,61% 12%,74% 9%,84% 11%,100% 9%,100% 100%,0 100%); transform: rotate(2deg) translateY(5%); }
[data-phase="torn"] .seam { visibility: visible; clip-path: polygon(0 0,100% 0,100% 9%,84% 11%,74% 9%,61% 12%,49% 9%,40% 12%,31% 10%,22% 12%,14% 9%,9% 11%,0 10%); transform: translate(6%,-3%) rotate(5deg); }
[data-phase="drawn"] .packet, [data-phase="revealed"] .packet, [data-phase="recent"] .packet { opacity: 0; }
[data-phase="drawn"] .ticket { visibility: visible; animation: draw-in .5s ease-out both; }
[data-phase="revealed"] .cartridge,[data-phase="recent"] .cartridge { visibility: visible; }
[data-phase="revealed"] .cartridge { animation: show-label .55s ease-out both; }
[data-waiting-for-art="true"] .ticket { visibility: visible; }
[data-title-length="long"] h1 { font-size: clamp(16px,min(5vw,7.5vh),76px); }
[data-title-length="longest"] h1 { font-size: clamp(14px,min(4.1vw,6.3vh),64px); }
.bottom-rail {
  gap: 1em; padding: clamp(5px,1.7vmin,17px) 5vw; border-top: 1px dashed #9c9c8c;
  color: var(--ink); background: #f1eedf; font-size: clamp(10px,2.2vmin,23px);
}
.bottom-rail > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#queue { text-align: right; }
@keyframes draw-in { from { opacity: 0; transform: translateY(13%) rotate(4deg); } }
@keyframes show-label { from { opacity: .2; transform: perspective(860px) rotateY(-65deg) rotateZ(-4deg); } }
@media (max-aspect-ratio: 4/5) {
  .worktop { grid-template-columns: 1fr; grid-template-rows: minmax(0,1fr) auto; gap: 2.5vmin; padding: 5vw 7vw; }
  .visual { grid-row: 1; }
  .label { grid-row: 2; padding-bottom: 2vw; }
  h1 { font-size: clamp(24px,9.5vw,72px); }
  .product { width: min(68vw,32vh); height: 95%; }
  .return-slot { width: 68%; max-height: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0s !important; animation-duration: 0s !important; }
}
