/* Play stage. Portrait: score row on top, board anchored under it.
   Landscape: score column left, board centred. Tiles in tiles.css. */
.t2-stage {
  flex: 1 1 auto;
  min-height: 0;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 0.8em;
  padding: 0.8em var(--t2-pad-r) var(--t2-pad-b) var(--t2-pad-l);
}

.t2-hud {
  display: flex;
  align-items: center;
  gap: 0.5em;
  min-width: 0;
}

.t2-stat {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 4.4em;
  padding: 0.35em 0.8em;
  border-radius: 0.9em;
  background: rgba(255, 255, 255, 0.6);
  line-height: 1.15;
}

.t2-stat-label {
  font-size: 0.7em;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a8790;
}

.t2-stat-value {
  font-size: 1.3em;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.t2-gain {
  position: absolute;
  top: 0.2em;
  left: 50%;
  font-weight: 700;
  color: #5f8279;
  pointer-events: none;
  animation: t2-rise 0.8s ease-out forwards;
}

@keyframes t2-rise {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -1.6em);
  }
}

.t2-tools {
  display: flex;
  gap: 0.5em;
  margin-left: auto;
}

.t2-tool {
  position: relative;
  width: clamp(44px, 7vmin, 180px);
  height: clamp(44px, 7vmin, 180px);
  border: none;
  border-radius: 50%;
  background: #ffffff;
  color: #4f6f68;
  font: inherit;
  font-size: clamp(20px, 3.2vmin, 86px);
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 0.1em 0 #d5ded9;
  cursor: pointer;
  touch-action: manipulation;
}

.t2-tool:disabled {
  opacity: 0.45;
  cursor: default;
}

.t2-count {
  position: absolute;
  top: -0.2em;
  right: -0.2em;
  min-width: 1.3em;
  padding: 0.1em 0.2em;
  border-radius: 1em;
  background: #7fa39a;
  color: #ffffff;
  font-size: 0.45em;
  font-weight: 700;
}

.t2-board-area {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}

.t2-board {
  --pad: 10px;
  --cell: 60px;
  position: absolute;
  top: 0;
  left: 50%;
  border-radius: calc(var(--pad) * 2);
  background: #cdd8d1;
  transform: translateX(-50%);
  touch-action: none;
  overscroll-behavior: none;
  cursor: pointer;
}

/* The board fills its area, so its focus ring goes inside (the area clips
   anything drawn outside it). */
.t2-board:focus-visible,
html.tv .t2-board:focus {
  outline-offset: -0.3rem;
}

html.tv .t2-board:focus {
  box-shadow: inset 0 0 0 0.6rem rgba(255, 255, 255, 0.85);
}

@media (orientation: landscape) {
  .t2-stage {
    grid-template-rows: minmax(0, 1fr);
    grid-template-columns: auto minmax(0, 1fr);
  }

  .t2-hud {
    flex-direction: column;
    justify-content: center;
  }

  .t2-stat {
    width: 100%;
  }

  .t2-board {
    top: 50%;
    transform: translate(-50%, -50%);
  }

  .t2-tools {
    margin-left: 0;
    margin-top: 0.4em;
  }
}

/* Big screens: 3% overscan margin (side and bottom pads in styles.css). */
@media (min-width: 960px) and (min-height: 500px) {
  .t2-stage {
    padding-top: 2dvh;
  }
}

@media (prefers-reduced-motion: reduce) {
  /* Still ends, so hud.js removes the chip. */
  .t2-gain {
    animation-duration: 1ms;
  }
}
