/* Third-grade remix: the boards for js/remix-third.js
   ------------------------------------------------------------------------
   Area painter, balance scale, bingo card, bar-model stories, box packing,
   the nines hands, fact-family house, word webs and word factory, sentence
   repair and colouring pens, clue hunts, number machine, code wheel, grid
   code, mini sudoku and seating plans.

   House rules from css/style.css: sizes are clamp()s that read on a phone
   held sideways and on an iPad, nothing scrolls, colours come from the
   theme's own variables (--ink, --gold, --gold-deep, --parchment-edge), and
   every animation is short and off under prefers-reduced-motion. Everything
   is prefixed rx3- so nothing leaks into the other games. */

/* ================================================================= shared */
.rx3-shake { animation: rx3-shake 0.45s ease; }
@keyframes rx3-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}
@keyframes rx3-pop {
  from { transform: scale(0.6); opacity: 0; }
}
@keyframes rx3-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 201, 74, 0); }
  50% { box-shadow: 0 0 0 6px rgba(255, 201, 74, 0.85); }
}

/* The boards reveal parts of themselves as the child goes. */
[class^='rx3-'][hidden],
[class*=' rx3-'][hidden] { display: none !important; }

.stage-board .stimulus:has([class^='rx3-'], [class*=' rx3-']) {
  flex: 1 1 auto;
  min-height: 0;
}

.rx3-fact {
  margin: 0;
  font-size: clamp(1.5rem, 5.6vw, 2.6rem);
  line-height: 1.05;
  color: var(--ink);
  letter-spacing: 0.03em;
}
.rx3-sub,
.rx3-note,
.rx3-read,
.rx3-step {
  margin: 0;
  font-size: clamp(0.8rem, 2.4vw, 1.05rem);
  opacity: 0.85;
  text-align: center;
  min-height: 1.2em;
}
.rx3-step { font-weight: bold; opacity: 1; color: var(--gold-deep); }

