/* V5 · LEGO: From Toy to Obsession — the film's look (V5 motion language, Brickfilm tokens) */
:root {
  --red: #c91a09; --yellow: #f2cd37; --blue: #0055bf; --green: #237841; --orange: #fe8a18;
  --azure: #36aebf; --lime: #bbe90b; --white: #ffffff; --black: #05131d; --lbg: #a0a5a9;
  --dark-blue: #0a3463; --brown: #582a12; --gold: #aa7f2e; --gold-hi: #f6d36b;
  --manual: #dce6ee; --ink: #1d2b36; --muted: #5f6b76;
  --line: #2b3a48;              /* outlines: slate, not black */
  --soft: #e9eef3;              /* quiet panel fill */
  --shadow: 0 6px 0 rgba(43, 58, 72, .14), 0 12px 24px rgba(43, 58, 72, .10);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: #1d2b36; overflow: hidden; }
body { font-family: 'Nunito Sans', sans-serif; color: var(--ink); }
#viewport { position: fixed; inset: 0; overflow: hidden; background: var(--manual); }
#stage {
  position: absolute; left: 50%; top: 50%; width: 1920px; height: 1080px;
  transform-origin: 0 0; overflow: visible; background: transparent;
}
#stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; z-index: 1; }
#stage video.on { opacity: 1; }
#world { position: absolute; left: 0; top: 0; z-index: 2; }        /* sized by Film.fit() to the whole screen */
.layer { position: absolute; inset: 0; pointer-events: none; }

/* ---------- year plate (the one big number) ---------- */
.yearplate {
  position: absolute; left: calc(60px - var(--ox, 0px)); top: calc(50px - var(--oy, 0px)); z-index: 6; opacity: 0;
  background: var(--white); border: 2px solid var(--line); border-radius: 14px; padding: 8px 20px 10px;
  box-shadow: var(--shadow);
}
/* Part 2: fixed top right, over the newest years; a fixed width so changing numbers never move it */
.yearplate.right { left: auto; right: calc(30px - var(--ox, 0px)); top: calc(30px - var(--oy, 0px)); width: 300px; }
.yearplate .y { font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 64px; line-height: .95; letter-spacing: -2px; font-variant-numeric: tabular-nums; color: var(--ink); }
.yearplate .p { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 19px; color: var(--muted); margin-top: 4px; }
.yearplate .p2 { font-family: 'Rubik', sans-serif; font-weight: 700; font-size: 16px; color: var(--blue); margin-top: 2px; }

/* ---------- information card: coloured header (number + topic) -> headline -> text -> source footer ---------- */
.callout {
  position: absolute; z-index: 8; display: block; opacity: 0; overflow: hidden;
  background: var(--white); border: 2px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow); transform-origin: 0 0; width: 440px;
}
.callout .n {
  position: absolute; left: 12px; top: 8px; z-index: 1;
  font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 14px; color: var(--blue);
  background: var(--white); width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
}
.callout .k { font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 14px; letter-spacing: 1.5px; text-transform: uppercase;
  color: var(--white); background: var(--blue); padding: 11px 16px 10px 46px; }
