.maze-mini {
  place-items: center;
  padding: 8px;
  background: #f7f3ff;
}

.maze-mini-map {
  width: min(100%, 134px);
  aspect-ratio: 1;
  display: block;
  overflow: visible;
  filter: drop-shadow(0 7px 10px rgba(73, 36, 116, 0.1));
}

.maze-mini-surface {
  fill: #fff;
  stroke: #ded2f2;
  stroke-width: 2;
}

.maze-mini-route {
  fill: none;
  stroke: #ffd400;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 2 6;
  opacity: 0.32;
  animation: maze-mini-route-flow 2.8s linear infinite;
}

.maze-mini-walls {
  fill: none;
  stroke: #6d28d9;
  stroke-width: 2.4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.maze-mini-start circle {
  fill: #eee8ff;
  stroke: #7c3aed;
  stroke-width: 1.5;
}

.maze-mini-start text,
.maze-mini-goal text {
  fill: #62358a;
  font-size: 7px;
  font-style: normal;
  font-weight: 900;
  text-anchor: middle;
}

.maze-mini-goal-halo {
  fill: rgba(255, 212, 0, 0.2);
  animation: maze-mini-goal-pulse 1.8s ease-in-out infinite;
}

.maze-mini-goal circle:not(.maze-mini-goal-halo) {
  fill: #ffd400;
  stroke: #fff;
  stroke-width: 2;
}

.maze-mini-goal text {
  fill: #4a3500;
}

.maze-mini-runner-halo {
  fill: rgba(124, 58, 237, 0.18);
  animation: maze-mini-runner-pulse 1.3s ease-in-out infinite;
}

.maze-mini-runner-ball {
  fill: #7c3aed;
  stroke: #fff;
  stroke-width: 2;
}

.maze-mini-runner path {
  fill: #fff;
}

.maze-mini-obstacle-halo {
  fill: rgba(229, 72, 77, 0.17);
  animation: maze-mini-obstacle-pulse 1.2s ease-in-out infinite;
}

.maze-mini-obstacle > circle:nth-of-type(2) {
  fill: #e5484d;
  stroke: #fff;
  stroke-width: 1.5;
}

.maze-mini-obstacle-core {
  fill: #fff;
}

.maze-mini-obstacle-two .maze-mini-obstacle-halo {
  animation-delay: -0.6s;
}

@keyframes maze-mini-route-flow {
  to {
    stroke-dashoffset: -16;
  }
}

@keyframes maze-mini-goal-pulse {
  0%,
  100% {
    opacity: 0.32;
    transform: scale(0.82);
    transform-origin: 140px 140px;
  }

  50% {
    opacity: 1;
    transform: scale(1.16);
    transform-origin: 140px 140px;
  }
}

@keyframes maze-mini-runner-pulse {
  0%,
  100% {
    opacity: 0.34;
    transform: scale(0.82);
  }

  50% {
    opacity: 0.72;
    transform: scale(1.12);
  }
}

@keyframes maze-mini-obstacle-pulse {
  0%,
  100% {
    opacity: 0.34;
    transform: scale(0.82);
  }

  50% {
    opacity: 0.76;
    transform: scale(1.12);
  }
}

@media (prefers-reduced-motion: reduce) {
  .maze-mini animateMotion {
    display: none;
  }

  .maze-mini-runner {
    transform: translate(20px, 20px);
  }

  .maze-mini-obstacle {
    display: none;
  }
}

.maze-entry-shell {
  width: min(100%, 620px);
  overflow-x: clip;
}

.maze-cover-topbar {
  flex: 0 0 auto;
}

.maze-hero {
  width: 100%;
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  align-items: center;
  gap: 24px;
  padding: 18px 0 10px;
}

.maze-hero > div:first-child {
  min-width: 0;
}

.maze-hero .brand-mark {
  margin-bottom: 14px;
}

.maze-title {
  margin: 10px 0 15px;
  color: var(--teal-dark);
  font-size: 47px;
  font-weight: 900;
}

.maze-title span {
  color: #b88200;
}

.maze-hero .lead {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.72;
}

.maze-cover-board {
  position: relative;
  width: 190px;
  max-width: 100%;
  aspect-ratio: 1;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(6, 1fr);
  overflow: hidden;
  border: 3px solid var(--teal-dark);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 12px 28px rgba(109, 40, 217, 0.14);
  animation: maze-board-float 4.8s ease-in-out infinite;
}

.cover-maze-cell {
  min-width: 0;
  border-top: 1px solid rgba(109, 40, 217, 0.38);
  border-left: 1px solid rgba(109, 40, 217, 0.38);
  background: #faf8ff;
}

.cover-maze-cell:nth-child(6n) {
  border-right: 1px solid rgba(109, 40, 217, 0.38);
}

.cover-maze-cell:nth-last-child(-n + 6) {
  border-bottom: 1px solid rgba(109, 40, 217, 0.38);
}

.cover-maze-cell:nth-child(2),
.cover-maze-cell:nth-child(5),
.cover-maze-cell:nth-child(8),
.cover-maze-cell:nth-child(9),
.cover-maze-cell:nth-child(13),
.cover-maze-cell:nth-child(17),
.cover-maze-cell:nth-child(20),
.cover-maze-cell:nth-child(22),
.cover-maze-cell:nth-child(27),
.cover-maze-cell:nth-child(29),
.cover-maze-cell:nth-child(34) {
  border-left-color: transparent;
}

.cover-maze-cell:nth-child(3),
.cover-maze-cell:nth-child(7),
.cover-maze-cell:nth-child(11),
.cover-maze-cell:nth-child(15),
.cover-maze-cell:nth-child(18),
.cover-maze-cell:nth-child(23),
.cover-maze-cell:nth-child(26),
.cover-maze-cell:nth-child(31),
.cover-maze-cell:nth-child(33),
.cover-maze-cell:nth-child(35) {
  border-top-color: transparent;
}

.maze-cover-board b,
.maze-cover-board em {
  position: absolute;
  z-index: 2;
  width: 24px;
  height: 24px;
  border: 3px solid #fff;
  border-radius: 50%;
  box-shadow: 0 4px 9px rgba(37, 29, 45, 0.2);
}

.maze-cover-board b {
  top: 5px;
  left: 5px;
  background: var(--teal);
  animation: maze-cover-ball 3.6s cubic-bezier(0.45, 0, 0.55, 1) infinite;
}

.maze-cover-board em {
  right: 5px;
  bottom: 5px;
  background: var(--yellow);
}

@keyframes maze-board-float {
  50% {
    transform: translateY(-5px);
    box-shadow: 0 17px 32px rgba(109, 40, 217, 0.18);
  }
}

@keyframes maze-cover-ball {
  0%,
  12% {
    transform: translate(0, 0);
  }
  25%,
  37% {
    transform: translate(52px, 0);
  }
  50%,
  62% {
    transform: translate(52px, 52px);
  }
  75%,
  87% {
    transform: translate(104px, 52px);
  }
  100% {
    transform: translate(104px, 104px);
  }
}

.maze-guide-shell {
  width: min(100%, 660px);
}

.maze-reverse-map {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  margin: 20px 0;
}

.maze-reverse-map span {
  min-width: 0;
  min-height: 70px;
  display: grid;
  place-content: center;
  gap: 4px;
  border: 1px solid #ddd3ef;
  border-top: 4px solid var(--yellow);
  border-radius: 7px;
  background: #fff;
  text-align: center;
}

.maze-reverse-map span:nth-child(even) {
  border-top-color: var(--teal);
}

.maze-reverse-map b {
  color: var(--teal-dark);
  font-size: 15px;
}

.maze-reverse-map i {
  color: var(--muted);
  font-size: 10px;
  font-style: normal;
  font-weight: 750;
}

.maze-shell {
  width: min(100%, 720px);
}

.maze-lobby {
  gap: 19px;
}

.maze-participant .participant-order {
  border-color: var(--participant-color);
  color: var(--participant-color);
  background: #fff;
}

.maze-setup {
  gap: 23px;
}

.maze-mode-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 7px;
}

