/* The Rive engine's own styles: the scene inside the design system's Player, for a student of about six. Every colour,
   space and radius is a token of design/tokens.css; sizes that follow the text are in em, so both text sizes hold. */
html,
body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
}
#page {
  display: flex;
  flex-direction: column;
  height: 100dvh;
}
#stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
}
#stage > .k-app {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
#strip {
  flex: none;
  max-height: 50dvh;
  overflow-y: auto;
}
#strip > .k-app {
  min-height: 0;
}
.r-plain {
  font-family: var(--font-body);
  color: var(--ink);
  padding: var(--space-5);
}

/* The lab's stand-in for Today */
.r-door {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  overflow-y: auto;
}
.r-door__card {
  width: 100%;
  max-width: 26rem;
  padding: var(--space-5);
  box-shadow: var(--shadow);
}

/* A plain word in the middle of the Player: opening, moved elsewhere, a refusal */
.r-message {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-5) var(--space-4);
}

/* The stage: the bird, alive, and the scene's drawing beside it */
.r-stage {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--grass);
  min-width: 0;
}
.r-stage__pic {
  flex: 0 1 12em;
  min-width: 0;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow);
  align-self: center;
}
.r-rive {
  position: relative;
  aspect-ratio: 1;
}
.r-rive canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
}
.r-rive--on canvas {
  opacity: 1;
}
.r-rive__still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.r-rive--plain svg {
  display: block;
  width: 100%;
  height: 100%;
}
.r-bird {
  flex: 0 0 auto;
  width: 7em;
}
.r-stage--alone {
  padding-block: var(--space-2);
}
.r-stage--alone .r-bird {
  width: 5em;
}
.r-bird--big {
  width: 10em;
}
@container app (min-width: 720px) {
  .r-bird {
    width: 10em;
  }
  .r-stage--alone .r-bird {
    width: 8em;
  }
  .r-stage__pic {
    flex-basis: 16em;
  }
}
@container app (min-width: 900px) {
  .r-stage {
    flex: 1 1 46%;
    position: sticky;
    top: 0;
    flex-direction: column;
    align-items: center;
    padding: var(--space-5);
  }
  .k-pscene > .k-pscene__words {
    flex: 1 1 54%;
  }
  .r-bird,
  .r-stage--alone .r-bird,
  .r-bird--big {
    width: min(100%, 15em);
  }
  .r-stage__pic {
    flex: none;
    width: min(100%, 18em);
  }
}
.k-pscene__words:focus {
  outline: none;
}

/* The mute: always in sight, and plainly pressed when the sound is off */
.r-mute {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-width: var(--touch);
  min-height: var(--touch);
  padding: 0;
  border-radius: var(--radius-pill);
  border: 2px solid transparent;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}
.r-mute:hover {
  background: var(--surface-2);
}
.r-mute--word {
  align-self: flex-start;
  padding: 0 var(--space-4) 0 var(--space-3);
  border-color: var(--line-strong);
  font-size: var(--text-sm);
}
.r-mute--on {
  background: var(--warning-soft);
  border-color: var(--warning);
  color: var(--warning);
}
.r-mute--on:hover {
  background: var(--warning-soft);
}

/* A press to hear it again */
.r-hears {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}
.r-hears .k-sound {
  min-height: var(--touch);
}
.r-hear:disabled,
.k-sound:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.r-hear {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 3.2em;
  min-width: var(--touch);
  height: 3.2em;
  min-height: var(--touch);
  border-radius: var(--radius-pill);
  border: 2px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
}
.r-hear:hover {
  border-color: var(--accent);
}
.r-hear--small {
  width: var(--touch);
  height: var(--touch);
}

