/* Shared look of the KnowX games (SAXS Detective, FAIR Rescue).
 * Copied from xpcs-beamline/game.css on 2026-11-25, so the games look the same. Each game adds its own game.css. */

:root,
:root[data-theme="light"] {
  color-scheme: light;
  --paper: #f6f8fa;
  --surface: #ffffff;
  --surface-sunk: #eef2f6;
  --ink: #0b2540;
  --ink-soft: #3d4f63;
  --rule: #d3dce6;
  --brand: #01385f;
  --brand-ink: #ffffff;
  --link: #0a4f86;
  --beam: #c98200;
  --beam-ink: #0b2540;
  --focus: #d48a00;
  --ok: #1f7a4d;
  --bad: #b3261e;
  --warn: #8a5a00;
  --shadow: 0 10px 30px rgb(11 37 64 / 0.18);
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #061a2c;
  --surface: #0a2238;
  --surface-sunk: #081e33;
  --ink: #e7eef6;
  --ink-soft: #a9bccf;
  --rule: #1d3a57;
  --brand: #8cc8ec;
  --brand-ink: #061a2c;
  --link: #8cc8ec;
  --beam: #f2b34c;
  --beam-ink: #061a2c;
  --focus: #f2b34c;
  --ok: #6fd3a0;
  --bad: #ff8a80;
  --warn: #f2b34c;
  --shadow: 0 10px 30px rgb(0 0 0 / 0.45);
}

* {
  box-sizing: border-box;
}
html,
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}
h1,
h2,
h3 {
  font-family: "Source Serif 4", Georgia, "Times New Roman", serif;
  line-height: 1.2;
  margin: 0;
}
a {
  color: var(--link);
}
button,
input,
select {
  font: inherit;
  color: inherit;
}
:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}
[hidden] {
  display: none !important;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.5rem;
  padding: 0.45rem 0.9rem;
  border-radius: 6px;
  border: 1.5px solid var(--brand);
  background: transparent;
  color: var(--brand);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background-color 120ms ease;
}
.btn:hover {
  background: color-mix(in oklab, var(--brand) 10%, transparent);
}
.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--brand);
  color: var(--brand-ink);
}
.btn-primary:hover {
  background: color-mix(in oklab, var(--brand) 86%, var(--ink));
}
.btn-beam {
  background: var(--beam);
  border-color: var(--beam);
  color: var(--beam-ink);
}
.btn-beam:hover {
  background: color-mix(in oklab, var(--beam) 85%, var(--ink));
}
.btn-small {
  min-height: 2rem;
  padding: 0.2rem 0.6rem;
  font-size: 0.9rem;
}
.btn-ghost {
  border-color: transparent;
}
.icon-btn {
  min-width: 2.5rem;
  padding: 0.3rem;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
  padding: 0.6rem 1rem;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
  position: sticky;
  top: 0;
  z-index: 5;
}
.brand {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-right: auto;
  min-width: 0;
}
.brand h1 {
  font-size: 1.15rem;
  white-space: nowrap;
}
.brand .lvl {
  color: var(--ink-soft);
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.meter-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.meter-inline .label {
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.shift-time {
  font-weight: 700;
}
.shift-time.low {
  color: var(--bad);
}
.spots {
  display: inline-flex;
  gap: 3px;
}
.spot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  border: 1.5px solid var(--brand);
}
.spot.used {
  background: color-mix(in oklab, var(--brand) 35%, transparent);
}
.spot.current {
  background: var(--brand);
}
.spot.ruined {
  border-color: var(--bad);
  background: repeating-linear-gradient(45deg, var(--bad) 0 2px, transparent 2px 4px);
}

/* Lab layout */
.lab {
  display: grid;
  gap: 0.9rem;
  padding: 0.9rem;
  max-width: 1500px;
  margin: 0 auto;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 1.15fr) minmax(250px, 0.85fr);
  grid-template-areas:
    "det plot plot"
    "ctrl tt status";
}
.panel {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 0.8rem;
  min-width: 0;
}
.panel h2 {
  font-size: 1rem;
  margin-bottom: 0.5rem;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
}
.panel h2 small {
  font-family: inherit;
  font-weight: 400;
  color: var(--ink-soft);
  font-size: 0.85rem;
}
.p-det {
  grid-area: det;
}
.p-plot {
  grid-area: plot;
}
.p-ctrl {
  grid-area: ctrl;
}
.p-tt {
  grid-area: tt;
}
.p-status {
  grid-area: status;
}