.callout .h { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 28px; line-height: 1.08; margin: 12px 18px 0; color: var(--ink); }
.callout .t { font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: 19px; line-height: 1.25; margin: 6px 18px 0; color: #3a4955; }
.callout .t b { font-weight: 700; color: var(--ink); }
.callout .src { margin-top: 14px; padding: 8px 18px 9px; background: var(--soft); border-top: 1px solid #d3dbe2;
  font-weight: 700; font-size: 12.5px; color: var(--muted); letter-spacing: .2px; }
.callout .src em { font-style: normal; color: var(--blue); margin-right: 8px; letter-spacing: 1px; font-size: 11px; font-weight: 800; }
.callout.gold .n { color: var(--gold); }
.callout.gold .k { background: var(--gold); }
.callout.gold .src em { color: var(--gold); }
.callout .photo { display: flex; align-items: center; gap: 12px; margin: 10px 18px 0; }
.callout .photo img { width: 96px; height: 94px; object-fit: cover; border-radius: 8px; border: 1px solid #c9d2da; background: #fff; }
.callout .photo span { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 16px; color: var(--muted); }
.callout .diagram { display: flex; gap: 20px; margin: 12px 18px 0; }
.callout .diagram svg { width: 140px; height: auto; }
.callout .diagram figure { text-align: center; }
.callout .diagram figcaption { font-family: 'Rubik', sans-serif; font-weight: 700; font-size: 16px; margin-top: 4px; }
.callout .diagram figcaption span { display: block; font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: 14px; color: var(--muted); }

/* ---------- speech bubble ---------- */
.bubble {
  position: absolute; z-index: 20; left: 0; top: 0; max-width: 430px; opacity: 0; pointer-events: none;
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--white); border: 2px solid var(--line); border-radius: 18px; padding: 10px 18px 12px 10px;
  box-shadow: var(--shadow);
}
.bubble img { width: 42px; height: 42px; border-radius: 50%; border: 2px solid var(--line); background: var(--manual); object-fit: cover; flex: none; }
.bubble .who { display: block; font-weight: 800; font-size: 13px; letter-spacing: 1.5px; text-transform: uppercase; }
.bubble .txt { display: block; font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 22px; line-height: 1.2; color: var(--ink); }
.bubble.lizzie .who { color: var(--dark-blue); }
.bubble.jhully .who { color: var(--brown); }
.bubble::after {
  content: ''; position: absolute; left: var(--tail, 50%); bottom: -12px; width: 20px; height: 20px; margin-left: -10px;
  background: var(--white); border-right: 2px solid var(--line); border-bottom: 2px solid var(--line);
  transform: rotate(45deg) skew(8deg, 8deg); border-radius: 0 0 5px 0;
}
.bubble.below::after { bottom: auto; top: -12px; transform: rotate(225deg) skew(8deg, 8deg); }
.bubble.side::after { display: none; }

/* ---------- dolls ---------- */
.doll { position: absolute; left: 0; top: 0; z-index: 10; pointer-events: none; will-change: transform; }
.doll .body { position: relative; height: 100%; transform-origin: 50% 100%; }
.doll img { display: block; height: 100%; width: auto; }
.doll img.b { position: absolute; left: 50%; bottom: 0; transform: translateX(-50%); clip-path: inset(100% 0 0 0); }
.doll .band {
  position: absolute; left: -12%; right: -12%; height: 46px; margin-top: -23px; opacity: 0;
  background: radial-gradient(ellipse at center, rgba(255, 240, 170, .95) 0, rgba(246, 211, 107, .7) 35%, rgba(246, 211, 107, 0) 70%);
  filter: blur(2px); mix-blend-mode: screen;
}
.doll .shadow { position: absolute; left: 14%; right: 14%; bottom: -12px; height: 26px; border-radius: 50%; background: rgba(5, 19, 29, .32); filter: blur(6px); }

/* ---------- kinetic word tiles (over video) ---------- */
#tiles { position: absolute; left: 0; right: 0; bottom: 90px; z-index: 9; display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 16px; padding: 0 160px; pointer-events: none; }
#tiles span {
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 58px; line-height: 1; color: var(--white);
  padding: 10px 20px 14px; border-radius: 14px; opacity: 0; display: inline-block;
  box-shadow: inset 0 -9px 0 rgba(0, 0, 0, .22), 0 10px 0 rgba(5, 19, 29, .35);
}
#tiles span.dark { color: var(--ink); }

/* ---------- titles ---------- */
.title-card { position: absolute; z-index: 12; opacity: 0; pointer-events: none; }
#actcard, #actcard2 { left: 640px; right: calc(60px - var(--ox, 0px)); top: 200px; text-align: center; }
#actcard .eyebrow, #actcard2 .eyebrow { display: inline-block; font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 22px; letter-spacing: 5px; text-transform: uppercase; color: var(--white); background: var(--blue); padding: 6px 16px; border-radius: 10px; }
#actcard .big, #actcard2 .big { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 150px; line-height: 1; margin-top: 10px; color: var(--ink); }
#actcard .big span, #actcard2 .big span { display: inline-block; }
#actcard .q, #actcard2 .q { font-family: 'Fredoka', sans-serif; font-weight: 600; font-size: 34px; margin-top: 18px; color: #3a4955; }

