/* The lobby's rule film (big screen): a phone beside the glass board. Prefix lf-.
   The phone (mimic.js) also appears beside the board during the Briefing, so its styles live here: the shell
   loads this file on the big screen's page, and it stays loaded during the game. */

.lesson-stage { transition: opacity .7s ease; }

.lf-phone {
  --c: var(--light);
  position: absolute;
  left: 4.2vw;
  top: 50%;
  z-index: 2;
  width: clamp(10.5rem, 14.5vw, 19rem);
  aspect-ratio: 9 / 17;
  transform: translateY(-50%);
  padding: 2.2rem 1rem 1.2rem;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 1rem;
  border-radius: 2.2rem;
  border: 1px solid rgba(244, 239, 228, .28);
  background: linear-gradient(170deg, rgba(26, 32, 41, .8), rgba(10, 13, 18, .85));
  box-shadow: 0 2rem 4rem rgba(0, 0, 0, .5), inset 0 0 0 1px rgba(255, 255, 255, .03);
  opacity: 0;
  pointer-events: none;
  transition: opacity .8s ease, transform .8s cubic-bezier(.2, .8, .2, 1);
}
.lf-phone::before { /* the speaker slot */
  content: ""; position: absolute; top: .9rem; left: 50%; width: 2.6rem; height: .28rem; margin-left: -1.3rem;
  border-radius: 1rem; background: rgba(244, 239, 228, .14);
}
.lf-phone.show { opacity: 1; }
.lf-phone.still, .lf-phone.still * { transition: none !important; animation: none !important; } /* (mimic.js: the film jumped in time) */
.lf-slots { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .35rem; }
.lf-slots i {
  display: grid; place-items: center; min-width: 0; aspect-ratio: 3 / 4; border-radius: .45rem;
  border: 1px dashed rgba(244, 239, 228, .28);
  transition: transform .45s cubic-bezier(.2, .8, .2, 1), box-shadow .45s, opacity .45s, border-color .3s;
}
.lf-slots i.full, .lf-slots i.locked { border: 0; }
.lf-slots .lm-card { width: 100%; height: 100%; border-radius: .45rem; box-shadow: 0 0 .8rem rgba(244, 239, 228, .3); }
.lf-slots .lm-hw .lm-g.sm, .lf-card .lm-hw .lm-g.sm { width: 32%; height: auto; aspect-ratio: 1; } /* a Haywire's moves, small enough for the phone's slots */
.lf-slots .lm-hw b, .lf-card .lm-hw b { font-size: .55rem; }
.lf-phone.locked .lf-slots i.full .lm-card { box-shadow: 0 0 1rem color-mix(in srgb, var(--c) 70%, transparent), 0 0 0 2px var(--c); }
.lf-slots i.now { transform: translateY(-.35rem) scale(1.12); }
.lf-slots i.now .lm-card { box-shadow: 0 0 1.6rem var(--c), 0 0 0 2px var(--c); }
.lf-slots i.done { opacity: .3; }
/* a slot jammed by a Haywire: its card face down, violet, glowing; it turns over when it runs */
.lf-slots i.locked .lm-card { box-shadow: 0 0 1.1rem rgba(185, 155, 255, .8), 0 0 0 2px rgba(185, 155, 255, .9); animation: lf-jam 2.4s ease-in-out infinite; }
.lf-slots i.landed { animation: lf-land .5s cubic-bezier(.2, 1.4, .3, 1); }
.lf-slots i.flip { animation: lf-flip .45s ease-in-out; }
@keyframes lf-jam { 50% { box-shadow: 0 0 1.8rem rgba(185, 155, 255, .95), 0 0 0 2px rgba(185, 155, 255, 1); } }
@keyframes lf-land { from { transform: scale(1.35); } }
@keyframes lf-flip { 50% { transform: scaleX(0); } }
/* the timer ran out: the empty slots flicker through faces, then settle */
.lf-slots i.dice .lm-card { opacity: .4; box-shadow: none; }
.lf-slots i.settled { animation: lf-land .4s cubic-bezier(.2, 1.4, .3, 1); }

