/* Each game's own look, beside its cartoon (web/howto/<engine>.css). @import has to come first. */
@import url("/howto/sketch.css");
@import url("/howto/doodle.css");
@import url("/howto/quiz.css");
@import url("/howto/clues.css");
@import url("/howto/likely.css");
@import url("/howto/minds.css");
@import url("/howto/bluff.css");
@import url("/howto/punchline.css");
@import url("/howto/letters.css");

/* How to play (howto.js): a cartoon on a 16:9 stage, drawn on a 1280 × 720 grid. One unit (--hu) is a 1280th of
   its width, set by howto.js, so it reads the same on a TV, on a game's page and in a card on a phone. Everything
   starts hidden or still; the cartoon's timeline moves it (Web Animations), so nothing here animates. */

.howto {
  position: relative; display: block; width: 100%; aspect-ratio: 16 / 9; overflow: hidden;
  --hu: calc(100vw / 1280);
  background: var(--background); color: var(--text); font-family: var(--display);
  -webkit-user-select: none; user-select: none;
  /* A cartoon's own layers (a phone in front, a badge on top) stay inside it: the Watch button is always above. */
  isolation: isolate;
}
/* Sized the same everywhere: the TV and the website set this for the page, the viewer (and so the videos) doesn't. */
.howto, .howto *, .howto *::before, .howto *::after { box-sizing: border-box; }
.hw-stage {
  position: absolute; inset: 0;
  background:
    radial-gradient(55% 75% at 12% 0%, var(--glow-lamp), transparent 70%),
    radial-gradient(60% 70% at 92% 100%, var(--glow-tv), transparent 70%);
}
.hw-stage p { margin: 0; }

