:root { font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #242424; background: #f4f4f4; }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
button, input, select { font: inherit; }
button { min-height: 42px; border: 1px solid #4d4d4d; border-radius: 3px; padding: 8px 14px; background: white; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #3869bf; outline-offset: 2px; }
.app { max-width: 520px; margin: auto; min-height: 100vh; min-height: 100dvh; background: white; }
header { position: sticky; top: 0; z-index: 2; color: white; background: #292929; }
.bar { position: relative; display: flex; align-items: center; justify-content: center; min-height: 44px; font-size: 19px; font-weight: 700; }
.corner { position: absolute; inset-inline-start: 4px; top: 0; color: inherit; background: transparent; border: 0; min-width: 42px; font-size: 24px; padding: 4px; }
.corner.end { inset-inline-start: auto; inset-inline-end: 4px; }
.transfer { position: absolute; right: 10px; background: transparent; color: #ddd; border-color: #777; min-height: 31px; font-size: 12px; padding: 4px 8px; }
.demo { background: #fff0be; color: #513b0e; text-align: center; font-size: 12px; font-weight: 750; letter-spacing: .04em; padding: 5px; }
form { padding: 22px 16px 30px; }
h1 { margin: 0 0 20px; font-size: 27px; }
fieldset { padding: 12px; margin: 0 0 16px; border: 1px solid #ddd; border-radius: 6px; }
legend { font-weight: 700; }
label { display: grid; gap: 5px; padding-bottom: 8px; font-size: 14px; }
input, select { min-height: 43px; width: 100%; min-width: 0; font-size: 16px; background: #fff; border: 1px solid #aaa; border-radius: 4px; padding: 7px; color: inherit; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.check { display: flex; align-items: center; gap: 9px; }
.check input { width: 18px; min-height: 18px; }
.setup-submit { width: 100%; }
#setup-error { color: #ad1022; }
.dark { color: white; background: #292929; }
.dark:disabled { background: #bfbfbf; border-color: #bfbfbf; color: #555; }
.counts { display: flex; margin: 27px 2px 14px; }
.count { flex: 1; text-align: center; padding: 6px 4px; font-size: 14px; border: 1px solid #ddd; }
.count.current { background: #eee; border-color: #555; font-weight: 700; }
.count b { display: inline-grid; place-items: center; min-width: 21px; height: 21px; padding: 0 4px; margin-bottom: 3px; border-radius: 100px; background: #eee; }
.count.current b { background: #292929; color: white; }
.actions { display: flex; justify-content: space-between; padding-inline: 2px; }
.actions button { min-width: 34%; }
.cards { display: grid; gap: 40px; margin: 36px 7%; }
.ticket { display: grid; grid-template-columns: 52px 1fr; align-items: stretch; position: relative; width: 100%; text-align: left; min-height: 160px; padding: 5px; border-color: #dadada; background: #f2f2f2; }
.ticket.selected { border: 2px solid #27983d; padding: 4px; }
.stub { display: flex; align-items: center; justify-content: center; border-right: 2px dashed #777; }
.stub span { writing-mode: vertical-rl; transform: rotate(180deg); max-height: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stub b { font-weight: 900; }
.ticket-body { min-width: 0; padding-left: 8px; display: flex; flex-direction: column; }
.ticket-title { padding-bottom: 4px; }
.ticket-band { display: grid; gap: 4px; align-content: start; position: relative; background: #0a0a0a; color: white; padding: 6px 26px 8px 7px; width: 94%; min-height: 79px; font-size: 14px; overflow-wrap: anywhere; }
.ticket-band time { font-size: 12px; }
.ticket-band .crest { position: absolute; right: -18px; top: 26%; width: 38px; height: 38px; mix-blend-mode: normal; clip-path: polygon(0 0,100% 0,100% 65%,80% 85%,50% 100%,20% 85%,0 65%); }
.ticket-index { font-size: 12px; margin-top: auto; text-align: right; padding-top: 7px; }
.selected-mark { position: absolute; color: white; background: #27983d; border-radius: 50%; padding: 1px 5px; right: -8px; top: -9px; }
.crest { flex: none; display: block; width: 60px; height: 60px; object-fit: contain; mix-blend-mode: multiply; }
.details { border-top: 1px solid #ddd; padding: 20px 16px 24px; font-size: 14px; }
.details > h2, .details > p { text-align: center; }
.details h2 { font-size: 19px; margin: 0 0 12px; }
.details h3 { font-size: 16px; margin-top: 30px; }
.event-info { display: flex; align-items: flex-start; gap: 10px; background: #f7f7f7; padding: 14px 8px; }
.event-info div { display: grid; gap: 5px; overflow-wrap: anywhere; }
.event-info button { margin-top: 8px; }
footer { position: sticky; bottom: 0; background: #f3f3f3; padding: 16px 9% max(16px, env(safe-area-inset-bottom)); }
footer button, .confirm button, .processing button { width: 100%; }
.match-banner { background: #090909; color: white; display: flex; gap: 10px; align-items: center; padding: 12px 16px; overflow-wrap: anywhere; }
.helmet { width: 36px; height: 37px; object-fit: contain; flex: none; }
.match-banner { position: relative; }
.match-banner:has(#return-controls:not([hidden])) { padding-inline: 49px; }
.match-banner .corner { top: 50%; transform: translateY(-50%); }
.match-banner strong { font-size: 14px; }
.match-banner small { display: block; padding-top: 2px; font-size: 12px; }
.type-lines { display: grid; gap: 5px; padding: 23px 8.5% 0; }
.type-line { display: flex; align-items: center; gap: 9px; margin: 0; font-size: 16px; font-weight: 700; }
.type-line b {
  display: inline-grid;
  place-items: center;
  flex: 0 0 32px;
  height: 32px;
  border: 1px solid #d6d6d6;
  border-radius: 50%;
  background: #fff;
  color: #171717;
  font-variant-numeric: tabular-nums;
}
.readout { text-align: center; padding: 12px 12px 18px; }
.watermark { width: 139px; height: 133px; overflow: hidden; margin: auto; }
.readout time { display: block; font-size: 34px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin-top: 14px; }
.watermark img { display: block; width: 100%; }
.readout.compact .watermark { height: 69px; }
.readout.compact { padding-top: 24px; padding-bottom: 16px; }
.readout.compact time { margin-top: 0; font-size: 35px; }
.confirm, .processing { text-align: center; padding: 24px 9% 28px; }
.confirm { background: #f7f7f7; border-top: 1px solid #e5e5e5; padding-top: 25px; padding-bottom: 24px; }
.confirm h2, .processing h2 { font-size: 20px; margin: 14px 0 8px; }
.confirm p, .processing p, .readout p { font-size: 14px; overflow-wrap: anywhere; }
.confirm button { min-height: 40px; font-size: 14px; }
.confirm button + button { margin-top: 23px; }
.confirm .note, .processing .note { color: #555; }
.green { color: white; background: #218436; border-color: #218436; }
.stop { display: inline-block; width: 59px; height: 59px; }
.processing { padding-top: 0; }
.processing button { margin-top: 28px; }
.redeem-icon { width: 104px; height: auto; display: block; margin-inline: auto; }
.loading-icon { position: relative; }
.loading-icon img { display: block; width: 100%; }
.loading-icon::after {
  content: "";
  position: absolute;
  inset: 0;
  background: url("frames/loading.png") center / 100% 100%;
  clip-path: circle(24% at 62% 63%);
  transform-origin: 62% 63%;
  animation: rotate-spinner .8s linear infinite;
}
@keyframes rotate-spinner { to { transform: rotate(1turn); } }
.ticket::before { content: ""; position: absolute; width: 15px; height: 15px; left: -9px; top: calc(50% - 8px); border: 1px solid #dadada; border-radius: 50%; clip-path: inset(0 0 0 50%); background: white; }
.ticket.selected::before { border-color: #27983d; }
.ticket-body { background-image: linear-gradient(#ddd, #ddd); background-repeat: no-repeat; background-size: calc(100% - 13px) 1px; background-position: right 16px bottom 21px; }
@media (prefers-reduced-motion: reduce) {
  .loading-icon::after { animation: none; }
}