/* choice: a picture, its word, and a press to hear it; three side by side, so none waits below the fold */
.r-cards {
  display: grid;
  gap: var(--space-2);
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.r-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  border: 3px solid var(--line-strong);
  background: var(--surface);
  min-width: 0;
}
.r-card--on {
  border-color: var(--accent);
  background: var(--accent-soft);
}
/* the word being said: its card is ringed, so the ear and the eye meet on one picture */
.r-card--saying {
  border-color: var(--info);
  box-shadow: 0 0 0 4px var(--info-soft);
}
.r-card--right {
  border-color: var(--success);
  background: var(--success-soft);
}
.r-card--wrong {
  border-color: var(--warning);
  background: var(--warning-soft);
}
.r-card__pick {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: 0 0 var(--space-1);
  border: 0;
  border-radius: var(--radius-md);
  background: none;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.r-card__pick:disabled {
  cursor: default;
}
.r-card__pick .k-drawing {
  width: 100%;
  border-radius: var(--radius-md);
}
.r-card__word {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.45em;
  line-height: 1.1;
  overflow-wrap: anywhere;
}
.r-card .r-hear {
  width: 100%;
  height: var(--touch);
}
@container app (min-width: 560px) {
  .r-cards {
    gap: var(--space-3);
  }
  .r-card__word {
    font-size: 1.7em;
  }
}

/* number: one press for each sound, one box for each press */
.r-count {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.r-count__row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}
.r-boxes {
  flex: 1;
  min-width: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--space-2);
  max-width: 26em;
}
.r-box {
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  border: 3px dashed var(--line-strong);
  background: var(--surface);
  overflow: hidden;
}
.r-box--on {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.r-boxes--right .r-box--on {
  border-color: var(--success);
  background: var(--success-soft);
}
.r-boxes--wrong .r-box--on {
  border-color: var(--warning);
  background: var(--warning-soft);
}
.r-box .r-rive {
  width: 100%;
}
.r-dot {
  display: none;
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background: var(--accent);
}
.r-box--on .r-dot {
  display: block;
}
.r-count__n {
  flex: none;
  min-width: 1.2em;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.8em;
  line-height: 1;
}
.r-count__keys {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}
.r-key {
  flex: 1 1 7em;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 4em;
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-lg);
  border: 3px solid var(--accent);
  background: var(--accent);
  color: var(--on-accent);
  font: inherit;
  font-weight: 700;
  font-size: var(--text-lg);
  cursor: pointer;
}
.r-key--quiet {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--line-strong);
}
.r-key:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* place: a letter for each sound, a box for each place */
.r-build {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.r-build__slots {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-3);
  max-width: 24em;
}
.r-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-1);
  min-height: 6.4em;
  padding: var(--space-2);
  border-radius: var(--radius-lg);
  border: 3px dashed var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  cursor: pointer;
}
.r-slot:disabled {
  cursor: default;
}
.r-slot small {
  color: var(--muted);
  font-size: var(--text-sm);
  font-weight: 700;
}
.r-slot__letter {
  flex: 1;
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 3em;
  line-height: 1;
}
.r-slot--ready {
  border-color: var(--focus);
}
.r-slot--on {
  border-style: solid;
  border-color: var(--accent);
  background: var(--accent-soft);
}
.r-slot--right {
  border-color: var(--success);
  background: var(--success-soft);
}
.r-slot--wrong {
  border-color: var(--warning);
  background: var(--warning-soft);
}
.r-build__pool {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  min-height: 4.6em;
}
.r-tile {
  display: inline-grid;
  place-items: center;
  width: 1.7em;
  height: 1.7em;
  border: 0;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow), inset 0 0 0 3px var(--line-strong);
  color: var(--ink);
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 2.7em;
  line-height: 1;
  cursor: pointer;
  touch-action: none;
}
.r-tile--on {
  box-shadow: var(--shadow), inset 0 0 0 4px var(--accent);
  background: var(--accent-soft);
}
.r-tile:disabled {
  opacity: 0.45;
}
.r-tile--ghost {
  position: fixed;
  z-index: 60;
  transform: translate(-50%, -50%);
  pointer-events: none;
}

/* What is said back, and the way on */
.r-foot {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.r-foot .k-feedback {
  align-items: center;
}

/* The lab's strip */
.r-strip {
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--muted);
  font-size: var(--text-sm);
}
.r-strip summary {
  min-height: var(--touch);
  display: flex;
  align-items: center;
  padding: var(--space-1) var(--space-4);
  cursor: pointer;
}
.r-strip__in {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: 0 var(--space-4) var(--space-4);
}
.r-strip ol,
.r-strip ul {
  margin: 0;
  padding-left: var(--space-5);
}
.r-strip ol:empty,
.r-strip ul:empty {
  display: none;
}

/* The lab's switch `?motion=reduced` asks of the page what the device's own setting asks of the design system */
[data-motion='reduced'] .k-up {
  animation: none;
}
[data-motion='reduced'] .k-app * {
  transition: none !important;
}
