/* VK: Boom – the HUD, the menus and the touch controls over the pixel picture. The box, the corner buttons and the
   start screen's frame come from css/game-stage.css; the HTML grows with the box (--ui, .ui-grows). */

.bm-stage {
  background: #0b0c22;
  cursor: default;
}

.bm-stage canvas {
  image-rendering: pixelated;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

/* ---------- The HUD: the players top left, the clock top right ---------- */

.bm-hud {
  justify-content: space-between;
  align-items: flex-start;
  pointer-events: none;
}

.bm-players {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 0.15rem;
  font-size: 0.8rem;
  font-style: normal;
  font-weight: 700;
  text-transform: none;
}

.bm-players li {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  color: var(--text);
  transition: opacity 0.3s;
}

.bm-players li.is-out {
  opacity: 0.4;
  text-decoration: line-through;
}

.bm-players li.is-you {
  color: var(--yellow);
}

.bm-dot {
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  flex: none;
}

.bm-stars {
  color: var(--yellow);
  letter-spacing: 0.05em;
}

.bm-clock {
  margin-right: 3.2rem;          /* clear of the fullscreen button */
  color: var(--cyan);
  font-size: 1.1rem;
  font-variant-numeric: tabular-nums;
}

.bm-clock.is-hurry {
  color: var(--magenta);
  animation: bm-blink 0.5s steps(2) infinite;
}

@keyframes bm-blink {
  50% { opacity: 0.4; }
}

/* the big texts in the middle ("Redo …", "Kör!", the winner) */
.bm-big {
  position: absolute;
  left: 0;
  right: 0;
  top: 38%;
  margin: 0;
  text-align: center;
  font-style: italic;
  font-weight: 900;
  font-size: calc(2.6rem * var(--ui, 1));
  text-transform: uppercase;
  color: var(--yellow);
  text-shadow: 0 0 18px rgba(255, 233, 77, 0.7), 0 2px 0 rgba(14, 10, 36, 0.9);
  pointer-events: none;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.15s, transform 0.15s;
  z-index: 2;
}

.bm-big.is-shown {
  opacity: 1;
  transform: scale(1);
}

.bm-big.is-blue {
  color: var(--cyan);
  text-shadow: 0 0 18px rgba(94, 240, 255, 0.8), 0 2px 0 rgba(14, 10, 36, 0.9);
}

/* ---------- The menus ---------- */

.bm-overlay {
  z-index: 3;
}

.bm-stage .icon-button {
  z-index: 4;
}

.bm-overlay h2 {
  color: var(--cyan);
  text-shadow: 0 0 14px rgba(94, 240, 255, 0.6);
}

.bm-overlay p {
  margin-bottom: 1rem;
}

.bm-overlay h2[hidden],
.bm-overlay p[hidden] {
  display: none;
}

/* a calmer veil than the default: the robots playing behind the menu show it is a game */
.bm-overlay {
  background: radial-gradient(ellipse at 50% 45%, rgba(11, 12, 34, 0.72), rgba(11, 12, 34, 0.9));
}

.bm-menu {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  width: min(100%, 34rem);
}

.bm-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  align-items: center;
  gap: 0.6rem;
}

/* every menu button shows the keyboard's place clearly */
.bm-menu button:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 3px;
}

/* the title: the game's name, big and tilted like the site's headings */
.bm-overlay .bm-logo {
  margin: 0;
  font-style: italic;
  font-weight: 900;
  font-size: 2.6rem;
  line-height: 1;
  text-transform: uppercase;
  color: var(--cyan);
  text-shadow: 0 0 16px rgba(94, 240, 255, 0.6), 0 3px 0 rgba(14, 10, 36, 0.9);
}

/* ----- the line-up: a card per player ----- */

.bm-cards {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 7.2rem));
  gap: 0.7rem;
  justify-content: center;
  width: 100%;
}

.bm-card {
  position: relative;
  min-width: 0;
}

.bm-card-main {
  width: 100%;
  height: 100%;
  min-height: 9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.25rem;
  padding: 0.5rem 0.35rem 0.55rem;
  font: inherit;
  color: var(--text);
  background: linear-gradient(180deg, color-mix(in srgb, var(--seat) 16%, transparent), rgba(13, 14, 36, 0.85) 70%);
  border: 2px solid color-mix(in srgb, var(--seat) 70%, transparent);
  border-radius: 0.7rem;
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}

.bm-card.is-robot .bm-card-main:hover,
.bm-card.is-empty .bm-card-main:hover,
.bm-card-main:focus-visible {
  transform: translateY(-2px);
  border-color: var(--seat);
  box-shadow: 0 0 14px color-mix(in srgb, var(--seat) 55%, transparent);
}

.bm-card.is-human .bm-card-main {
  cursor: default;
}

