/* Arrow Escape (箭头迷宫) — page styles.
 *
 * The Nintendo-2001 chrome (colors, bevels, buttons) comes from
 * /assets/game.css. This file only styles the board, the lines and the
 * two animations of this game.
 */

.ae-status {
  margin: 10px 0 0;
  min-height: 18px;
  color: var(--signal);
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 3px;
  text-align: center;
}

.ae-board {
  max-width: 520px;
  margin: 0 auto;
  padding: 0;
}
.ae-board svg {
  display: block;
  width: 100%;
  height: auto;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  overflow: hidden;
}

.ae-plate {
  fill: var(--surface);
  stroke: var(--chrome);
  stroke-width: 2;
  filter: drop-shadow(0 1px 2px rgba(33, 36, 46, 0.28));
}
.ae-grid-lines {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}

.ae-arrow {
  cursor: pointer;
}
/* A tap must not leave a focus frame on the board, a keyboard user
   still gets one. */
.ae-arrow:focus { outline: none; }
.ae-arrow:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
}
.ae-line {
  fill: none;
  stroke: var(--ae-color, var(--ink));
  stroke-width: 13;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.ae-head-shape {
  fill: var(--ae-color, var(--ink));
  stroke: none;
}
.ae-hit {
  fill: none;
  stroke: transparent;
  stroke-width: 30;
  pointer-events: stroke;
  cursor: pointer;
}

/* Blocked: a short poke forward, a colour flash and back. */
@keyframes ae-nudge {
  0% { transform: translate(0, 0); }
  32% { transform: translate(var(--ae-dx, 0px), var(--ae-dy, 0px)); }
  100% { transform: translate(0, 0); }
}
@keyframes ae-flash-line {
  0%, 55% { stroke: var(--primary); }
  100% { stroke: var(--ae-color, var(--ink)); }
}
@keyframes ae-flash-head {
  0%, 55% { fill: var(--primary); }
  100% { fill: var(--ae-color, var(--ink)); }
}
.ae-arrow.is-blocked {
  animation: ae-nudge 360ms cubic-bezier(0.32, 0.72, 0.35, 1);
}
.ae-arrow.is-blocked .ae-line { animation: ae-flash-line 360ms linear; }
.ae-arrow.is-blocked .ae-head-shape { animation: ae-flash-head 360ms linear; }

/* Reduced motion: the line leaves at once, the blocked line only
   changes colour. */
.ae-fade {
  opacity: 0;
  transition: opacity 160ms linear;
}
@media (prefers-reduced-motion: reduce) {
  .ae-arrow.is-blocked { animation: none; }
  .ae-arrow.is-blocked .ae-line { animation: ae-flash-line 260ms linear; }
  .ae-arrow.is-blocked .ae-head-shape { animation: ae-flash-head 260ms linear; }
  .ae-fade { transition-duration: 80ms; }
}

.ae-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  max-width: 520px;
  margin: 14px auto 0;
}

/* .btn sets display:inline-flex, so the hidden attribute needs a
   little help. */
.ae-actions .btn[hidden] { display: none; }
