/* ============================================================
   Pastel Stack — game-only styles (linked from games/pastel-stack.html)
   Uses site tokens from styles.css
   ============================================================ */

.ps-game {
  position: relative;
  overflow: visible;
  padding-bottom: 20px;
}

.ps-help {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.35;
  text-align: center;
}

.ps-game kbd {
  display: inline-block;
  padding: 0 5px;
  font-family: 'VT323', monospace;
  font-size: 0.95em;
  line-height: 1.2;
  color: var(--text-dark);
  background: var(--bg-window-alt);
  border: 1px solid var(--border);
  border-radius: 3px;
  box-shadow: 1px 1px 0 var(--shadow);
}

/* ---- HUD ---- */
.ps-hud {
  display: flex;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: center;
  gap: 8px;
  margin-bottom: 7px;
}

.ps-stat {
  min-width: 72px;
  min-height: 48px;
  padding: 6px 10px;
  text-align: center;
  background: var(--bg-window);
  border: 2px solid var(--border);
  box-shadow: 2px 2px 0 var(--shadow);
}

.ps-stat-label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
}

.ps-stat-value {
  color: var(--text-dark);
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
}

.ps-status {
  min-height: 20px;
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.2;
  text-align: center;
}

/* ---- layout: hold | board | next ---- */
.ps-layout {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  gap: 10px;
  margin: 0 auto 13px;
  max-width: 420px;
}

.ps-side {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  padding: 6px;
  background:
    radial-gradient(circle at 18% 14%, rgba(255, 255, 255, 0.92) 0 2px, transparent 3px),
    linear-gradient(145deg, rgba(255, 214, 234, 0.7), rgba(203, 182, 240, 0.6));
  border: 2px solid var(--border);
  box-shadow: inset 1px 1px 0 rgba(255, 255, 255, 0.75), 2px 2px 0 var(--shadow);
  border-radius: 8px;
}

.ps-side-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 7px;
  color: var(--muted);
  letter-spacing: 0.5px;
}

.ps-mini {
  display: block;
  width: 72px;
  height: 72px;
  background: rgba(255, 250, 253, 0.55);
  border: 1px solid rgba(155, 77, 138, 0.28);
  border-radius: 8px;
}

.ps-mini.ps-next {
  height: 216px;
}

.ps-stage-shell {
  flex: 0 1 auto;
  width: 100%;
  max-width: 240px;
  padding: 6px 6px 8px;
  overflow: visible;
  background:
    radial-gradient(circle at 12% 10%, rgba(255, 255, 255, 0.92) 0 2px, transparent 3px),
    radial-gradient(circle at 88% 86%, rgba(255, 255, 255, 0.75) 0 2px, transparent 3px),
    linear-gradient(145deg, rgba(255, 214, 234, 0.82), rgba(203, 182, 240, 0.74));
  border: 2px solid var(--border);
  box-shadow: inset 2px 2px 0 rgba(255, 255, 255, 0.75), 3px 3px 0 var(--shadow);
  border-radius: 4px;
}

.ps-stage {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 2;
  border: 2px solid var(--border);
  background: linear-gradient(180deg, #efe6fb 0%, #ffe1f0 55%, #f5e8ff 100%);
  overflow: hidden;
  border-radius: 6px;
}

.ps-canvas {
  display: block;
  width: 100%;
  height: 100%;
  outline: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.ps-canvas:focus-visible {
  box-shadow: inset 0 0 0 3px var(--pink-deep);
}

/* ---- overlays ---- */
.ps-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  overflow-y: auto;
  background: rgba(243, 238, 252, 0.62);
  animation: ps-fade-in 220ms ease-out;
}

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

.ps-overlay-inner {
  width: 100%;
  max-width: 280px;
  margin: auto;
  padding: 18px 14px 14px;
  text-align: center;
  background: var(--bg-window);
  border: 2px solid var(--border);
  box-shadow: 4px 4px 0 var(--shadow);
  animation: ps-card-pop 260ms ease-out;
  border-radius: 6px;
}

.ps-overlay-title {
  margin: 0 0 10px;
  color: var(--text-dark);
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
}

.ps-overlay-msg {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 18px;
  line-height: 1.3;
}

.ps-overlay-new {
  margin: 0 0 6px;
  color: var(--pink-deep);
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
}

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

.ps-overlay-inner .lb-prompt {
  margin-top: 8px;
}

.ps-overlay-hint {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 15px;
}

@keyframes ps-fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes ps-card-pop {
  0%   { transform: scale(0.85); opacity: 0; }
  70%  { transform: scale(1.03); opacity: 1; }
  100% { transform: scale(1); }
}

/* ---- mobile pad ---- */
.ps-mobile {
  display: none;
  flex-direction: column;
  gap: 8px;
  max-width: 280px;
  margin: 0 auto 12px;
}

.ps-mobile-row {
  display: flex;
  justify-content: center;
  gap: 8px;
}

.ps-pad {
  min-width: 56px;
  min-height: 48px;
  padding: 8px 12px;
  font-family: 'Press Start 2P', monospace;
  font-size: 12px;
  color: var(--text-dark);
  background: linear-gradient(180deg, var(--pink-soft) 0%, var(--lavender) 100%);
  border: 2px solid var(--border);
  border-radius: 10px;
  box-shadow: inset 1px 1px 0 #ffeef8, 2px 2px 0 var(--shadow);
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none;
}

.ps-pad:active {
  transform: translate(1px, 1px);
  box-shadow: inset 1px 1px 0 #ffeef8, 1px 1px 0 var(--shadow);
}

.ps-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 2px;
}

.ps-actions .btn[disabled] {
  opacity: 0.55;
  cursor: url("../assets/cursor-pink.png?v=3") 13 6, auto;
}

.ps-back-btn {
  display: inline-block;
  text-decoration: none;
  font-size: 8px !important;
}

.ps-keys {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.5;
  text-align: center;
}

.ps-keys-mobile {
  display: none;
}

@media (max-width: 560px) {
  .ps-help { font-size: 17px; }
  .ps-layout { gap: 6px; max-width: 360px; }
  .ps-mini { width: 56px; height: 56px; }
  .ps-mini.ps-next { height: 168px; }
  .ps-side { padding: 4px; }
  .ps-stage-shell { max-width: 200px; padding: 4px 4px 6px; }
  .ps-mobile { display: flex; }
  .ps-keys { display: none; }
  .ps-keys-mobile { display: block; margin-top: 8px; font-size: 15px; }
}

@media (max-width: 380px) {
  .ps-game { padding-left: 4px; padding-right: 4px; }
  .ps-help { font-size: 16px; }
  .ps-stat { min-width: 64px; padding: 5px 6px; }
  .ps-stat-value { font-size: 9px; }
  .ps-layout {
    flex-wrap: wrap;
    justify-content: center;
    gap: 6px;
  }
  .ps-hold-panel { order: 1; }
  .ps-next-panel { order: 2; }
  .ps-stage-shell {
    order: 3;
    width: 100%;
    max-width: min(200px, calc(100vw - 40px));
    margin: 0 auto;
  }
  .ps-mini { width: 48px; height: 48px; }
  .ps-mini.ps-next { height: 144px; width: 48px; }
  .ps-pad { min-width: 48px; min-height: 44px; font-size: 11px; }
  .ps-stat { min-width: 58px; }
}

@media (prefers-reduced-motion: reduce) {
  .ps-overlay,
  .ps-overlay-inner {
    animation: none !important;
  }
}

.os-body.ps-game {
  overflow: visible;
  padding-bottom: 20px;
}
