/* Svärm – only what is special to this game (the shared box is css/game-stage.css). */

/* A phone held upright: a taller box (see "Game pages = ONE SCREEN" in CLAUDE.md) */
@media (max-aspect-ratio: 1 / 1) {
  .stage {
    --aspect: 3 / 4;
  }
}

#game {
  outline: none;                 /* the canvas takes keyboard focus; no blue ring */
  -webkit-tap-highlight-color: transparent;
}

.stage .overlay p {
  white-space: pre-line;         /* the result screen writes its lines with \n */
}

.stage .overlay p:empty {
  display: none;
}

/* ---------- The top strip: level + XP bar, then life / time / how many are down ---------- */

.sv-hud {
  flex-direction: column;
  align-items: stretch;
  gap: 0.2rem;
  top: calc(0.6rem + var(--safe-top));
  font-style: normal;
  font-size: 0.95rem;
}

.sv-xp {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  min-height: 1.3rem;
  font-weight: 800;
  font-style: italic;
  color: var(--yellow);
}

.sv-xp-bar {
  flex: 1;
  height: 0.7rem;
  background: rgba(14, 10, 36, 0.7);
  border: 1px solid rgba(94, 240, 255, 0.55);
  transform: skewX(-18deg);
}

.sv-xp-bar i {
  display: block;
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--cyan), var(--yellow));
  box-shadow: 0 0 8px var(--cyan);
}

.sv-stats {
  display: flex;
  justify-content: space-between;
  font-weight: 800;
  font-style: italic;
  color: var(--text);
  text-shadow: 0 0 6px rgba(14, 10, 36, 0.9);
}

.sv-life {
  color: var(--magenta);
}

.sv-time {
  font-size: 1.15rem;
  font-variant-numeric: tabular-nums;
}

.sv-gold {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--yellow);
}

.sv-gold i {
  width: 0.75rem;
  height: 0.9rem;
  background: var(--yellow);
  clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
}

.sv-kills {
  color: var(--text-muted);
}

.sv-kills strong {
  font-size: 1.1rem;
}

/* ---------- Start screen: the keys, drawn ---------- */

.sv-keys {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.2rem;
  margin: 0 0 1.2rem;
}

.sv-keycaps {
  display: inline-flex;
  gap: 0.25rem;
}

.sv-keycaps kbd {
  display: grid;
  place-items: center;
  width: 2.2rem;
  height: 2.2rem;
  font-family: inherit; font-weight: 800; font-size: 1rem;
  color: var(--text);
  background: rgba(94, 240, 255, 0.1);
  border: 2px solid var(--cyan);
  border-bottom-width: 4px;
}

@media (pointer: coarse) {
  .sv-keys {
    display: none;
  }
}

/* ---------- Start screen: the mode switches (Lugn, Turbo, 15 min, Limit Break, Slump), the stage and the shop ---------- */

.sv-modes { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem 0.7rem; max-width: 40rem; margin: 0 auto 1rem; }
@media (max-width: 480px) {                     /* a phone held upright: smaller switches, two or three a row (each still 44 px high) */
  .sv-modes { gap: 0.4rem; }
  .sv-mode { padding: 0.3rem 0.6rem; font-size: 0.9rem; }
}
.sv-modes[hidden] { display: none; }
.sv-mode-note { flex-basis: 100%; min-height: 1.3em; margin: 0; font-size: 0.9rem; line-height: 1.3; color: rgba(233, 255, 244, 0.85); }
.sv-mode-note b { color: var(--sv-sun, #ffcf5a); font-style: italic; }
.sv-mode-note.is-off { opacity: 0.6; }
.sv-mode {
  display: inline-flex; align-items: center; gap: 0.45rem; min-height: 2.75rem; padding: 0.35rem 0.9rem;
  font-family: inherit; font-weight: 800; font-size: 1rem; color: var(--text); background: rgba(94, 240, 255, 0.08);
  border: 2px solid rgba(94, 240, 255, 0.35); cursor: pointer;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.sv-mode svg { width: 1.35rem; height: 1.35rem; fill: currentColor; }
.sv-mode[aria-pressed="true"] { color: var(--yellow, #ffe94d); border-color: var(--yellow, #ffe94d); background: rgba(255, 233, 77, 0.16); box-shadow: 0 0 14px rgba(255, 233, 77, 0.35); }
.sv-mode:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- The level-up cards ---------- */

.sv-levelup {
  z-index: 3;
  background: rgba(14, 10, 36, 0.8);
}

.sv-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.9rem;
}

.sv-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  width: 9.5rem;
  min-height: 11rem;
  padding: 1.1rem 0.7rem 0.8rem;
  font: inherit;
  color: var(--text);
  text-align: center;
  background: rgba(94, 240, 255, 0.08);
  border: 2px solid var(--cyan);
  cursor: pointer;
  touch-action: manipulation;
  transition: transform 0.12s, box-shadow 0.12s;
}

.sv-card:focus-visible {
  transform: translateY(-4px);
  background: rgba(94, 240, 255, 0.18);
  box-shadow: 0 0 16px var(--cyan);
  outline: none;
}
@media (hover: hover) {                      /* (a finger leaves :hover on the last card it touched: only a mouse lifts a card it points at) */
  .sv-card:hover { transform: translateY(-4px); background: rgba(94, 240, 255, 0.18); box-shadow: 0 0 16px var(--cyan); }
}

.sv-card svg {
  width: 3rem;
  height: 3rem;
  fill: none;
  stroke: var(--yellow);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 6px rgba(255, 233, 77, 0.6));
}

/* an arcana card with the owner's own picture (arcana-art.js): the picture behind its frame, drawn at a whole multiple of its pixels, never smoothed */
.sv-arkana {
  image-rendering: pixelated;
  display: block;
}
.sv-card.has-arkana {
  width: auto;
  min-width: 9.5rem;
  max-width: 16rem;
}
.sv-card-name {
  font-size: 1.15rem;
  font-weight: 900;
  font-style: italic;
  text-transform: uppercase;
  color: var(--yellow);
}

.sv-card-text {
  font-size: 0.95rem;
}

/* the number key that picks the card, small in its corner (computers only) */
.sv-card-key {
  position: absolute;
  top: 0.35rem;
  left: 0.45rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--text-muted);
}

@media (pointer: coarse) {
  .sv-card-key {
    display: none;
  }
}

/* a phone: the three cards in a column, close together */
@media (max-width: 520px) {
  .sv-cards {
    flex-direction: column;
    gap: 0.5rem;
  }

  .sv-card {
    flex-direction: row;
    width: min(20rem, 100%);
    min-height: 0;
    padding: 0.6rem 0.8rem 0.6rem 1.6rem;
    gap: 0.8rem;
    text-align: left;
  }

  .sv-card svg {
    flex: none;
    width: 2.2rem;
    height: 2.2rem;
  }
}

.sv-lab-host:empty {
  display: none;
}

/* ---------- The lab (?labb): the game and the panel side by side; on a phone the game stays at the top ---------- */

.is-lab .sv-play {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(20rem, 26rem);
  gap: 1rem;
  align-items: start;
}

.is-lab .sv-play .stage {
  --room: calc(var(--window-height) - var(--stage-top) - 1rem);
  position: sticky;
  top: 3.2rem;
}

@media (max-width: 760px) {
  .is-lab .sv-play {
    display: block;
  }

  .is-lab .site-header {
    position: static;
  }

  .is-lab .sv-play .stage {
    --room: 54svh;
    top: 0;
    z-index: 20;
    margin-inline: auto;
  }
}

/* ---------- The hero's weapons and passive items (bottom left): a little picture and its level ---------- */

.sv-items[hidden] { display: none; }
.sv-items {
  position: absolute;
  left: calc(0.6rem + var(--safe-left, 0px));
  bottom: calc(0.6rem + var(--safe-bottom, 0px));
  z-index: 2;
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  max-width: 55%;
  pointer-events: none;
}

.sv-item {
  position: relative;
  display: grid;
  place-items: center;
  width: calc(1.9rem * var(--ui, 1));
  height: calc(1.9rem * var(--ui, 1));
  background: rgba(14, 10, 36, 0.78);
  border: 1px solid rgba(94, 240, 255, 0.6);
}

.sv-item.is-evolved { border-color: var(--yellow, #ffe94d); box-shadow: 0 0 0.45rem rgba(255, 233, 77, 0.7); }        /* an evolved weapon's slot shines */
.sv-item-passive {
  border-color: rgba(255, 233, 77, 0.6);
}

.sv-item svg {
  width: 70%;
  height: 70%;
  fill: none;
  stroke: var(--yellow);
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sv-item-weapon svg {
  stroke: var(--cyan);
}

.sv-item b {
  position: absolute;
  right: 0.1rem;
  bottom: -0.05rem;
  font-size: calc(0.7rem * var(--ui, 1));
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 3px #000, 0 0 3px #000;
}

/* the owner's battery picture on the "Mat" card: whole pixel multiples, never smoothed */
.sv-card-art {
  width: 3rem;
  height: 3rem;
  image-rendering: pixelated;
}

@media (max-width: 520px) {
  .sv-card-art {
    flex: none;
    width: 2.2rem;
    height: 2.2rem;
  }
}

/* ---------- The chest screen ---------- */

.sv-chest {
  gap: 1rem;
}

.sv-chest-box {
  width: 6rem;
  height: 4.2rem;
  position: relative;
  background: #b8742b;
  border: 3px solid #5a3410;
  box-shadow: 0 0 24px rgba(255, 233, 77, 0.4);
}

.sv-chest-box::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 1.3rem;
  background: var(--yellow);
}

.sv-chest-box::after {
  content: "";
  position: absolute;
  left: calc(50% - 0.5rem);
  top: 0.9rem;
  width: 1rem;
  height: 1.3rem;
  background: #5a3410;
}

.sv-chest.is-open .sv-chest-box {
  animation: sv-chest-pop 0.5s ease-out;
}

@keyframes sv-chest-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.25) rotate(-3deg); }
  100% { transform: scale(1); }
}