.lf-hand { display: grid; grid-template-columns: repeat(4, 1fr); align-content: end; gap: .4rem; padding-bottom: .2rem; }
.lf-card {
  position: relative; z-index: 1; aspect-ratio: 3 / 4; border-radius: .45rem;
  opacity: 0; transform: translateY(1.5rem);
  transition: transform .45s cubic-bezier(.3, .7, .2, 1), opacity .4s;
}
.lf-phone.show .lf-card { opacity: 1; transform: none; transition-delay: calc(var(--n) * 70ms); }
.lf-phone.show .lf-card.flying { transition-delay: 0s; z-index: 3; }
.lf-card.gone { opacity: 0 !important; transition: opacity .15s !important; }
.lf-card .lm-card { width: 100%; height: 100%; border-radius: .45rem; }

/* the bottom row: the deck stack (left, only when it matters), the lock button (middle) */
.lf-bottom { display: grid; grid-template-columns: 1fr 2.4fr 1fr; align-items: center; gap: .4rem; }
.lf-lock {
  display: grid; place-items: center; height: 2.4rem; border-radius: 2rem;
  border: 1px solid rgba(244, 239, 228, .25); color: var(--faint);
  transition: all .5s cubic-bezier(.2, .8, .2, 1);
}
.lf-lock .lm-g { width: 1.5rem; height: 1.5rem; }
.lf-phone.locked .lf-lock { background: var(--c); border-color: var(--c); color: var(--ink); box-shadow: 0 0 1.6rem color-mix(in srgb, var(--c) 60%, transparent); }
.lf-phone.run .lf-hand, .lf-phone.run .lf-lock { opacity: .25; transition: opacity .8s; }
.lf-deck { position: relative; justify-self: start; width: 1.7rem; height: 2.25rem; opacity: 0; transition: opacity .5s; }
.lf-phone.deck .lf-deck { opacity: 1; }
.lf-deck b { position: absolute; inset: 0; border-radius: .3rem; border: 1px solid rgba(244, 239, 228, .35); background: rgba(26, 32, 41, .95); }
.lf-deck b + b { transform: translate(.18rem, -.18rem); }
.lf-top { position: absolute; inset: 0; transform: translate(.36rem, -.36rem); }
.lf-top .lm-card { width: 100%; height: 100%; border-radius: .3rem; }
.lf-top .lm-card .lm-g { width: 80%; height: 80%; }
.lf-deck.hit .lf-top { animation: lf-land .45s cubic-bezier(.2, 1.4, .3, 1); }

/* the phone's "?" (top right, as on the real phones); it glows when the Briefing points at it */
.lf-ask {
  position: absolute; top: .45rem; right: .9rem; display: grid; place-items: center; width: 1.6rem; height: 1.6rem;
  border-radius: 50%; color: var(--dim); font-weight: 300; font-size: 1rem; line-height: 1;
  transition: color .4s, background .4s, box-shadow .4s;
}
.lf-ask.glow { color: var(--ink); background: var(--light); box-shadow: 0 0 1.4rem rgba(244, 239, 228, .7); }

/* the phone's timer: a hairline across the top that shrinks to nothing */
.lf-clock { position: absolute; top: 2.1rem; left: 1rem; right: 1rem; height: 2px; opacity: 0; transition: opacity .3s; }
.lf-phone.timing .lf-clock { opacity: 1; }
.lf-clock i { position: absolute; inset: 0; background: var(--energy); box-shadow: 0 0 10px rgba(255, 197, 110, .8); transform-origin: 50% 50%; }