/* your own card is a little brighter (who you are, at a glance) */
.bm-card:first-child .bm-card-main {
  border-color: var(--seat);
  box-shadow: 0 0 12px color-mix(in srgb, var(--seat) 40%, transparent);
}

.bm-stage .bm-card-figure {
  position: static;
  display: block;
  width: 5.6rem;
  height: 5.6rem;
  image-rendering: pixelated;
  flex: none;
}

.bm-card-name {
  max-width: 100%;
  font-weight: 800;
  font-size: 0.82rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.bm-card-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--seat);
}

.bm-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
}

.bm-bars span {
  width: 4px;
  background: color-mix(in srgb, var(--seat) 25%, transparent);
}

.bm-bars span:nth-child(1) { height: 5px; }
.bm-bars span:nth-child(2) { height: 8px; }
.bm-bars span:nth-child(3) { height: 11px; }

.bm-bars span.is-on {
  background: var(--seat);
}

/* a robot card can be changed: a small "turn" mark in its corner */
.bm-card-swap {
  position: absolute;
  left: 0.45rem;
  top: 0.3rem;
  font-size: 0.85rem;
  color: color-mix(in srgb, var(--seat) 75%, transparent);
}

.bm-card-remove {
  position: absolute;
  right: -0.45rem;
  top: -0.45rem;
  width: 1.7rem;
  height: 1.7rem;
  padding: 0.3rem;
  display: grid;
  place-items: center;
  color: var(--text);
  background: #1b1d40;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-radius: 50%;
  cursor: pointer;
}

.bm-card-remove svg {
  width: 100%;
  height: 100%;
}

.bm-card-remove:hover,
.bm-card-remove:focus-visible {
  border-color: var(--magenta);
  color: var(--magenta);
}

.bm-card.is-empty .bm-card-main {
  justify-content: center;
  background: transparent;
  border-style: dashed;
  border-color: rgba(255, 255, 255, 0.25);
  color: var(--text-muted);
}

.bm-card-plus {
  width: 2.2rem;
  height: 2.2rem;
}

/* ----- the big button and the rules line ----- */

.bm-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-width: 13rem;
  font-size: 1.35rem;
  padding: 0.75rem 1.8rem;
}

.bm-go-icon {
  display: inline-grid;
  width: 1.1em;
  height: 1.1em;
}

.bm-go-icon svg {
  width: 100%;
  height: 100%;
}

.bm-rules-line {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  max-width: 100%;
  padding: 0.45rem 0.9rem;
  font: inherit;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 999px;
  cursor: pointer;
}

.bm-rules-line svg {
  width: 1.2rem;
  height: 1.2rem;
  flex: none;
}

.bm-rules-word {
  font-weight: 800;
  color: var(--text);
}

.bm-rules-line:hover,
.bm-rules-line:focus-visible {
  color: var(--text);
  border-color: var(--cyan);
}

/* ----- the rules screen: one row per rule, the choices joined like a switch ----- */

.bm-settings {
  display: grid;
  gap: 0.75rem;
  width: 100%;
}

.bm-setting {
  display: grid;
  grid-template-columns: minmax(9rem, 1fr) auto;
  align-items: center;
  gap: 0.4rem 1rem;
  padding: 0.55rem 0.8rem;
  text-align: left;
  background: rgba(13, 14, 36, 0.75);
  border: 1px solid rgba(94, 240, 255, 0.18);
  border-radius: 0.6rem;
}

.bm-setting-head {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 0.5rem;
}

.bm-setting-icon {
  grid-row: span 2;
  display: grid;
  width: 1.5rem;
  height: 1.5rem;
  color: var(--cyan);
}

.bm-setting-icon svg {
  width: 100%;
  height: 100%;
}

.bm-setting-label {
  font-weight: 800;
}

.bm-setting-note {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.bm-segments {
  display: inline-flex;
  justify-self: end;
  padding: 3px;
  gap: 3px;
  background: rgba(0, 0, 0, 0.35);
  border-radius: 0.5rem;
}

.bm-segment {
  min-width: 2.6rem;
  padding: 0.4rem 0.65rem;
  font: inherit;
  font-weight: 800;
  font-size: 0.9rem;
  white-space: nowrap;
  color: var(--text-muted);
  background: transparent;
  border: 0;
  border-radius: 0.35rem;
  cursor: pointer;
}

.bm-segment:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.06);
}

.bm-segment.is-chosen {
  color: #0b0c22;
  background: var(--yellow);
  box-shadow: 0 0 10px rgba(255, 233, 77, 0.4);
}

.bm-result {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  max-width: 22rem;
}

.bm-result li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.2rem 0;
  font-weight: 700;
}

.bm-result li.is-you {
  color: var(--yellow);
}