.det-wrap {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  border-radius: 4px;
  overflow: hidden;
  background: var(--surface-sunk);
  touch-action: manipulation;
}
.det-wrap canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
#det {
  image-rendering: pixelated;
}
.det-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
  margin-top: 0.5rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.det-legend b {
  color: var(--ink);
  font-weight: 600;
}

.plot-tabs {
  display: none;
  gap: 0.3rem;
  margin-bottom: 0.5rem;
}
.plot-tabs [aria-selected="true"] {
  background: var(--brand);
  color: var(--brand-ink);
}
.plot-area {
  display: grid;
  grid-template-columns: 1fr 15rem;
  gap: 0.8rem;
}
.canvas-box {
  position: relative;
  width: 100%;
  height: 340px;
}
.canvas-box canvas {
  width: 100%;
  height: 100%;
  display: block;
  border-radius: 4px;
}
#g2 {
  cursor: grab;
  touch-action: none;
}
#g2:active {
  cursor: grabbing;
}
.plot-help {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0.35rem 0 0;
}

.fit {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  font-size: 0.9rem;
}
.fit .param {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.1rem 0.5rem;
  align-items: center;
}
.fit .param label {
  font-weight: 600;
}
.fit .param output {
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.fit .param input[type="range"] {
  grid-column: 1 / -1;
  width: 100%;
}
.fit .lock {
  grid-column: 1 / -1;
  font-size: 0.8rem;
  color: var(--ink-soft);
  display: flex;
  gap: 0.35rem;
  align-items: center;
}
.fit-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}
.readout {
  border-top: 1px solid var(--rule);
  padding-top: 0.45rem;
  font-variant-numeric: tabular-nums;
}
.readout div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.readout .k {
  color: var(--ink-soft);
}
.readout .v {
  font-weight: 600;
}
.readout .good {
  color: var(--ok);
}
.readout .poor {
  color: var(--bad);
}

/* Controls */
.ctrl {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.ctrl .row label,
.ctrl .row .lab-title {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
  font-size: 0.92rem;
}
.ctrl .row output {
  font-weight: 400;
  font-variant-numeric: tabular-nums;
}
.ctrl input[type="range"] {
  width: 100%;
}
.seg {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 1fr;
  border: 1.5px solid var(--brand);
  border-radius: 6px;
  overflow: hidden;
  margin-top: 0.25rem;
}
.seg button {
  border: 0;
  border-right: 1px solid var(--rule);
  background: transparent;
  padding: 0.35rem 0;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  font-size: 0.88rem;
  min-height: 2.25rem;
}
.seg button:last-child {
  border-right: 0;
}
.seg button[aria-pressed="true"] {
  background: var(--brand);
  color: var(--brand-ink);
  font-weight: 700;
}
.ring-sel {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.ring-sel output {
  flex: 1;
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.inline-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
}
.note {
  font-size: 0.8rem;
  color: var(--ink-soft);
  margin: 0.2rem 0 0;
}
.beam-btn {
  width: 100%;
  min-height: 3rem;
  font-size: 1.05rem;
}
.beam-btn[aria-pressed="true"] {
  background: var(--beam);
  border-color: var(--beam);
  color: var(--beam-ink);
}
.beam-dot {
  width: 0.75rem;
  height: 0.75rem;
  border-radius: 50%;
  border: 2px solid currentColor;
}
.beam-btn[aria-pressed="true"] .beam-dot {
  background: currentColor;
}

/* Two-time */
.tt-box {
  position: relative;
  aspect-ratio: 1;
  width: 100%;
  max-width: 340px;
  margin: 0 auto;
}
.tt-box canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.window-ctrl {
  margin-top: 0.5rem;
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
}
.window-ctrl label {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

/* Status: dose etc. */
.dose {
  margin-bottom: 0.75rem;
}
.dose-bar {
  position: relative;
  height: 1.1rem;
  border-radius: 4px;
  background: var(--surface-sunk);
  border: 1px solid var(--rule);
  overflow: hidden;
}
.dose-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--brand);
  transition: width 120ms linear;
}
.dose-bar.over .dose-fill {
  background: var(--beam);
}
.dose-bar.critical .dose-fill {
  background: var(--bad);
}
.dose-bar.pulse {
  animation: pulse 1.2s ease-in-out infinite;
}
@keyframes pulse {
  50% {
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--beam) 45%, transparent);
  }
}
.dose-tick {
  position: absolute;
  top: -2px;
  bottom: -2px;
  width: 2px;
  background: var(--ink);
}
.dose-scale {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--ink-soft);
  margin-top: 0.15rem;
}
.dose-scale span:nth-child(2) {
  position: relative;
}
.stats {
  font-size: 0.88rem;
  font-variant-numeric: tabular-nums;
  display: grid;
  gap: 0.15rem;
  margin-bottom: 0.75rem;
}
.stats div {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.stats .k {
  color: var(--ink-soft);
}
.status-actions {
  display: grid;
  gap: 0.45rem;
}
.quality {
  font-size: 0.85rem;
  color: var(--ink-soft);
}
.toast {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--paper);
  padding: 0.55rem 0.9rem;
  border-radius: 6px;
  box-shadow: var(--shadow);
  z-index: 40;
  max-width: min(92vw, 34rem);
  font-size: 0.92rem;
}

