/* Ställ upp! – only what is special to this game: the uppställning grid. The game box, menu, number pad, result,
   effects and the hologram around the task (.skol-holo) are shared by all school games: css/skolspel.css.
   The size of the squares: --cell. */

.su-sum {
  --cell: clamp(3rem, 11vw, 4.4rem);   /* big: the digits must be easy to read while typing (owner) */
  display: grid;
  grid-template-columns: repeat(var(--columns), var(--cell));
  grid-auto-rows: var(--cell);
  /* As wide as the ROUND'S widest task (--round-columns, stallupp.js), the squares against the right edge: a task
     one column narrower than the one before keeps its ental column in the same place (owner, 2026-10-14) */
  min-width: calc(var(--round-columns, var(--columns)) * var(--cell));
  justify-content: end;
  gap: 0;                       /* the squares touch, like squared paper */
  font-size: calc(var(--cell) * 0.7);
  font-weight: 800;
  line-height: 1;
}

/* Fullscreen: on a LOW screen (a phone held sideways, 960 x 540) the squares get smaller so the task fits the height;
   never bigger than normal – on big screens the whole screen grows with the box instead (css/skolspel.css --skol-zoom) */
.is-fullscreen .su-sum {
  --cell: clamp(3.4rem, 9vh, 4.4rem);
  --cell: clamp(3.4rem, 9dvh, 4.4rem);
}

.su-cell {
  display: grid;
  place-items: center;
  width: var(--cell);
  height: var(--cell);
  padding: 0;
  font: inherit;
  color: #f2feff;                /* hologram white: a touch of cyan */
  /* A sharp edge first, then a soft glow further out – the digit itself must stay crisp (owner) */
  text-shadow: 0 0 1px currentColor, 0 0 0.45em rgba(94, 240, 255, 0.4);
  background: none;
  border: none;
}

/* The grid's squares (numbers and answer), thin lines like the book's squared boxes */
.su-square {
  border: 1px solid rgba(94, 240, 255, 0.4);
  box-shadow: inset 0 0 8px rgba(94, 240, 255, 0.12);
}

/* The column being worked on: a soft light through all its squares, so the digits that belong together are easy to see */
.su-lit {
  background-image: linear-gradient(rgba(94, 240, 255, 0.12), rgba(94, 240, 255, 0.05));
}

/* The thick line under the second number */
.su-last-row {
  border-bottom: 4px solid var(--cyan);
  box-shadow: 0 6px 8px -6px var(--cyan);
}

/* The small squares on top: minnessiffror and växling (checked too: tasks.js checkVaxling) */
.su-note {
  position: relative;
  align-self: end;
  height: calc(var(--cell) * 0.7);
  margin: 0 0.12rem 0.2rem;
  width: calc(var(--cell) - 0.24rem);
  font-size: 0.65em;
  color: var(--magenta);
  border: 2px dashed rgba(255, 63, 180, 0.4);
  cursor: pointer;
}

/* Växling help: once the answer digit that needs växling is typed, its note squares light up (helpGroupsOf in tasks.js) */
.su-note.is-help {
  border: 3px solid var(--yellow);
  background: rgba(255, 233, 77, 0.12);
  animation: su-help 1s ease-in-out infinite;
}

@keyframes su-help {
  50% { box-shadow: 0 0 18px rgba(255, 233, 77, 0.9); }
}

/* Hologram energy has flown into a note square (växling made visible, every task): its magenta frame glows – ready for
   a number – until something is written there */
.su-note.is-ready {
  border: 3px solid var(--magenta);
  background: rgba(255, 63, 180, 0.1);
  animation: su-ready 1s ease-in-out infinite;
}

@keyframes su-ready {
  50% { box-shadow: 0 0 18px rgba(255, 63, 180, 0.9); }
}

/* Help tasks only (the first two of a level): a faint cyan helper number where the energy landed; it goes when the
   child writes in the square */
.su-note[data-ghost]:empty::before {
  content: attr(data-ghost);
  color: var(--cyan);
  opacity: 0.4;
}

/* The numbers: a click strikes a digit through (växling) */
button.su-digit {
  position: relative;
  cursor: pointer;
}

/* Struck through with a DIAGONAL stroke (\), the same way as in the kids' maths book (owner).
   With a corner direction the gradient's middle runs between the OTHER two corners: "to top right" = "\".
   A note square can be struck too: växling över noll, the 10 written above the zero is struck again (the book's way). */
.su-digit.is-struck,
.su-note.is-struck {
  color: var(--text-muted);
}

.su-digit.is-struck::after,
.su-note.is-struck::after {
  content: "";
  position: absolute;
  inset: 18% 22%;
  pointer-events: none;
  background: linear-gradient(to top right, transparent calc(50% - 0.09em), var(--magenta) calc(50% - 0.06em),
    var(--magenta) calc(50% + 0.06em), transparent calc(50% + 0.09em));
  filter: drop-shadow(0 0 3px rgba(255, 63, 180, 0.8));
}

.su-sign {
  color: var(--cyan);
}

.su-answer {
  position: relative;
  color: var(--yellow);
  cursor: pointer;
}

/* "Ställ upp och räkna ut": the number squares take writing, so they look like the answer squares do */
.su-digit.is-start { animation: su-breathe 1.1s ease-in-out infinite; }

.su-digit.is-ready {
  border: 3px solid var(--magenta);
  background: rgba(255, 63, 180, 0.1);
  animation: su-ready 1s ease-in-out infinite;
}

