.tac-game {
  --highlight: #adf2bf;
  color: #fbf4e2;
  background: #172625;
  border: 1px solid #516459;
  border-radius: 14px;
  overflow: hidden;
}
.tac-game.lava {
  --highlight: #ffd0a1;
}
.tac-game.end {
  --highlight: #ded0ff;
}
.tac-banner {
  padding: clamp(12px, 2.4vw, 23px);
  background:
    linear-gradient(90deg, #152722ed, #192827b5 58%, #15272228),
    url('./assets/world-panoramas.webp') center top / 100% 400%;
}
.lava .tac-banner,
.end .tac-banner {
  background-image:
    linear-gradient(90deg, #29202eed, #231e2ec4 58%, #29202e30), url('./assets/realm-panoramas.webp');
  background-size:
    100% 100%,
    100% 300%;
}
.end .tac-banner {
  background-position: center, bottom;
}
.tac-banner small {
  font-weight: 700;
  color: #ffe3a1;
}
.tac-banner h2 {
  font-size: clamp(21px, 4vw, 34px);
  margin: 4px 0;
}
.tac-banner p {
  max-width: 55ch;
  line-height: 1.35;
  margin: 0.3em 0;
}
.tac-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  color: #d4e6d2;
  padding: 8px 16px;
  background: #101b1c;
}
.tac-stats span:nth-child(2) {
  color: #ffb7a5;
}
.tac-stats span:nth-child(3) {
  color: #8fe8c0;
}
.tac-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.65fr) minmax(190px, 0.85fr);
  gap: 14px;
  align-items: start;
  padding: clamp(9px, 2vw, 18px);
}
.tac-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  padding: 5px;
  background: #152423;
  border: 2px solid #728475;
  border-radius: 2px;
  gap: 2px;
}
.tac-cell,
.tac-command button {
  font: inherit;
  color: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.tac-cell {
  display: grid;
  align-items: end;
  position: relative;
  isolation: isolate;
  min-width: 0;
  min-height: 0;
  aspect-ratio: 1.12;
  border: 1px solid #acbd905a;
  border-bottom: 3px solid #1b3332;
  padding: 0;
  overflow: hidden;
  opacity: 1;
  background: #314941 var(--stone) repeat;
  background-size: 145%;
  border-radius: 1px;
}
.tac-cell:disabled {
  cursor: default;
  color: inherit;
  opacity: 1;
}
.tac-cell.rock {
  border-color: #536462;
  border-bottom-width: 6px;
  background: linear-gradient(#636e60, #41544c 80%, #34453e 81%);
}
.tac-cell.reachable {
  border: 2px solid var(--highlight);
  box-shadow: inset 0 0 11px #e2ffd120;
}
.tac-cell.danger {
  background: repeating-linear-gradient(135deg, #762c3760 0 7px, #ae4f5480 7px 10px), var(--stone);
}
.tac-cell.reachable:hover {
  filter: brightness(1.2);
}
.tac-stand {
  height: 92%;
  position: absolute;
  inset: auto 1% 2%;
  display: flex;
  justify-content: center;
  align-items: end;
  pointer-events: none;
}
.tac-sprite {
  display: block;
  flex: 1 1 0;
  max-width: 90%;
  height: 100%;
  background-repeat: no-repeat;
  filter: drop-shadow(0 2px 1px #20202b);
}
.tac-hero {
  background-image: url('./assets/maze-figures.webp');
  background-size: 500% 200%;
  max-width: 60%;
}
.tac-monster {
  max-width: 83%;
  height: 90%;
  object-fit: contain;
}
.tac-sprite.sleep {
  transform: rotate(-13deg);
  opacity: 0.74;
}
.tac-sprite.current {
  filter: drop-shadow(0 0 2px white);
}
.tac-gem {
  width: 46%;
  height: auto;
  justify-self: center;
  align-self: center;
}
.tac-mark {
  position: absolute;
  right: 2px;
  top: 2px;
  width: 1.05em;
  border-radius: 3px;
  color: #291c28;
  background: #ffb4af;
  text-align: center;
  font-weight: 900;
  line-height: 1.1;
}
.tac-command {
  display: grid;
  gap: 8px;
}
.tac-command button {
  background: #344746;
  border: 1px solid #6c8880;
  padding: 8px;
  min-height: 42px;
  border-radius: 3px;
  border-bottom-width: 3px;
}
.tac-command button:disabled {
  opacity: 0.6;
  cursor: default;
}
.tac-team {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 5px;
}
.tac-team button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  text-align: left;
  padding: 4px;
}
.tac-team button[aria-pressed='true'] {
  border-color: #a5f1cd;
  background: #3e645b;
}
.tac-team .tac-hero {
  flex: 0 0 25px;
  height: 39px;
}
.tac-team small,
.tac-command > small {
  color: #c5d3c9;
  font-size: 0.76rem;
  display: block;
}
.tac-command p {
  margin: 0;
  font-size: 0.91rem;
  line-height: 1.4;
}
.tac-cue {
  color: #f5d89a;
}
.tac-guide {
  color: #e4e7dc;
}
.tac-command .tac-primary {
  font-weight: 700;
  background: #b2e5bc;
  border-color: #d5f2d3;
  color: #17322b;
}
@media (max-width: 660px) {
  .tac-layout {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .tac-board {
    max-width: 480px;
    width: 100%;
    margin: auto;
  }
  .tac-command {
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .tac-team,
  .tac-command .tac-cue,
  .tac-guide,
  .tac-primary {
    grid-column: 1/-1;
  }
  .tac-banner p {
    font-size: 0.8rem;
  }
  .tac-command > small {
    align-self: center;
  }
}
.tac-command details {
  grid-column: 1/-1;
  font-size: 0.82rem;
  color: #cad8ca;
}
.tac-command summary {
  cursor: pointer;
}
.lava .tac-cell.rock {
  background: linear-gradient(#664746, #482e3e);
}
.end .tac-cell.rock {
  background: linear-gradient(#625667, #40394f);
}
.tac-fixture {
  position: absolute;
  inset: 2% 2% 4%;
  background: url('./games/block-maze/assets/maze-landmarks.webp') no-repeat;
  background-size: 400% 500%;
}
.tac-cell.gate .tac-fixture {
  opacity: 0.9;
}

.arcade .tac-banner {
  background-position:
    center,
    center 33.33%;
}
.waterpark .tac-banner {
  background-position:
    center,
    center 66.67%;
}
.store .tac-banner {
  background-position: center, bottom;
}
.castle .tac-banner {
  background-image:
    linear-gradient(90deg, #29202eed, #231e2ec4 58%, #29202e30), url('./assets/realm-panoramas.webp');
  background-size:
    100% 100%,
    100% 300%;
  background-position: center;
}
.tac-mission {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 0.85rem;
}
.tac-mission select {
  font: inherit;
  color: inherit;
  border: 1px solid #647a6c;
  border-radius: 4px;
  padding: 5px;
  background: #213632;
}
.tac-cell:focus-visible {
  outline: 3px solid #fff4b7;
  outline-offset: -4px;
}

/* Phone held sideways: the board fills the height, the mission and team sit
   beside it and scroll on their own, so the board stays in view. */
@media (orientation: landscape) and (max-height: 540px) {
  .tac-game {
    display: grid;
    grid-template-columns: auto minmax(200px, 1fr);
    grid-template-rows: auto auto minmax(0, 1fr);
    column-gap: 10px;
    height: calc(100svh - 62px - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  }
  .tac-banner { grid-column: 2; padding: 6px 8px; }
  .tac-banner h2 { font-size: 1rem; margin: 0; }
  .tac-banner > p { display: none; }
  .tac-stats { grid-column: 2; padding-block: 2px; }
  .tac-game .tac-layout { display: contents; }
  .tac-game .tac-board {
    grid-column: 1;
    grid-row: 1 / span 3;
    align-self: start;
    margin: 6px 0 0 6px;
    width: calc((100svh - 82px - env(safe-area-inset-top) - env(safe-area-inset-bottom)) * 1.344);
    max-width: calc(100vw - 260px);
  }
  .tac-game .tac-command { grid-column: 2; grid-row: 3; min-height: 0; overflow-y: auto; padding: 0 8px 8px; }
}