.bm-result .bm-stars {
  margin-left: auto;
}

/* ---------- Touch: the pad (left) and the balloon button (right) ---------- */

.bm-touch {
  position: absolute;
  inset: auto 0 0 0;
  height: 0;
  z-index: 2;
}

.bm-touch[hidden] {
  display: none;
}

.bm-pad {
  position: absolute;
  left: max(0.8rem, var(--safe-left, 0px));
  bottom: max(0.8rem, var(--safe-bottom, 0px));
  width: 8.5rem;
  height: 8.5rem;
  border-radius: 50%;
  background: rgba(94, 240, 255, 0.08);
  border: 2px solid rgba(94, 240, 255, 0.35);
  touch-action: none;
}

.bm-arrow {
  position: absolute;
  width: 0;
  height: 0;
  border: 0.75rem solid transparent;
  opacity: 0.75;
}

.bm-arrow.is-on {
  opacity: 1;
  filter: drop-shadow(0 0 6px var(--cyan));
}

.bm-arrow.is-up { left: calc(50% - 0.75rem); top: 0.4rem; border-bottom: 1rem solid var(--cyan); border-top: 0; }
.bm-arrow.is-down { left: calc(50% - 0.75rem); bottom: 0.4rem; border-top: 1rem solid var(--cyan); border-bottom: 0; }
.bm-arrow.is-left { top: calc(50% - 0.75rem); left: 0.4rem; border-right: 1rem solid var(--cyan); border-left: 0; }
.bm-arrow.is-right { top: calc(50% - 0.75rem); right: 0.4rem; border-left: 1rem solid var(--cyan); border-right: 0; }

.bm-drop {
  position: absolute;
  right: max(4.2rem, var(--safe-right, 0px));     /* clear of the sound button in the corner */
  bottom: max(1.2rem, var(--safe-bottom, 0px));
  width: 5.5rem;
  height: 5.5rem;
  border-radius: 50%;
  border: 3px solid var(--cyan);
  background: radial-gradient(circle at 40% 35%, #b4f3ff 0 12%, #3fd8ff 13% 55%, #1a8fc4 56% 100%);
  box-shadow: 0 0 14px rgba(63, 216, 255, 0.55);
  touch-action: none;
  cursor: pointer;
}

.bm-drop:active,
.bm-drop.is-on {
  transform: scale(0.92);
}

/* a phone held upright: a taller box, the field at the top and the thumbs' room under it */
@media (orientation: portrait) and (max-width: 700px) {
  .bm-stage {
    --aspect: 9 / 14;
  }

  /* the players on one or two short lines over the field, not a column down its side */
  .bm-players {
    display: flex;
    flex-wrap: wrap;
    gap: 0.1rem 0.7rem;
    flex: 1 1 auto;
    font-size: 0.7rem;
  }

  .bm-players li {
    white-space: nowrap;
  }

  .bm-clock {
    margin-right: 0;
  }

  .bm-hud {
    padding-left: 3.4rem;          /* clear of the pause button */
    padding-right: 3.4rem;
  }
}

/* the stop button (only once you can kick): small, above the balloon button */
.bm-stop {
  position: absolute;
  right: max(5.2rem, var(--safe-right, 0px));
  bottom: calc(max(1.2rem, var(--safe-bottom, 0px)) + 6.2rem);
  width: 3.4rem;
  height: 3.4rem;
  border-radius: 50%;
  border: 3px solid #ff9a3c;
  background: rgba(255, 154, 60, 0.18) linear-gradient(#ff9a3c, #ff9a3c) center / 1.1rem 1.1rem no-repeat;
  touch-action: none;
  cursor: pointer;
}

.bm-stop[hidden] {
  display: none;
}

/* narrow boxes (phones): the cards two by two, the rules' choices under their names */
@media (max-width: 560px) {
  .bm-cards {
    grid-template-columns: repeat(2, minmax(0, 7.2rem));
  }

  .bm-card-main {
    min-height: 0;
    gap: 0.1rem;
    padding-top: 0.3rem;
  }

  .bm-stage .bm-card-figure {
    width: 3rem;
    height: 3rem;
  }

  .bm-overlay .bm-logo {
    font-size: 1.9rem;
  }

  .bm-setting {
    grid-template-columns: 1fr;
  }

  .bm-segments {
    justify-self: start;
    flex-wrap: wrap;
  }
}

/* ----- the adventure's HUD: one small red lamp per lamp on the level, dark once broken ----- */

.bm-players li.bm-lamps {
  gap: 0.35rem;
}

.bm-lamp {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
  background: #ff3b4e;
  box-shadow: 0 0 0.45rem rgba(255, 59, 78, 0.8);
}

.bm-lamp.is-broken {
  background: #2a2f52;
  box-shadow: none;
}