/* The line along the top: How to play · the game, and a dot per scene. */
.hw-top {
  position: absolute; top: calc(34 * var(--hu)); left: calc(56 * var(--hu)); right: calc(56 * var(--hu));
  display: flex; justify-content: space-between; align-items: center; opacity: 0;
}
.hw-eyebrow { font-family: var(--mono); font-size: calc(17 * var(--hu)); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.hw-dots { display: flex; gap: calc(14 * var(--hu)); }
.hw-dots i { width: calc(12 * var(--hu)); height: calc(12 * var(--hu)); border-radius: 50%; background: var(--accent); opacity: 0.25; }

/* The game's name first, then one line a scene (two for the scenes with a turn in them, the second in the accent). */
.hw-title, .hw-cap {
  position: absolute; top: calc(84 * var(--hu)); left: calc(60 * var(--hu)); right: calc(60 * var(--hu));
  display: flex; flex-direction: column; align-items: center; gap: calc(4 * var(--hu)); text-align: center;
}
.hw-title { top: calc(96 * var(--hu)); gap: calc(10 * var(--hu)); }
.hw-kicker { font-family: var(--mono); font-size: calc(20 * var(--hu)); letter-spacing: 0.08em; text-transform: uppercase; color: var(--accent); }
.hw-name { font-size: calc(86 * var(--hu)); font-weight: 800; line-height: 1.04; letter-spacing: -0.02em; }
.hw-cap span { display: block; font-size: calc(50 * var(--hu)); font-weight: 800; line-height: 1.14; letter-spacing: -0.02em; opacity: 0; text-wrap: balance; }
.hw-cap .b { color: var(--accent); }

/* The cast: four critters in a row, each holding a phone, with room above for a speech bubble. */
.hw-cast { position: absolute; inset: 0; }
.hw-who { position: absolute; top: calc(318 * var(--hu)); width: calc(220 * var(--hu)); height: calc(330 * var(--hu)); transform-origin: 50% 100%; }
.hw-who.p0 { left: calc(140 * var(--hu)); }
.hw-who.p1 { left: calc(400 * var(--hu)); }
.hw-who.p2 { left: calc(660 * var(--hu)); }
.hw-who.p3 { left: calc(920 * var(--hu)); }

.hw-body { position: absolute; top: 0; left: calc(22 * var(--hu)); width: calc(176 * var(--hu)); aspect-ratio: 1; transform-origin: 50% 100%; }
.howto .critter { position: relative; display: block; border-radius: 50%; overflow: hidden; background: var(--pc); aspect-ratio: 1; }
.howto .critter picture, .howto .critter img { display: block; width: 100%; height: 100%; }
.howto .critter .rig { position: relative; display: block; width: 100%; height: 100%; transform-origin: 50% 100%; }
.howto .critter .eyes { position: absolute; inset: 0; transform-origin: 50% var(--eye, 45%); transition: none; }
.hw-critter { width: 100%; }
.hw-ring {
  position: absolute; inset: calc(-11 * var(--hu)); border-radius: 50%;
  border: calc(6 * var(--hu)) solid var(--accent); opacity: 0; scale: 0.85;
}

/* A phone, as the game's: the player's colour along the top, then what it shows. */
.hw-phone {
  position: absolute; top: calc(132 * var(--hu)); left: calc(44 * var(--hu)); width: calc(132 * var(--hu)); height: calc(190 * var(--hu));
  border-radius: calc(24 * var(--hu)); background: var(--background); border: calc(5 * var(--hu)) solid var(--line-strong);
  box-shadow: 0 calc(12 * var(--hu)) calc(30 * var(--hu)) var(--shadow);
}
.hw-screen { position: absolute; inset: 0; display: block; }
.hw-bar { position: absolute; top: calc(12 * var(--hu)); left: calc(12 * var(--hu)); width: calc(44 * var(--hu)); height: calc(11 * var(--hu)); border-radius: 9999px; background: var(--pc); }
.scr { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; opacity: 0; }
.scr-word { font-size: calc(31 * var(--hu)); font-weight: 800; letter-spacing: -0.01em; }
.scr-none { font-size: calc(100 * var(--hu)); font-weight: 800; color: var(--accent); }
.hw-face { width: calc(84 * var(--hu)); }
.scr-type { align-items: flex-start; padding: calc(50 * var(--hu)) calc(9 * var(--hu)) 0; }
.hw-field {
  display: flex; align-items: center; width: 100%; height: calc(46 * var(--hu)); padding: 0 calc(9 * var(--hu));
  border-radius: calc(12 * var(--hu)); border: calc(3 * var(--hu)) solid var(--accent-soft-border); background: var(--surface);
  font-size: calc(24 * var(--hu)); font-weight: 800;
}
.hw-field .ch { opacity: 0; }
.hw-field .caret { display: block; width: calc(3 * var(--hu)); height: calc(26 * var(--hu)); margin-left: calc(2 * var(--hu)); background: var(--accent); }
.scr-x { align-items: flex-end; padding-bottom: calc(16 * var(--hu)); }
.scr-x svg { width: calc(46 * var(--hu)); height: calc(46 * var(--hu)); padding: calc(9 * var(--hu)); border-radius: 50%; background: var(--accent); color: var(--accent-text); }

/* A clue, in a speech bubble over its critter. */
.hw-bubble { position: absolute; left: calc(-40 * var(--hu)); right: calc(-40 * var(--hu)); top: calc(-88 * var(--hu)); display: flex; justify-content: center; opacity: 0; transform-origin: 50% 100%; }
.hw-bubble span {
  position: relative; padding: calc(10 * var(--hu)) calc(22 * var(--hu)); border-radius: calc(22 * var(--hu));
  background: var(--paper); color: var(--background); font-size: calc(30 * var(--hu)); font-weight: 800; white-space: nowrap;
}
.hw-bubble span::after {
  content: ""; position: absolute; left: 50%; bottom: calc(-13 * var(--hu)); margin-left: calc(-13 * var(--hu));
  border: calc(13 * var(--hu)) solid transparent; border-bottom: 0; border-top-color: var(--paper);
}

/* The votes on the accused, as the TV's count badge. */
.hw-count {
  position: absolute; top: calc(-58 * var(--hu)); left: 50%; translate: -50% 0; padding: calc(6 * var(--hu)) calc(16 * var(--hu));
  border-radius: 9999px; background: var(--accent); color: var(--accent-text);
  font-family: var(--mono); font-size: calc(24 * var(--hu)); font-weight: 500; white-space: nowrap; opacity: 0;
}

/* Confetti for the winners, waiting above the stage. */
.hw-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.hw-confetti i { position: absolute; top: calc(-30 * var(--hu)); width: calc(12 * var(--hu)); height: calc(18 * var(--hu)); border-radius: calc(3 * var(--hu)); background: var(--pc); }
.hw-confetti i:nth-child(3n) { height: calc(12 * var(--hu)); border-radius: 50%; }

/* The closing card (the website and the video). */
.hw-end { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: calc(12 * var(--hu)); opacity: 0; }
.hw-icon { width: calc(150 * var(--hu)); height: calc(150 * var(--hu)); border-radius: calc(34 * var(--hu)); box-shadow: 0 0 calc(70 * var(--hu)) var(--glow-lamp); }
.hw-stage .hw-end-name { margin-top: calc(14 * var(--hu)); font-size: calc(80 * var(--hu)); font-weight: 800; letter-spacing: -0.02em; line-height: 1.04; }
.hw-end-line { font-size: calc(34 * var(--hu)); font-weight: 600; color: var(--accent); }
.hw-end-site { font-family: var(--mono); font-size: calc(22 * var(--hu)); letter-spacing: 0.04em; color: var(--text-muted); }

/* On the TV: the whole board. */
.tv.howto-tv { padding: 0; gap: 0; }
.howto-tv .howto { width: 100%; height: 100%; }

/* On a phone with no TV: a card. */
.page .howto { border-radius: var(--radius-card); border: 1px solid var(--line); }
.howto-steps { margin: 0; padding-left: 2em; display: flex; flex-direction: column; gap: 10px; color: var(--text-soft); font-size: 17px; line-height: 1.4; }
.howto-steps li::marker { color: var(--accent); font-family: var(--mono); font-weight: 500; }

/* On a game's page: the cartoon with a play button, and a switch for the music. */
.howto-embed:empty { aspect-ratio: 16 / 9; }
.howto-embed { position: relative; margin: 0 0 30px; border-radius: 18px; overflow: hidden; border: 1px solid var(--line); background: var(--background); }
.howto-embed .howto { border-radius: 0; border: 0; }
.hw-play {
  position: absolute; inset: 0; display: flex; align-items: flex-end; justify-content: center; padding-bottom: 7%;
  border: 0; background: transparent; cursor: pointer; font: inherit; font-family: var(--display);
}
.hw-play span {
  display: inline-flex; align-items: center; gap: 10px; padding: 14px 24px 14px 18px; border-radius: 9999px;
  background: var(--accent); color: var(--accent-text); font-weight: 800; font-size: 17px; box-shadow: 0 10px 30px var(--shadow);
}
.hw-play svg { width: 22px; height: 22px; }
.hw-play[hidden], .hw-sound[hidden] { display: none; }
.hw-sound {
  position: absolute; right: 12px; bottom: 12px; width: 44px; height: 44px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  background: var(--glass); border: 1px solid var(--line-strong); color: var(--text); cursor: pointer; padding: 0;
}
.hw-sound svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@media (max-width: 560px) {
  .hw-play span { padding: 11px 18px 11px 14px; font-size: 15px; }
}

/* /howto/watch.html: one cartoon filling the window (and the page tools/record-howto.py records). */
body.watch { font-family: var(--display); color: var(--text); margin: 0; height: 100vh; display: flex; align-items: center; justify-content: center; overflow: hidden; background: var(--background); }
body.watch .howto-embed { width: min(100vw, calc(100vh * 16 / 9)); margin: 0; border: 0; border-radius: 0; }
body.watch > .howto { width: min(100vw, calc(100vh * 16 / 9)); }