/* Overlays: menu, cards, tutorial */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: color-mix(in oklab, var(--paper) 70%, transparent);
  backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 1rem;
  overflow-y: auto;
}
.card {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 1.4rem;
  width: min(100%, 44rem);
  max-height: calc(100svh - 2rem);
  overflow-y: auto;
}
.card h2 {
  font-size: 1.5rem;
  margin-bottom: 0.4rem;
}
.card h3 {
  font-size: 1.1rem;
  margin: 1rem 0 0.3rem;
}
.card p {
  margin: 0.4rem 0;
}
.card .kicker {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.card .actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.1rem;
}
.card.win .kicker {
  color: var(--ok);
}
.card.lose .kicker {
  color: var(--bad);
}
.result-table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  margin: 0.6rem 0;
  font-size: 0.95rem;
}
.result-table th,
.result-table td {
  text-align: left;
  padding: 0.35rem 0.4rem;
  border-bottom: 1px solid var(--rule);
}
.result-table td:not(:first-child),
.result-table th:not(:first-child) {
  text-align: right;
}
.learned {
  background: var(--surface-sunk);
  border-left: 4px solid var(--beam);
  padding: 0.6rem 0.8rem;
  border-radius: 0 6px 6px 0;
  margin: 0.8rem 0;
}
.mini-plot {
  width: 100%;
  height: 180px;
  display: block;
}

.menu .levels {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
  gap: 0.7rem;
  margin: 1rem 0;
}
.level-card {
  text-align: left;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  padding: 0.8rem;
  background: var(--surface);
  cursor: pointer;
  display: grid;
  gap: 0.25rem;
}
.level-card:hover {
  border-color: var(--brand);
}
.level-card .num {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.level-card .ttl {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 1.1rem;
  font-weight: 700;
}
.level-card .desc {
  font-size: 0.88rem;
  color: var(--ink-soft);
}
.level-card .done {
  color: var(--ok);
  font-weight: 700;
  font-size: 0.85rem;
}
.menu-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  font-size: 0.88rem;
  align-items: center;
}

.tut-ring {
  position: fixed;
  z-index: 35;
  border: 3px solid var(--beam);
  border-radius: 8px;
  box-shadow: 0 0 0 9999px color-mix(in oklab, var(--paper) 55%, transparent);
  pointer-events: none;
  transition: all 200ms ease;
}
.tut-bubble {
  position: fixed;
  z-index: 36;
  width: min(22rem, calc(100vw - 2rem));
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 0.9rem;
}
.tut-bubble p {
  margin: 0 0 0.6rem;
}
.tut-bubble .actions {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}
.selftest-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.8rem;
  background: var(--surface-sunk);
  padding: 0.6rem;
  border-radius: 6px;
  white-space: pre-wrap;
  max-height: 50vh;
  overflow: auto;
}

