:root {
  --alta-red: #ef6d62;
  --alta-red-soft: rgba(239, 109, 98, 0.16);
  --alta-blue: #6a84ff;
  --alta-blue-soft: rgba(106, 132, 255, 0.16);
  --alta-line-shadow: rgba(10, 14, 16, 0.42);
}

body.alta-page {
  color: var(--site-text);
}

.alta-board-panel {
  overflow: hidden;
}

.alta-status-note {
  margin-top: -2px;
  margin-bottom: 12px;
}

.alta-board-stage {
  --goal-depth: clamp(32px, 5vw, 48px);
  position: relative;
  width: min(100%, 640px);
  aspect-ratio: 1 / 1;
  margin: 12px auto 4px;
}

.alta-board {
  position: absolute;
  inset: var(--goal-depth);
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  grid-template-rows: repeat(9, minmax(0, 1fr));
  gap: clamp(4px, 0.75vw, 7px);
}

.alta-board.is-disabled {
  pointer-events: none;
  opacity: 0.78;
}

.alta-goal {
  position: absolute;
  display: grid;
  place-items: center;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f6f8fb;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.alta-goal-top,
.alta-goal-bottom {
  left: 50%;
  width: 24%;
  height: calc(var(--goal-depth) + 8px);
  transform: translateX(-50%);
}

.alta-goal-left,
.alta-goal-right {
  top: 50%;
  width: calc(var(--goal-depth) + 8px);
  height: 24%;
  transform: translateY(-50%);
}

.alta-goal-top {
  top: 0;
  background: linear-gradient(180deg, #8ea3ff 0%, #4c66e2 100%);
}

.alta-goal-bottom {
  bottom: 0;
  background: linear-gradient(180deg, #4c66e2 0%, #8ea3ff 100%);
}

.alta-goal-left {
  left: 0;
  background: linear-gradient(90deg, #f18a80 0%, #d65246 100%);
}

.alta-goal-right {
  right: 0;
  background: linear-gradient(90deg, #d65246 0%, #f18a80 100%);
}

.alta-board-stage[data-turn='BLUE'] .alta-goal-top,
.alta-board-stage[data-turn='BLUE'] .alta-goal-bottom {
  box-shadow: 0 0 0 2px rgba(106, 132, 255, 0.18);
}

.alta-board-stage[data-turn='RED'] .alta-goal-left,
.alta-board-stage[data-turn='RED'] .alta-goal-right,
.alta-board-stage[data-winner='RED'] .alta-goal-left,
.alta-board-stage[data-winner='RED'] .alta-goal-right {
  box-shadow: 0 0 0 2px rgba(239, 109, 98, 0.18);
}

.alta-board-stage[data-winner='BLUE'] .alta-goal-top,
.alta-board-stage[data-winner='BLUE'] .alta-goal-bottom {
  box-shadow: 0 0 0 2px rgba(106, 132, 255, 0.18);
}

.alta-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid rgba(219, 228, 221, 0.08);
  background: rgba(24, 32, 28, 0.92);
  box-shadow: none;
}

.alta-cell.is-owned-red {
  background: linear-gradient(180deg, rgba(239, 109, 98, 0.08), rgba(24, 32, 28, 0.94));
}

.alta-cell.is-owned-blue {
  background: linear-gradient(180deg, rgba(106, 132, 255, 0.08), rgba(24, 32, 28, 0.94));
}

.alta-cell.is-selected {
  border-color: var(--site-accent);
  box-shadow: 0 0 0 2px rgba(169, 196, 178, 0.16);
}

.alta-cell.is-winning {
  border-color: rgba(255, 255, 255, 0.28);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.08);
}

.alta-cell.is-last-move {
  box-shadow: 0 0 0 2px rgba(169, 196, 178, 0.14);
}

.alta-empty-hit,
.alta-toggle-hit,
.alta-cell-static {
  position: absolute;
  inset: 0;
  border: 0;
  border-radius: inherit;
  background: transparent;
  padding: 0;
}

.alta-empty-hit,
.alta-toggle-hit {
  cursor: pointer;
}

.alta-empty-hit::before,
.alta-empty-hit::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 12%;
  height: 115%;
  transform-origin: center;
  border-radius: 999px;
  background: rgba(237, 243, 238, 0.1);
  opacity: 0.22;
}

.alta-empty-hit::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.alta-empty-hit::after {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.alta-empty-hit:hover,
.alta-empty-hit:focus-visible,
.alta-toggle-hit:hover,
.alta-toggle-hit:focus-visible {
  background: rgba(169, 196, 178, 0.06);
  outline: none;
}

.alta-empty-hit:hover::before,
.alta-empty-hit:hover::after,
.alta-empty-hit:focus-visible::before,
.alta-empty-hit:focus-visible::after {
  opacity: 0.56;
}

.alta-choice {
  position: absolute;
  inset: 8%;
  border: 0;
  border-radius: inherit;
  background: transparent;
  color: var(--site-accent);
  cursor: pointer;
  z-index: 2;
}

.alta-choice--red {
  color: var(--alta-red);
}

.alta-choice--blue {
  color: var(--alta-blue);
}

.alta-choice::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16%;
  height: 132%;
  transform-origin: center;
  border-radius: 999px;
  background: currentColor;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 10px 18px rgba(10, 14, 16, 0.24);
}

.alta-choice-fw {
  clip-path: polygon(0 88%, 0 66%, 66% 0, 88% 0, 100% 12%, 12% 100%);
}

.alta-choice-fw::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.alta-choice-bw {
  clip-path: polygon(0 12%, 12% 0, 34% 0, 100% 66%, 100% 88%, 88% 100%, 66% 100%, 0 34%);
}

.alta-choice-bw::before {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.alta-choice:hover,
.alta-choice:focus-visible {
  filter: brightness(1.14);
  outline: none;
}

.alta-switch {
  position: absolute;
  inset: 8%;
  pointer-events: none;
}

.alta-switch::before {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 16%;
  height: 132%;
  transform-origin: center;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.06), 0 10px 18px rgba(10, 14, 16, 0.24);
}

.alta-switch-fw::before {
  transform: translate(-50%, -50%) rotate(45deg);
}

.alta-switch-bw::before {
  transform: translate(-50%, -50%) rotate(-45deg);
}

.alta-owner-red::before {
  background: linear-gradient(180deg, #ff958d 0%, var(--alta-red) 100%);
}

.alta-owner-blue::before {
  background: linear-gradient(180deg, #91a3ff 0%, var(--alta-blue) 100%);
}

.alta-switch-preview {
  opacity: 0;
  transition: opacity 180ms ease;
}

.alta-cell.is-togglable:hover .alta-switch-preview,
.alta-cell.is-togglable:focus-within .alta-switch-preview {
  opacity: 0.24;
}

.alta-switch-preview::before {
  background: rgba(255, 255, 255, 0.26);
  box-shadow: none;
}

.alta-stat-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.alta-stat {
  border-top: 1px solid rgba(238, 243, 239, 0.06);
  padding: 0.55rem 0;
  background: transparent;
}

.alta-stat span {
  display: block;
  color: var(--site-text-muted);
  font-size: 0.78rem;
  margin-bottom: 2px;
}

.alta-stat strong {
  color: var(--site-text);
  font-size: 0.96rem;
}

.alta-history [data-player='RED'] {
  color: #f3b4ae;
}

.alta-history [data-player='BLUE'] {
  color: #b9c5ff;
}

.alta-help p,
.alta-help li {
  color: var(--site-text-muted);
}

.alta-stat:nth-child(-n + 2) {
  border-top: 0;
  padding-top: 0;
}

@media (max-width: 760px) {
  .alta-board-stage {
    width: min(100%, 560px);
  }

  .alta-goal {
    font-size: 0.62rem;
  }

  .alta-stat-grid {
    grid-template-columns: 1fr;
  }
}