/* ---------- source + chapters ---------- */
#source { position: absolute; left: 70px; bottom: 54px; z-index: 6; font-weight: 800; font-size: 15px; color: var(--muted); opacity: 0; background: rgba(255,255,255,.85); padding: 6px 12px; border-radius: 8px; }
#source em { font-style: normal; background: var(--blue); color: var(--white); padding: 2px 9px; border-radius: 5px; margin-right: 10px; letter-spacing: 1px; font-size: 16px; }
#chapters { position: absolute; left: calc(-1 * var(--ox, 0px)); right: calc(-1 * var(--ox, 0px)); bottom: calc(-1 * var(--oy, 0px)); height: 34px; z-index: 40; display: flex; gap: 4px; padding: 0 4px 6px; opacity: .25; transition: opacity .3s; }
#stage:hover #chapters, #stage.paused #chapters { opacity: 1; }
#chapters .ch { position: relative; flex: 1; cursor: pointer; display: flex; flex-direction: column; justify-content: flex-end; }
#chapters .ch .bar { height: 8px; border-radius: 4px; background: rgba(5, 19, 29, .25); overflow: hidden; }
#chapters .ch .bar i { display: block; height: 100%; width: 0; background: var(--c, var(--red)); }
#chapters .ch .lbl { font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 15px; letter-spacing: 1px; text-transform: uppercase; color: var(--white); text-shadow: 0 1px 2px rgba(0,0,0,.6); margin-bottom: 4px; }
#chapters .ch.soon { cursor: default; opacity: .45; }
#hint { position: absolute; right: calc(28px - var(--ox, 0px)); bottom: calc(52px - var(--oy, 0px)); z-index: 41; font-weight: 800; font-size: 18px; color: var(--white); background: rgba(5,19,29,.7); padding: 8px 14px; border-radius: 10px; opacity: 0; transition: opacity .3s; }
#stage.paused #hint { opacity: 1; }

/* ---------- start screen ---------- */
#start { position: absolute; inset: calc(-1 * var(--oy, 0px)) calc(-1 * var(--ox, 0px)); z-index: 60; display: grid; place-items: center; background: var(--manual); }
#start .studs { position: absolute; inset: 0; background-image: radial-gradient(circle at 24px 24px, rgba(10,52,99,.1) 9px, transparent 10px); background-size: 48px 48px; }
#start .inner { position: relative; text-align: center; }
#start .kicker { font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 22px; letter-spacing: 7px; color: var(--muted); text-transform: uppercase; }
#start h1 { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 128px; line-height: .95; margin-top: 14px; }
#start h1 .w { display: inline-block; }
#start h1 .r { color: var(--red); } #start h1 .b { color: var(--blue); }
#start h1 .o { display: inline-block; width: .74em; height: .74em; border-radius: 50%; vertical-align: -.04em; margin: 0 .02em;
  background: radial-gradient(circle at 38% 32%, #ffe98a 0 18%, var(--yellow) 19% 60%, #c9a51f 61%); box-shadow: 0 10px 0 #a8871a; }
#start .sub { font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: 30px; color: #3a4955; margin-top: 20px; }
#play {
  margin-top: 44px; display: inline-flex; align-items: center; gap: 20px; padding: 18px 40px 18px 28px; cursor: pointer;
  background: var(--yellow); border: 3px solid var(--line); border-radius: 22px;
  box-shadow: inset 0 -12px 0 rgba(0,0,0,.18), 0 14px 0 rgba(5,19,29,.25); font-family: 'Fredoka', sans-serif; color: var(--ink);
}
#play b { font-size: 48px; font-weight: 700; }
#play small { font-family: 'Nunito Sans', sans-serif; font-weight: 800; font-size: 17px; text-align: left; line-height: 1.2; }
#play .tri { width: 0; height: 0; border-left: 42px solid var(--red); border-top: 26px solid transparent; border-bottom: 26px solid transparent; }
#play:hover { transform: translateY(-3px); }
#play:focus-visible { outline: 6px solid var(--blue); outline-offset: 6px; }
#stage.started #start { display: none; }