/* Responsive */
@media (max-width: 1180px) {
  .lab {
    grid-template-columns: minmax(260px, 1fr) minmax(280px, 1.2fr);
    grid-template-areas:
      "det plot"
      "status plot"
      "ctrl tt";
  }
  .plot-area {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 760px) {
  body {
    font-size: 15px;
  }
  .topbar {
    padding: 0.5rem 0.75rem;
    gap: 0.4rem 0.9rem;
  }
  .brand {
    width: 100%;
  }
  .lab {
    padding: 0.6rem;
    gap: 0.6rem;
    grid-template-columns: 1fr;
    grid-template-areas:
      "det"
      "status"
      "plot"
      "tt"
      "ctrl";
  }
  .lab.tab-tt .p-tt {
    display: block;
  }
  .plot-tabs {
    display: flex;
  }
  .p-tt {
    display: none;
  }
  .lab.tab-tt .p-plot .g2-only {
    display: none;
  }
  .canvas-box {
    height: 240px;
  }
  /* keep the shutter within reach on phones */
  .topbar {
    position: static;
  }
  body {
    padding-bottom: 4.6rem;
  }
  .beam-btn {
    position: fixed;
    left: 0.6rem;
    right: 0.6rem;
    bottom: 0.6rem;
    width: auto;
    z-index: 6;
    box-shadow: var(--shadow);
    background: var(--surface);
  }
}
@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
    animation: none !important;
  }
}

