:root {
  --ink: #07021a; --pink: #ff2bd6; --cyan: #00e5ff; --yel: #ffd400; --navy: #0a1a7a;
  --f: "Bungee", "Arial Black", sans-serif; --m: "VT323", "Courier New", monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: #fff; overflow: hidden; overscroll-behavior: none; }
body { font-family: var(--m); -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
#gl { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#trail { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; }
#trail path { fill: none; stroke: var(--cyan); stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; opacity: .75; filter: drop-shadow(0 0 6px var(--cyan)); }

/* loader: a rack lighting up, pin by pin */
#loader { position: fixed; inset: 0; z-index: 50; background: radial-gradient(circle at 50% 45%, #1a0644, var(--ink) 70%); display: grid; place-items: center; transition: opacity .5s; }
#loader.gone { opacity: 0; pointer-events: none; }
.rack { display: grid; grid-template-columns: repeat(7, 22px); grid-template-rows: repeat(4, 30px); gap: 0; }
.rack i { width: 18px; height: 18px; border-radius: 50%; background: #2a1a55; box-shadow: inset 0 0 0 2px #3c2a77; transition: background .2s, box-shadow .2s; }
.rack i.on { background: #fff; box-shadow: 0 0 14px var(--pink), inset 0 -4px 0 #e0142c; }
.rack i:nth-child(1) { grid-area: 4 / 4; } .rack i:nth-child(2) { grid-area: 3 / 3; } .rack i:nth-child(3) { grid-area: 3 / 5; }
.rack i:nth-child(4) { grid-area: 2 / 2; } .rack i:nth-child(5) { grid-area: 2 / 4; } .rack i:nth-child(6) { grid-area: 2 / 6; }
.rack i:nth-child(7) { grid-area: 1 / 1; } .rack i:nth-child(8) { grid-area: 1 / 3; } .rack i:nth-child(9) { grid-area: 1 / 5; } .rack i:nth-child(10) { grid-area: 1 / 7; }

/* hud */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud > * { pointer-events: auto; }
#shoes { position: absolute; left: max(14px, env(safe-area-inset-left)); top: max(14px, env(safe-area-inset-top)); display: flex; align-items: center; gap: 8px; padding: 8px 12px 8px 10px; border: 2px solid var(--pink); background: rgba(7,2,26,.72); border-radius: 10px; font-family: var(--f); font-size: 15px; letter-spacing: .04em; color: #fff; box-shadow: 0 0 12px rgba(255,43,214,.55), inset 0 0 10px rgba(255,43,214,.25); text-shadow: 0 0 8px var(--pink); }
#shoes svg { width: 34px; height: 18px; }
#shoes svg path { fill: #c8102e; } #shoes svg .sole { fill: #f4f0e6; } #shoes svg .lace { fill: none; stroke: #fff; stroke-width: 2; }
#snd { position: absolute; right: max(14px, env(safe-area-inset-right)); top: max(14px, env(safe-area-inset-top)); width: 44px; height: 44px; border-radius: 50%; border: 2px solid var(--cyan); background: rgba(7,2,26,.72); display: grid; place-items: center; box-shadow: 0 0 10px rgba(0,229,255,.5); }
#snd svg { width: 22px; height: 22px; fill: #fff; stroke: #fff; }
#snd .x { display: none; } #snd.off .x { display: inline; } #snd.off .w { display: none; }
#lanes { position: absolute; left: 0; right: 0; bottom: max(14px, env(safe-area-inset-bottom)); display: flex; justify-content: space-between; padding: 0 max(12px, env(safe-area-inset-left)); pointer-events: none; transition: opacity .3s; }
#lanes button { pointer-events: auto; display: flex; align-items: center; gap: 8px; max-width: 44vw; padding: 9px 12px; border: 2px solid var(--yel); border-radius: 10px; background: rgba(7,2,26,.72); color: #fff; font-family: var(--f); font-size: 13px; box-shadow: 0 0 10px rgba(255,212,0,.45); }
#lanes button span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
#lanes button b { color: var(--yel); }
#hud.busy #lanes, #hud.mid #lanes { opacity: 0; } #hud.busy #lanes button, #hud.mid #lanes button { pointer-events: none; }
#power { position: absolute; left: 50%; bottom: 76px; width: 180px; height: 12px; margin-left: -90px; border: 2px solid #fff; border-radius: 8px; overflow: hidden; display: none; background: rgba(7,2,26,.6); }
#power i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--cyan), var(--yel), var(--pink)); }
#power.on { display: block; }
#hint { position: absolute; left: 50%; bottom: 20%; width: 4px; height: 140px; margin-left: -2px; opacity: 0; transition: opacity .6s; }
#hint.on { opacity: 1; }
#hint i { position: absolute; left: -16px; bottom: 0; width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--cyan); box-shadow: 0 0 14px var(--cyan); animation: swipe 1.8s ease-in infinite; }
@keyframes swipe { 0% { transform: translateY(0); opacity: 0; } 15% { opacity: 1; } 70% { transform: translateY(-120px); opacity: 1; } 100% { transform: translateY(-140px); opacity: 0; } }

/* the work, large */
#work { position: fixed; inset: 0; z-index: 20; background: rgba(4,1,16,.92); display: flex; align-items: center; justify-content: center; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); animation: rise .35s ease-out; }
#work[hidden], #counter[hidden], #over[hidden] { display: none; }
/* the lane buttons and the shoe sign stay out of the reader's way */
body:has(#work:not([hidden])) #hud, body:has(#counter:not([hidden])) #hud { visibility: hidden; }
@keyframes rise { from { opacity: 0; transform: scale(.97); } to { opacity: 1; transform: none; } }
.w-in { width: min(1320px, 100%); max-height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 300px; grid-template-rows: auto minmax(0, 1fr); gap: 14px 18px; }
.w-in header { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; border-bottom: 3px solid var(--pink); padding-bottom: 10px; box-shadow: 0 6px 12px -8px var(--pink); }
#w-lane { font-family: var(--f); font-size: 30px; color: var(--ink); background: var(--yel); padding: 2px 10px; border-radius: 6px; }
.w-t { flex: 1; min-width: 0; }
.w-t h2 { margin: 0; font-family: var(--f); font-weight: 400; font-size: clamp(20px, 3vw, 34px); line-height: 1.05; color: #fff; text-shadow: 0 0 12px var(--pink); }
#w-client { font-size: 20px; color: var(--cyan); letter-spacing: .06em; }
#w-close { width: 46px; height: 46px; flex: none; border-radius: 50%; border: 2px solid #fff; background: transparent; font-size: 20px; }
#w-stage { position: relative; background: #000; border: 3px solid #1c1240; border-radius: 6px; min-height: 0; aspect-ratio: 16 / 9; max-height: calc(100vh - 140px); width: 100%; align-self: start; overflow: hidden; }
#w-stage.vert { aspect-ratio: 9 / 16; width: min(100%, calc((100vh - 140px) * 9 / 16)); justify-self: center; }
#w-stage iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
/* real pictures, whole: the stage is as wide as the set's widest picture and as tall as its tallest needs,
   never taller than the screen; each picture is contained, centred, in that definite box */
#w-stage.pic { aspect-ratio: var(--rt, 1.7778); width: min(100%, calc((100vh - 140px) * var(--rw, 1.7778))); max-height: calc(100vh - 140px); justify-self: center; }
#w-stage .pics { position: absolute; inset: 0; }
#w-stage .pics img { display: block; width: 100%; height: 100%; object-fit: contain; object-position: center; }
#w-stage .step { position: absolute; top: 50%; margin-top: -24px; width: 48px; height: 48px; border-radius: 50%; border: 2px solid #fff; background: rgba(7,2,26,.7); font-size: 18px; }
#w-stage .step.prev { left: 10px; } #w-stage .step.next { right: 10px; }
#w-stage .count { position: absolute; right: 12px; bottom: 8px; font-size: 20px; color: #ccc; background: rgba(0,0,0,.5); padding: 0 6px; }
#w-stage .play { position: absolute; inset: 0; border: 0; padding: 0; background: #000 center / contain no-repeat; display: grid; place-items: center; }
#w-stage .play b { width: 92px; height: 92px; border-radius: 50%; background: rgba(255,43,214,.9); display: grid; place-items: center; font-size: 38px; box-shadow: 0 0 24px var(--pink); padding-left: 8px; }
#w-stage .play em { position: absolute; left: 14px; bottom: 10px; font-style: normal; font-size: 24px; background: rgba(0,0,0,.6); padding: 2px 8px; }
#w-stage .snd { position: absolute; inset: 0; background: #0a0420 center / contain no-repeat; display: flex; align-items: flex-end; }
#w-stage .snd div { width: 100%; padding: 12px; background: linear-gradient(transparent, rgba(0,0,0,.85)); }
#w-stage .snd b { display: block; font-size: 24px; font-weight: 400; margin-bottom: 6px; }
#w-stage .snd audio { width: 100%; }
.w-side { min-height: 0; overflow: auto; font-size: 20px; line-height: 1.25; padding-right: 4px; }
#w-items { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
#w-items button { width: 100%; text-align: left; display: flex; gap: 10px; align-items: baseline; padding: 7px 10px; border: 2px solid #2b1f5a; border-radius: 6px; background: #120a30; font-size: 20px; }
#w-items button.on { border-color: var(--cyan); background: #0c2a4a; box-shadow: 0 0 10px rgba(0,229,255,.4); }
#w-items button i { font-style: normal; color: var(--yel); width: 16px; flex: none; }
#w-desc { margin: 0 0 10px; color: #f3eefc; }
#w-sec { margin: 0 0 10px; color: #bfb6e0; }
#w-sec:empty, #w-credits:empty { display: none; }
#w-credits { margin: 0 0 12px; color: #9c92c2; font-size: 17px; }
#w-bowl { width: 100%; padding: 12px; border: 2px solid var(--yel); border-radius: 8px; background: transparent; font-family: var(--f); font-size: 18px; color: var(--yel); box-shadow: 0 0 10px rgba(255,212,0,.35); }

/* the shoe counter */
#counter { position: fixed; inset: 0; z-index: 25; background: rgba(4,1,16,.88); display: flex; justify-content: center; padding: max(14px, env(safe-area-inset-top)) 14px max(14px, env(safe-area-inset-bottom)); animation: rise .3s ease-out; }
.c-in { width: min(720px, 100%); display: flex; flex-direction: column; min-height: 0; max-height: 100%; overflow: auto; overscroll-behavior: contain; background: linear-gradient(#1b0b45, #0b0424); border: 3px solid var(--pink); border-radius: 14px; box-shadow: 0 0 24px rgba(255,43,214,.5); }
.c-in header { position: sticky; top: 0; z-index: 1; background: #1b0b45; display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 2px dashed rgba(255,255,255,.25); }
.c-in header b { font-family: var(--f); font-weight: 400; font-size: 30px; color: #fff; text-shadow: 0 0 10px var(--pink), 0 0 22px var(--pink); }
#c-close { width: 44px; height: 44px; border-radius: 50%; border: 2px solid #fff; background: transparent; }
#c-list { list-style: none; margin: 0; padding: 8px 10px; columns: 2 280px; column-gap: 10px; }
#c-list li { break-inside: avoid; }
#c-list button { width: 100%; display: flex; align-items: center; gap: 10px; padding: 6px 8px; margin-bottom: 4px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-size: 21px; }
#c-list button:hover, #c-list button:focus-visible { background: rgba(0,229,255,.15); outline: none; }
#c-list .n { font-family: var(--f); font-size: 15px; color: var(--ink); background: var(--yel); border-radius: 4px; padding: 1px 6px; flex: none; }
#c-list img { width: 40px; height: 34px; object-fit: contain; flex: none; }
#c-list .nm { flex: 1; min-width: 0; line-height: 1.05; }
#c-list .nm small { display: block; font-size: 16px; color: var(--cyan); }
#c-about { padding: 10px 16px 14px; border-top: 2px dashed rgba(255,255,255,.25); font-size: 19px; color: #ddd6f5; }
#c-about h3 { margin: 0 0 2px; font-family: var(--f); font-weight: 400; font-size: 20px; color: #fff; }
#c-about .ti { color: var(--yel); margin-bottom: 6px; }
#c-about p { margin: 0 0 8px; }
#c-about a { color: var(--cyan); }
#c-about ul { margin: 0 0 8px; padding-left: 18px; }

#over { position: fixed; left: 0; right: 0; bottom: max(24px, env(safe-area-inset-bottom)); z-index: 8; display: flex; justify-content: center; }
#again { padding: 14px 28px; border: 3px solid var(--yel); border-radius: 10px; background: rgba(7,2,26,.8); font-family: var(--f); font-size: 20px; color: var(--yel); box-shadow: 0 0 16px rgba(255,212,0,.6); }

@media (max-width: 820px) {
  #work { align-items: flex-start; overflow: auto; }
  .w-in { grid-template-columns: 1fr; grid-template-rows: auto auto auto; align-content: start; max-height: none; }
  #w-stage { max-height: none; }
  #w-stage.vert { width: min(100%, calc((100svh - 150px) * 9 / 16)); margin: 0 auto; }
  #w-stage.pic { width: min(100%, calc((100svh - 150px) * var(--rw, 1.7778))); max-height: calc(100svh - 150px); margin: 0 auto; }
  .w-side { overflow: visible; }
  #w-lane { font-size: 22px; }
  #lanes button { font-size: 11px; padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) { #hint i { animation: none; } }