.lf-finger {
  position: absolute; left: 0; top: 0; z-index: 5; width: 1.9rem; height: 1.9rem; margin: -.95rem 0 0 -.95rem;
  border-radius: 50%; background: rgba(244, 239, 228, .28); border: 1.5px solid rgba(244, 239, 228, .85);
  box-shadow: 0 0 1.2rem rgba(244, 239, 228, .45);
  opacity: 0; transition: transform .42s cubic-bezier(.4, .1, .2, 1), opacity .3s, scale .15s;
}
.lf-finger.on { opacity: 1; }
.lf-finger.press { scale: .72; background: rgba(244, 239, 228, .6); }

/* a card flying across the screen (junk from a robot to a phone or a player's token) */
.lf-fly { --s: 2.2rem; position: absolute; left: 0; top: 0; z-index: 6; width: var(--s); height: calc(var(--s) * 1.29); pointer-events: none; will-change: transform; }
.lf-fly .lm-card { width: 100%; height: 100%; border-radius: .4rem; }
.lf-fly .lm-card .lm-g { width: 74%; height: 74%; }
.lm-card.lf-back { background: var(--violet); background-image: repeating-linear-gradient(45deg, rgba(21, 24, 29, .18) 0 3px, transparent 3px 8px); }

/* the scene's 1-5 strip above the board, as in a race (style.css's .lm-regs isn't loaded in the lobby) */
.lf-regs { position: absolute; display: flex; gap: .4rem; width: 16rem; height: 2.2rem; transform: translateX(-50%); pointer-events: none; opacity: 0; transition: opacity .6s; }
.lf-regs.on { opacity: 1; }
/* a line of light in five lengths: the one running is lit and carries its number, the ones run are gone */
.lf-regs i {
  position: relative; flex: 1; padding-top: .35rem; text-align: center;
  font-style: normal; font-weight: 200; font-size: 1.3rem; font-variant-numeric: tabular-nums;
  color: transparent; transition: color .5s;
}
.lf-regs i::before {
  content: ""; position: absolute; top: 0; left: 0; right: 0; height: 2px; transform-origin: 0 50%;
  background: rgba(244, 239, 228, .22); transition: transform .6s cubic-bezier(.2, .8, .2, 1), background .5s, box-shadow .5s;
}
.lf-regs i.done::before { transform: scaleX(0); }
.lf-regs i.now { color: var(--light); }
.lf-regs i.now::before { background: var(--light); box-shadow: 0 0 10px rgba(244, 239, 228, .7); }

/* The scenes: one dot each, under the board. The lit one is a bar that fills as its scene plays.
   They're buttons (mouse, touch, keys): hovering one lifts it, clicking jumps to that scene. */
/* the browser wouldn't make a 3D view: a note where the film plays (click to try again) */
.lf-no3d {
  position: absolute; left: 50%; top: 50%; transform: translate(calc(-50% - 13vw), -50%); max-width: 28rem; pointer-events: auto;
  display: grid; gap: .5rem; padding: 1.2rem 1.6rem; text-align: center; cursor: pointer; font: inherit;
  border: 1px solid var(--hair2); border-radius: 1rem; background: rgba(12, 15, 20, .7); color: var(--dim);
}
.lf-no3d[hidden] { display: none; }
.lf-no3d b { font-weight: 400; font-size: 1.15rem; color: var(--light); }
.lf-no3d:hover { border-color: rgba(244, 239, 228, .5); }
@media (orientation: portrait) {
  .lf-no3d { transform: translate(-50%, -50%); max-width: 80vw; }
}