/* ---------- guesses ---------- */
.guess { position: absolute; left: 660px; right: 60px; top: 120px; z-index: 30; display: none; text-align: center;
  background: var(--white); border: 2px solid var(--line); border-radius: 18px; padding: 16px 24px 18px; box-shadow: var(--shadow); }
.guess.show { display: block; animation: gpop .4s cubic-bezier(.2, 1.6, .4, 1); }
@keyframes gpop { from { transform: scale(.7); opacity: 0 } to { transform: scale(1); opacity: 1 } }
.guess .gq { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 28px; margin-bottom: 12px; color: var(--ink); }
.guess .go { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.guess button { font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 22px; padding: 10px 22px 13px; cursor: pointer;
  border: 2px solid var(--line); border-radius: 12px; background: var(--yellow); color: var(--ink); box-shadow: inset 0 -5px 0 rgba(0,0,0,.15); }
.guess button:hover { transform: translateY(-3px); }
.guess button.on { background: var(--green); color: var(--white); }
.guess .gt { height: 8px; border-radius: 4px; background: rgba(5,19,29,.12); margin-top: 14px; overflow: hidden; }
.guess .gt i { display: block; height: 100%; width: 100%; background: var(--blue); }

/* ---------- result stamp + score ---------- */
.stamp { position: absolute; left: 860px; right: 330px; top: 60px; z-index: 31; text-align: center; opacity: 0; pointer-events: none;
  font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 32px; line-height: 1.15; padding: 10px 20px; border-radius: 16px;
  border: 3px solid var(--white); box-shadow: var(--shadow); color: var(--white); }
.stamp b { font-family: 'Rubik', sans-serif; }
.stamp.ok { background: var(--green); }
.stamp.no { background: var(--red); }
/* the reader's collection (top right) and the collector cards */
.album { position: absolute; left: 850px; top: 20px;   /* top centre: clear of the plates, the chart tops and the ruler */ z-index: 32; display: flex; gap: 14px; align-items: center;
  background: var(--white); border: 2px solid var(--line); border-radius: 12px; padding: 6px 14px 6px 10px; box-shadow: var(--shadow); }
.album .stack { position: relative; width: 30px; height: 38px; }
.album .stack i { position: absolute; inset: 0; border: 2px solid var(--line); border-radius: 6px; background: var(--yellow); }
.album .stack i:nth-child(1) { transform: rotate(-12deg); background: var(--red); }
.album .stack i:nth-child(2) { transform: rotate(6deg); background: var(--blue); }
.album .lbl { display: block; font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.album b { font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 26px; line-height: 1; display: inline-block; color: var(--ink); }
.ccard { position: absolute; left: 1250px; top: 120px; width: 300px; z-index: 45; display: none; opacity: 0; pointer-events: none;
  background: var(--white); border: 3px solid var(--line); border-radius: 18px; padding: 12px; text-align: center;
  box-shadow: 0 12px 24px rgba(43,58,72,.25), 0 0 0 8px var(--yellow); }
.ccard.blue { box-shadow: 0 12px 24px rgba(43,58,72,.25), 0 0 0 8px var(--blue); }
.ccard .cc-top { font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 13px; letter-spacing: 2px; color: var(--muted); }
.ccard .cc-img { height: 190px; margin: 10px 0; border-radius: 12px; background: var(--manual); display: grid; place-items: center; overflow: hidden; }
.ccard .cc-img img { max-width: 92%; max-height: 92%; }
.ccard .cc-title { font-family: 'Fredoka', sans-serif; font-weight: 700; font-size: 28px; color: var(--ink); }
.ccard .cc-fact { font-family: 'Fredoka', sans-serif; font-weight: 500; font-size: 18px; margin-top: 4px; color: #3a4955; }
.ccard .cc-act { margin-top: 10px; font-family: 'Rubik', sans-serif; font-weight: 800; font-size: 12px; letter-spacing: 2px; text-transform: uppercase; color: var(--white); background: var(--blue); border-radius: 8px; padding: 4px; }
