/* Shared gameplay/tutorial pit surfaces, projected outlines and pointer targets. */
.board-stage[data-renderer="webgl"] > .houses {
  position: absolute;
  inset: 0;
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
}

.board-stage[data-renderer="webgl"] .house {
  position: absolute;
  z-index: 1;
  min-width: 0;
  min-height: 0;
}

.board-stage[data-renderer="webgl"] .house button {
  position: absolute;
  z-index: 1;
  left: var(--renderer-house-hit-left);
  top: var(--renderer-house-hit-top);
  width: var(--renderer-house-hit-width);
  height: var(--renderer-house-hit-height);
  border: 0;
  border-radius: 0;
  min-inline-size: 44px;
  min-height: 44px;
  min-block-size: 44px;
  background: transparent;
  box-shadow: none;
  pointer-events: none;
}

.board-stage[data-renderer="webgl"] .house-id,
.board-stage[data-renderer="webgl"] .house-count {
  position: absolute;
  z-index: 2;
  bottom: -0.3rem;
  padding: 0.15rem 0.2rem;
  background: #291d14ee;
  line-height: 1.15;
  border-radius: 0.2rem;
}

.board-stage[data-renderer="webgl"] .house-id {
  right: 50%;
  color: var(--board-ink);
  font-size: 0.7rem;
  padding-block: 0.35rem;
}

.board-stage[data-renderer="webgl"] .house-count {
  left: 50%;
  color: var(--board-ink);
  font-size: 1.05rem;
}

.board-stage[data-renderer="webgl"] .house button[data-legal="true"]::before {
  /* The SVG below follows the perspective rim; the flat ellipse does not. */
  display: none;
}

.pit-legal-outline,
.pit-feedback-outline { display: none; pointer-events: none; }

.board-stage[data-renderer="webgl"] .pit-legal-outline {
  inset: auto;
  position: absolute;
  top: var(--house-pit-y, 50%);
  left: var(--house-pit-x, 50%);
  width: var(--house-pit-width, 80%);
  height: var(--house-pit-height, 80%);
  transform: translate(-50%, -50%);
  overflow: visible;
  z-index: 1;
  fill: none;
  stroke: var(--theme-accent, #ebc379);
  stroke-width: 1.2px;
  stroke-linejoin: round;
  opacity: 0.8;
  filter: drop-shadow(0 0 2px var(--theme-accent, #ebc379));
}
.board-stage[data-renderer="webgl"] .house button[data-legal="true"] .pit-legal-outline {
  display: block;
}
.board-stage[data-renderer="webgl"] .house button:is(:hover, :focus-visible) .pit-legal-outline {
  opacity: 1;
  stroke: color-mix(in srgb, var(--theme-accent, #ebc379), white 35%);
}
.board-stage[data-renderer="webgl"] .pit-feedback-outline {
  display: block;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: none;
  stroke: var(--hotkey-color);
  stroke-width: 2px;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 4px var(--hotkey-color));
}

/* Ownership and action reasons stay in each native button's accessible name.
   The visible S/N IDs and player cards supply the same non-colour mapping. */
.house-owner,
.board-stage[data-renderer="webgl"] .house-state,
.board-stage[data-renderer="webgl"] .house-last-landing {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.board-stage[data-renderer="webgl"] .house button::after {
  content: "";
  position: absolute;
  z-index: 5;
  inset: 0;
  display: block;
  /* This empty pseudo-element is pointer geometry only. The unchanged button
     remains the keyboard, focus, activation, and accessible-name authority. */
  background: transparent;
  clip-path: var(--renderer-house-clip-path, inset(50%));
  pointer-events: auto;
  touch-action: manipulation;
  transform: none;
  transform-origin: center;
}

.board-stage[data-renderer="webgl"]
  > .houses[data-layout="circular_candidate_b"]
  .house button::after {
  /* Circular B uses each validated, non-overlapping semantic button box as
     its pointer region. The visible Three/Rapier opening remains unchanged. */
  clip-path: inset(0);
}


.house button {
  width: 100%;
  min-width: 0;
  min-inline-size: 44px;
  min-height: 5.5rem;
  min-block-size: 44px;
  border: 0.2rem solid #c8955c;
  border-radius: 50%;
  background: #412819;
  color: var(--ink);
  cursor: default;
  touch-action: manipulation;
  /* Suppress the browser's rectangular tap flash, not keyboard focus. */
  -webkit-tap-highlight-color: transparent;
}

.house button[data-legal="true"] {
  border-color: var(--theme-accent, #ebc379);
  cursor: pointer;
}

.house button[data-legal="true"]::before {
  content: "";
  position: absolute;
  inset: 5px;
  z-index: 1;
  display: block;
  border: 1px solid var(--theme-accent, #ebc379);
  border-top-color: color-mix(in srgb, var(--theme-accent, #ebc379), white 45%);
  border-radius: 50%;
  box-shadow: 0 0 5px color-mix(in srgb, var(--theme-accent, #ebc379) 28%, transparent),
    inset 0 0 5px color-mix(in srgb, var(--theme-accent, #ebc379) 14%, transparent);
  opacity: 0.8;
  pointer-events: none;
  transition: opacity 160ms ease, box-shadow 160ms ease, border-color 160ms ease;
}

.house button[data-legal="true"]:is(:hover, :focus-visible)::before {
  opacity: 1;
  border-color: color-mix(in srgb, var(--theme-accent, #ebc379), white 35%);
  box-shadow: 0 0 10px color-mix(in srgb, var(--theme-accent, #ebc379) 45%, transparent),
    inset 0 0 10px color-mix(in srgb, var(--theme-accent, #ebc379) 22%, transparent);
}

:root:is([data-motion-mode="reduced"], [data-motion-mode="static"]) .house button[data-legal="true"]::before {
  transition: none;
}

.house button:focus-visible {
  outline: 0.24rem solid #fff;
  outline-offset: 0.18rem;
}

/* The minimum keyboard/pointer target is rectangular; the visible focus
   boundary must follow the projected pit, including empty/unavailable pits. */
.board-stage[data-renderer="webgl"] .house button:focus-visible {
  outline: none;
}
.board-stage[data-renderer="webgl"] .house button:focus-visible .pit-legal-outline {
  display: block;
  opacity: 1;
  stroke: #fff;
  stroke-width: 3px;
  filter: drop-shadow(0 0 2px #211a13);
}
@media (forced-colors: active) {
  .board-stage[data-renderer="webgl"] .house button:focus-visible .pit-legal-outline {
    stroke: Highlight;
    forced-color-adjust: none;
    filter: none;
  }
}
