:root {
  --top: env(safe-area-inset-top, 0px);
  --bar: 24px;
  --bottom: calc(8px + max(env(safe-area-inset-bottom, 0px), var(--covered, 0px)));
  --grey: #c5cbd0;
}
html, body { margin: 0; height: 100%; overflow: hidden; overscroll-behavior: none; background: #f8f3ea; }
#games { position: fixed; inset: calc(var(--top) + var(--bar)) 0 0; overflow: hidden; }
#games iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #f8f3ea; }
#games .current { z-index: 1; }
#games .parked { visibility: hidden; pointer-events: none; }
#games .preview { z-index: 2; pointer-events: none; }
#games .lift { clip-path: inset(0 0 var(--bottom) 0); pointer-events: none; }
#forward, #undo {
  appearance: none; position: fixed; z-index: 3; padding: 0; border: 0; background: transparent;
  touch-action: none; cursor: grab;
}
#forward { inset: var(--top) 0 auto; width: 100%; height: var(--bar); }
#undo { bottom: var(--bottom); left: calc(50% - 60px); width: 120px; height: 44px; }
#undo .rail { position: absolute; bottom: 0; left: 50%; transform: translateX(-50%); width: 100vw; pointer-events: none; }
#undo .grip::after {
  content: ''; width: 5px; height: 5px; border: solid #dce0e3; border-width: 1px 0 0 1px; transform: translateY(1px) rotate(45deg);
}
#shelf { position: fixed; z-index: 4; top: var(--top); left: 6px; display: flex; gap: 4px; height: var(--bar); }
#shelf button {
  width: var(--bar); height: var(--bar); border: 0; border-radius: 5px; background: #aab3b8 center / cover; cursor: pointer;
}
#shutter {
  position: fixed; z-index: 2; inset: 0; display: flex; flex-direction: column;
  visibility: hidden; pointer-events: none;
  transform: translateY(min(calc(var(--top) + var(--bar) + var(--shutter-pull, 0px) - 100%), calc(0px - var(--bottom))));
}
#shutter.moving { visibility: visible; }
#shutter.moving + #forward .grip { visibility: hidden; }
.rail {
  position: relative; height: var(--bar); flex: none;
  background: linear-gradient(#fff0, #fff5 65%, #56616b30) bottom / 100% 5px no-repeat var(--grey);
  box-shadow: inset 0 -1px #0004;
}
.grip {
  position: absolute; inset: 5px auto 5px calc(50% - 38px); width: 76px; border-radius: 8px;
  display: grid; place-content: center; background: #343b40; pointer-events: none;
}
.grip::before { content: ''; width: 3px; height: 6px; border-radius: 2px; background: #aab4bb; box-shadow: -6px 0 #aab4bb, 6px 0 #aab4bb; }
#undo .grip { display: flex; align-items: center; gap: 13px; }
.slats { flex: 1; }
.slats, #cue::before { background: repeating-linear-gradient(#bdc7cd8f 0 3px, #bdc7cd30 3px 15px, #252d3535 15px 18px); }
#cue {
  position: fixed; z-index: 2; top: var(--top); inset-inline: 0;
  pointer-events: none; color: #262b30; font: bold 12px/1.35 system-ui, sans-serif;
}
#cue::before {
  content: ''; position: absolute; z-index: -1; top: var(--bar); inset-inline: 0; height: 20px;
  border-bottom: 1px solid var(--grey); opacity: 0.6; transform-origin: top; animation: lower 180ms ease-out both;
}
.cue-hand {
  position: absolute; top: 2px; left: calc(50% - 29px); width: 58px; height: 81px;
  animation: gesture 570ms 150ms ease-out both;
}
.cue-hand svg { width: 100%; height: 100%; overflow: visible; }
.cue-label {
  position: absolute; top: calc(var(--bar) + 8px); left: calc(50% + 34px); max-width: calc(50% - 44px);
  border-radius: 7px; background: #f3f3ef; border: 1px solid var(--grey); padding: 5px 7px;
}
@keyframes lower { from { transform: scaleY(0); } }
@keyframes gesture { 0% { opacity: 0; } 20% { opacity: 1; } 100% { transform: translateY(22px); } }
@media (prefers-reduced-motion: reduce) {
  #cue::before, .cue-hand { animation: none; }
}
#loading {
  position: fixed; z-index: 2; top: calc(var(--top) + var(--bar) + 8px); left: 50%; transform: translateX(-50%);
  border-radius: 8px; padding: 5px 10px; background: #f8f3ea; color: #343b40; font: 12px system-ui, sans-serif; white-space: nowrap;
}
