/* ==========================================================================
   Variables & Conditionals — DotCode
   All sizes are in px on a 1920×1080 stage; script.js scales it to fit.
   ========================================================================== */

:root {
  /* DotCode brand */
  --primary: #5C48E7;
  --primary-light: #8C6DF5;
  --lavender: #BEC7EC;

  --bg: #080F1A;
  --bg-soft: #0E1628;
  --panel: rgba(255, 255, 255, 0.045);
  --panel-border: rgba(140, 109, 245, 0.24);
  --text: #F1F2FA;
  --muted: #A3AAC8;
  --warn: #FFC857;
  --good: #C3E88D; /* numbers, and "true" */
  --bad: #FF8A8A;  /* "false" */
  --ink: #14102E;  /* dark text on the light game scenes */

  --radius: 28px;
  --font: 'Poppins', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --mono: 'JetBrains Mono', Consolas, 'Courier New', monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

/* ---- Stage --------------------------------------------------------------- */

#viewport {
  position: fixed;
  inset: 0;
}

#stage {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1920px;
  height: 1080px;
  transform-origin: center;
  overflow: hidden;
  background:
    radial-gradient(900px 620px at 88% 8%, rgba(92, 72, 231, 0.34), transparent 70%),
    radial-gradient(760px 520px at 4% 100%, rgba(140, 109, 245, 0.16), transparent 70%),
    radial-gradient(circle, rgba(190, 199, 236, 0.07) 1.5px, transparent 1.8px) 0 0 / 48px 48px,
    var(--bg);
}

.stage-footer {
  position: absolute;
  left: 140px;
  bottom: 40px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 22px;
  color: var(--muted);
  transition: opacity 0.4s;
}

/* The logo SVG has lots of empty space around it, so it's drawn large and pulled in */
.stage-footer img { height: 130px; margin: -40px -24px -40px -44px; }
#stage.hide-footer .stage-footer { opacity: 0; }

/* ---- Slides -------------------------------------------------------------- */

.slide {
  position: absolute;
  inset: 0;
  padding: 90px 140px 150px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transform: translateX(80px);
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s 0.6s;
}

.slide.past { transform: translateX(-80px); }

.slide.active {
  opacity: 1;
  visibility: visible;
  transform: none;
  transition: opacity 0.5s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), visibility 0s;
}

/* .reveal — rises in automatically when its slide opens. --i sets the order. */
.slide.active .reveal {
  animation: rise 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) both;
  animation-delay: calc(150ms + var(--i, 0) * 110ms);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(36px); }
  to   { opacity: 1; transform: none; }
}

/* .fragment — hidden until Next is pressed (PowerPoint "on click").
   [data-from] — the same, for the parts of a demo that appear on a certain step. */