.sv-chest-items {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.6rem;
  min-height: 3.4rem;
}

.sv-chest-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 5.2rem;
  padding: 0.5rem 0.7rem;
  font-weight: 800;
  font-style: italic;
  color: var(--text);
  background: rgba(94, 240, 255, 0.1);
  border: 2px solid var(--cyan);
}

.sv-chest-item svg {
  width: 1.8rem;
  height: 1.8rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  color: var(--cyan);
}

.sv-chest-item.is-gold {
  border-color: var(--yellow);
  color: var(--yellow);
}

/* The result screen's new unlocks (R12): a row of small chips, each the thing's picture and its name */
.sv-fever { display: inline-block; width: calc(3rem * var(--ui, 1)); height: calc(0.5rem * var(--ui, 1)); background: rgba(14, 10, 36, 0.8); border: 1px solid var(--yellow, #ffe94d); align-self: center; animation: sv-fever-pulse 0.5s steps(2) infinite; }
.sv-fever[hidden] { display: none; }
.sv-fever i { display: block; height: 100%; background: var(--yellow, #ffe94d); }
@keyframes sv-fever-pulse { 50% { box-shadow: 0 0 0.4rem rgba(255, 233, 77, 0.8); } }
.sv-recipes { display: flex; flex-direction: column; align-items: center; gap: 0.35rem; margin: 0.4rem 0; max-height: 40%; overflow-y: auto; }
.sv-recipes[hidden] { display: none; }
.sv-recipe { display: flex; align-items: center; gap: 0.35rem; }
.sv-recipe-chip { width: 2.3rem; height: 2.3rem; }
.sv-recipe-chip b { font-size: 0.8rem; }
.sv-recipe-chip.is-unknown { border-style: dashed; color: rgba(255, 255, 255, 0.7); font-weight: 900; font-size: 1.2rem; }
.sv-recipe-chip.is-ready { border-color: var(--yellow, #ffe94d); box-shadow: 0 0 0.5rem rgba(255, 233, 77, 0.6); }
.sv-recipe-chip.is-ready b { color: var(--yellow, #ffe94d); }
.sv-recipe-sign { font-weight: 900; color: rgba(255, 255, 255, 0.75); }
.sv-unlocks { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; margin: 0.5rem 0; }
.sv-unlocks[hidden] { display: none; }
.sv-unlocks .sv-unlock { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.3rem 0.7rem; border: 2px solid var(--yellow, #ffe94d); background: rgba(255, 233, 77, 0.12); font-weight: 800; }
.sv-unlocks .sv-unlock svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- The card screen's three tools (reroll, skip, banish) ---------- */

.sv-card-tools { display: flex; justify-content: center; gap: 0.7rem; margin-top: 0.9rem; }
.sv-card-tools:empty { display: none; }
.sv-tool {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-width: 2.75rem; min-height: 2.75rem; padding: 0.3rem 0.8rem;
  font-family: inherit; font-weight: 800; font-size: 1rem; color: var(--text); background: rgba(94, 240, 255, 0.1); border: 2px solid var(--cyan); cursor: pointer; touch-action: manipulation;
  clip-path: polygon(8px 0, 100% 0, calc(100% - 8px) 100%, 0 100%);
}
.sv-tool svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sv-tool .icon { fill: currentColor; stroke: none; }
.sv-tool[aria-pressed="true"] { color: var(--yellow, #ffe94d); border-color: var(--yellow, #ffe94d); background: rgba(255, 233, 77, 0.16); box-shadow: 0 0 14px rgba(255, 233, 77, 0.35); }
.sv-tool:focus-visible { box-shadow: 0 0 14px var(--cyan); outline: none; }
@media (hover: hover) { .sv-tool:hover { box-shadow: 0 0 14px var(--cyan); outline: none; } }
.sv-cards.is-banish .sv-card { border-color: var(--magenta, #ff3fb4); background: rgba(255, 63, 180, 0.1); animation: sv-shake 0.4s infinite alternate; }
@keyframes sv-shake { from { transform: rotate(-0.8deg); } to { transform: rotate(0.8deg); } }

/* ---------- The gold shop ---------- */

.sv-shop { gap: 0.8rem; }
.sv-shop-top { display: flex; align-items: center; justify-content: space-between; width: min(100%, 52rem); gap: 1rem; }
.sv-shop-top h2 { margin: 0 auto 0 0.4rem; font-size: clamp(1.3rem, 3.4vw, 1.9rem); }
.sv-refund { padding-inline: 0.7rem; font-size: 0.9rem; }
.sv-refund .sv-refund-word { white-space: nowrap; }
/* the grid and, beside it, the card of the upgrade picked: what one rank gives and Köp (owner, 2026-11-06: nothing said what a tile did,
   and a press bought it at once) */
.sv-shop-body { display: flex; align-items: center; justify-content: center; gap: 1rem; width: 100%; }
.sv-shop-info {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 0.35rem; width: 11rem; padding: 0.8rem 0.7rem;
  text-align: center; background: rgba(11, 26, 20, 0.88); border: 2px solid var(--sv-sun, #ffcf5a);
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.sv-shop-info svg { width: 2.6rem; height: 2.6rem; fill: none; stroke: var(--yellow, #ffe94d); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sv-shop-info svg .icon { fill: var(--yellow, #ffe94d); stroke: none; }
.sv-shop-info b { font-size: 1.15rem; font-style: italic; color: var(--sv-sun, #ffcf5a); line-height: 1.1; }
.sv-shop-effect { font-size: 1rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.sv-shop-buy { display: inline-flex; align-items: center; justify-content: center; gap: 0.3rem; align-self: stretch; margin-top: 0.3rem; font-size: 1rem; }
.sv-shop-buy img { width: 1.1rem; height: 1.1rem; image-rendering: pixelated; }
.sv-shop-buy.is-short { opacity: 0.5; }
.sv-shop-buy.is-maxed { pointer-events: none; opacity: 0.7; }
.sv-shop-buy.is-no { animation: sv-no 0.25s; }
.sv-power.is-picked { border-color: var(--sv-sun, #ffcf5a); background: rgba(255, 207, 90, 0.16); box-shadow: inset 0 0 0 2px var(--sv-sun, #ffcf5a), 0 0 14px rgba(255, 207, 90, 0.4); opacity: 1; }
.sv-power-name { white-space: nowrap; }                    /* "Andra chansen" on ONE line (two lines pushed its price down) */
.sv-power-name.is-long { font-size: 0.82em; letter-spacing: -0.01em; }
@media (max-width: 640px) { .sv-shop-body { flex-direction: column; } .sv-shop-info { width: min(100%, 20rem); } }
@media (max-width: 480px) {                 /* a phone held upright: the top row's title and gold smaller, "Sälj allt" only its arrow (it armed = yellow) */
  .sv-shop-top { gap: 0.4rem; }
  .sv-shop-top h2 { font-size: 1.05rem; margin-left: 0.2rem; }
  .sv-shop-top .sv-shop-gold { font-size: 1.2rem; gap: 0.3rem; }
  .sv-refund .sv-refund-word { display: none; }
}
@media (max-height: 520px) {                 /* a phone held sideways: smaller tiles and card so all of it fits */
  .sv-shop { gap: 0.4rem; }
  .sv-shop .sv-power { width: 4.9rem; min-height: 5.6rem; padding: 0.35rem 0.2rem; font-size: 0.78rem; gap: 0.12rem; }
  .sv-shop .sv-power svg { width: 1.6rem; height: 1.6rem; }
  .sv-shop .sv-shop-grid { gap: 0.4rem; max-width: 32rem; }
  .sv-shop-info { width: 9.5rem; padding: 0.6rem 0.5rem; gap: 0.25rem; }
  .sv-shop-info svg { width: 2rem; height: 2rem; }
  .sv-shop-top .sv-tool { min-height: 2.4rem; }
}
.sv-shop-gold { display: inline-flex; align-items: center; gap: 0.5rem; font-size: 1.6rem; color: var(--yellow, #ffe94d); text-shadow: 0 0 10px rgba(255, 233, 77, 0.5); }
.sv-shop-gold img { image-rendering: pixelated; width: 1.4rem; height: 1.4rem; }
.sv-shop-grid { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.6rem; max-width: 40rem; }
.sv-power {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.2rem; width: 5.6rem; min-height: 6.6rem; padding: 0.5rem 0.3rem;
  font-family: inherit; font-weight: 700; font-size: 0.85rem; color: var(--text); text-align: center; background: rgba(94, 240, 255, 0.08); border: 2px solid var(--cyan); cursor: pointer; touch-action: manipulation;
}
.sv-power svg { width: 2rem; height: 2rem; fill: none; stroke: var(--yellow, #ffe94d); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sv-power .icon { fill: var(--yellow, #ffe94d); stroke: none; }
.sv-power:focus-visible { background: rgba(94, 240, 255, 0.2); box-shadow: 0 0 12px var(--cyan); outline: none; }
@media (hover: hover) { .sv-power:hover { background: rgba(94, 240, 255, 0.2); box-shadow: 0 0 12px var(--cyan); outline: none; } }
.sv-power.is-short { opacity: 0.5; }
.sv-power.is-maxed { border-color: var(--yellow, #ffe94d); }
.sv-power.is-bought { animation: sv-pop 0.25s; }
.sv-power.is-no { animation: sv-no 0.25s; }
@keyframes sv-pop { 50% { transform: scale(1.12); } }
@keyframes sv-no { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.sv-pips { display: flex; gap: 3px; min-height: 0.6rem; }
.sv-pips i { width: 0.45rem; height: 0.45rem; border: 1px solid var(--cyan); }
.sv-pips i.is-on { background: var(--yellow, #ffe94d); border-color: var(--yellow, #ffe94d); }
.sv-price { display: inline-flex; align-items: center; gap: 0.25rem; color: var(--yellow, #ffe94d); }
.sv-price img { image-rendering: pixelated; width: 0.9rem; height: 0.9rem; }

/* Limit Break's two Random buttons (text next to the picture) and the line shown when a level-up was settled for you */
.sv-tool.sv-tool-text { width: auto; padding: 0 1rem; gap: 0.5rem; }
.sv-auto-note {
  position: absolute; left: 50%; top: 18%; transform: translateX(-50%); z-index: 5; pointer-events: none;
  padding: 0.35rem 0.9rem; border: 2px solid var(--cyan, #5ef0ff); background: rgba(8, 6, 24, 0.82); color: #fff;
  font-weight: 800; font-style: italic; opacity: 0; transition: opacity 0.25s;
}
.sv-auto-note.is-on { opacity: 1; }

/* ---------- THE MENUS (owner, 2026-11-04: "Fixa menyerna"; theme D1 = runes meet circuit boards and solarpunk) ----------
   The look: a dark moss-green board with faint copper traces and solder pads, a low sunrise glow at the bottom (solarpunk),
   runes as glowing strokes on the traces (menus.js runeRow). Mint = what can be pressed, sun gold = what matters most,
   copper = frames. The screens themselves are #overlay's sections; svarm.js shows one at a time. */

.stage {
  --sv-board: #0b1a14;
  --sv-mint: #2ee6a6;
  --sv-sun: #ffcf5a;
  --sv-copper: #d98b4a;
  --sv-leaf: #7be36b;
  --sv-ink: #e9fff4;
}
.sv-menu {
  color: var(--sv-ink);
  background:
    radial-gradient(120% 60% at 50% 115%, rgba(255, 207, 90, 0.28), rgba(255, 140, 60, 0.08) 45%, transparent 70%),
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(217, 139, 74, 0.09) 46px 48px),
    repeating-linear-gradient(0deg, transparent 0 62px, rgba(46, 230, 166, 0.06) 62px 64px),
    rgba(7, 20, 15, 0.9);
  gap: 0.6rem;
}
.sv-menu .sv-screen { display: flex; flex-direction: column; align-items: center; gap: 0.8rem; width: 100%; }
.sv-menu .sv-screen[hidden] { display: none; }

/* the title row: the back arrow, the title, a row of runes on a trace */
.sv-menu-head { position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; }
.sv-menu h2 {
  margin: 0; font-style: normal; letter-spacing: 0.08em; color: var(--sv-sun);
  text-shadow: 0 0 12px rgba(255, 207, 90, 0.55), 0 2px 0 #4a2a10;
}
.sv-menu[data-screen="main"] h2 { font-size: clamp(2.4rem, 8vw, 4.2rem); }
.sv-menu:not([data-screen="main"]) h2 { font-size: clamp(1.5rem, 4.5vw, 2.3rem); }
.sv-runes { display: block; width: 9rem; height: 1.6rem; margin-top: 0.2rem; }
.sv-trace { stroke: var(--sv-copper); stroke-width: 1; opacity: 0.8; fill: none; }
.sv-pad { fill: var(--sv-copper); }
.sv-rune { stroke: var(--sv-mint); stroke-width: 1.4; fill: none; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 2px var(--sv-mint)); }
.sv-back { position: absolute; left: 0; top: 0.2rem; color: var(--sv-mint); border-color: var(--sv-mint); }
.sv-back[hidden] { display: none; }

/* the big buttons: a mint plate with a sun-gold edge; the small square ones beside them (shop, quit, menu) copper */
.sv-menu .sv-big {
  min-width: 11rem; min-height: 3.2rem; font-size: 1.35rem; letter-spacing: 0.04em;
  color: #06140e; background: linear-gradient(180deg, #6bf5c3, var(--sv-mint)); border: 2px solid var(--sv-sun);
  text-shadow: none; box-shadow: 0 0 18px rgba(46, 230, 166, 0.45), inset 0 -3px 0 rgba(0, 0, 0, 0.25);
}
.sv-menu .sv-big:focus-visible { box-shadow: 0 0 26px rgba(255, 207, 90, 0.7), inset 0 -3px 0 rgba(0, 0, 0, 0.25); outline: 2px solid #fff; outline-offset: 3px; }
@media (hover: hover) { .sv-menu .sv-big:hover { box-shadow: 0 0 26px rgba(255, 207, 90, 0.7), inset 0 -3px 0 rgba(0, 0, 0, 0.25); outline: 2px solid #fff; outline-offset: 3px; } }
.sv-menu .sv-big:disabled { opacity: 0.6; }
.sv-main-buttons { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0.7rem; }
.sv-plate {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; min-width: 3.2rem; min-height: 3.2rem; padding: 0.3rem 0.8rem;
  font-family: inherit; font-weight: 800; font-size: 1.05rem; color: var(--sv-ink); background: rgba(217, 139, 74, 0.14); border: 2px solid var(--sv-copper); cursor: pointer;
  clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
}
.sv-plate .icon { width: 1.5rem; height: 1.5rem; fill: currentColor; }
.sv-plate:focus-visible { background: rgba(217, 139, 74, 0.3); outline: none; box-shadow: inset 0 0 0 2px var(--sv-sun); }
@media (hover: hover) { .sv-plate:hover { background: rgba(217, 139, 74, 0.3); outline: none; box-shadow: inset 0 0 0 2px var(--sv-sun); } }
.sv-shop-open .sv-open-coin { image-rendering: pixelated; width: 1.2rem; height: 1.2rem; }
.sv-shop-open .sv-shop-n { color: var(--sv-sun); }
.sv-quit.is-sure { color: #fff; border-color: var(--magenta, #ff3fb4); background: rgba(255, 63, 180, 0.25); }

/* the main menu: Botti on a solder pad, glowing like a sunrise */
.sv-hero-spot {
  display: grid; place-items: center; width: 7.5rem; height: 7.5rem; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 207, 90, 0.35), rgba(46, 230, 166, 0.12) 55%, transparent 70%);
  border: 2px dashed rgba(217, 139, 74, 0.6);
}
.sv-hero-spot canvas { width: 5.5rem; height: 5.5rem; image-rendering: pixelated; animation: sv-bob 1.6s ease-in-out infinite; }
@keyframes sv-bob { 50% { transform: translateY(-4px); } }

/* the robot cards and the stage cards */
.sv-robots, .sv-stages { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.8rem; }
.sv-robot, .sv-stage {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 0.3rem; padding: 0.6rem 0.6rem 0.5rem;
  font-family: inherit; font-weight: 800; font-size: 1rem; color: var(--sv-ink); background: rgba(11, 26, 20, 0.85); border: 2px solid var(--sv-copper); cursor: pointer;
  clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}
.sv-robot { width: 7rem; }
.sv-stage { width: 9.5rem; }
.sv-robot:focus-visible, .sv-stage:focus-visible { border-color: var(--sv-mint); outline: none; box-shadow: inset 0 0 0 2px var(--sv-mint); }
@media (hover: hover) { .sv-robot:hover, .sv-stage:not(:disabled):hover { border-color: var(--sv-mint); outline: none; box-shadow: inset 0 0 0 2px var(--sv-mint); } }
.sv-robot.is-chosen, .sv-stage.is-chosen { border-color: var(--sv-sun); background: rgba(255, 207, 90, 0.12); box-shadow: inset 0 0 0 2px var(--sv-sun), 0 0 18px rgba(255, 207, 90, 0.35); }
.sv-robot-frame, .sv-stage-picture {
  position: relative; display: grid; place-items: center; width: 100%; aspect-ratio: 1;
  background: radial-gradient(circle at 50% 80%, rgba(255, 207, 90, 0.2), transparent 65%), rgba(46, 230, 166, 0.06);
  border: 1px solid rgba(46, 230, 166, 0.3);
}
.sv-stage-picture { aspect-ratio: 4 / 3; }
.sv-robot-picture { width: 80%; height: 80%; image-rendering: pixelated; }
.sv-robot.is-locked { cursor: default; opacity: 0.55; }
.sv-robot.is-locked .sv-robot-picture { filter: brightness(0) drop-shadow(0 0 1px var(--sv-copper)); }
.sv-stage-picture svg { width: 70%; height: 70%; fill: none; stroke: var(--sv-leaf); stroke-width: 1.4; stroke-linecap: round; stroke-linejoin: round; }
.sv-stage-picture .sv-sun { stroke: var(--sv-sun); fill: rgba(255, 207, 90, 0.35); }
.sv-lock, .sv-star { position: absolute; width: 40% !important; height: 40% !important; }
.sv-lock { stroke: var(--sv-sun) !important; stroke-width: 2 !important; fill: rgba(7, 20, 15, 0.8) !important; }
.sv-star { top: 4px; right: 4px; width: 28% !important; height: 28% !important; stroke: var(--sv-sun) !important; fill: var(--sv-sun) !important; }
.sv-stage:disabled { cursor: default; }
.sv-stage:disabled .sv-stage-picture svg:first-child { opacity: 0.25; }
.sv-stage-name, .sv-robot-name { font-size: 1.05rem; }
.sv-stage-need { font-size: 0.8rem; font-weight: 700; color: var(--sv-sun); }
.sv-robot-weapon svg { width: 1.6rem; height: 1.6rem; }
.sv-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sv-robot-weapon { color: var(--sv-sun); }
.sv-menu .sv-recipes { max-height: 13rem; }
.sv-menu .sv-mode { border-color: rgba(46, 230, 166, 0.4); background: rgba(46, 230, 166, 0.08); }
.sv-menu .sv-mode[aria-pressed="true"] { color: var(--sv-sun); border-color: var(--sv-sun); background: rgba(255, 207, 90, 0.16); }

/* the post-run screen: big tiles, the damage given and taken, the weapons as bars */
.sv-result { display: flex; flex-direction: column; align-items: center; gap: 0.6rem; width: min(100%, 36rem); }
.sv-tiles, .sv-damage { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.5rem; width: 100%; }
.sv-tile {
  flex: 1 1 6.5rem; display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; align-items: center; column-gap: 0.45rem;
  padding: 0.4rem 0.6rem; text-align: left; background: rgba(11, 26, 20, 0.85); border: 1px solid rgba(217, 139, 74, 0.6);
}
.sv-tile-icon { grid-row: span 2; display: grid; place-items: center; width: 1.8rem; height: 1.8rem; color: var(--sv-mint); }
.sv-tile-icon svg, .sv-tile-icon img { width: 100%; height: 100%; fill: currentColor; image-rendering: pixelated; }
.sv-tile-value { font-size: 1.35rem; line-height: 1.1; color: var(--sv-ink); font-variant-numeric: tabular-nums; }
.sv-tile-label { font-size: 0.75rem; font-weight: 700; color: rgba(233, 255, 244, 0.65); }
.sv-tile.is-gold .sv-tile-value { color: var(--sv-sun); }
.sv-tile.is-given .sv-tile-icon { color: var(--sv-sun); }
.sv-tile.is-taken .sv-tile-icon { color: var(--magenta, #ff3fb4); }
.sv-weapons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.25rem; width: 100%; }
.sv-weapon { display: grid; grid-template-columns: 1.6rem 7.5rem 2.2rem 1fr 4.2rem 2.6rem 3.4rem; align-items: center; gap: 0.45rem; font-size: 0.85rem; text-align: left; }
.sv-weapon-icon { display: grid; place-items: center; color: var(--sv-mint); }
.sv-weapon-icon svg { width: 1.4rem; height: 1.4rem; }
.sv-weapon-icon svg:not(.sv-line) { fill: currentColor; }
.sv-weapon-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sv-weapon-bar { height: 0.55rem; background: rgba(46, 230, 166, 0.1); border: 1px solid rgba(46, 230, 166, 0.35); }
.sv-weapon-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--sv-mint), var(--sv-sun)); }
.sv-weapon-damage { text-align: right; font-variant-numeric: tabular-nums; }
.sv-weapon-level, .sv-weapon-time { color: rgba(233, 255, 244, 0.6); font-variant-numeric: tabular-nums; }
.sv-weapon-time { text-align: right; }
.sv-kit { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; }
.sv-kit-item { display: flex; flex-direction: column; align-items: center; gap: 0.1rem; width: 2rem; color: var(--sv-mint); }
.sv-kit-item svg { width: 1.6rem; height: 1.6rem; padding: 0.15rem; border: 1px solid rgba(217, 139, 74, 0.6); background: rgba(11, 26, 20, 0.85); }
.sv-kit-item b { font-size: 0.75rem; color: var(--sv-sun); line-height: 1; }
.sv-kit-item.is-arcana { color: var(--sv-sun); }
.sv-weapon-dps { text-align: right; color: rgba(233, 255, 244, 0.6); font-variant-numeric: tabular-nums; }
.sv-weapon.is-evolved .sv-weapon-icon, .sv-weapon.is-evolved .sv-weapon-name { color: var(--sv-sun); }
.sv-weapon.is-other .sv-weapon-icon { color: rgba(233, 255, 244, 0.6); }
@media (max-width: 480px) {
  .sv-weapon { grid-template-columns: 1.4rem 1fr 2rem 3.8rem; }
  .sv-weapon-bar, .sv-weapon-dps, .sv-weapon-time { display: none; }
  .sv-robot { width: 5.6rem; }
  .sv-stage { width: 7.4rem; }
  .sv-tile { flex-basis: 5.5rem; }
}
@media (max-height: 520px) {                 /* a low box (phone sideways, a small window): smaller pictures */
  .sv-hero-spot { width: 5rem; height: 5rem; }
  .sv-hero-spot canvas { width: 3.8rem; height: 3.8rem; }
  .sv-stage { width: 8rem; }
}
/* the result in a low, wide box (a phone held sideways, 2026-11-06: with six weapons "Spela igen" ended up under the box's edge):
   the tiles on the left, the weapons' bars on the right, the items and the pickups under them, everything a little tighter */
@media (max-height: 520px) and (min-width: 600px) {
  .sv-menu[data-screen="result"] { gap: 0.3rem; }
  .sv-menu[data-screen="result"] .sv-screen { gap: 0.45rem; }
  .sv-menu[data-screen="result"] .sv-runes, .sv-menu[data-screen="pause"] .sv-runes { display: none; }
  .sv-result { display: grid; grid-template-columns: minmax(12rem, 16rem) minmax(0, 1fr); align-items: start; gap: 0.4rem 0.9rem; width: min(100%, 50rem); }
  .sv-result .sv-tiles { grid-column: 1; grid-row: 1; }
  .sv-result .sv-damage { grid-column: 1; grid-row: 2; }
  .sv-result .sv-weapons { grid-column: 2; grid-row: 1 / span 2; gap: 0.15rem; }
  .sv-result .sv-kit, .sv-result .sv-pickups { grid-row: 3; align-self: center; }
  .sv-result .sv-kit { grid-column: 1; }
  .sv-result .sv-pickups { grid-column: 2; }
  .sv-result .sv-tiles, .sv-result .sv-damage { gap: 0.35rem; }
  .sv-result .sv-tile { flex-basis: 5.6rem; padding: 0.25rem 0.45rem; }
  .sv-result .sv-tile-icon { width: 1.4rem; height: 1.4rem; }
  .sv-result .sv-tile-value { font-size: 1.1rem; }
  .sv-result .sv-tile-label { font-size: 0.7rem; }
  .sv-result .sv-weapon { grid-template-columns: 1.3rem minmax(4rem, 7rem) 2rem 1fr 3.4rem 2.8rem; gap: 0.35rem; font-size: 0.8rem; }
  .sv-result .sv-weapon-time { display: none; }
  .sv-result .sv-weapon-icon svg { width: 1.15rem; height: 1.15rem; }
  .sv-menu[data-screen="result"] .sv-unlocks { margin: 0; }
  .sv-menu[data-screen="result"] .sv-big { min-height: 2.6rem; font-size: 1.15rem; }
}

/* the other screens over the game wear the same look: the level-up cards, the chest, the shop */
.sv-levelup, .sv-shop, #chest {
  background:
    radial-gradient(120% 60% at 50% 115%, rgba(255, 207, 90, 0.22), transparent 65%),
    repeating-linear-gradient(90deg, transparent 0 46px, rgba(217, 139, 74, 0.08) 46px 48px),
    rgba(7, 20, 15, 0.86);
}
.sv-levelup h2, .sv-shop h2, #chest h2 { color: var(--sv-sun, #ffcf5a); }

/* ---------- The chest's slot machine (owner, 2026-11-04, after the original's): a beam of light out of the chest with the things
   spinning up through it, coins flying out, the gold counting; then a card per thing saying what it gave ---------- */
.sv-chest-stage { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; width: 12rem; height: 15.8rem; }
.sv-chest-stage .sv-chest-box { z-index: 2; }
.sv-reels { position: absolute; inset: 0; z-index: 1; pointer-events: none; }
.sv-reel {                          /* turned round its foot in the chest: the reels fan out (--fan, svarm.js) */
  position: absolute; left: calc(50% - 2rem); bottom: 3.6rem; width: 4rem; height: 12rem; overflow: hidden; z-index: 1;       /* tall (owner, 2026-11-04: "så att den inte ser så stubbig ut") */
  transform: rotate(var(--fan, 0deg)); transform-origin: 50% calc(100% + 3.7rem);     /* the turning point lies down in the chest: the reels stand apart like a fan's ribs */
  background: linear-gradient(90deg, rgba(46, 230, 166, 0.15), rgba(233, 255, 244, 0.65) 50%, rgba(46, 230, 166, 0.15));
  box-shadow: 0 0 22px rgba(255, 207, 90, 0.6);
  -webkit-mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent);
          mask-image: linear-gradient(transparent, #000 25%, #000 75%, transparent);
}
.sv-reel-strip {                /* svarm.js moves it: it starts under the beam's foot (in the chest) and rises out, stopping on each prize in turn */
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem; position: absolute; left: 0; right: 0; top: 0; will-change: transform;
}
.sv-reel-strip svg { width: 2.6rem; height: 2.6rem; flex: none; fill: none; stroke: #0b1a14; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 3px #fff); }
.sv-chest-box.is-spinning { animation: sv-chest-shake 0.12s infinite alternate; }
@keyframes sv-chest-shake { from { transform: translateX(-2px) rotate(-1deg); } to { transform: translateX(2px) rotate(1deg); } }
.sv-chest-coins { position: absolute; left: 50%; bottom: 2rem; width: 0; height: 0; z-index: 3; pointer-events: none; }
.sv-chest-coins > * {
  position: absolute; left: -0.6rem; top: -0.6rem; width: 1.2rem; height: 1.2rem; image-rendering: pixelated; opacity: 0;
  animation: sv-coin-fly 1.1s ease-out var(--delay) forwards;
}
.sv-chest-coins > i { border-radius: 50%; background: var(--yellow, #ffe94d); }
@keyframes sv-coin-fly {
  0% { opacity: 1; transform: translate(0, 0) rotate(0); }
  60% { opacity: 1; transform: translate(calc(var(--dx) * 0.8), var(--dy)) rotate(var(--spin)); }
  100% { opacity: 0; transform: translate(var(--dx), calc(var(--dy) + 4rem)) rotate(var(--spin)); }
}
.sv-chest-gold { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 1.8rem; font-weight: 900; color: var(--sv-sun, #ffcf5a); font-variant-numeric: tabular-nums; text-shadow: 0 0 10px rgba(255, 207, 90, 0.5); }
.sv-chest-gold[hidden] { display: none; }
.sv-chest-gold img { width: 1.5rem; height: 1.5rem; image-rendering: pixelated; }
.sv-chest-gold img[hidden] { display: none; }
.sv-chest .sv-chest-item { animation: sv-chest-card 0.35s ease-out calc(var(--k, 0) * 0.12s) backwards; background: rgba(11, 26, 20, 0.9); border-color: var(--sv-copper, #d98b4a); max-width: 11rem; }
.sv-chest .sv-chest-item svg { color: var(--sv-mint, #2ee6a6); width: 2.4rem; height: 2.4rem; }
.sv-chest .sv-chest-item.is-evolved { border-color: var(--sv-sun, #ffcf5a); box-shadow: 0 0 16px rgba(255, 207, 90, 0.5); }
.sv-chest .sv-chest-item.is-evolved svg { color: var(--sv-sun, #ffcf5a); }
.sv-chest .sv-chest-level { color: var(--sv-sun, #ffcf5a); font-style: normal; }
@keyframes sv-chest-card { from { opacity: 0; transform: translateY(0.8rem) scale(0.8); } }
@media (prefers-reduced-motion: reduce) {
  .sv-reel-strip, .sv-chest-coins > *, .sv-chest-box.is-spinning, .sv-chest .sv-chest-item { animation-duration: 0.01s; }
}

/* The hero's numbers beside the level-up cards (like the original's): a narrow column on the left, a picture, a name and the number */
.sv-hero-stats {
  position: absolute; left: calc(1rem + var(--safe-left, 0px)); top: 50%; transform: translateY(-50%); width: 12.5rem; padding: 0.5rem 0.6rem;
  display: flex; flex-direction: column; gap: 0.1rem; text-align: left; font-size: 0.82rem;
  background: rgba(11, 26, 20, 0.88); border: 2px solid var(--sv-copper);
}
.sv-hero-stats[hidden] { display: none; }
.sv-hero-stat { display: grid; grid-template-columns: 1.1rem 1fr auto; align-items: center; gap: 0.35rem; }
.sv-hero-stat svg { width: 1rem; height: 1rem; fill: none; stroke: var(--sv-mint); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.sv-hero-stat b { color: var(--sv-sun); font-variant-numeric: tabular-nums; }
.sv-hero-stat.is-none { opacity: 0.45; }
.sv-hero-stat.is-none b { color: inherit; }
.sv-hero-gap { display: block; height: 0.35rem; }

/* the result's row of pickups (and light sources broken) with their counts */
.sv-pickups { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.35rem; padding: 0.3rem 0.5rem; background: rgba(11, 26, 20, 0.6); }
.sv-pickup img.sv-pickup-art { width: 1.6rem; height: 1.6rem; padding: 0.15rem; image-rendering: pixelated; border: 1px solid rgba(217, 139, 74, 0.6); background: rgba(11, 26, 20, 0.85); }

/* ----- The chest show's flair (owner, 2026-11-04: "chromatic aberration, lens flares och party"; all CSS transforms/opacity = cheap) ----- */
.sv-chest.is-showing h2 { visibility: hidden; }                   /* the title goes when the show starts: the room is the show's */
.sv-chest { overflow-x: clip; }
.sv-chest-stage { overflow: visible; }
.sv-reel.is-fast .sv-reel-strip svg { filter: drop-shadow(3px 0 0 #ff3fb4) drop-shadow(-3px 0 0 #2de2ff); transform: scaleY(1.4); opacity: 0.85; }      /* rolling fast: stretched and split, like motion blur */
.sv-reel-strip svg.is-won {
  stroke: #ffffff; transform: scale(1.35);
  filter: drop-shadow(2px 0 0 #ff3fb4) drop-shadow(-2px 0 0 #2de2ff) drop-shadow(0 0 4px #ffcf5a);
  animation: sv-won 0.35s ease-out, sv-hover 1.1s ease-in-out 0.35s infinite;      /* the dead stop's pop, then it hovers */
}
@keyframes sv-hover { 0%, 100% { transform: scale(1.35) translateY(0); } 50% { transform: scale(1.35) translateY(-0.25rem); } }
@keyframes sv-won { 0% { transform: scale(2.2); filter: drop-shadow(6px 0 0 #ff3fb4) drop-shadow(-6px 0 0 #2de2ff) drop-shadow(0 0 10px #fff); } 100% { transform: scale(1.35); } }
.sv-chest-flare {                 /* a lens flare: a long thin streak + a soft disc + a small ring, laid on with "screen" */
  position: absolute; left: 50%; top: 4rem; width: 30rem; height: 7rem; margin-left: -15rem; margin-top: -3.5rem; rotate: var(--tilt, 0deg); pointer-events: none; z-index: 4; opacity: 0;
  mix-blend-mode: screen;
  background:
    radial-gradient(closest-side, rgba(255, 255, 255, 0.95), rgba(255, 207, 90, 0.5) 30%, transparent 70%) 50% 50% / 7rem 7rem no-repeat,
    radial-gradient(closest-side, transparent 70%, rgba(45, 226, 255, 0.55) 78%, transparent 86%) 72% 60% / 3.2rem 3.2rem no-repeat,
    radial-gradient(closest-side, rgba(255, 63, 180, 0.45), transparent) 30% 40% / 1.6rem 1.6rem no-repeat,
    linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.85) 48%, #fff 50%, rgba(255, 255, 255, 0.85) 52%, transparent) 50% 50% / 100% 3px no-repeat;
}
.sv-chest-flare.go { animation: sv-flare 0.75s ease-out; }
@keyframes sv-flare { 0% { opacity: 0; transform: scaleX(0.2); } 15% { opacity: 1; transform: scaleX(1.1); } 100% { opacity: 0; transform: scaleX(1.4); } }
.sv-chest-flash { position: absolute; inset: 0; pointer-events: none; background: #fff; opacity: 0; z-index: 6; }
.sv-chest-flash.go { animation: sv-flash 0.3s ease-out; }
@keyframes sv-flash { 0% { opacity: 0.7; } 100% { opacity: 0; } }
.sv-chest-stage.is-bump .sv-chest-box { animation: sv-bump 0.35s ease-out; }
@keyframes sv-bump { 0% { transform: translateY(0) scale(1); } 30% { transform: translateY(-0.5rem) scale(1.12, 0.9); } 100% { transform: none; } }
.sv-chest-confetti { position: absolute; left: 50%; top: 4rem; width: 0; height: 0; z-index: 5; pointer-events: none; }
.sv-chest-confetti > i { position: absolute; left: -0.25rem; top: -0.15rem; width: 0.5rem; height: 0.3rem; animation: sv-confetti 1.3s cubic-bezier(0.2, 0.6, 0.4, 1) forwards; }
@keyframes sv-confetti {
  0% { transform: translate(0, 0) rotate(0); opacity: 1; }
  45% { transform: translate(var(--dx), var(--dy)) rotate(var(--spin)); opacity: 1; }
  100% { transform: translate(calc(var(--dx) * 1.2), calc(var(--dy) + 9rem)) rotate(calc(var(--spin) * 2)); opacity: 0; }
}
.sv-chest-gold.is-done { animation: sv-gold-done 0.5s ease-out; }
@keyframes sv-gold-done { 0% { transform: scale(1.5); text-shadow: 3px 0 #ff3fb4, -3px 0 #2de2ff, 0 0 18px #ffcf5a; } 100% { transform: none; } }
.sv-chest .sv-chest-items { min-height: 5.6rem; }
.sv-chest { gap: 0.6rem; }
.sv-chest .sv-chest-item { padding: 0.35rem 0.6rem; }
@media (prefers-reduced-motion: reduce) {
  .sv-chest-confetti > i, .sv-chest-flare.go { display: none; }
  .sv-chest-flash.go { animation: sv-flash-soft 0.4s ease-out; }
  .sv-reel-strip svg.is-won { animation: none; }
}

/* The flashing-lights warning before the game (owner, 2026-11-04): a sign, two short lines, OK */
.sv-warning-sign { width: 4.5rem; height: 4.5rem; fill: rgba(255, 207, 90, 0.15); stroke: var(--sv-sun); stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; animation: sv-warning-pulse 1.6s ease-in-out infinite; }
@keyframes sv-warning-pulse { 50% { transform: scale(1.06); filter: drop-shadow(0 0 8px rgba(255, 207, 90, 0.6)); } }
.sv-menu .sv-warning-text { margin: 0; font-size: 1.3rem; max-width: 26rem; }
.sv-menu .sv-warning-text b { color: var(--sv-sun); }
.sv-menu .sv-warning-small { margin: 0; font-size: 0.95rem; color: rgba(233, 255, 244, 0.75); max-width: 26rem; }
@media (prefers-reduced-motion: reduce) { .sv-warning-sign { animation: none; } }
@keyframes sv-flash-soft { 0% { opacity: 0.2; } 100% { opacity: 0; } }

/* the chest show zooms the canvas in (svarm.js CHEST.zoom): the box keeps it inside */
.stage { overflow: clip; }
/* the chest's title takes no room (the reels need the height) and the cards are compact, so six of them still fit above "Klart" */
.sv-chest > h2 { position: absolute; top: calc(0.6rem + var(--safe-top, 0px)); left: 0; right: 0; margin: 0; }
.sv-chest .sv-chest-item { min-width: 0; max-width: 8.6rem; padding: 0.3rem 0.5rem; font-size: 0.85rem; line-height: 1.15; }
.sv-chest .sv-chest-item svg { width: 1.7rem; height: 1.7rem; }
.sv-chest .sv-chest-items { gap: 0.4rem; min-height: 4.6rem; max-width: 46rem; }
/* a stopped reel shows only its prize (owner, 2026-11-04: "Det viktiga är att se vinsterna, inte vad man kunde fått") */
.sv-reel.is-stopped .sv-reel-strip svg:not(.is-won) { visibility: hidden; }

/* ---------- The merchant Ramel (merchant.js) ---------- */

.sv-merchant { gap: 0.9rem; }
.sv-merchant-top { display: flex; align-items: center; justify-content: center; gap: 1rem; }
.sv-merchant-top h2 { margin: 0; font-size: clamp(1.5rem, 4.5vw, 2.4rem); }
@media (max-height: 520px) { .sv-merchant .sv-merchant-face { width: 3rem; height: 3rem; } .sv-merchant { gap: 0.6rem; } }
.sv-merchant .sv-merchant-face { width: 4rem; height: 4rem; image-rendering: pixelated; }
.sv-merchant .sv-power { width: 7rem; }
.sv-merchant .sv-power.is-full { opacity: 0.5; }
.sv-merchant .sv-power.is-sold { border-color: var(--yellow, #ffe94d); opacity: 0.6; }
.sv-merchant-empty { width: 3rem; height: 3rem; color: var(--muted, #9aa); }

/* ---------- A diskett found: the robot in it (map.js coffins) ---------- */

.sv-found { gap: 0.8rem; }
.sv-found .sv-found-robot { width: 8rem; height: 8rem; image-rendering: pixelated; animation: sv-found-pop 0.6s ease-out; filter: drop-shadow(0 0 14px rgba(255, 233, 77, 0.6)); }
.sv-found-name { font-size: 1.6rem; color: var(--yellow, #ffe94d); }
@keyframes sv-found-pop { from { transform: scale(0.2) rotate(-20deg); opacity: 0; } 70% { transform: scale(1.15); } to { transform: none; opacity: 1; } }

/* ---------- The robots for sale ---------- */

.sv-robot.is-for-sale .sv-robot-picture { filter: saturate(0.6) brightness(0.85); }
.sv-robot.is-short { opacity: 0.6; }
.sv-robot.is-no { animation: sv-no 0.25s; }
.sv-robot .sv-price { font-size: 0.9rem; }
.sv-unlocks .sv-unlock-robot { width: 1.6rem; height: 1.6rem; image-rendering: pixelated; }

/* a low box (a phone held sideways, owner 2026-11-05: "rätt skevt"): the cards keep their height and never slide in under "Klart"; the
   stage gives up its room instead, and a card is wider so its text takes two lines, not four */
.sv-chest .sv-chest-items, .sv-chest #chest-button, .sv-chest .sv-chest-gold { flex-shrink: 0; }
.sv-chest .sv-chest-stage { flex-shrink: 1; min-height: 8rem; }
@media (max-height: 520px) {
  .sv-chest { gap: 0.35rem; }
  .sv-chest .sv-chest-items { min-height: 0; }
  .sv-chest .sv-chest-item { max-width: 14rem; }
  .sv-chest .sv-chest-gold { font-size: 1.4rem; }
}
/* the prize cards are equally wide (a long text never makes one card twice the others'), five in a row where they fit */
.sv-chest .sv-chest-items { max-width: min(100%, 46rem); }
.sv-chest .sv-chest-item { flex: 1 1 0; min-width: 6.5rem; max-width: 9rem; }
@media (max-height: 520px) { .sv-chest .sv-chest-item { max-width: 9rem; } }

/* ---------- The robot screen (owner, 2026-11-05: see the robot's numbers, Köp when it is not bought, a RUNE HOLOGRAM round it, not a circle) ----------
   rune-holo.js draws the hologram on .sv-holo; the cards below only choose which robot is shown. */
.stage canvas.sv-holo { display: block; width: 15rem; height: 15rem; position: static; }   /* (.stage canvas would stretch it over the box) */
.stage canvas.sv-holo-main { width: 12rem; height: 12rem; }
.sv-holo.is-bought { animation: sv-holo-bought 0.6s ease-out; }
@keyframes sv-holo-bought { 30% { transform: scale(1.08); filter: brightness(1.8) drop-shadow(0 0 14px var(--sv-sun)); } }
.sv-showcase { display: flex; align-items: center; justify-content: center; gap: 1.2rem; width: 100%; }
.sv-robot-info { display: flex; flex-direction: column; align-items: flex-start; gap: 0.45rem; min-width: 13rem; }
.sv-robot-title { margin: 0; font-size: 1.9rem; font-style: italic; color: var(--sv-sun); text-shadow: 0 0 12px rgba(255, 207, 90, 0.5); }
.sv-robot-stats { display: flex; flex-direction: column; gap: 0.15rem; width: 100%; padding: 0.4rem 0.6rem; font-size: 0.95rem; text-align: left; background: rgba(11, 26, 20, 0.85); border: 1px solid rgba(217, 139, 74, 0.6); }
.sv-robot-stats .sv-hero-stat { grid-template-columns: 1.3rem 1fr auto; }
.sv-robot-stats svg { width: 1.2rem; height: 1.2rem; fill: none; stroke: var(--sv-mint); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sv-robot-stats .sv-hero-stat:first-child svg { stroke: var(--sv-sun); }
.sv-robot-stats .is-special small { display: block; font-size: 0.78em; font-style: italic; color: rgba(233, 255, 244, 0.65); line-height: 1.1; }
.sv-robot-stats .is-special b { color: var(--sv-mint); }
#robot-go { align-self: stretch; display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; }
#robot-go .sv-go-coin { width: 1.3rem; height: 1.3rem; image-rendering: pixelated; }
#robot-go.is-buy { color: #2a1505; background: linear-gradient(180deg, #ffe08f, var(--sv-sun)); border-color: var(--sv-mint); box-shadow: 0 0 18px rgba(255, 207, 90, 0.5), inset 0 -3px 0 rgba(0, 0, 0, 0.25); }
#robot-go.is-short { opacity: 0.55; }
#robot-go.is-no { animation: sv-no 0.25s; }
.sv-robot-screen .sv-robots { gap: 0.5rem; }
.sv-robot-screen .sv-robot { width: 5.2rem; padding: 0.35rem 0.35rem 0.3rem; gap: 0.15rem; }
.sv-robot-screen .sv-robot-name { font-size: 0.85rem; }
.sv-robot-screen .sv-robot-weapon { display: none; }
.sv-robot-screen .sv-robot .sv-price { font-size: 0.8rem; }
.sv-robot-screen .sv-robot.is-chosen { background: rgba(11, 26, 20, 0.85); box-shadow: none; position: relative; }
.sv-robot-screen .sv-robot.is-chosen::after {      /* the robot that plays now: a mint tick in the corner (a whole frame read as a second choice) */
  content: ""; position: absolute; top: 0.2rem; right: 0.2rem; width: 1rem; height: 1rem; border-radius: 50%;
  background: var(--sv-mint) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%23062018' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 75% no-repeat;
  box-shadow: 0 0 6px rgba(46, 230, 166, 0.7);
}
.sv-robot-screen .sv-robot.is-viewed { border-color: var(--sv-sun); background: rgba(255, 207, 90, 0.12); box-shadow: inset 0 0 0 2px var(--sv-sun), 0 0 18px rgba(255, 207, 90, 0.35); }
@media (max-width: 560px) {                 /* a phone held upright: the hologram above its numbers */
  .sv-showcase { flex-direction: column; gap: 0.4rem; }
  .stage canvas.sv-holo { width: 11rem; height: 11rem; }
  .sv-robot-info { align-items: center; min-width: 0; width: min(100%, 17rem); }
}
@media (max-height: 520px) {                /* a phone held sideways: everything smaller, the hologram beside the numbers */
  .stage canvas.sv-holo { width: 10rem; height: 10rem; }
  .stage canvas.sv-holo-main { width: 8rem; height: 8rem; }
  .sv-robot-title { font-size: 1.3rem; }
  .sv-robot-stats { font-size: 0.8rem; padding: 0.25rem 0.5rem; }
  .sv-robot-info { gap: 0.3rem; min-width: 11rem; }
  #robot-go.sv-big { min-height: 2.4rem; font-size: 1.1rem; }
  .sv-robot-screen .sv-robot { width: 4rem; }
  .sv-robot-screen .sv-robot-name { display: none; }
  .sv-robot-screen .sv-robot-frame { width: 2.6rem; }
}

/* a locked robot looked at (2026-11-06: a press on one did nothing): its dark silhouette in a copper hologram, where it is found, a dim "Låst" */
#robot-go.is-locked { opacity: 0.45; cursor: default; color: var(--sv-ink); background: rgba(217, 139, 74, 0.18); border-color: var(--sv-copper); box-shadow: none; }
.sv-robot-stats .is-need { grid-template-columns: 1.3rem 1fr; color: var(--sv-sun); font-weight: 700; }
.sv-robot-stats .is-need svg { stroke: var(--sv-copper) !important; }
.sv-robot.is-locked { cursor: pointer; }
.sv-robot-screen .sv-robot.is-locked.is-viewed { opacity: 1; }
.sv-merchant .sv-full-note { color: var(--magenta, #ff3fb4); font-style: italic; }
