/* PackSeal -- used by the /arcade/ page only. */

.ps-tools {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: 0 0 1rem;
}

.ps-tools button {
  padding: 0.4rem 1rem;
  border: 1px solid var(--card-line);
  border-radius: 999px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), color 0.2s var(--ease);
}

.ps-tools button:hover { border-color: var(--accent); color: var(--accent); }

.ps-bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: clamp(1.2rem, 6vw, 3rem);
  margin: 0 0 1.1rem;
  padding: 0;
  list-style: none;
}

.ps-bar li { text-align: center; }

.ps-bar b {
  display: block;
  min-height: 2.2rem;
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.ps-bar span {
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--muted);
}

.ps-wrap {
  position: relative;
  width: min(100%, 456px);
  margin: 0 auto;
  border-radius: var(--radius);
  outline-offset: 4px;
}

.ps-wrap canvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 19 / 21;
  border-radius: var(--radius);
  border: 1px solid var(--card-line);
  background: #0a0e1a;
  box-shadow: 0 30px 70px -34px rgba(0,0,0,1), 0 0 40px -18px rgba(74,134,255,0.55);
  touch-action: none;        /* swiping the board steers; it doesn't scroll the page */
}

.ps-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 1.2rem;
  text-align: center;
  border-radius: var(--radius);
  background: rgba(7,9,15,0.78);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.ps-overlay[hidden] { display: none; }

.ps-overlay h3 {
  margin: 0;
  font-size: 1.7rem;
  font-weight: 700;
  background: linear-gradient(100deg, var(--accent), var(--magenta));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ps-overlay p {
  margin: 0 0 0.8rem;
  max-width: 30ch;
  color: var(--muted);
  font-size: 0.92rem;
}

.ps-overlay button {
  padding: 0.55rem 1.4rem;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: rgba(255,159,46,0.14);
  color: var(--accent);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s var(--ease), color 0.2s var(--ease);
}

.ps-overlay button:hover { background: var(--accent); color: #07090f; }
.ps-overlay button:disabled { opacity: 0.4; cursor: not-allowed; }
.ps-overlay button:disabled:hover { background: rgba(255,159,46,0.14); color: var(--accent); }

/* the initials box (styled by .snake-name in snake.css) lives in this overlay; its Skip is a plain link */
.ps-overlay [hidden] { display: none !important; }
.ps-overlay .snake-skip {
  padding: 0.3rem 0.5rem;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 400;
  text-decoration: underline;
}
.ps-overlay .snake-skip:hover { background: none; color: var(--text); }

.ps-hint {
  margin: 1rem 0 0;
  text-align: center;
  font-size: 0.82rem;
  color: var(--muted);
}

/* on-screen arrows: only worth showing on touch screens */
.ps-pad {
  display: none;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(2, 56px);
  gap: 8px;
  justify-content: center;
  margin: 1.1rem auto 0;
}

@media (hover: none) and (pointer: coarse) {
  .ps-pad { display: grid; }
}

.ps-pad button {
  border: 1px solid var(--card-line);
  border-radius: 14px;
  background: var(--card);
  color: var(--text);
  font: inherit;
  font-size: 1.3rem;
  cursor: pointer;
  touch-action: manipulation;
}

.ps-pad button:active { background: var(--accent); color: #07090f; }
.ps-pad [data-ps-dir="up"]    { grid-column: 2; grid-row: 1; }
.ps-pad [data-ps-dir="left"]  { grid-column: 1; grid-row: 2; }
.ps-pad [data-ps-dir="down"]  { grid-column: 2; grid-row: 2; }
.ps-pad [data-ps-dir="right"] { grid-column: 3; grid-row: 2; }

/* ---------- fullscreen ----------
   The stage fills the screen and the board (19 wide by 21 tall) is as big as fits beside the
   buttons and score. .pseudo-full is the same thing pinned by hand for browsers without the API. */
.ps-stage:fullscreen,
.ps-stage:-webkit-full-screen,
.ps-stage.pseudo-full {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.2rem;
  width: 100%;
  height: 100%;
  padding: 0.8rem;
  background: radial-gradient(ellipse at 50% 0%, var(--bg-2) 0%, var(--bg) 70%);
  overflow: auto;
}

.ps-stage.pseudo-full {
  position: fixed;
  inset: 0;
  z-index: 200;
  height: 100dvh;
}

.ps-stage.is-full > * { flex-shrink: 0; }
.ps-stage.is-full .ps-tools { margin-bottom: 0.4rem; }
.ps-stage.is-full .ps-bar { margin-bottom: 0.4rem; gap: 2.4rem; }
.ps-stage.is-full .ps-hint { margin-top: 0.5rem; }

.ps-stage.is-full .ps-wrap {
  width: min(94vw, calc((100vh - 12.5rem) * 19 / 21));
  width: min(94vw, calc((100dvh - 12.5rem) * 19 / 21));
}

/* touch screens also show the arrow pad under the board, so leave more room for it */
@media (hover: none) and (pointer: coarse) {
  .ps-stage.is-full .ps-wrap {
    width: min(94vw, calc((100vh - 19rem) * 19 / 21));
    width: min(94vw, calc((100dvh - 19rem) * 19 / 21));
  }
}

.ps-noscroll, .ps-noscroll body { overflow: hidden; }
