/* Help Starlight Find Gus — maze game */
.g-maze { --pad-size: 64px; }
.g-maze .game-bar .stat { line-height: 30px; }
.g-maze .icon-btn[disabled] { opacity: .4; cursor: not-allowed; box-shadow: inset 0 0 0 2px var(--line); }
.g-maze .g-maze__hint { min-height: 48px; }

.g-maze__stage { display: flex; flex-wrap: wrap; gap: 20px 28px; align-items: center; justify-content: center; }
.g-maze__board {
  flex: 0 1 auto;
  width: 640px; /* fallback */
  width: min(100%, 680px, max(290px, calc(100vh - 230px)));
  width: min(100%, 680px, max(290px, calc(100svh - 230px)));
  border-radius: 22px; padding: 0; position: relative;
  box-shadow: 0 0 0 4px #fff, 0 0 0 7px var(--sky), 0 14px 30px rgba(30, 36, 82, .18);
  background: #eef3ff; overflow: hidden;
}
.g-maze__canvas {
  display: block; width: 100%; aspect-ratio: 1 / 1; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent;
  cursor: pointer; outline: none;
}
.g-maze__board:has(.g-maze__canvas:focus-visible) { box-shadow: 0 0 0 4px #fff, 0 0 0 8px var(--gold), 0 14px 30px rgba(30, 36, 82, .18); }

.g-maze__side { display: flex; flex-direction: column; align-items: center; gap: 14px; max-width: 240px; }
.g-maze__tip { margin: 0; text-align: center; font-size: .95rem; color: var(--ink-soft); line-height: 1.4; }

.g-maze__dpad {
  display: grid; grid-template-columns: repeat(3, var(--pad-size)); grid-template-rows: repeat(3, var(--pad-size));
  gap: 6px; padding: 10px; border-radius: 50%; background: var(--sky);
  box-shadow: inset 0 0 0 3px #fff, 0 8px 20px rgba(30, 36, 82, .14);
  -webkit-user-select: none; user-select: none; touch-action: none;
}
.g-maze__pad {
  border: 0; border-radius: 18px; cursor: pointer; font-size: 1.5rem; color: #fff;
  background: var(--berry); box-shadow: 0 5px 0 var(--berry-dark);
  display: grid; place-items: center; touch-action: none; -webkit-tap-highlight-color: transparent;
  transition: transform .08s, box-shadow .08s, background .15s;
}
.g-maze__pad:hover { background: #ec3a71; }
.g-maze__pad.is-down, .g-maze__pad:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--berry-dark); }
.g-maze__pad--up { grid-column: 2; grid-row: 1; }
.g-maze__pad--left { grid-column: 1; grid-row: 2; }
.g-maze__pad--right { grid-column: 3; grid-row: 2; }
.g-maze__pad--down { grid-column: 2; grid-row: 3; }
.g-maze__pad-mid { grid-column: 2; grid-row: 2; display: grid; place-items: center; font-size: 1.6rem; background: #fff; border-radius: 50%; margin: 6px; box-shadow: inset 0 0 0 3px var(--line); }

.g-maze__sr { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* tablets / phones: D-pad under the maze, a touch more compact */
@media (max-width: 900px) {
  .g-maze__side { max-width: none; width: 100%; }
}
@media (max-width: 620px) {
  .g-maze { --pad-size: 56px; }
  .g-maze .game-bar { gap: 8px; margin-bottom: 12px; }
  .g-maze .game-bar .group { gap: 6px; }
  .g-maze .game-bar .stat { padding: 6px 12px; font-size: .98rem; }
  .g-maze .g-maze__hint { padding: 8px 14px; font-size: .92rem; }
  .g-maze__board { width: 100%; border-radius: 16px; }
  .g-maze__stage { gap: 16px; }
}
@media (max-width: 380px) {
  .g-maze { --pad-size: 52px; }
  .g-maze .g-maze__hint { padding: 8px 12px; }
}
@media (prefers-reduced-motion: reduce) {
  .g-maze__pad { transition: none; }
}