.lf-dots {
  position: absolute; left: 50%; bottom: 1.5rem; display: flex; align-items: center;
  transform: translateX(calc(-50% - 13vw)); pointer-events: auto;
}
.lf-dot {
  appearance: none; display: grid; place-items: center; height: 2.6rem; min-width: 2.2rem; padding: 0 .35rem;
  border: 0; border-radius: 2rem; background: none; cursor: pointer; touch-action: manipulation; outline: none;
}
.lf-dot i {
  position: relative; display: block; overflow: hidden; width: .55rem; height: .55rem; border-radius: 1rem;
  background: rgba(244, 239, 228, .24);
  transition: width .6s cubic-bezier(.2, .8, .2, 1), background .3s, box-shadow .3s, scale .25s;
}
.lf-dot b { position: absolute; inset: 0; border-radius: inherit; background: var(--light); transform: scaleX(0); transform-origin: left; }
.lf-dot.on i { width: 2.4rem; background: rgba(244, 239, 228, .26); }
.pointer .lf-dot:not(.on) i { background: rgba(244, 239, 228, .42); } /* the mouse moved: they brighten, inviting a click */
.lf-dots .lf-dot:hover i, .lf-dots .lf-dot:focus-visible i { background: rgba(244, 239, 228, .62); box-shadow: 0 0 .9rem rgba(244, 239, 228, .45); scale: 1.35; }
.lf-dot.on:hover i, .lf-dot.on:focus-visible i { scale: 1 1.35; }
.lf-dot:focus-visible { box-shadow: inset 0 0 0 1px var(--hair2); }
.lf-dot:active i { scale: .9; }
/* the lit dot is a scrub bar: with the mouse about it lengthens (finer aim); hovering it shows a hairline where
   a click would go, and the bar thickens a little; while held it follows the pointer */
.lf-dot.on { cursor: ew-resize; touch-action: none; }
.pointer .lf-dot.on i, .lf-dot.on.scrub i { width: 7rem; }
.lf-dot.on i::after {
  content: ''; position: absolute; top: 0; bottom: 0; left: calc(var(--h, 0) * 100%); width: 2px; margin-left: -1px;
  background: var(--light); opacity: 0; transition: opacity .2s;
}
.lf-dot.on:hover i::after { opacity: .7; }
.lf-dot.on:hover i, .lf-dot.on:focus-visible i, .lf-dot.on.scrub i { scale: 1 1.6; box-shadow: none; background: rgba(244, 239, 228, .34); }
.lf-dot.on.scrub i::after { opacity: 0; }
.lf-dot.on:active i { scale: 1 1.6; }

@media (prefers-reduced-motion: reduce) { .lf-finger { display: none; } }

/* a phone held upright as the big screen: the phone lies wide and short under the board (the hand in one
   row), in the film and in the Briefing (there above the robots along the bottom) */
@media (orientation: portrait) {
  .lf-phone {
    left: 50%; top: auto; bottom: 7rem; width: min(74vw, 26rem); aspect-ratio: auto; transform: translateX(-50%);
    grid-template-rows: auto auto auto; padding: 1.6rem .9rem .7rem; gap: .7rem; border-radius: 1.6rem;
  }
  .lm-host .lf-phone { bottom: 11.5rem; }
  .lf-phone::before { top: .65rem; }
  .lf-hand { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: .3rem; align-content: start; }
  .lf-lock { height: 2rem; }
}
/* an upright window wider than a phone (a laptop's window, a tablet): in the film, the phone stands beside the
   board again, at the left (lobby.js centres it in the room under the join band and fits the board beside it) */
@media (orientation: portrait) and (min-width: 540px) {
  .lesson-ui .lf-phone {
    left: 4.2vw; top: 50%; bottom: auto; width: clamp(9rem, 28vw, 15rem); aspect-ratio: 9 / 17; transform: translateY(-50%);
    grid-template-rows: auto 1fr auto; padding: 2.2rem 1rem 1.2rem; gap: 1rem; border-radius: 2.2rem;
  }
  .lesson-ui .lf-phone::before { top: .9rem; }
  .lesson-ui .lf-hand { grid-template-columns: repeat(4, 1fr); gap: .4rem; align-content: end; }
  .lesson-ui .lf-lock { height: 2.4rem; }
}

/* a phone held upright: the scene dots centred, clear of the corner buttons at the left */
@media (orientation: portrait) { .lf-dots { transform: translateX(-50%); } }