.fragment,
[data-from] {
  opacity: 0;
  transform: translateY(16px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.fragment.visible,
[data-from].is-shown {
  opacity: 1;
  transform: none;
}

/* ---- Typography ---------------------------------------------------------- */

h1, h2, h3, p { margin: 0; }

h1 {
  font-size: 150px;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
}

h2 {
  font-size: 72px;
  line-height: 1.1;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 56px;
}

h3 {
  font-size: 44px;
  line-height: 1.2;
  font-weight: 700;
}

p {
  font-size: 34px;
  line-height: 1.5;
  color: var(--muted);
}

p strong { color: var(--text); font-weight: 600; }

.lead {
  font-size: 42px;
  line-height: 1.45;
  color: var(--text);
}

.grad {
  background: linear-gradient(90deg, var(--primary-light), #C9B8FF 55%, #7FD6FF);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.emoji {
  font-size: 68px;
  line-height: 1;
  flex-shrink: 0;
}

/* Small line above the title */
.kicker {
  margin-bottom: 28px;
  font-size: 30px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--primary-light);
}

.byline {
  font-size: 44px;
  margin-top: 48px;
}

.hl { color: #C9B8FF !important; }

/* The name of a variable, or anything else you would type into Construct */
code {
  font-family: var(--mono);
  font-size: 0.92em;
  color: var(--good);
}

kbd {
  display: inline-block;
  min-width: 1.5em;
  padding: 0 0.35em;
  font-family: var(--mono);
  font-size: 0.85em;
  text-align: center;
  color: var(--text);
  background: rgba(140, 109, 245, 0.22);
  border: 1.5px solid rgba(140, 109, 245, 0.55);
  border-bottom-width: 4px;
  border-radius: 8px;
}

/* ---- Building blocks ----------------------------------------------------- */

.card {
  background: var(--panel);
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius);
  padding: 36px 40px;
}

.card--row {
  display: flex;
  align-items: center;
  gap: 32px;
}

/* Dark box used for the "Global variables" panels and the pretend Construct windows */
.panel {
  padding: 26px 28px;
  background: #050A14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
}

.panel-title {
  margin-bottom: 14px;
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* A demo whose parts appear a few at a time, with its caption underneath */
.staged {
  display: grid;
  gap: 24px 48px;
}

/* Caption under each demo: what just happened, and "2 / 6" on the right */
.caption {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  min-height: 60px;
  font-size: 32px;
  line-height: 1.35;
  color: var(--text);
}

.caption b { color: #C9B8FF; }

.caption .count {
  flex-shrink: 0;
  font-size: 24px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---- Variables ----------------------------------------------------------- */

/* One variable in a "Global variables" panel:  NUMBER  score  ………  0
   A slider can go between the name and the value. */
.var {
  display: flex;
  align-items: center;
  gap: 20px;
  min-height: 68px;
  padding: 0 16px;
  font-family: var(--mono);
  font-size: 30px;
  color: var(--text);
  border-radius: 12px;
  transition: background 0.25s, box-shadow 0.25s;
}

.var small {
  min-width: 124px;
  font-family: var(--font);
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.var input { flex: 1; }

.var output {
  min-width: 2ch;
  margin-left: auto;
  text-align: right;
  color: var(--good);
}

/* The variable that a step has just changed */
.var.is-active {
  background: rgba(255, 200, 87, 0.12);
  box-shadow: inset 0 0 0 2px var(--warn);
}

/* script.js adds this wherever it writes "false" */
.is-false { color: var(--bad) !important; }

/* ---- Sprites and scenes -------------------------------------------------- */

.sprite {
  display: inline-block;
  flex-shrink: 0;
  background-repeat: no-repeat;
  image-rendering: pixelated;
}

/* The character: one frame of an animation strip. Every strip is a row of 128×128
   frames, and script.js sets --sheet (the picture), --frames (how many frames are
   in it) and --frame (which one to show). Only the 64×88 part of a frame that the
   character stands in is shown, so give this a width OR a height and it keeps its shape.
   --crop is how wide that part is, and --crop-x where it starts. */
.sprite--hero {
  --crop: 64;
  --crop-x: 26;
  aspect-ratio: var(--crop) / 88;
  background-image: var(--sheet, url(assets/Fighter/Idle.png));
  background-size: calc(var(--frames, 6) * 128 / var(--crop) * 100%) calc(128 / 88 * 100%);
  background-position: calc((var(--frame, 0) * 128 + var(--crop-x)) / (var(--frames, 6) * 128 - var(--crop)) * 100%) 100%;
}

/* Dead: the character falls over, so show a wider part (with the same middle) */
.sprite--hero.is-wide {
  --crop: 96;
  --crop-x: 10;
}

/* The enemy picture is drawn by script.js */
.sprite--enemy {
  aspect-ratio: 48 / 40;
  background-image: var(--enemy);
  background-size: 100% 100%;
}

/* A light box to stand sprites in, so they show up on the dark slide */
.scene {
  --ground: 56px;
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  background:
    linear-gradient(rgba(20, 16, 46, 0.06) 2px, transparent 2px) 0 0 / 48px 48px,
    linear-gradient(90deg, rgba(20, 16, 46, 0.06) 2px, transparent 2px) 0 0 / 48px 48px,
    #EEF3FB;
}

/* The background image: sky, sun, hills and ground */
.backdrop {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 84% 20%, #FFF6C2 0 44px, rgba(255, 246, 194, 0.35) 46px 70px, transparent 72px),
    radial-gradient(52% 44% at 24% 100%, #86D694 99%, transparent 100%),
    radial-gradient(46% 34% at 82% 100%, #6CCB7D 99%, transparent 100%),
    linear-gradient(#7CC8FF, #D6F1FF);
}

.backdrop::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: var(--ground);
  background: linear-gradient(#4CBB5A 0 14px, #9A6A47 14px);
}

/* Dark label in the corner of a scene */
.scene-badge,
.game-score {
  position: absolute;
  top: 16px;
  padding: 4px 18px;
  font-family: var(--mono);
  font-size: 24px;
  white-space: nowrap;
  color: var(--text);
  background: var(--ink);
  border-radius: 999px;
}

.scene-badge { left: 18px; }

/* Things in a scene that float up and down a little */
@keyframes bob {
  from { transform: translateY(0); }
  to   { transform: translateY(-10px); }
}

/* A value that has just been put in or changed */
@keyframes pop {
  from { transform: scale(1.5); }
  to   { transform: none; }
}

/* ---- Slide layouts ------------------------------------------------------- */

/* Title */
.slide--title {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 90px;
}

.title-logo { width: 760px; }

/* Add "slide--demo" to a slide with an interactive demo, to leave it more room. */
.slide--demo h2 {
  font-size: 64px;
  margin-bottom: 28px;
}

.slide--demo .lead {
  font-size: 38px;
  margin-bottom: 28px;
}

/* ---- Integers (slide 2) -------------------------------------------------- */
/* A number line from -5 to 5. Each number brings its own piece of the line and its
   own tick, so when the negative numbers appear the line grows to the left. */

.numline {
  display: grid;
  grid-template-columns: repeat(11, 1fr);
  padding: 80px 0 24px;
}

.numline span {
  position: relative;
  padding-top: 56px;
  font-family: var(--mono);
  font-size: 60px;
  text-align: center;
  color: var(--good);
}

/* the piece of line */
.numline span::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 6px;
  background: var(--lavender);
}

/* the tick */
.numline span::after {
  content: '';
  position: absolute;
  top: -18px;
  left: 50%;
  width: 6px;
  height: 42px;
  margin-left: -3px;
  background: var(--lavender);
  border-radius: 3px;
}

/* A bracket under the whole line with "Integers" in it */
.numline-brace {
  padding: 12px 0 18px;
  font-size: 44px;
  font-weight: 700;
  text-align: center;
  color: var(--warn);
  border: 5px solid var(--warn);
  border-top: 0;
  border-radius: 0 0 24px 24px;
}

/* ---- Types of data (slide 3) --------------------------------------------- */
/* One card per type: its name at the top, an example in the middle, what it is for underneath. */

.typecards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 48px;
}

.typecard {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  padding: 32px;
  background: var(--panel);
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius);
}

.typecard small {
  font-size: 26px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.typecard code {
  display: grid;
  place-items: center;
  width: 100%;
  height: 200px;
  font-size: 72px;
  background: #050A14;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 22px;
}

.typecard code .is-false { color: var(--bad); }
.typecard code.is-string { color: var(--warn); }

.typecard p {
  font-size: 30px;
  color: var(--text);
}

/* ---- What is a variable? (slide 4) --------------------------------------- */
/* Python-style code: one line per variable, name = value. Global variables on the left, the Player object's on the right. */

.varcode {
  display: flex;
  flex-direction: column;
  gap: 28px;
  margin: 0;
  padding: 48px 64px;
  font-family: var(--mono);
  font-size: 76px;
  line-height: 1.2;
  color: var(--muted);
  background: #050A14;
  border: 1.5px solid var(--panel-border);
  border-radius: var(--radius);
}

.varcode b {
  font-weight: 500;
  color: var(--text);
}

.varcode output { color: var(--good); }

.varcode b,
.varcode output {
  padding: 0 8px;
  border-radius: 10px;
  transition: box-shadow 0.3s;
}

/* Where a variable lives: the global area on the left (dashed, outside everything),
   the Player object on the right */
.var-homes {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}

.var-home {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 28px 32px 32px;
  border-radius: var(--radius);
  transition: box-shadow 0.3s;
}

.var-home--global { border: 3px dashed var(--panel-border); }

.var-home--object {
  background: var(--panel);
  border: 3px solid var(--primary-light);
}

.var-home .panel-title {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 80px;
  margin: 0;
  font-size: 24px;
}

.var-home .varcode {
  padding: 32px 40px;
  font-size: 60px;
}

/* The player, standing in a small light square so it shows up on the dark slide */
.var-home-pic {
  display: grid;
  place-items: center;
  width: 80px;
  height: 80px;
  border-radius: 16px;
}

.var-home-pic .sprite { width: 52px; }

/* data-mark on a step points at one part of the picture */
[data-mark="name"] .varcode b,
[data-mark="value"] .varcode output,
[data-mark="global"] .var-home--global,
[data-mark="object"] .var-home--object { box-shadow: 0 0 0 5px var(--warn); }

/* ---- Events -------------------------------------------------------------- */
/* Written the way Construct shows them: the condition on the left and the action
   on the right, each with the name of its object above it. */

.rules {
  --cols: 1fr 36px 1fr;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.rules-head,
.rule {
  display: grid;
  grid-template-columns: var(--cols);
  gap: 20px;
}

.rules-head {
  margin-bottom: -8px;
  padding: 0 28px;
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.rule {
  align-items: stretch;
  border-radius: 22px;
}

.rule-when,
.rule-do {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px 28px 18px;
  font-size: 28px;
  line-height: 1.3;
  font-weight: 500;
  color: var(--text);
  border-radius: 22px;
  transition: box-shadow 0.3s;
}

.rule-when {
  background: rgba(140, 109, 245, 0.22);
  border: 1.5px solid rgba(140, 109, 245, 0.55);
}

.rule-do {
  background: rgba(195, 232, 141, 0.1);
  border: 1.5px solid rgba(195, 232, 141, 0.45);
}

.rules small {
  font-size: 20px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

/* The yellow "IF" label */
.rules small em {
  margin-right: 12px;
  padding: 1px 10px;
  font-style: normal;
  color: var(--ink);
  background: var(--warn);
  border-radius: 6px;
}

.rule-when b { font-weight: 700; color: #C9B8FF; }
.rule-do b { font-weight: 700; color: var(--good); }

.rule-arrow {
  align-self: center;
  font-size: 36px;
  line-height: 1;
  text-align: center;
  color: var(--primary-light);
}

/* The event that was just added */
.rule.is-new .rule-when,
.rule.is-new .rule-do { box-shadow: 0 0 0 4px var(--warn); }

/* The event that is running right now */
.rule.is-on .rule-when,
.rule.is-on .rule-do { box-shadow: 0 0 0 4px var(--good), 0 0 30px rgba(195, 232, 141, 0.45); }

/* ---- Games (slides 5 and 8) ---------------------------------------------- */
/* The variables and events on the left, and a tiny game that obeys them on the right. */

.game-demo {
  display: grid;
  grid-template-columns: 1fr 640px;
  gap: 24px 48px;
  align-items: center;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 20px;
  min-width: 0;
}

.game {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.game-view {
  height: 330px;
  --ground: 48px;
}

.game-view .sprite {
  position: absolute;
  bottom: var(--ground);
}

/* left is set by script.js; the negative margin puts the middle of the sprite there */
.game-hero { width: 80px; margin-left: -40px; }
.game-hero.is-wide { width: 120px; margin-left: -60px; }
.game-enemy { width: 90px; margin-left: -45px; }

.game-lives {
  position: absolute;
  top: 14px;
  left: 18px;
  font-size: 34px;
  letter-spacing: 4px;
}

.game-score { right: 18px; }

.game-over {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 64px;
  font-weight: 800;
  color: var(--text);
  background: rgba(8, 15, 26, 0.65);
}

.game-keys {
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 24px;
  color: var(--muted);
}

.game-keys span { margin-left: 10px; }

.key {
  width: 64px;
  height: 64px;
  font: inherit;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  background: rgba(140, 109, 245, 0.2);
  border: 1.5px solid rgba(140, 109, 245, 0.55);
  border-bottom-width: 6px;
  border-radius: 14px;
  cursor: pointer;
  touch-action: none;
  transition: background 0.1s, transform 0.1s;
}

.key.is-down {
  background: var(--primary);
  transform: translateY(4px);
  border-bottom-width: 2px;
}

.key:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 3px; }

/* A coin to collect. It floats away when it is taken, and comes back a moment later. */
.coin {
  position: absolute;
  bottom: calc(var(--ground) + 20px);
  width: 38px;
  height: 38px;
  margin-left: -19px;
  background: radial-gradient(circle at 36% 30%, #FFF6C2, #FFC857 55%, #E59A17);
  border: 4px solid #B9770B;
  border-radius: 50%;
  animation: bob 0.8s ease-in-out infinite alternate;
  transition: opacity 0.25s, translate 0.25s;
}

.coin:nth-of-type(even) { animation-delay: -0.4s; }

.coin.is-taken {
  opacity: 0;
  translate: 0 -46px;
}

/* If (slide 8) has four events, so it squeezes up: the two variables side by side,
   and smaller events */
.ifs-demo .panel {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 24px;
  padding: 18px 24px;
}

.ifs-demo .panel-title { grid-column: 1 / -1; margin-bottom: 4px; }
.ifs-demo .var { min-height: 56px; }
.ifs-demo .rules { gap: 12px; }

.ifs-demo .rule-when,
.ifs-demo .rule-do {
  padding: 10px 24px 12px;
  font-size: 26px;
}

.ifs-demo .rules small { font-size: 17px; }

/* ---- Booleans (slide 6) -------------------------------------------------- */
/* Click a variable on the left to flip it, and the picture on the right changes. */

.bools-demo {
  display: grid;
  grid-template-columns: 1fr 760px;
  gap: 24px 48px;
  align-items: center;
}

.bools-demo .var {
  width: 100%;
  min-height: 92px;
  font-size: 36px;
  font-weight: inherit;
  line-height: inherit;
  text-align: left;
  background: none;
  border: 0;
  cursor: pointer;
}

.bools-demo .var:hover { background: rgba(255, 255, 255, 0.06); }
.bools-demo .var:focus-visible { outline: 3px solid var(--primary-light); }
.bools-demo .var.is-active { background: rgba(255, 200, 87, 0.12); }

/* isNight = true */
.bools-demo .var b {
  padding: 2px 8px;
  font-weight: 500;
  border-radius: 10px;
  transition: box-shadow 0.3s;
}

.bools-demo .var output { margin-left: 0; }

/* data-mark="name" on a step points at the names */
.bools-demo[data-mark="name"] .var b { box-shadow: 0 0 0 4px var(--warn); }

.bool-scene {
  height: 430px;
  --ground: 64px;
}

.bool-scene .sprite {
  position: absolute;
  left: 50%;
  bottom: var(--ground);
  width: 190px;
  margin-left: -95px;
}

/* isNight: a dark sky with a moon (covering the sun) and stars, faded in over the day */
.night {
  position: absolute;
  inset: 0;
  opacity: 0;
  background:
    radial-gradient(circle at 84% 20%, #F6F3DC 0 45px, transparent 47px),
    radial-gradient(circle at 12% 16%, #fff 0 3px, transparent 4px),
    radial-gradient(circle at 30% 34%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 46% 12%, #fff 0 3px, transparent 4px),
    radial-gradient(circle at 63% 30%, #fff 0 2px, transparent 3px),
    radial-gradient(circle at 70% 9%, #fff 0 2px, transparent 3px),
    rgba(10, 12, 48, 0.8);
  transition: opacity 0.7s;
}

.bool-scene.isNight .night { opacity: 1; }

/* hasKey: a key above the character's head */
.held-key {
  position: absolute;
  left: 50%;
  bottom: calc(var(--ground) + 270px);
  width: 90px;
  margin-left: -45px;
  font-size: 62px;
  line-height: 1;
  text-align: center;
  opacity: 0;
  transform: translateY(30px) scale(0.4);
  transition: opacity 0.3s, transform 0.4s cubic-bezier(0.3, 1.6, 0.5, 1);
}

.bool-scene.hasKey .held-key {
  opacity: 1;
  transform: none;
}

/* ---- Conditions (slide 7) ------------------------------------------------ */
/* Sliders for the variables on the left; the questions and their answers on the right. */

.compare-demo {
  display: grid;
  grid-template-columns: 680px 1fr;
  gap: 24px 48px;
  align-items: center;
}

.conds {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.conds .panel-title { margin-bottom: 0; }

/* One question:   score > 10     false   (script.js fills it in) */
.cond {
  display: grid;
  grid-template-columns: 1fr 150px;
  align-items: center;
  gap: 24px;
  min-height: 84px;
  padding: 0 28px;
  background: var(--panel);
  border: 1.5px solid var(--panel-border);
  border-radius: 22px;
}

.cond code { font-size: 36px; color: var(--text); }

.cond output {
  padding: 6px 0;
  font-family: var(--mono);
  font-size: 30px;
  text-align: center;
  color: var(--good);
  background: rgba(195, 232, 141, 0.12);
  border: 1.5px solid rgba(195, 232, 141, 0.45);
  border-radius: 999px;
  transition: background 0.2s, border-color 0.2s;
}

.cond output.is-false {
  background: rgba(255, 138, 138, 0.12);
  border-color: rgba(255, 138, 138, 0.45);
}

.cond.is-new { box-shadow: 0 0 0 4px var(--warn); }

/* ---- Pick your player / enemy (slides 9 and 10) -------------------------- */
/* One card per character: it plays on the left. On the right are its name, the
   strip of frames that is playing, and its downloads. */

/* Any strip of square frames, playing at 10 frames a second. script.js sets the
   picture and --frames (how many frames are in the strip). */
.sprite--sheet {
  aspect-ratio: 1;
  background-size: calc(var(--frames, 1) * 100%) 100%;
  animation: sheet calc(var(--frames, 1) * 0.1s) steps(var(--frames, 1), jump-none) infinite;
}

@keyframes sheet {
  to { background-position-x: 100%; }
}

.characters {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.character {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 10px 32px;
  align-items: center;
  padding: 14px 28px;
}

.character-title {
  display: flex;
  align-items: center;
  gap: 28px;
  min-width: 0;
}

.character h3 {
  min-width: 300px;
  font-size: 34px;
}

/* The whole sprite sheet, with a line between each frame so they are easy to count.
   script.js sets --sheet (the picture) and --frames. */
.sheet-strip {
  flex: 0 1 calc(var(--frames, 1) * 64px); /* 64px a frame, but shrinks to fit a long strip */
  min-width: 0;
  aspect-ratio: var(--frames, 1) / 1;
  border-radius: 12px;
  background:
    linear-gradient(90deg, transparent calc(100% - 2px), rgba(20, 16, 46, 0.22) 0) 0 0 / calc(100% / var(--frames, 1)) 100%,
    var(--sheet, none) 0 0 / 100% 100% no-repeat,
    linear-gradient(#8FD0FF, #D6F1FF);
}

.character-preview {
  grid-row: 1 / span 2;
  height: 170px;
  --ground: 26px;
}

.character-preview .sprite {
  position: absolute;
  left: 50%;
  bottom: var(--ground);
  width: 170px;
  margin-left: -85px;
}

.chips {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
}

/* One download link:  ⬇ Walk      8   (the number of frames; it says "8 frames" when you point at it) */
.chip {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  height: 44px;
  padding: 0 10px;
  font-size: 19px;
  font-weight: 600;
  white-space: nowrap;
  text-decoration: none;
  color: var(--text);
  background: rgba(140, 109, 245, 0.2);
  border: 1.5px solid rgba(140, 109, 245, 0.55);
  border-radius: 14px;
  transition: background 0.2s;
}

.chip:hover { background: var(--primary); }
.chip:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 3px; }
.chip svg { flex-shrink: 0; width: 20px; height: 20px; }
.chip span { overflow: hidden; text-overflow: ellipsis; }

.chip small {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 500;
  color: var(--good);
}

/* ---- Sliders ------------------------------------------------------------- */

input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  margin: 0;
  background: rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 32px;
  height: 32px;
  background: var(--primary-light);
  border: 4px solid var(--text);
  border-radius: 50%;
}

input[type="range"]::-moz-range-thumb {
  width: 24px;
  height: 24px;
  background: var(--primary-light);
  border: 4px solid var(--text);
  border-radius: 50%;
}

input[type="range"]:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 6px; }

/* ---- Controls ------------------------------------------------------------ */

#progress {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10;
  width: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 0.4s ease;
}

#controls {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: rgba(14, 22, 40, 0.85);
  border: 1px solid rgba(140, 109, 245, 0.3);
  border-radius: 999px;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  transition: opacity 0.3s;
}

.ctrl {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}

.ctrl:hover { background: rgba(140, 109, 245, 0.22); }
.ctrl.primary { background: var(--primary); }
.ctrl.primary:hover { background: var(--primary-light); }
.ctrl:disabled { opacity: 0.3; cursor: default; background: transparent; }
.ctrl:focus-visible { outline: 3px solid var(--primary-light); outline-offset: 2px; }
.ctrl svg { width: 22px; height: 22px; }

#counter {
  min-width: 70px;
  text-align: center;
  font-size: 15px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}

.divider {
  width: 1px;
  height: 28px;
  margin: 0 4px;
  background: rgba(255, 255, 255, 0.14);
}

.icon-compress { display: none; }
.is-fullscreen .icon-expand { display: none; }
.is-fullscreen .icon-compress { display: block; }

/* In fullscreen, hide the controls and cursor when the mouse is still */
.is-fullscreen.idle #controls:not(:hover) { opacity: 0; }
.is-fullscreen.idle { cursor: none; }

/* ---- Reduced motion ------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
  .slide, .slide.past { transform: none; }
  .slide.active .reveal { animation: none; }
  .fragment, [data-from] { transform: none; transition: opacity 0.2s; }
  .coin, .sprite--sheet { animation: none; }
  .held-key { transition: none; }
}