.maze-mode-tabs button {
  min-width: 0;
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 5px;
  padding: 11px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.maze-mode-tabs button.selected {
  border: 2px solid var(--teal);
  background: var(--purple-soft);
}

.maze-mode-tabs strong,
.maze-mode-tabs span {
  display: block;
}

.maze-mode-tabs strong {
  font-size: 13px;
}

.maze-mode-tabs span {
  color: var(--muted);
  font-size: 9px;
}

.maze-size-segments {
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.maze-size-segments .segment {
  min-width: 0;
  padding-right: 3px;
  padding-left: 3px;
  font-size: 11px;
}

.maze-guest-config {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 15px 0;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.maze-guest-config span {
  color: var(--muted);
  font-size: 11px;
}

.maze-guest-config strong {
  color: var(--teal-dark);
  font-size: 13px;
}

.maze-lobby-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.maze-lobby-actions .primary-button,
.maze-lobby-actions .secondary-button {
  margin-top: 0;
}

.maze-game-shell {
  width: min(100%, 720px);
  gap: 10px;
  padding-bottom: max(28px, env(safe-area-inset-bottom));
}

.maze-game-header {
  min-height: 52px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line);
}

.maze-game-header > div:first-child {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.maze-game-header > div:first-child span {
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 750;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maze-game-header > div:first-child strong {
  color: var(--teal-dark);
  font-size: 22px;
  font-variant-numeric: tabular-nums;
}

.maze-reverse-alert {
  min-height: 45px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 12px;
  border-left: 5px solid var(--yellow);
  color: var(--ink);
  background: var(--gold-soft);
  text-align: center;
}

.maze-reverse-alert span {
  padding: 4px 6px;
  border-radius: 4px;
  color: #fff;
  background: var(--teal-dark);
  font-size: 9px;
  font-weight: 850;
}

.maze-reverse-alert strong {
  font-size: 13px;
}

.maze-reverse-alert.normal {
  border-left-color: #55c895;
  background: #effbf5;
}

.maze-reverse-alert.normal span {
  background: #14845b;
}

.maze-switch-setting {
  margin-bottom: 0;
}

.maze-board-wrap {
  width: 100%;
  display: grid;
  place-items: center;
}

.maze-board {
  position: relative;
  width: min(100%, 600px);
  aspect-ratio: 1;
  overflow: hidden;
  border: 3px solid var(--teal-dark);
  border-radius: 6px;
  background: #fff;
  box-shadow:
    0 12px 26px rgba(109, 40, 217, 0.12),
    inset 0 0 0 1px rgba(255, 212, 0, 0.32);
  isolation: isolate;
}

.maze-cell-grid,
.maze-wall-layer,
.maze-obstacle-layer,
.maze-player-layer {
  position: absolute;
  inset: 0;
}

.maze-cell-grid {
  display: grid;
  grid-template-columns: repeat(var(--maze-size), minmax(0, 1fr));
  grid-template-rows: repeat(var(--maze-size), minmax(0, 1fr));
}

.maze-wall-layer {
  z-index: 2;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.maze-wall-layer path {
  fill: none;
  stroke: #563077;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.maze-cell {
  position: relative;
  min-width: 0;
  min-height: 0;
  margin: 0;
  background: #fff;
}

.maze-start-cell {
  background: #f2edff;
}

.maze-goal-cell {
  background: #fff7c2;
}

.maze-cell > span,
.maze-cell > strong {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: rgba(109, 40, 217, 0.42);
  font-size: clamp(8px, 2.4vw, 14px);
  font-weight: 900;
}

.maze-cell > strong {
  color: #8a6900;
}

.maze-obstacle-layer,
.maze-player-layer {
  pointer-events: none;
}

.maze-obstacle {
  position: absolute;
  z-index: 3;
  width: calc(60% / var(--maze-size));
  max-width: 34px;
  min-width: 13px;
  aspect-ratio: 1;
  border: 3px solid #fff;
  border-radius: 50%;
  background: #f05252;
  box-shadow:
    0 3px 8px rgba(86, 20, 20, 0.24),
    0 0 0 2px rgba(240, 82, 82, 0.2);
  transform: translate(-50%, -50%);
}

.maze-obstacle::after {
  position: absolute;
  top: 23%;
  right: 23%;
  width: 25%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  content: "";
}

.maze-ball {
  position: absolute;
  z-index: 5;
  width: calc(70% / var(--maze-size));
  max-width: 38px;
  min-width: 17px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 3px solid #fff;
  border-radius: 50%;
  color: #fff;
  background: var(--ball-color, var(--teal));
  box-shadow:
    0 4px 9px rgba(37, 29, 45, 0.24),
    0 0 0 2px rgba(109, 40, 217, 0.13);
  transform:
    translate(
      calc(-50% + var(--ball-offset, 0px)),
      -50%
    );
  transition:
    top 130ms cubic-bezier(0.2, 1.35, 0.4, 1),
    left 130ms cubic-bezier(0.2, 1.35, 0.4, 1);
}

.maze-ball.mine {
  z-index: 6;
  box-shadow:
    0 0 0 3px rgba(255, 212, 0, 0.66),
    0 5px 11px rgba(37, 29, 45, 0.25);
}

.maze-ball.finished {
  opacity: 0.38;
}

.maze-ball i {
  max-width: 100%;
  overflow: hidden;
  font-size: clamp(7px, 1.7vw, 11px);
  font-style: normal;
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maze-ball-shared {
  --ball-color: var(--teal-dark);
}

.maze-ball-shared::after {
  position: absolute;
  inset: -7px;
  border: 2px solid rgba(255, 212, 0, 0.62);
  border-radius: 50%;
  content: "";
  animation: maze-shared-pulse 1.5s ease-in-out infinite;
}

@keyframes maze-shared-pulse {
  50% {
    opacity: 0.2;
    transform: scale(1.16);
  }
}

.maze-pause-overlay {
  position: absolute;
  z-index: 10;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--teal-dark);
  background: rgba(255, 255, 255, 0.88);
}

.maze-pause-overlay strong {
  padding: 10px 15px;
  border: 2px solid var(--yellow);
  border-radius: 6px;
  background: #fff;
  font-size: 19px;
}

.maze-rule-transition-overlay {
  align-content: center;
  gap: 10px;
  padding: 20px;
  text-align: center;
}

.maze-rule-transition-overlay > span {
  color: var(--coral);
  font-size: 11px;
  font-weight: 850;
}

.maze-rule-transition-overlay strong {
  min-width: 132px;
  font-size: 24px;
}

.maze-rule-transition-overlay small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.maze-rule-transition-overlay small b {
  color: var(--teal-dark);
  font-size: 16px;
  font-variant-numeric: tabular-nums;
}

.maze-live-roster {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(98px, 1fr));
  gap: 1px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--line);
}

.maze-live-roster > div {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 7px;
  padding: 8px;
  background: #fff;
}

.maze-live-roster > div.mine {
  background: var(--gold-soft);
}

.maze-live-roster span {
  min-width: 0;
  overflow: hidden;
  color: var(--player-color);
  font-size: 10px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maze-live-roster b {
  color: var(--teal-dark);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.maze-live-roster small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 8px;
}

.maze-controller {
  display: grid;
  place-items: center;
  padding: 12px 0 0;
  border-top: 1px solid var(--line);
}

.maze-dpad {
  display: grid;
  grid-template-columns: repeat(3, 68px);
  grid-template-rows: repeat(3, 58px);
  gap: 5px;
}

.maze-direction {
  min-width: 0;
  min-height: 0;
  display: grid;
  place-content: center;
  gap: 1px;
  padding: 2px;
  border: 1px solid #d9cdf5;
  border-radius: 7px;
  color: var(--teal-dark);
  background: var(--purple-soft);
  box-shadow: 0 4px 10px rgba(109, 40, 217, 0.09);
  touch-action: manipulation;
  user-select: none;
}

.maze-direction span {
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.maze-direction small {
  color: var(--muted);
  font-size: 8px;
  font-weight: 750;
}

.maze-direction:active:not(:disabled) {
  border-color: var(--yellow);
  background: var(--gold-soft);
  transform: scale(0.92);
}

.solo-coach-mode .maze-direction:active:not(:disabled) {
  transform: none;
}

.maze-direction:disabled {
  cursor: default;
  opacity: 0.28;
}

.maze-up {
  grid-column: 2;
  grid-row: 1;
}

.maze-left {
  grid-column: 1;
  grid-row: 2;
}

.maze-right {
  grid-column: 3;
  grid-row: 2;
}

.maze-down {
  grid-column: 2;
  grid-row: 3;
}

.maze-dpad-center {
  grid-column: 2;
  grid-row: 2;
  display: grid;
  place-items: center;
}

.maze-dpad-center span {
  width: 39px;
  height: 39px;
  display: grid;
  place-items: center;
  border: 2px solid var(--yellow);
  border-radius: 50%;
  color: #fff;
  background: var(--teal-dark);
  font-size: 17px;
  font-weight: 900;
}

.maze-dpad-center.normal span {
  border-color: #55c895;
  background: #14845b;
}

.maze-finished-note {
  padding: 12px 14px;
  border-left: 4px solid #159a68;
  color: #0f704b;
  background: #effbf5;
  font-size: 11px;
  font-weight: 750;
  text-align: center;
}

.maze-result {
  justify-content: flex-start;
}

.maze-result-heading {
  padding: 24px 0 18px;
  border-bottom: 1px solid var(--line);
}

.maze-result-heading h1 {
  color: var(--teal-dark);
}

.maze-result-heading > span {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.maze-result-list {
  border-top: 1px solid var(--line);
}

.maze-result-row {
  min-height: 58px;
  display: grid;
  grid-template-columns: 28px minmax(75px, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 8px 4px;
  border-bottom: 1px solid var(--line);
}

.maze-result-row.winner {
  background: var(--gold-soft);
}

.maze-result-row > span {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: var(--teal);
  font-size: 11px;
  font-weight: 850;
}

.maze-result-row strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maze-result-row b {
  color: var(--teal-dark);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.maze-result-row small {
  color: var(--muted);
  font-size: 9px;
}

@media (max-width: 620px) {
  .maze-hero {
    grid-template-columns: minmax(0, 1fr) 142px;
    gap: 15px;
  }

  .maze-cover-board {
    width: 142px;
  }

  .maze-cover-board b,
  .maze-cover-board em {
    width: 20px;
    height: 20px;
  }

  .maze-cover-board b {
    top: 3px;
    left: 3px;
  }

  .maze-cover-board em {
    right: 3px;
    bottom: 3px;
  }

  @keyframes maze-cover-ball {
    0%,
    12% {
      transform: translate(0, 0);
    }
    25%,
    37% {
      transform: translate(38px, 0);
    }
    50%,
    62% {
      transform: translate(38px, 38px);
    }
    75%,
    87% {
      transform: translate(76px, 38px);
    }
    100% {
      transform: translate(76px, 76px);
    }
  }

  .maze-board {
    width: 100%;
  }

  .maze-dpad {
    grid-template-columns: repeat(3, 74px);
    grid-template-rows: repeat(3, 60px);
  }
}

@media (max-width: 480px) {
  .maze-hero {
    grid-template-columns: minmax(0, 1fr) 116px;
  }

  .maze-title {
    font-size: 38px;
  }

  .maze-cover-board {
    width: 116px;
  }

  .maze-cover-board b,
  .maze-cover-board em {
    width: 18px;
    height: 18px;
  }

  @keyframes maze-cover-ball {
    0%,
    12% {
      transform: translate(0, 0);
    }
    25%,
    37% {
      transform: translate(31px, 0);
    }
    50%,
    62% {
      transform: translate(31px, 31px);
    }
    75%,
    87% {
      transform: translate(62px, 31px);
    }
    100% {
      transform: translate(62px, 62px);
    }
  }

  .maze-mode-tabs {
    grid-template-columns: 1fr;
  }

  .maze-mode-tabs button {
    min-height: 58px;
  }

  .maze-size-segments {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .maze-lobby-actions {
    grid-template-columns: 1fr;
  }

  .maze-game-shell {
    padding-right: 12px;
    padding-left: 12px;
  }

  .maze-result-row {
    grid-template-columns: 26px minmax(64px, 1fr) auto;
  }

  .maze-result-row small {
    grid-column: 2 / -1;
    text-align: right;
  }
}

@media (max-width: 360px) {
  .maze-reverse-map {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .maze-game-header {
    align-items: flex-start;
  }

  .maze-game-header .game-controls {
    display: grid;
    grid-template-columns: repeat(2, auto);
  }

  .maze-dpad {
    grid-template-columns: repeat(3, 68px);
    grid-template-rows: repeat(3, 56px);
  }

  .maze-live-roster {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-height: 760px) and (max-width: 620px) {
  .maze-game-shell {
    gap: 7px;
    padding-top: max(8px, env(safe-area-inset-top));
  }

  .maze-game-header {
    min-height: 42px;
  }

  .maze-reverse-alert {
    min-height: 38px;
  }

  .maze-board {
    width: min(100%, 46dvh);
  }

  .maze-live-roster > div {
    padding: 6px;
  }

  .maze-controller {
    padding-top: 7px;
  }

  .maze-dpad {
    grid-template-columns: repeat(3, 58px);
    grid-template-rows: repeat(3, 48px);
  }

  .maze-direction span {
    font-size: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .maze-cover-board,
  .maze-cover-board b,
  .maze-ball-shared::after {
    animation: none;
  }
}

/* ===== 反转追逐（chase） ===== */
.maze-mode-tabs-4 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.chase-grid-bg {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(86, 48, 119, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(86, 48, 119, 0.07) 1px, transparent 1px),
    #fdfcff;
  background-size: calc(100% / var(--maze-size))
    calc(100% / var(--maze-size));
}

.chase-obstacle-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.chase-obstacle {
  position: absolute;
  width: calc(100% / var(--maze-size));
  height: calc(100% / var(--maze-size));
  background:
    repeating-linear-gradient(
      45deg,
      #d9cced 0 5px,
      #cbb8e6 5px 10px
    );
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(86, 48, 119, 0.18);
}

.chase-snake,
.chase-ball {
  position: absolute;
  z-index: 5;
  width: calc(82% / var(--maze-size));
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  transform: translate(-50%, -50%);
  transition:
    top 240ms cubic-bezier(0.2, 1.35, 0.4, 1),
    left 240ms cubic-bezier(0.2, 1.35, 0.4, 1);
}

.chase-snake {
  max-width: 42px;
  min-width: 20px;
  border-radius: 34% 34% 42% 42%;
  background: linear-gradient(160deg, #3fbf8f 0%, #168b61 100%);
  box-shadow:
    0 4px 10px rgba(11, 82, 57, 0.3),
    inset 0 2px 0 rgba(255, 255, 255, 0.3);
  animation: chase-snake-breathe 1.6s ease-in-out infinite;
}

.chase-snake-face {
  display: flex;
  gap: 18%;
  width: 52%;
  aspect-ratio: 1;
}

.chase-snake-face b {
  flex: 1;
  background: #fff;
  border-radius: 50%;
  position: relative;
}

.chase-snake-face b::after {
  content: "";
  position: absolute;
  left: 28%;
  top: 30%;
  width: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #173c2c;
}

.chase-ball {
  max-width: 34px;
  min-width: 16px;
  border: 3px solid #fff;
  border-radius: 50%;
  background: radial-gradient(circle at 32% 28%, #ffd966 0%, #f5a623 78%);
  box-shadow:
    0 4px 9px rgba(122, 74, 0, 0.3),
    0 0 0 2px rgba(245, 166, 35, 0.22);
}

.chase-ball i {
  position: absolute;
  top: 16%;
  right: 18%;
  width: 26%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.8);
}

@keyframes chase-snake-breathe {
  0%,
  100% {
    scale: 1;
  }
  50% {
    scale: 1.07;
  }
}

.chase-status {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.chase-status-side {
  min-width: 0;
  display: grid;
  gap: 2px;
  padding: 6px 9px;
  border-radius: 7px;
  border: 2px solid transparent;
}

.chase-status-side.mine {
  border-color: var(--teal);
  background: var(--purple-soft);
}

.chase-status-side:last-child {
  justify-items: end;
  text-align: right;
}

.chase-status-role {
  color: var(--ink);
  font-size: 11px;
  font-weight: 850;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.chase-status-side b {
  font-size: 19px;
  font-variant-numeric: tabular-nums;
}

.chase-status-side small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 750;
}

.chase-status-center {
  display: grid;
  justify-items: center;
  gap: 2px;
  padding: 4px 12px;
  border-radius: 7px;
  background: #f4f0fa;
}

.chase-status-center b {
  color: var(--teal-dark);
  font-size: 24px;
  font-variant-numeric: tabular-nums;
}

.chase-status-center small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
}

.chase-controller {
  gap: 12px;
}

.chase-controller .maze-dpad {
  grid-template-columns: repeat(3, 84px);
  grid-template-rows: repeat(3, 72px);
  gap: 8px;
}

.chase-controller .chase-direction {
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(109, 40, 217, 0.14);
}

.chase-controller .chase-direction span {
  font-size: 30px;
}

.chase-controller .maze-dpad-center span {
  width: 44px;
  height: 44px;
  font-size: 18px;
}

.chase-my-role {
  display: grid;
  justify-items: center;
  gap: 3px;
  width: 100%;
  padding: 9px 10px;
  border-radius: 8px;
  text-align: center;
}

.chase-my-role.as-snake {
  color: #0b5239;
  background: rgba(63, 191, 143, 0.14);
}

.chase-my-role.as-ball {
  color: #7a4a00;
  background: rgba(245, 166, 35, 0.16);
}

.chase-my-role strong {
  font-size: 13px;
}

.chase-my-role small {
  font-size: 10px;
  font-weight: 700;
}

/* 球方移动冷却反馈：方向键短暂变淡，松开即恢复 */
.chase-controller .maze-dpad .maze-direction {
  transition: opacity 0.12s ease, transform 0.12s ease;
}

.chase-controller .maze-dpad.chase-dpad-cooldown .maze-direction {
  opacity: 0.45;
  transform: scale(0.96);
}

.chase-round-overlay {
  display: grid;
  justify-items: center;
  gap: 6px;
  text-align: center;
}

.chase-round-overlay strong {
  font-size: 22px;
}

@media (max-width: 560px) {
  .chase-status {
    gap: 6px;
    padding: 8px 9px;
  }

  .chase-status-center b {
    font-size: 20px;
  }

  .chase-status-role {
    font-size: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .chase-snake {
    animation: none;
  }
}
