.tactics-chapter {
  position: relative;
  min-height: 155svh;
  color: #eeebf8;
  scroll-margin-top: -100px;
}
.tactics-ground {
  position: absolute;
  inset: 0;
  z-index: 1;
  opacity: var(--tactics-ground, 0);
  pointer-events: none;
}
.tactics-ground::before {
  content: '';
  position: absolute;
  inset: -5px -2px;
  background: url('assets/transition/mirage-flight-end.webp') center / cover no-repeat;
  transform: translate(var(--tactics-impact-x, 0px), var(--tactics-impact-y, 0px)) scale(var(--tactics-ground-scale, 1));
}
.scene-stage :is(#webgl, .tactics-ground-shadow) { translate: var(--tactics-impact-x, 0px) var(--tactics-impact-y, 0px); }
.tactics-ground-shadow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  fill: #312521;
  opacity: 0;
}
.tactics-contact-shadow { filter: blur(4px); }

.tactics-stage {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  height: 100svh;
  padding: clamp(82px,10.8svh,116px) var(--page-gutter) clamp(22px,3.5svh,42px);
  text-align: center;
}

.tactics-foot {
  opacity: var(--tactics-ui,1);
  transform: translateY(calc((1 - var(--tactics-ui,1)) * 14px));
}

.tactics-foot {
  display: grid;
  justify-items: center;
  gap: 12px;
  width: min(100%,900px);
}

.tactics-patterns {
  --pattern-split: calc(40% + 1px);
  --pattern-active-start: 4px;
  --pattern-active-end: calc(100% - var(--pattern-split));
  position: relative;
  isolation: isolate;
  display: inline-grid;
  grid-template-columns: minmax(0,2fr) minmax(0,3fr);
  width: min(100%,286px);
  padding: 4px;
  border: 1px solid #b8ade730;
  border-radius: 13px;
  background: #111421eb;
}

.tactics-patterns:has([data-pattern="1"][aria-pressed="true"]) {
  --pattern-active-start: var(--pattern-split);
  --pattern-active-end: 4px;
}

.tactics-patterns:has([aria-pressed="true"])::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset-block: 4px;
  inset-inline: var(--pattern-active-start) var(--pattern-active-end);
  border: 1px solid #b6a5e852;
  border-radius: 9px;
  background: linear-gradient(165deg,#3b3450,#242033);
  pointer-events: none;
  transition: inset-inline-start .26s cubic-bezier(.22,.7,.28,1), inset-inline-end .26s cubic-bezier(.22,.7,.28,1);
}

.tactics-patterns button {
  position: relative;
  min-height: 36px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #bcb7cc;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  pointer-events: auto;
  transition: background-color .18s, color .18s;
}

.tactics-patterns button[aria-pressed="false"]:hover {
  color: #f5f1ff;
  background: #a695e214;
}

.tactics-patterns button[aria-pressed="true"] {
  color: #f5f1ff;
  border-color: #b6a5e852;
  background: #302841;
}

.tactics-patterns:has([aria-pressed="true"]) button[aria-pressed="true"] {
  border-color: transparent;
  background: transparent;
}

.tactics-patterns button:focus-visible {
  z-index: 1;
  outline: 2px solid #cbb9ff;
  outline-offset: -2px;
}

.tactics-summary {
  min-height: 1.5em;
  margin: 0;
  color: #e2dcea;
  font-size: clamp(12px,1vw,15px);
  line-height: 1.5;
  text-wrap: pretty;
}

@media (max-width: 760px) {
  .tactics-chapter { scroll-margin-top: -80px; }
  .tactics-stage { padding: clamp(112px,15svh,144px) 20px 20px; }
  .tactics-foot { gap: 8px; }
  .tactics-patterns button { min-height: 34px; padding-inline: 9px; font-size: 12px; }
}

@media (max-height: 700px) and (min-width: 761px) {
  .tactics-stage { padding-block: 74px 18px; }
  .tactics-foot { gap: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  .tactics-chapter { min-height: 100svh; }
  .tactics-stage { position: relative; }
  .tactics-foot { opacity: 1; transform: none; }
  .tactics-patterns button,.tactics-patterns::before { transition: none; }
}
