/* Pentomino DP lab: on top of the square lab's layout (../square-lab/styles.css). */

.board-stage { position: relative; }

#dp-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  border-radius: 12px;
}

#game-board { cursor: default; }

/* The order: a number on each chosen piece; a piece out of the order keeps
   its colours on a quieter tile. */
.piece-btn { position: relative; }
.piece-btn:not(.selected) {
  background: #0d1218;
  border-color: rgba(170, 220, 255, 0.10);
}
.dp-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 10px;
  font: 800 12px/20px Manrope, system-ui, sans-serif;
  text-align: center;
  color: #07060a;
  background: #ffd84a;
  box-shadow: 0 0 0 2px #0d1117;
  pointer-events: none;
}
.dp-badge:empty { display: none; }
.piece-btn.is-current {
  border-color: #ffd84a;
  box-shadow: 0 0 0 2px rgba(255, 216, 74, 0.55), 0 0 16px rgba(255, 216, 74, 0.45);
}
@keyframes dp-invite { 0%, 100% { box-shadow: none; } 50% { box-shadow: 0 0 0 2px rgba(0, 209, 255, 0.55), 0 0 14px rgba(0, 209, 255, 0.35); } }
.dp-invite .piece-btn:not(.selected) { animation: dp-invite 1.2s ease-in-out 2; }

/* The area pill is a readout here. Its chip sits beside it with a gap; it
   stays inside the pill's markup so the shared pill sizing ignores it. */
.dp-pill { position: relative; cursor: default; overflow: visible; }
.dp-pillchip { position: absolute; left: calc(100% + 8px); top: 50%; transform: translateY(-50%); }
.dp-pill:has(.dp-pillchip:not([hidden])) + .dp-prev { margin-left: 40px; }
#dp-layout[data-phase="done"] .dp-pill { box-shadow: 0 0 0 2px rgba(255, 216, 74, 0.55), 0 0 22px rgba(255, 216, 74, 0.35); }

/* The previous area for the same pieces in another order. */
.dp-prev { display: inline-flex; gap: 6px; align-items: baseline; font: 800 18px/1 Manrope, system-ui, sans-serif; margin-left: 10px; }
.dp-prev[hidden] { display: none; }
.dp-prev s { color: #7ea8bf; text-decoration-thickness: 2px; }
.dp-prev .up { color: #2fe08a; }
.dp-prev .down { color: #ff3bd4; }

/* Chips beside a control keep their 40 px hit area off the control. */
.math-chip::after { inset: -9px; }
.dp-sidechip { align-self: center; margin: 0 6px; }
/* A reveal's chip keeps its slot while hidden, so the button never moves under the finger. */
.boardbar .dp-sidechip[hidden] { display: inline-flex; visibility: hidden; }
.dp-layerchip { position: absolute; top: 12px; right: 12px; z-index: 3; }

/* Play turns into pause while it runs. */
#dp-play .icoPause { display: none; }
#dp-play[data-playing="true"] .icoPlay { display: none; }
#dp-play[data-playing="true"] .icoPause { display: block; }

.dp-reveal { color: #ffd84a; }
.dp-reveal[aria-pressed="true"] { box-shadow: 0 0 0 2px rgba(255, 216, 74, 0.6); }

/* The links to the other labs: in the top strip on wide screens (as in the
   square lab); on narrower screens their own row under the area, at the
   right, as in the other 2026 labs. */
@media (max-width: 1180px) {
  #panel-game { --board-size: max(96px, min(calc(100vw - 20px), calc(100dvh - 420px))); }
  .game-layout {
    grid-template-rows: auto auto minmax(0, 1fr) auto auto auto auto auto minmax(0, 1fr);
    grid-template-areas:
      "toolbar"
      "links"
      "."
      "acts"
      "main"
      "dock"
      "bar"
      "label"
      ".";
  }
  .lab-nav { grid-area: links; justify-self: end; display: flex; gap: 8px; }
  /* The pieces: a compact grid, as in the square lab. */
  .piece-dock { grid-template-columns: repeat(6, min(58px, calc((var(--board-size) - 40px) / 6))); justify-content: center; }
}
/* Phones: the pill's chip needs room before the language switch. */
@media (max-width: 640px) {
  /* On phones the spare height goes below the lab, not between the links and the controls. */
  .game-layout { grid-template-rows: auto auto 0 auto auto auto auto auto minmax(0, 1fr); }
  .game-toolbar {
    width: calc(100vw - 20px);
    margin-left: calc((var(--board-size) - 100vw + 20px) / 2);
    justify-content: flex-start;
    padding-right: 212px;
    position: relative;
  }
  .dp-prev { position: absolute; z-index: 3; left: 16px; top: calc(100% + 18px); margin-left: 0 !important; }
  /* The links row spans the width: only its links take taps, the readout under the pill stays reachable. */
  .lab-nav { pointer-events: none; }
  .lab-nav > a { pointer-events: auto; }
  .lab-nav {
    width: calc(100vw - 20px);
    margin-left: calc((var(--board-size) - 100vw + 20px) / 2);
    justify-content: flex-end;
  }
}