/* Tap tiles and buttons in the answer row of a stage board. */
.choices.stage-controls { gap: clamp(6px, 1.6vw, 14px); }
.stage-controls .rx3-pick.num { width: calc(var(--tile) * 0.78); height: calc(var(--tile) * 0.78); }
.stage-controls .rx3-pick.word {
  width: auto;
  min-width: calc(var(--tile) * 1.1);
  height: calc(var(--tile) * 0.72);
  padding: 0 0.7em;
}
.rx3-btn { white-space: nowrap; }
.rx3-btn.chosen { outline: 4px solid var(--ink); outline-offset: 2px; }
.rx3-btn:disabled { opacity: 0.5; }
body[class] .stage-controls .rx3-stop { background: linear-gradient(180deg, #ffd3cf, #f08a80); border-color: #c24a3f; color: #3a1410; text-shadow: none; }

/* A long word or a clue card will not fit a square drag tile. */
.drag-item.rx3-word,
.drag-item.rx3-card {
  width: auto;
  min-width: var(--w);
  padding: 0 0.55em;
}
.drag-item.rx3-word .text { font-size: clamp(0.95rem, 3vw, 1.45rem); white-space: nowrap; }
.drag-item.rx3-card { height: auto; min-height: calc(var(--w) * 0.8); max-width: min(46vw, 260px); padding: 0.3em 0.6em; }
.drag-item.rx3-card .text { font-size: clamp(0.72rem, 2.2vw, 1rem); line-height: 1.2; white-space: normal; text-align: center; }
.play-screen:has(.rx3-word) .slot {
  width: auto;
  min-width: calc(var(--tile) * 0.95);
  height: calc(var(--tile) * 0.62);
  padding: 0 4px;
}
.drag-stage .stimulus:has(.rx3-word) { width: 100%; }
.slot .drag-item.rx3-word { height: calc(var(--tile) * 0.5); }
.slot.filled:has(.drag-item.rx3-word.locked) { border-color: transparent; background: transparent; }
.drag-item.rx3-word.locked { border-style: solid; background: rgba(255, 255, 255, 0.85); }
.drag-item.rx3-sym { background: transparent; border-color: transparent; box-shadow: none; }
.slot.filled:has(.rx3-sym) { border-color: transparent; background: transparent; }
.bucket.rx3-web { background: rgba(255, 255, 255, 0.5) repeating-radial-gradient(circle at 50% 50%, transparent 0 18px, rgba(0, 0, 0, 0.06) 18px 19px); }
.drag-stage .stimulus:has(.rx3-homo, .rx3-web, .rx3-rule) { width: 100%; }
.bucket.rx3-homo .bucket-label { font-size: clamp(1.1rem, 3.6vw, 1.6rem); font-weight: bold; }
.bucket .zone-items .drag-item.rx3-word,
.bucket .zone-items .drag-item.rx3-card { --w: calc(var(--tile) * 0.5); }
.bucket .zone-items .drag-item.rx3-card .text { font-size: clamp(0.62rem, 1.8vw, 0.85rem); }

/* Printed pictures above a slot board: a goal meaning, a roof, some clues. */
.rx3-goal {
  display: inline-block;
  font-size: clamp(1.05rem, 3.6vw, 1.6rem);
  padding: 0.25em 0.8em;
  border-radius: 999px;
  background: #fff;
  border: 3px dashed var(--gold-deep);
  color: var(--ink);
}
.rx3-roof {
  display: inline-flex;
  gap: clamp(8px, 2.4vw, 18px);
  align-items: flex-end;
  justify-content: center;
  padding: clamp(14px, 3.4vh, 26px) clamp(20px, 6vw, 44px) 6px;
  font-size: clamp(1.1rem, 4vw, 1.8rem);
  color: #fff;
  background: var(--gold-deep);
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
  min-width: clamp(160px, 40vw, 260px);
}
.rx3-roof b { text-shadow: 0 2px 0 rgba(0, 0, 0, 0.25); }
.rx3-clues {
  margin: 0;
  padding: 0.3em 0.6em 0.3em 1.8em;
  text-align: left;
  font-size: clamp(0.78rem, 2.4vw, 1.05rem);
  line-height: 1.3;
  background: rgba(255, 255, 255, 0.65);
  border-radius: 12px;
}

/* =========================================================== area painter */
.rx3-area { display: flex; flex-direction: column; align-items: center; gap: clamp(2px, 0.8vh, 8px); }
.rx3-grid {
  --cell: min(calc(46vh / var(--rr)), calc(82vw / var(--cc)), 40px);
  display: grid;
  gap: 2px;
  touch-action: none;
  user-select: none;
}
.rx3-grid .rx3-h {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--cell);
  height: var(--cell);
  font-size: calc(var(--cell) * 0.45);
  opacity: 0.6;
}
.rx3-cell {
  width: var(--cell);
  height: var(--cell);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.75);
  border: 2px solid var(--parchment-edge);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: calc(var(--cell) * 0.55);
  line-height: 1;
  cursor: pointer;
}
.rx3-cell.on { background: var(--gold); border-color: var(--gold-deep); }
.rx3-area.solved .rx3-cell.on { background: #c7f5d8; border-color: var(--green); }
.rx3-area.shown .rx3-cell.on { animation: rx3-glow 1s ease-in-out 2; }

/* ========================================================== balance scale */
.rx3-balance {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: min(560px, 100%);
  /* room for the high end of a tipped beam */
  padding-top: clamp(18px, 6vh, 54px);
}
.rx3-scale {
  position: relative;
  width: min(480px, 88%);
  height: clamp(96px, 24vh, 190px);
  transform: rotate(var(--tilt));
  transform-origin: 50% 12px;
  transition: transform 0.6s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.rx3-beam {
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  height: 12px;
  border-radius: 6px;
  background: var(--gold-deep);
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}
.rx3-pan {
  position: absolute;
  top: 18px;
  width: 44%;
  min-height: 70%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 6px;
  border-radius: 0 0 40% 40% / 0 0 30% 30%;
  border: 3px solid var(--gold-deep);
  border-top-width: 1px;
  background: rgba(255, 255, 255, 0.8);
  transform: rotate(calc(var(--tilt) * -1));
  transform-origin: 50% 0;
  transition: transform 0.6s cubic-bezier(0.3, 1.5, 0.5, 1);
}
.rx3-pan.l { left: 0; }
.rx3-pan.r { right: 0; }
.rx3-expr { font-size: clamp(1.1rem, 4vw, 1.8rem); color: var(--ink); }
.rx3-dots { display: grid; gap: 2px; }
.rx3-dots i { width: clamp(4px, 0.9vh, 7px); height: clamp(4px, 0.9vh, 7px); border-radius: 50%; background: var(--gold-deep); }
.rx3-tot { font-size: clamp(0.85rem, 2.6vw, 1.15rem); font-weight: bold; color: var(--gold-deep); min-height: 1em; }
.rx3-scale { z-index: 1; }
/* The stand runs from the pivot of the beam down to a foot. */
.rx3-post {
  position: relative;
  z-index: 0;
  width: 44px;
  height: calc(clamp(96px, 24vh, 190px) + 8px);
  margin-top: calc(-1 * clamp(96px, 24vh, 190px) + 4px);
  background: var(--gold-deep);
  clip-path: polygon(44% 0, 56% 0, 56% 84%, 100% 100%, 0 100%, 44% 84%);
}
.rx3-balance.level .rx3-beam { background: var(--green); }

/* ================================================================== bingo */
.rx3-bingo { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 3vw, 28px); flex-wrap: wrap; }
.rx3-caller { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.rx3-ball {
  display: flex;
  align-items: center;
  justify-content: center;
  width: clamp(84px, 20vh, 140px);
  height: clamp(84px, 20vh, 140px);
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fff, var(--gold) 60%, var(--gold-deep));
  font-size: clamp(1.2rem, 4.6vh, 2rem);
  color: var(--ink);
  box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}
.rx3-ball.rx3-pop { animation: rx3-pop 0.3s ease; }
.rx3-callno { font-size: clamp(0.8rem, 2.2vw, 1rem); opacity: 0.8; }
.rx3-bcard {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: clamp(4px, 1vh, 8px);
  padding: clamp(5px, 1.2vh, 10px);
  border-radius: 16px;
  background: var(--gold-deep);
}
.rx3-sq {
  position: relative;
  font: inherit;
  width: clamp(52px, 13vh, 92px);
  height: clamp(52px, 13vh, 92px);
  border-radius: 12px;
  border: 3px solid var(--parchment-edge);
  background: #fff;
  color: var(--ink);
  font-size: clamp(1.1rem, 4.4vh, 1.9rem);
  cursor: pointer;
}
.rx3-daub {
  position: absolute;
  top: -0.35em;
  right: -0.35em;
  display: none;
  font-size: 0.8em;
  line-height: 1;
}
.rx3-sq.daubed { background: var(--gold); border-color: var(--gold-deep); }
.rx3-sq.daubed .rx3-daub { display: flex; animation: rx3-pop 0.25s ease; }
.rx3-sq.win { border-color: var(--green); background: #c7f5d8; }
.rx3-sq.glow { animation: rx3-glow 1s ease-in-out 2; }

/* ============================================================ bar stories */
.rx3-story { display: flex; flex-direction: column; align-items: center; gap: clamp(4px, 1.2vh, 10px); width: min(680px, 100%); }
.rx3-text { margin: 0; font-size: clamp(0.9rem, 2.8vw, 1.25rem); line-height: 1.3; text-align: center; }
.rx3-bars { width: 100%; display: flex; flex-direction: column; gap: 4px; }
.rx3-brace {
  text-align: center;
  border: 3px solid var(--gold-deep);
  border-bottom: 0;
  border-radius: 10px 10px 0 0;
  height: 12px;
  margin: 0 4px 6px;
  position: relative;
}
.rx3-brace span {
  position: absolute;
  top: -0.9em;
  left: 50%;
  transform: translateX(-50%);
  background: var(--parchment);
  padding: 0 0.4em;
  font-weight: bold;
  color: var(--gold-deep);
  font-size: clamp(0.9rem, 2.8vw, 1.2rem);
}
.rx3-bar { display: flex; gap: 3px; height: clamp(28px, 6.5vh, 46px); }
.rx3-seg {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  border-radius: 8px;
  background: var(--gold);
  border: 2px solid var(--gold-deep);
  font-size: clamp(0.72rem, 2.3vw, 1.05rem);
  font-weight: bold;
  color: var(--ink);
  overflow: hidden;
  white-space: nowrap;
}
.rx3-bar.bottom .rx3-seg { background: #fff; }
.rx3-seg.ask { background: #fff; border-style: dashed; }
.rx3-seg.gone { background: repeating-linear-gradient(135deg, #ffd3cf 0 6px, #fff 6px 12px); border-color: var(--red); }
.rx3-bar.bottom:not([hidden]) { animation: rx3-pop 0.3s ease; }

/* ============================================================== box packing */
.rx3-pack { display: flex; flex-direction: column; align-items: center; gap: clamp(3px, 1vh, 8px); width: min(680px, 100%); }
.rx3-pile {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  max-width: 100%;
  min-height: 1.4em;
  font-size: clamp(0.95rem, 3.4vh, 1.5rem);
  line-height: 1.1;
}
.rx3-boxes { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; min-height: clamp(28px, 7vh, 52px); }
.rx3-box {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 2px 6px;
  border-radius: 10px;
  background: #fff;
  border: 2px solid var(--parchment-edge);
  animation: rx3-pop 0.25s ease;
}
.rx3-box b { font-size: clamp(1rem, 3.4vh, 1.5rem); }
.rx3-box i { font-style: normal; font-size: clamp(0.6rem, 2vh, 0.9rem); display: flex; flex-wrap: wrap; max-width: 4.6em; }
.rx3-pack.solved .rx3-pile { outline: 3px solid var(--green); outline-offset: 3px; border-radius: 8px; }

/* ============================================================== the nines */
.rx3-nines { display: flex; flex-direction: column; align-items: center; gap: clamp(3px, 1vh, 8px); }
.rx3-hands { display: flex; gap: clamp(14px, 5vw, 40px); align-items: flex-end; }
.rx3-hand { display: flex; gap: clamp(3px, 1vw, 8px); align-items: flex-end; }
.rx3-finger {
  --fh: clamp(80px, 26vh, 170px);
  font: inherit;
  width: clamp(28px, 6.2vw, 48px);
  height: calc(var(--fh) * var(--h));
  border-radius: 999px 999px 10px 10px;
  border: 3px solid var(--parchment-edge);
  background: linear-gradient(180deg, #ffe7d1, #f6c9a4);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0 4px;
  cursor: pointer;
  transition: height 0.3s ease, background 0.2s ease;
}
.rx3-nail { width: 60%; height: 14%; min-height: 8px; border-radius: 999px 999px 6px 6px; background: var(--gold); }
.rx3-finger b { font-size: clamp(0.8rem, 2.6vh, 1.1rem); color: var(--ink); }
.rx3-finger.down { height: calc(var(--fh) * 0.22); background: #d8cfc6; }
.rx3-finger.tens { background: linear-gradient(180deg, #d7e8ff, #9cc3ff); border-color: #4a7fd0; }
.rx3-finger.ones { background: linear-gradient(180deg, #d9ffe6, #9fe6b8); border-color: var(--green); }
.rx3-finger.glow { animation: rx3-glow 1s ease-in-out 2; }
.rx3-finger:disabled { cursor: default; }
.rx3-read b.t { color: #2f64b5; }
.rx3-read b.o { color: #1f8a53; }

/* ========================================================= sentence boards */
.rx3-fix,
.rx3-pos,
.rx3-clue { display: flex; flex-direction: column; align-items: center; gap: clamp(4px, 1.4vh, 12px); width: min(700px, 100%); }
.rx3-sentence,
.rx3-passage { margin: 0; text-align: center; line-height: 1.9; }
.rx3-sentence { font-size: clamp(1.1rem, 4vw, 1.8rem); }
.rx3-passage { font-size: clamp(0.9rem, 2.8vw, 1.25rem); line-height: 1.75; }
.rx3-tok {
  font: inherit;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.7);
  border: 2px solid var(--parchment-edge);
  border-radius: 10px;
  padding: 0 0.28em;
  margin: 1px 0;
  cursor: pointer;
}
.rx3-passage .rx3-tok { border-width: 1px; border-radius: 7px; padding: 0 0.2em; }
.rx3-tok.little { opacity: 0.75; border-style: dashed; }
.rx3-tok.struck { text-decoration: line-through; text-decoration-thickness: 3px; text-decoration-color: var(--red); border-color: var(--red); }
.rx3-tok.fine { border-color: var(--green); }
.rx3-tok.glow { animation: rx3-glow 1s ease-in-out 2; }
.rx3-tok:disabled { cursor: default; }
.rx3-tok.mystery { background: var(--gold); border-color: var(--gold-deep); font-weight: bold; }
.rx3-tok.clue { background: #c7f5d8; border-color: var(--green); }
.rx3-dot { font-size: 1em; }

/* colouring pens */
/* body[class] out-ranks each theme's own .btn-gold colours */
.rx3-tok.pen-n,
body[class] .stage-controls .rx3-pen.pen-n { background: #cfe0ff; border-color: #3b6fd0; }
.rx3-tok.pen-v,
body[class] .stage-controls .rx3-pen.pen-v { background: #ffd6d2; border-color: #d0493e; }
.rx3-tok.pen-a,
body[class] .stage-controls .rx3-pen.pen-a { background: #d2f5dd; border-color: #2ea86a; }
body[class] .stage-controls .rx3-pen { color: #222; text-shadow: none; }

/* ========================================================= number machine */
.rx3-machine { display: flex; flex-direction: column; align-items: center; gap: clamp(4px, 1vh, 8px); }
.rx3-mach {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 16px;
  border-radius: 14px;
  background: var(--gold-deep);
  color: #fff;
  font-size: clamp(0.85rem, 2.6vw, 1.1rem);
}
.rx3-gear { font-size: 1.4em; display: inline-block; animation: rx3-spin 4s linear infinite; }
.rx3-gear.r { animation-direction: reverse; }
@keyframes rx3-spin { to { transform: rotate(360deg); } }
.rx3-rows { display: flex; flex-direction: column; gap: clamp(3px, 0.8vh, 6px); }
.rx3-io {
  display: grid;
  grid-template-columns: 3.2em 1.6em 3.2em;
  align-items: center;
  justify-items: center;
  font-size: clamp(1.1rem, 4.6vh, 2rem);
}
.rx3-io b {
  width: 100%;
  text-align: center;
  background: #fff;
  border: 3px solid var(--parchment-edge);
  border-radius: 12px;
}
.rx3-io.ask .out { border-style: dashed; border-color: var(--gold-deep); color: var(--gold-deep); }
.rx3-io.solved .out { border-style: solid; border-color: var(--green); background: #c7f5d8; color: var(--ink); }

/* =============================================================== code wheel */
.rx3-cipher { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 3vw, 30px); flex-wrap: wrap; }
.rx3-wheel {
  --size: min(44vh, 70vw, 280px);
  position: relative;
  width: var(--size);
  height: var(--size);
  border-radius: 50%;
  background: radial-gradient(circle, #fff 0 55%, var(--parchment-2) 55% 100%);
  border: 4px solid var(--gold-deep);
  flex: 0 0 auto;
}
.rx3-ring { position: absolute; inset: 0; }
.rx3-ring span {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1.4em;
  margin: -0.7em 0 0 -0.7em;
  text-align: center;
  font-size: calc(var(--size) * 0.058);
  line-height: 1.4em;
  font-weight: bold;
  color: var(--ink);
}
.rx3-ring.outer span { transform: rotate(calc(var(--i) * 13.8462deg)) translateY(calc(var(--size) * -0.43)) rotate(calc(var(--i) * -13.8462deg)); }
.rx3-ring.inner span {
  color: var(--gold-deep);
  transform: rotate(calc((var(--i) - var(--spin)) * 13.8462deg)) translateY(calc(var(--size) * -0.31)) rotate(calc((var(--i) - var(--spin)) * -13.8462deg));
  transition: transform 0.25s ease;
}
.rx3-pointer { position: absolute; top: calc(var(--size) * -0.085); left: 50%; transform: translateX(-50%); color: var(--red); font-size: calc(var(--size) * 0.07); line-height: 1; }
.rx3-cipher .rx3-wheel { margin-top: calc(var(--size) * 0.06); }
.rx3-wheel::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 2%;
  width: calc(var(--size) * 0.09);
  height: 40%;
  transform: translateX(-50%);
  border-radius: 999px;
  background: rgba(255, 201, 74, 0.35);
  pointer-events: none;
}
.rx3-cipher.solved .rx3-wheel { border-color: var(--green); }
.rx3-side { display: flex; flex-direction: column; align-items: center; gap: clamp(4px, 1.2vh, 10px); }
.rx3-key { margin: 0; font-size: clamp(1rem, 3.4vw, 1.5rem); }
.rx3-code { margin: 0; font-size: clamp(1.4rem, 5vw, 2.4rem); letter-spacing: 0.15em; color: var(--gold-deep); }
.rx3-turn { font-size: clamp(1.4rem, 4vw, 2rem); padding: 0.1em 0.8em; }

/* ================================================================ grid code */
.rx3-gridcode { display: flex; align-items: center; justify-content: center; gap: clamp(10px, 3vw, 30px); flex-wrap: wrap; }
.rx3-ggrid {
  --cell: min(calc(50vh / 6), calc(80vw / 6), 50px);
  display: grid;
  grid-template-columns: repeat(6, var(--cell));
  gap: 3px;
}
.rx3-ggrid .rx3-h { display: flex; align-items: center; justify-content: center; font-weight: bold; color: var(--gold-deep); font-size: calc(var(--cell) * 0.45); }
.rx3-gsq {
  font: inherit;
  width: var(--cell);
  height: var(--cell);
  border-radius: 8px;
  border: 2px solid var(--parchment-edge);
  background: #fff;
  color: var(--ink);
  font-size: calc(var(--cell) * 0.5);
  cursor: pointer;
}
.rx3-gsq.hit { background: var(--gold); border-color: var(--gold-deep); }
.rx3-gsq.glow { animation: rx3-glow 1s ease-in-out 2; }
.rx3-gridcode .rx3-code span { display: inline-block; padding: 0 0.15em; border-radius: 8px; }
.rx3-gridcode .rx3-code span.now { background: var(--gold); color: var(--ink); }
.rx3-gridcode .rx3-code span.used { opacity: 0.4; }
.rx3-gridcode .rx3-code { font-size: clamp(1.1rem, 4vw, 1.9rem); letter-spacing: 0.05em; }
.rx3-spell { margin: 0; display: flex; gap: 6px; font-size: clamp(1.4rem, 5vw, 2.4rem); }
.rx3-spell span { min-width: 1em; text-align: center; border-bottom: 3px solid var(--ink); line-height: 1.1; }

/* ============================================================= mini sudoku */
.rx3-sgrid {
  --cell: min(calc(46vh / 4), calc(70vw / 4), 64px);
  display: grid;
  grid-template-columns: repeat(4, var(--cell));
  gap: 3px;
  padding: 4px;
  border-radius: 12px;
  background: var(--gold-deep);
}
.rx3-scell {
  font: inherit;
  width: var(--cell);
  height: var(--cell);
  border: 0;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font-size: calc(var(--cell) * 0.52);
  cursor: pointer;
}
/* the four boxes of four, told apart by a tint on two of them */
.rx3-scell.tint { background: color-mix(in srgb, var(--gold) 16%, #fff); }
.rx3-scell.given { cursor: default; font-weight: bold; }
.rx3-scell.sel { outline: 4px solid var(--gold); outline-offset: -4px; }
.rx3-scell.filled { background: #c7f5d8; }
.rx3-scell.bad { background: #ffd6d2; }
.rx3-scell.glow { animation: rx3-glow 1s ease-in-out 2; }
.rx3-sudoku.solved .rx3-sgrid { background: var(--green); }
.rx3-sym-btn { font-size: clamp(1.3rem, 4vw, 2rem); min-width: 2.6em; padding: 0.15em 0.5em; }

/* ============================================= phones held sideways, etc. */
@media (max-height: 520px) {
  .rx3-fact { font-size: clamp(1.1rem, 7vh, 1.8rem); }
  .rx3-sub { display: none; }
  .rx3-text { font-size: clamp(0.75rem, 4vh, 1rem); }
  .rx3-sentence { font-size: clamp(0.95rem, 6vh, 1.4rem); line-height: 1.7; }
  .rx3-passage { font-size: clamp(0.75rem, 4.2vh, 1rem); line-height: 1.6; }
  .rx3-clues { font-size: clamp(0.7rem, 3.8vh, 0.95rem); }
  .rx3-goal { font-size: clamp(0.9rem, 5vh, 1.2rem); }
  .rx3-roof { padding-top: 10px; font-size: clamp(0.95rem, 6vh, 1.4rem); }
  .stage-controls .rx3-pick.num { width: calc(var(--tile) * 0.62); height: calc(var(--tile) * 0.62); }
  .stage-controls .rx3-pick.word { height: calc(var(--tile) * 0.55); }
  /* a short screen has width to spare: fact and readout go beside the grid */
  .rx3-area {
    display: grid;
    grid-template-columns: auto minmax(7em, auto);
    grid-template-areas: 'grid fact' 'grid read';
    align-items: center;
    column-gap: clamp(10px, 3vw, 24px);
  }
  .rx3-area .rx3-grid { grid-area: grid; }
  .rx3-area .rx3-fact { grid-area: fact; align-self: end; }
  .rx3-area .rx3-read { grid-area: read; align-self: start; }
  .rx3-grid { --cell: min(calc(46vh / var(--rr)), calc(55vw / var(--cc)), 32px); gap: 1px; }
  .rx3-sq { width: clamp(40px, 15vh, 70px); height: clamp(40px, 15vh, 70px); }
  .rx3-ball { width: clamp(64px, 24vh, 110px); height: clamp(64px, 24vh, 110px); }
  .rx3-finger { --fh: clamp(60px, 30vh, 120px); }
  .rx3-wheel { --size: min(42vh, 60vw, 200px); }
  /* the fact house: two facts to a line instead of one */
  .slot-row.frame:has(.rx3-sym) { grid-template-columns: repeat(10, auto); }
  .slot-row.frame:has(.rx3-sym) > .slot:nth-child(10n + 6) { margin-left: clamp(10px, 3vw, 22px); }
  .slots-pic:has(.rx3-roof, .rx3-clues, .rx3-goal) { margin-bottom: 0; line-height: 1; }
  .rx3-roof { padding: 8px 26px 3px; min-width: 150px; }
  .play-screen:has(.rx3-word) .slot { height: calc(var(--tile) * 0.46); }
  .slot .drag-item.rx3-word { height: calc(var(--tile) * 0.4); }
  .play-screen:has(.rx3-word) .slot-row:has(.has-before) { padding-top: 1.6em; }
  .play-screen:has(.rx3-word) .slot.has-before::before { top: -1.5em; font-size: 0.8rem; }
  .rx3-clues { line-height: 1.2; padding-block: 0.15em; }
  .rx3-io { font-size: clamp(0.95rem, 7vh, 1.5rem); }
}

@media (prefers-reduced-motion: reduce) {
  .rx3-shake,
  .rx3-ball.rx3-pop,
  .rx3-sq.daubed .rx3-daub,
  .rx3-bar.bottom:not([hidden]),
  .rx3-box,
  .rx3-gear { animation: none; }
  .rx3-scale,
  .rx3-pan,
  .rx3-finger,
  .rx3-ring.inner span { transition: none; }
}

/* The analogy line is the whole puzzle, so it reads large. */
.stage .passage:has(> b) { font-size: clamp(1.25rem, 4.2vw, 2.1rem); line-height: 1.35; }
.stage .passage > b { color: var(--gold-deep); }
@media (max-height: 520px) {
  .stage .passage:has(> b) { font-size: clamp(1rem, 6vh, 1.5rem); }
}