.su-answer.is-active,
.su-digit.is-active,
.su-note.is-active {
  border: 3px solid var(--yellow);
  box-shadow: 0 0 12px rgba(255, 233, 77, 0.7);
}

/* Nothing typed yet: the square to start in breathes, with a little arrow under it ("start here") */
.su-answer.is-start {
  animation: su-breathe 1.1s ease-in-out infinite;
}

.su-answer.is-start::after {
  content: "▲";
  position: absolute;
  top: 100%;
  left: 50%;
  font-size: 0.45em;
  color: var(--yellow);
  transform: translateX(-50%);
  animation: su-arrow 1.1s ease-in-out infinite;
}

@keyframes su-breathe {
  50% { box-shadow: 0 0 22px rgba(255, 233, 77, 1); }
}

@keyframes su-arrow {
  50% { transform: translate(-50%, 0.3em); }
}

.su-sum.is-checked .su-answer {
  cursor: default;
}

/* Right: the answer turns cyan. Wrong: magenta (the right answer is NOT shown – owner) */
.su-sum.is-right .su-answer {
  color: var(--cyan);
  border-color: var(--cyan);
  box-shadow: 0 0 14px rgba(94, 240, 255, 0.7);
}

.su-sum.is-wrong .su-answer {
  color: var(--magenta);
  border-color: rgba(255, 63, 180, 0.6);
}

/* A mistake's red-pen ring (.is-ringed) is shared by every school game: css/skolspel.css */

/* ---------- Tiobasmaterial on the help tasks (the owner's photo of the board, 2026-10-14) ----------
   A canvas BESIDE the hologram (above it, it stole height and the whole round shrank on a Chromebook), outside it so
   the scanlines don't run over the blocks; drawn in whole screen pixels by stallupp.js drawBlocks. In a landscape box
   the row takes the hologram's place in the play screen's grid (css/skolspel.css). */
.su-with-blocks {
  display: grid;
  /* The blocks' column is reserved for the WHOLE round (--blocks-room, stallupp.js planBlocksRoom: as wide as the
     round's widest picture, 0 when none), so the uppställning never moves when the blocks come and go */
  grid-template-columns: var(--blocks-room, 0px) auto;
  align-items: center;
  justify-content: center;
}

.su-with-blocks > .skol-holo {
  grid-column: 2;
  margin: 0;
}

@media (orientation: landscape) {
  .skol-stage .skol-play > .su-with-blocks { grid-column: 1; grid-row: 2; margin: 0.25rem auto 0.5rem; }
}

.su-blocks {
  display: block;
  grid-column: 1;
  justify-self: end;             /* right next to the uppställning, whatever the number's width */
  margin-right: 1.1rem;
}

.su-blocks[hidden] {
  display: none;
}

/* ---------- Tre termer: two uppställningar (the book, lesson 12: one calculation at a time, left to right) ----------
   The whole task on one line, then the first uppställning, the arrow and the second one. The first answer flies along
   the arrow and stays yellow up there (it is the child's own answer, like the answer squares). Narrow screens: the two
   on top of each other, the arrow pointing down. */
/* The levels that come uppställda have no line to show: then it must take no room at all */
.su-expr:empty { display: none; }

.su-expr {
  margin: 0.1rem 0 0.5rem;
  text-align: center;
  font-size: clamp(1.4rem, 4vw, 2.2rem);
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #f2feff;
  text-shadow: 0 0 1px currentColor, 0 0 0.45em rgba(94, 240, 255, 0.4);
}

.su-two {
  --cell: clamp(2.6rem, 6.4vw, 4.2rem);
  display: flex;
  align-items: flex-start;
  justify-content: center;
}

.su-two .su-sum {
  --cell: inherit;
  transition: opacity 0.3s;
}

/* Fullscreen on a low screen: smaller squares (never bigger than normal; big screens zoom – css/skolspel.css) */
.is-fullscreen .su-two {
  --cell: clamp(2.8rem, 8vh, 4.2rem);
  --cell: clamp(2.8rem, 8dvh, 4.2rem);
}

/* The second one waits for the first answer; the one not worked on is a little dimmer */
.su-two .su-sum.is-waiting {
  opacity: 0.35;
}

.su-two .su-sum:not(.is-current):not(.is-checked):not(.is-waiting) {
  opacity: 0.7;
}

.su-carried {
  color: var(--yellow);
}

.su-arrow {
  flex: none;
  width: calc(var(--cell) * 1.5);
  height: calc(var(--cell) * 4);
}

.su-arrow path {
  fill: none;
  stroke: rgba(94, 240, 255, 0.35);
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: stroke 0.3s;
}

/* The first answer has gone over: the arrow lights up */
.su-arrow.is-on path {
  stroke: var(--yellow);
  filter: drop-shadow(0 0 4px rgba(255, 233, 77, 0.9));
}

/* Phones held upright: smaller squares, so the task and the pad under it fit the box without scrolling (owner,
   2026-10-14). Tre termer's two uppställningar stay side by side (one over the other was 300 px too tall), the
   screen shrinks a little to fit the width (js/skol-ui.js fit). */
@media (max-width: 480px) {
  .su-sum {
    --cell: clamp(2.6rem, 10vw, 4.4rem);
  }

  .su-two {
    --cell: clamp(2.2rem, 9vw, 3.6rem);
  }

  .su-holo .su-expr {
    margin-bottom: 0.3rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .su-answer.is-start, .su-answer.is-start::after, .su-note.is-help, .su-note.is-ready,
  .su-digit.is-start, .su-digit.is-ready { animation: none; }
}
