:root {
  --paper: #f1e6cc; --paper2: #e6d6b2; --card: #fbf4e2; --ink: #1f2433; --ink2: #545a6b;
  --red: #c63d2f; --red2: #9e2c22; --mustard: #e8b03a; --teal: #1f8a84; --line: rgba(31, 36, 51, .16);
  --disp: 'Bungee', Impact, sans-serif; --inl: 'Bungee Inline', 'Bungee', sans-serif;
  --mono: 'Courier Prime', ui-monospace, monospace; --body: 'Atkinson Hyperlegible', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background-color: var(--paper); color: var(--ink); font: 16px/1.45 var(--body);
  background-image: radial-gradient(rgba(31, 36, 51, .07) 1px, transparent 1.4px);
  background-size: 14px 14px; min-height: 100vh;
}
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
h1, h2 { margin: 0; font-weight: 400; }

/* ---------- sign ---------- */
.top { display: flex; gap: 24px; align-items: stretch; padding: 24px clamp(16px, 4vw, 48px) 8px; max-width: 1400px; margin: 0 auto; }
.sign {
  position: relative; flex: 1; background: var(--red); color: #fff3dc; border-radius: 10px; padding: 26px 34px 22px;
  box-shadow: 0 0 0 4px var(--ink), 0 8px 0 4px var(--ink);
}
.bulbs {
  position: absolute; inset: 8px; border-radius: 6px; pointer-events: none;
  --b: radial-gradient(circle, #ffe9a8 0 3px, #d99a1c 3.6px 4.4px, transparent 5px);
  background: var(--b) top left / 22px 22px repeat-x, var(--b) bottom left / 22px 22px repeat-x;
}
.sign h1 { font: 400 clamp(36px, 6.4vw, 78px)/1 var(--inl); letter-spacing: .01em; margin-top: 8px; text-shadow: 4px 4px 0 var(--red2); }
.sign h1 span { color: var(--mustard); }
.sign p { margin: 10px 0 6px; font: 700 15px var(--mono); letter-spacing: .02em; opacity: .9; }

/* ---------- player card ---------- */
.card-slot { width: 300px; flex: none; display: flex; }
.pcard {
  flex: 1; display: flex; flex-direction: column; justify-content: space-between; gap: 10px; text-align: left;
  border: 0; border-radius: 14px; padding: 16px 18px; background: var(--c, var(--teal)); color: #fff7e6;
  box-shadow: 0 0 0 3px var(--ink), 0 7px 0 3px var(--ink); position: relative; overflow: hidden;
}
.pcard::before { content: ''; position: absolute; right: -40px; top: -40px; width: 150px; height: 150px; border-radius: 50%; background: rgba(255, 255, 255, .12); }
.pcard .row1 { display: flex; align-items: center; gap: 10px; font: 700 12px var(--mono); letter-spacing: .12em; text-transform: uppercase; opacity: .85; }
.chip { width: 34px; height: 26px; border-radius: 5px; background: linear-gradient(135deg, #f3d27a, #c9962c); box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .25); }
.pcard .nm { font: 400 26px/1.05 var(--disp); }
.pcard .tk { display: flex; align-items: baseline; gap: 8px; font: 400 34px/1 var(--disp); }
.pcard .tk small { font: 700 13px var(--mono); letter-spacing: .1em; }
.pcard.empty { background: var(--card); color: var(--ink); justify-content: center; align-items: flex-start; }
.pcard.empty .nm { font-size: 22px; }
.pcard.empty p { margin: 0; color: var(--ink2); font-size: 14px; }
.btn {
  display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 8px; padding: 9px 14px; background: var(--ink); color: #fff7e6;
  font: 400 14px var(--disp); letter-spacing: .02em; text-decoration: none; box-shadow: 0 3px 0 rgba(0, 0, 0, .35); white-space: nowrap;
}
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 rgba(0, 0, 0, .35); }
.btn.alt { background: transparent; color: var(--ink); box-shadow: inset 0 0 0 2px var(--ink); }
.btn.gold { background: var(--mustard); color: var(--ink); }

/* ---------- hall ---------- */
.hall { display: grid; grid-template-columns: 1fr 340px; gap: 32px; padding: 28px clamp(16px, 4vw, 48px) 40px; max-width: 1400px; margin: 0 auto; }
.sec-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.sec-head h2 { font: 400 22px var(--disp); }
.hint { font: 700 13px var(--mono); color: var(--ink2); }
.tabs { display: inline-flex; border-radius: 7px; box-shadow: inset 0 0 0 2px var(--ink); overflow: hidden; }
.tabs button { border: 0; background: none; padding: 4px 10px; font: 700 12px var(--mono); }
.tabs button.on { background: var(--ink); color: #fff7e6; }

.cabs { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 26px 22px; }
.cab {
  --c: #888; position: relative; background: var(--c); color: var(--ink2); padding: 0 12px 12px; border-radius: 6px;
  clip-path: polygon(0 18px, 18px 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 0 100%);
  filter: drop-shadow(0 6px 0 rgba(31, 36, 51, .9));
}
.cab .mq {
  margin: 0 -12px; padding: 22px 12px 10px; text-align: center; color: var(--k, #fff); font: 400 24px/1 var(--disp);
  background: linear-gradient(rgba(255, 255, 255, .16), rgba(255, 255, 255, 0));
  text-shadow: 2px 2px 0 rgba(0, 0, 0, .28); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.screen {
  position: relative; display: block; aspect-ratio: 16 / 10; background: #14161f; border-radius: 8px; overflow: hidden;
  box-shadow: 0 0 0 6px var(--ink), inset 0 0 30px rgba(0, 0, 0, .6); margin: 6px 6px 16px; cursor: pointer;
}
.screen img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .3s; }
.screen:hover img { transform: scale(1.04); }
.screen .ph { position: absolute; inset: 0; display: grid; place-items: center; font: 400 22px var(--disp); color: var(--c); background: repeating-linear-gradient(45deg, #1a1d29 0 10px, #14161f 10px 20px); }
.panel { background: var(--card); border-radius: 6px; padding: 12px 12px 12px; color: var(--ink); }
.kind { display: inline-block; font: 700 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--ink2); }
.pitch { margin: 4px 0 10px; font-size: 14px; line-height: 1.35; min-height: 38px; }
.hi { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; font: 400 13px var(--mono); padding: 8px 0; border-top: 1px dashed var(--line); margin-bottom: 10px; }
.hi b { font-weight: 700; }
.hi .v { text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cab .acts { display: flex; gap: 8px; }
.cab .acts .btn { flex: 1; justify-content: center; }
.cab .acts .btn.alt { flex: none; }
.oor {
  position: absolute; left: 50%; top: 42%; transform: translate(-50%, -50%) rotate(-5deg); background: #fffdf3; color: var(--red2);
  font: 400 18px/1.1 var(--disp); padding: 10px 16px; text-align: center; box-shadow: 0 2px 6px rgba(0, 0, 0, .3);
}
.oor::before, .oor::after { content: ''; position: absolute; top: -8px; width: 46px; height: 16px; background: rgba(240, 225, 170, .8); }
.oor::before { left: -14px; transform: rotate(-30deg); } .oor::after { right: -14px; transform: rotate(30deg); }
.oor small { display: block; font: 700 11px var(--mono); color: var(--ink2); margin-top: 4px; }

/* ---------- ticket strip ---------- */
.strip { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.strip li {
  --notch: radial-gradient(circle at 0 50%, transparent 7px, #000 7.5px);
  display: grid; grid-template-columns: 30px 28px 1fr auto; align-items: center; gap: 10px; padding: 9px 14px 9px 16px;
  background: #f6c95c; color: var(--ink); cursor: pointer; font: 700 14px var(--mono);
  -webkit-mask: var(--notch) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 7px, #000 7.5px) right / 51% 100% no-repeat;
  mask: var(--notch) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 7px, #000 7.5px) right / 51% 100% no-repeat;
}
.strip li:nth-child(even) { background: #f0bd48; }
.strip li.me { background: #ffe39a; outline: 2px dashed var(--ink); outline-offset: -5px; }
.strip .rk { font: 400 16px var(--disp); text-align: center; border-right: 2px dashed rgba(31, 36, 51, .35); padding-right: 6px; }
.strip .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.strip .sc { font: 400 15px var(--disp); white-space: nowrap; }
.strip .sc small { font: 700 10px var(--mono); margin-left: 3px; }
.strip .empty, .receipt .empty { cursor: default; display: block; text-align: center; background: var(--card); font-weight: 400; color: var(--ink2); }
.tok {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--c); color: #fff7e6;
  font: 400 10px var(--disp); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .35), 0 0 0 1.5px var(--ink); letter-spacing: -.02em;
}
.counter { display: flex; flex-direction: column; gap: 30px; }
.receipt { list-style: none; margin: 0; padding: 12px 14px; background: #fffdf6; font: 400 13px/1.35 var(--mono); box-shadow: 0 2px 0 var(--line);
  -webkit-mask: linear-gradient(#000, #000) top / 100% calc(100% - 8px) no-repeat, conic-gradient(from -45deg at bottom, transparent 90deg, #000 0) bottom / 12px 8px repeat-x;
  mask: linear-gradient(#000, #000) top / 100% calc(100% - 8px) no-repeat, conic-gradient(from -45deg at bottom, transparent 90deg, #000 0) bottom / 12px 8px repeat-x; padding-bottom: 20px; }
.receipt li { display: grid; grid-template-columns: 1fr auto; gap: 0 8px; padding: 6px 0; border-bottom: 1px dashed var(--line); }
.receipt li:last-child { border-bottom: 0; }
.receipt .who { font-weight: 700; cursor: pointer; }
.receipt .when { color: var(--ink2); font-size: 11px; }
.receipt .what { color: var(--ink2); }

.foot { text-align: center; padding: 10px 16px 40px; font: 700 13px var(--mono); color: var(--ink2); }

/* ---------- play ---------- */
.play { position: fixed; inset: 0; z-index: 20; display: flex; flex-direction: column; background: var(--ink); }
.play[hidden] { display: none; }
.play-bar { display: flex; align-items: center; gap: 12px; padding: 0 12px; height: 46px; flex: none; background: var(--ink); color: #fff7e6; border-bottom: 4px solid var(--c, var(--red)); }
.play-bar .back { text-decoration: none; font: 400 14px var(--disp); padding: 6px 10px; border-radius: 6px; background: rgba(255, 255, 255, .1); }
.play-name { font: 400 18px var(--disp); color: var(--c); white-space: nowrap; }
.play-best { font: 700 13px var(--mono); opacity: .8; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grow { flex: 1; }
.pbtn { border: 0; background: rgba(255, 255, 255, .1); border-radius: 6px; padding: 6px 10px; font: 700 13px var(--mono); color: #fff7e6; text-decoration: none; white-space: nowrap; }
.pbtn.on { background: var(--mustard); color: var(--ink); }
.play-body { flex: 1; display: flex; min-height: 0; position: relative; }
.play-body iframe { flex: 1; border: 0; width: 100%; height: 100%; background: #000; }
.drawer { width: 340px; flex: none; overflow: auto; background: var(--paper); padding: 16px; border-left: 4px solid var(--ink); }
.drawer[hidden] { display: none; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(31, 36, 51, .55); display: grid; place-items: center; padding: 16px; }
.modal[hidden] { display: none; }
.sheet { width: min(520px, 100%); max-height: calc(100vh - 32px); overflow: auto; background: var(--paper); border-radius: 12px; padding: 22px; box-shadow: 0 0 0 3px var(--ink), 0 8px 0 3px var(--ink); position: relative; }
.sheet h2 { font: 400 24px var(--disp); margin-bottom: 6px; }
.sheet p { margin: 6px 0 14px; color: var(--ink2); }
.sheet .x { position: absolute; right: 12px; top: 10px; border: 0; background: none; font: 400 22px var(--disp); }
.field { display: block; margin: 10px 0 14px; }
.field span { display: block; font: 700 12px var(--mono); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 6px; }
.field input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 2px solid var(--ink); background: #fffdf6; font: 400 18px var(--disp); }
.field input.code { font: 700 18px var(--mono); letter-spacing: .1em; text-transform: uppercase; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatches button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--c); box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px transparent; }
.swatches button.on { box-shadow: 0 0 0 3px var(--paper), 0 0 0 5px var(--ink); }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.err { color: var(--red2); font: 700 13px var(--mono); min-height: 18px; }
.codebox { font: 700 22px var(--mono); letter-spacing: .12em; background: #fffdf6; border: 2px dashed var(--ink); border-radius: 8px; padding: 10px 14px; text-align: center; user-select: all; }
.linkish { border: 0; background: none; padding: 0; text-decoration: underline; font: 700 13px var(--mono); color: var(--ink2); }
.bests { display: grid; grid-template-columns: 1fr auto auto; gap: 4px 14px; font: 400 14px var(--mono); margin: 8px 0 16px; }
.bests b { font-family: var(--disp); font-weight: 400; }
.bests .t { color: var(--ink2); text-align: right; }
.phead { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.phead .tok { width: 54px; height: 54px; font-size: 16px; }

/* ---------- ticket toast ---------- */
.toasts { position: fixed; z-index: 60; top: 58px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: min(440px, calc(100% - 32px)); }
.toast {
  pointer-events: auto; width: 100%; background: #f6c95c; color: var(--ink); padding: 12px 22px; font: 700 14px var(--mono);
  -webkit-mask: radial-gradient(circle at 0 50%, transparent 9px, #000 9.5px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 9px, #000 9.5px) right / 51% 100% no-repeat;
  mask: radial-gradient(circle at 0 50%, transparent 9px, #000 9.5px) left / 51% 100% no-repeat, radial-gradient(circle at 100% 50%, transparent 9px, #000 9.5px) right / 51% 100% no-repeat;
  animation: print .5s cubic-bezier(.2, .9, .3, 1.2);
}
.toast big { display: block; font: 400 22px var(--disp); }
.toast.plain { background: var(--card); }
@keyframes print { from { transform: translateY(-30px); opacity: 0; } }

@media (max-width: 980px) {
  .hall { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  .top { flex-direction: column; gap: 20px; }
  .card-slot { width: 100%; }
  .sign { padding: 22px 20px 18px; }
  .drawer { position: absolute; inset: 0 0 0 auto; width: min(340px, 92%); }
  .play-best, .pbtn.out { display: none; }
}
@media (prefers-reduced-motion: reduce) { .toast { animation: none; } .screen img { transition: none; } }

/* ---------- lifetime stats ---------- */
.sheet.wide { width: min(720px, 100%); }
.pcard .tk .see { margin-left: auto; font-size: 11px; opacity: .8; }
.sub { font: 400 18px var(--disp) !important; margin: 22px 0 10px !important; }
.life { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.life > div { background: var(--ink); color: #fff7e6; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; }
.life small, .gnums small { font: 700 11px var(--mono); letter-spacing: .1em; text-transform: uppercase; opacity: .75; }
.life b { font: 400 26px/1.15 var(--disp); }
.life span { font: 400 12px var(--mono); opacity: .75; }
.gstat { background: var(--card); border-left: 8px solid var(--c); border-radius: 6px; padding: 10px 14px; margin-bottom: 8px; display: grid; grid-template-columns: 1fr auto; gap: 6px 16px; align-items: center; }
.gname b { display: block; font: 400 17px var(--disp); }
.gname span { font: 400 12px var(--mono); color: var(--ink2); }
.gnums { display: grid; grid-template-columns: repeat(4, minmax(64px, auto)); gap: 14px; text-align: right; }
.gnums small { color: var(--ink2); opacity: 1; display: block; }
.gnums b { font: 700 14px var(--mono); white-space: nowrap; }
.hls { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.hls span { font: 400 12px var(--mono); background: var(--paper2); padding: 2px 8px; border-radius: 99px; }
@media (max-width: 620px) {
  .life { grid-template-columns: repeat(2, 1fr); }
  .gstat { grid-template-columns: 1fr; }
  .gnums { text-align: left; }
}