/* The beamline manager: messages during the shift, and the verdict at its end */
.boss {
  position: fixed;
  right: 1rem;
  top: 4.2rem;
  z-index: 45;
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  max-width: min(calc(100vw - 2rem), 26rem);
  padding: 0.7rem 0.8rem;
  background: var(--surface);
  color: var(--ink);
  border: 2px solid var(--bad);
  border-radius: 10px;
  box-shadow: var(--shadow);
  animation: boss-in 0.35s ease-out;
}
.boss[hidden] {
  display: none;
}
.boss.good {
  border-color: var(--ok);
}
.boss.furious .boss-face {
  animation: boss-shake 0.5s linear 2;
}
.boss-face {
  flex: none;
  color: var(--bad);
}
.boss-text b {
  font-size: 0.82rem;
  color: var(--ink-soft);
}
.boss-text p {
  margin: 0.15rem 0 0;
  font-size: 0.95rem;
}
.boss-close {
  flex: none;
  margin-left: auto;
  min-width: 2rem;
  font-size: 1.1rem;
  line-height: 1;
}
.boss-inline {
  position: static;
  max-width: none;
  box-shadow: none;
  margin-bottom: 0.9rem;
  animation: none;
}
.verdict {
  display: flex;
  align-items: flex-start;
  gap: 0.9rem;
  padding: 0.8rem 0.9rem;
  margin-bottom: 1rem;
  border-radius: 10px;
  border: 2px solid var(--rule);
  background: var(--surface-sunk);
}
.verdict.happy {
  border-color: var(--ok);
}
.verdict.angry {
  border-color: var(--bad);
}
.verdict p {
  margin: 0.15rem 0;
}
.verdict-title {
  font-size: 1.3rem;
  font-weight: 800;
}
.objective-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem 0.6rem;
  padding: 0.5rem 0.7rem;
  background: var(--surface-sunk);
  border-radius: 6px;
  font-size: 0.92rem;
}
.objective-card[aria-pressed="true"] {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}
@keyframes boss-in {
  from {
    transform: translateY(-1rem);
    opacity: 0;
  }
}
@keyframes boss-shake {
  25% {
    transform: rotate(-9deg);
  }
  75% {
    transform: rotate(9deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .boss,
  .boss.furious .boss-face {
    animation: none;
  }
}

/* Safety training before the first shift */
.quiz-q {
  font-size: 1.25rem;
  line-height: 1.3;
}
.quiz-opts {
  display: grid;
  gap: 0.5rem;
  margin-top: 0.9rem;
}
.quiz-opt {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.7rem;
  align-items: center;
  min-height: 3rem;
  padding: 0.6rem 0.8rem;
  border: 1.5px solid var(--rule);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.quiz-opt:hover:not(:disabled) {
  border-color: var(--brand);
}
.quiz-opt:disabled {
  cursor: default;
  color: var(--ink-soft);
}
.quiz-letter {
  display: grid;
  place-items: center;
  width: 1.7rem;
  height: 1.7rem;
  border-radius: 50%;
  background: var(--surface-sunk);
  color: var(--ink);
  font-weight: 700;
  font-size: 0.9rem;
}
.quiz-mark {
  font-weight: 700;
  font-size: 0.85rem;
  white-space: nowrap;
}
.quiz-opt.is-right {
  border-color: var(--ok);
  border-width: 2px;
  color: var(--ink);
}
.quiz-opt.is-right .quiz-mark {
  color: var(--ok);
}
.quiz-opt.is-wrong {
  border-color: var(--bad);
  border-width: 2px;
  color: var(--ink);
}
.quiz-opt.is-wrong .quiz-mark {
  color: var(--bad);
}
.quiz-feedback {
  min-height: 1rem;
  margin-top: 0.8rem;
}
.card.quiz .boss-inline {
  margin: 0.8rem 0;
}
@media (max-width: 30rem) {
  .quiz-opt {
    grid-template-columns: auto 1fr;
  }
  .quiz-mark {
    grid-column: 2;
  }
}

/* The manager's photo. The mood sits around it: ring, flush, sweat and steam. */
.boss-photo {
  position: relative;
  display: inline-block;
  width: 72px;
  height: 72px;
}
.boss-frame {
  position: relative;
  display: block;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  border: 3px solid var(--rule);
  background: var(--surface-sunk);
}
.boss-frame img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.boss-frame .boss-drawn {
  display: none;
}
.boss-frame.no-photo img {
  display: none;
}
.boss-frame.no-photo .boss-drawn {
  display: block;
  width: 100%;
  height: 100%;
}
.boss-frame::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  pointer-events: none;
}
.boss-frame.no-photo::after {
  display: none;
}
.mood-happy .boss-frame {
  border-color: var(--ok);
}
.mood-angry .boss-frame {
  border-color: var(--bad);
}
.boss-steam {
  position: absolute;
  left: 12px;
  top: -13px;
  width: 48px;
  height: 14px;
  color: var(--bad);
  animation: boss-steam 1.1s ease-in-out infinite;
}
.boss-sweat {
  position: absolute;
  right: -3px;
  top: 6px;
  width: 10px;
  height: 14px;
}
.mood-happy .boss-frame {
  animation: boss-nod 0.6s ease-in-out 1;
}
@keyframes boss-steam {
  50% {
    transform: translateY(-3px);
    opacity: 0.55;
  }
}
@keyframes boss-nod {
  40% {
    transform: translateY(3px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .boss-steam,
  .mood-happy .boss-frame {
    animation: none;
  }
}

/* Talking: text appears letter by letter, the picture bobs, three small bars move next to the name. */
.boss-say .unsaid {
  color: transparent;
}
.boss-wave {
  display: none;
  gap: 2px;
  align-items: flex-end;
  height: 0.7em;
  margin-left: 0.45rem;
}
.boss.talking .boss-wave {
  display: inline-flex;
}
.boss-wave i {
  display: block;
  width: 3px;
  height: 100%;
  border-radius: 1px;
  background: currentColor;
  transform-origin: bottom;
  animation: boss-wave 0.5s ease-in-out infinite;
}
.boss-wave i:nth-child(2) {
  animation-delay: 0.12s;
}
.boss-wave i:nth-child(3) {
  animation-delay: 0.24s;
}
.boss.talking:not(.has-loop) .boss-frame {
  animation: boss-talk 0.34s ease-in-out infinite;
}
.boss.talking:not(.has-loop) .mood-angry .boss-frame {
  animation: boss-talk-angry 0.2s linear infinite;
}
@keyframes boss-wave {
  50% {
    transform: scaleY(0.3);
  }
}
@keyframes boss-talk {
  50% {
    transform: translateY(-2px) rotate(-2deg);
  }
}
@keyframes boss-talk-angry {
  25% {
    transform: translate(-1.5px, -1px) rotate(-3deg);
  }
  75% {
    transform: translate(1.5px, 1px) rotate(3deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .boss.talking .boss-frame,
  .boss-wave i {
    animation: none;
  }
}
