/* Pipens supperbra mattespel – only what is special to this game: the picture in the hologram, Pipen's words (and the
   missing ones), Pipen beside the task with his speech bubble, and the dot that falls off. The box, menu, cards,
   result, effects and red pen are every school game's: css/skolspel.css. */

/* Schoolbell = Pipen's handwriting (owner's pick of 19, 2026-10-16; saved on our own server, licence in
   public/fonts/Schoolbell-Apache.txt) */
@font-face {
  font-family: "Schoolbell";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../../../../fonts/schoolbell-latin.woff2") format("woff2");
}

/* ---------- Pipen's sign on the menu: the game's name in his own handwriting ---------- */

/* A scrap of paper taped up crooked. Pipen can't spell ("supperbra") – but only when he WRITES: his speech bubbles are
   spelt right (owner, 2026-10-16: "Pipen kan inte stava så bra, men pratar ju inte med stavfel"). */
.pm-note {
  position: relative;
  width: fit-content;
  margin: 0.4rem auto 1.4rem;
  padding: 0.5rem 1.4rem 0.6rem;
  font-family: "Schoolbell", "Comic Sans MS", system-ui, sans-serif;
  font-size: 2.1rem;
  font-weight: 400;
  font-style: normal;
  line-height: 1.05;
  text-align: center;
  color: #27204a;
  background: linear-gradient(170deg, #fbf6df, #ece3c2);
  box-shadow: 0 0.3rem 0.9rem rgba(0, 0, 0, 0.45);
  transform: rotate(-3deg);
}

/* Two bits of tape at the top corners */
.pm-note::before,
.pm-note::after {
  content: "";
  position: absolute;
  top: -0.55rem;
  width: 3.2rem;
  height: 1.1rem;
  background: rgba(255, 233, 77, 0.45);
}

.pm-note::before { left: -0.6rem; transform: rotate(-24deg); }
.pm-note::after { right: -0.6rem; transform: rotate(18deg); }

/* The scrawl (pipen.js scrawl): one line = one row, every letter its own box with its own tilt, size and jump */
.pm-scrawl-line {
  display: block;
  white-space: nowrap;
}

.pm-scrawl {
  display: inline-block;
}

/* Where he pressed hard with the pen: thicker, darker ink */
.pm-scrawl.is-hard {
  color: #120c2c;
  -webkit-text-stroke: 0.025em currentColor;
}

.pm-scrawl-under {
  display: block;
  width: 85%;
  height: 0.4em;
  margin: 0.05em auto 0;
  overflow: visible;
  transform: rotate(-3deg);
}

.pm-scrawl-under polyline {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

/* ---------- The hologram: the picture + Pipen's words ---------- */

.pm-holo {
  padding: 0.5rem 1rem 0.6rem;
}

.pm-picture {
  display: block;
  width: min(22rem, 100%);
  height: auto;
  aspect-ratio: 320 / 180;
  overflow: hidden;              /* what flies out of the picture (the birds, a falling corner) is gone */
  filter: drop-shadow(0 0 3px rgba(94, 240, 255, 0.55));
}

/* The words under the picture. Always the same height, so the cards below never jump (a missing text = the same room) */
.pm-words {
  min-height: 1.6em;
  margin: 0.2rem 0 0;
  font-size: 1.45rem;
  font-weight: 900;
  font-style: italic;
  line-height: 1.6;
  text-align: center;
  color: #f2feff;
  text-shadow: 0 0 1px currentColor, 0 0 0.45em rgba(94, 240, 255, 0.5);
}

/* Pipen lost the words: an empty strip with a blinking cursor, flickering now and then */
.pm-words.is-missing {
  width: 13em;
  margin-inline: auto;
  color: var(--yellow);
  text-align: left;
  border-bottom: 2px dashed rgba(255, 233, 77, 0.35);
  animation: pm-lost 3.1s steps(1) infinite;
}

.pm-words.is-missing::after {
  content: "▌";
  animation: pm-cursor 1s steps(1) infinite;
}

@keyframes pm-cursor {
  50% { opacity: 0; }
}

@keyframes pm-lost {
  0%, 100% { transform: none; opacity: 1; }
  91% { transform: translateX(4px) skewX(-8deg); opacity: 0.5; }
  94% { transform: translateX(-3px); opacity: 0.9; }
}

/* ---------- The picture's lines (hologram colours: cyan; yellow for what matters; magenta only for "wrong") ---------- */

.pm-picture * { vector-effect: non-scaling-stroke; }
.pm-picture text { vector-effect: none; }

.pm-line, .pm-water, .pm-glass-jar, .pm-eight, .pm-pizza, .pm-choc {
  fill: rgba(94, 240, 255, 0.1);
  stroke: #5ef0ff;
  stroke-width: 2.5;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.pm-stroke-only, .pm-branch, .pm-arm {
  fill: none;
  stroke: #5ef0ff;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.pm-arm { stroke-width: 5; }
.pm-branch { stroke-width: 4; stroke: #8fe9f5; }
.pm-thin { fill: none; stroke: rgba(94, 240, 255, 0.55); stroke-width: 1.5; stroke-linecap: round; }
.pm-shine { fill: none; stroke: rgba(255, 255, 255, 0.7); stroke-width: 2; stroke-linecap: round; }
.pm-dot { fill: #5ef0ff; }
.pm-grain { fill: rgba(255, 233, 77, 0.8); }
.pm-ground { stroke: rgba(94, 240, 255, 0.35); stroke-width: 2; stroke-dasharray: 6 5; }
.pm-glass { fill: rgba(94, 240, 255, 0.05); stroke: rgba(94, 240, 255, 0.35); stroke-width: 2; }
.pm-glass-bar { stroke: rgba(94, 240, 255, 0.25); stroke-width: 2; }
.pm-glass-jar { fill: rgba(94, 240, 255, 0.06); }
.pm-water { fill: rgba(94, 240, 255, 0.25); }

.pm-yellow, .pm-sand, .pm-cone, .pm-cookie, .pm-sausage, .pm-sun, .pm-corner, .pm-ball {
  fill: rgba(255, 233, 77, 0.18);
  stroke: #ffe94d;
  stroke-width: 2.5;
  stroke-linejoin: round;
}

.pm-sand { fill: rgba(255, 233, 77, 0.12); }
.pm-cone { fill: rgba(255, 190, 90, 0.12); stroke: #ffc65a; }
.pm-cookie { fill: rgba(255, 190, 90, 0.2); stroke: #ffc65a; }
.pm-sausage { fill: rgba(255, 140, 120, 0.15); stroke: #ff9c8a; }
.pm-corner, .pm-ball { fill: #ffe94d; }
.pm-sun { fill: rgba(255, 233, 77, 0.35); }
.pm-sun-ray { stroke: #ffe94d; stroke-width: 3; stroke-linecap: round; }
.pm-topping { fill: #ffe94d; }
.pm-face { fill: rgba(255, 255, 255, 0.15); stroke: none; }
.pm-beak { fill: #ffe94d; }
.pm-blue { fill: rgba(79, 134, 255, 0.3); stroke: #6f9bff; stroke-width: 2.5; stroke-linejoin: round; }
.pm-green { fill: rgba(125, 255, 138, 0.25); stroke: #7dff8a; stroke-width: 2.5; stroke-linejoin: round; }
.pm-hole { fill: rgba(255, 233, 77, 0.45); }
.pm-eight { fill: none; stroke-width: 9; }
.pm-pair { fill: none; stroke: #ffe94d; stroke-width: 2.5; stroke-dasharray: 7 5; }
.pm-finish { stroke: #f2feff; stroke-width: 4; stroke-dasharray: 5 5; }
.pm-turn { fill: none; stroke: #ffe94d; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.pm-hand-hour { stroke: #ffe94d; stroke-width: 6; stroke-linecap: round; }
.pm-hand-hour.is-lit { stroke: #fff6a8; filter: drop-shadow(0 0 4px #ffe94d); }
.pm-hand-minute { stroke: #5ef0ff; stroke-width: 3.5; stroke-linecap: round; }

/* A cut: dashed where it will be, solid and bright when it is made */
.pm-cut { stroke: #ffe94d; stroke-width: 2.5; stroke-dasharray: 6 5; }
.pm-cut.is-cut { stroke: #fffbe6; stroke-width: 3; stroke-dasharray: none; filter: drop-shadow(0 0 4px #ffe94d); }

.pm-picture text {
  font-family: inherit;
  font-weight: 900;
  font-style: italic;
}

.pm-sign { font-size: 34px; fill: #ffe94d; }
.pm-ask { font-size: 44px; }
.pm-digit { font-size: 104px; font-style: normal; fill: rgba(94, 240, 255, 0.12); stroke: #5ef0ff; stroke-width: 3; }
.pm-digit.is-lit { fill: rgba(255, 233, 77, 0.25); stroke: #ffe94d; }
.pm-woof { font-size: 26px; fill: #ffe94d; }
.pm-clock-number { font-size: 11px; font-style: normal; fill: rgba(242, 254, 255, 0.85); }
.pm-runner-label { font-size: 15px; font-style: normal; fill: #f2feff; }

/* ---------- Pipen beside the task, with his speech bubble ---------- */

.pm-pipen {
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* The bubble keeps its room (two lines) whether it shows or not: nothing moves when Pipen speaks */
.pm-bubble {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  min-height: 3.6rem;
  margin: 0 0 0.7rem;
  padding: 0.45rem 0.7rem;
  font-weight: 800;
  font-size: 1rem;
  line-height: 1.3;
  color: var(--text);
  background: rgba(14, 10, 36, 0.88);
  border: 2px solid var(--yellow);
  box-shadow: 0 0 14px rgba(255, 233, 77, 0.35);
  opacity: 0;
  transform: translateY(-0.3rem) scale(0.95);
  transition: opacity 0.25s, transform 0.25s;
}

/* The tail points down at Pipen */
.pm-bubble::after {
  content: "";
  position: absolute;
  bottom: -0.55rem;
  left: 50%;
  border: 0.5rem solid transparent;
  border-bottom: 0;
  border-top-color: var(--yellow);
}

.pm-bubble.show {
  opacity: 1;
  transform: none;
}

.pm-pipen-picture {
  width: 12rem;
  height: 12rem;
}

/* ---------- The layout: a landscape box = the task on the left, Pipen on the right ---------- */

@media (orientation: landscape) {
  .skol-stage .pm-play:not([hidden]) {
    grid-template-columns: minmax(23rem, max-content) 13rem;
    column-gap: 2rem;
  }

  .skol-stage .pm-play > .skol-holo { grid-column: 1; grid-row: 2; margin: 0.25rem auto 0.4rem; }
  .skol-stage .pm-play > .skol-choices { grid-column: 1; grid-row: 3; margin-bottom: 0.4rem; }
  .skol-stage .pm-play > .pm-pipen { grid-column: 2; grid-row: 2 / 4; align-self: end; }
  .skol-stage .pm-play > .skol-feedback { grid-column: 1; grid-row: 4; }
  .skol-stage .pm-play > .skol-actions { grid-column: 2; grid-row: 4; }

  /* The clock games put their cards to the right in fullscreen (skolspel.css) – here that is Pipen's place, so the
     cards stay under the picture (owner, 2026-10-16: on a phone held sideways Pipen stood in front of the cards) */
  .skol-stage.is-fullscreen .pm-play > .skol-choices { grid-column: 1; grid-row: 3; align-self: start; }
}

/* Upright (a phone): no Pipen picture (no room) – his bubble sits over the task instead */
@media (orientation: portrait) {
  .skol-stage .pm-play:not([hidden]) {
    display: flex;
    flex-direction: column;
  }

  .pm-play > .skol-label { order: 0; }
  .pm-play > .pm-pipen { order: 1; }
  .pm-play > .skol-holo { order: 2; }
  .pm-play > .skol-choices { order: 3; }
  .pm-play > .skol-feedback { order: 4; }
  .pm-play > .skol-actions { order: 5; }

  .pm-pipen-picture { display: none; }
  .pm-bubble { margin: 0 0 0.4rem; }
}

/* The cards: three in a row under the picture */
.pm-play .skol-choices {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  width: min(23rem, 100%);
}

/* ---------- The dot that falls off (pipen.js dropDot) ---------- */

.skol-dot.pm-falling {
  animation: none;
}

@media (prefers-reduced-motion: reduce) {
  .pm-words.is-missing, .pm-words.is-missing::after { animation: none; }
}
