/* スコア加算時だけ短く光らせる。ゲーム進行は妨げない */
.gs-hud__value.is-bump {
  animation: sn-bump 240ms ease-out;
}

@keyframes sn-bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.18); color: var(--md-sys-color-primary); }
  100% { transform: scale(1); }
}

.sn-stage {
  position: relative;
  width: 100%;
  max-width: min(100%, 480px);
  margin: 0 auto 14px;
  touch-action: none;
  overscroll-behavior: none;
}

/* ゲーム領域内だけタッチ操作を占有し、領域外のページスクロールは妨げない */
.sn-canvas {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 1px solid rgba(96, 154, 214, 0.35);
  border-radius: var(--md-sys-shape-corner-large);
  background: #0d1730;
  box-shadow: 0 14px 34px rgba(28, 52, 96, 0.24);
  touch-action: none;
  overscroll-behavior: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.sn-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 16px;
  border-radius: var(--md-sys-shape-corner-large);
  background: rgba(11, 20, 42, 0.92);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  text-align: center;
  animation: sn-fade 180ms ease-out;
}

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

.sn-overlay__title {
  margin: 0;
  color: #ffffff;
  font-family: "Outfit", "Noto Sans JP", sans-serif;
  font-size: clamp(1.5rem, 7vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.sn-overlay.is-clear .sn-overlay__title {
  color: #a8f0ff;
  text-shadow: 0 0 18px rgba(96, 220, 255, 0.7), 0 0 34px rgba(150, 106, 255, 0.45);
}

.sn-overlay.is-over .sn-overlay__title {
  color: #ffc7d3;
  text-shadow: 0 0 18px rgba(255, 107, 138, 0.55);
}

.sn-overlay__detail {
  margin: 0;
  color: rgba(230, 240, 255, 0.86);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.sn-overlay__best {
  margin: 0;
  color: rgba(198, 224, 255, 0.72);
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  line-height: 1.5;
}

.sn-overlay__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.sn-overlay__actions .btn {
  min-width: 8.5rem;
  justify-content: center;
}

.sn-guide {
  max-width: min(100%, 480px);
  margin: 0 auto 4px;
  color: var(--md-sys-color-on-surface-variant);
  font-size: 0.8125rem;
  line-height: 1.6;
  text-align: center;
}

.game-panel {
  margin-top: 20px;
}

.game-controls {
  justify-content: center;
  max-width: min(100%, 480px);
  margin-left: auto;
  margin-right: auto;
}

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

  .gs-hud__value.is-bump {
    animation: none;
  }
}

/* 外枠・HUD・ボタンの配色は共通プレイ画面を使用。盤面のみ高さに合わせる。 */
html.gs-playing .game-panel {
  --sn-chrome: 208px;
  display: grid;
  grid-template-columns: minmax(0, 640px);
  justify-content: center;
  align-content: start;
}
html.gs-playing .gs-hud { max-width: 640px; }
html.gs-playing .sn-stage {
  width: min(100%, max(120px, calc(100dvh - var(--sn-chrome))), 480px);
  max-width: 100%;
  margin: 0 auto 10px;
}
html.gs-playing .sn-canvas { border-color: var(--play-border); }
html.gs-playing .sn-guide {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
html.gs-playing .game-controls { width: 100%; max-width: 640px; gap: 12px; margin: 0; }
@media (min-width: 768px) and (min-height: 600px) {
  html.gs-playing .game-panel {
    --sn-chrome: 290px;
    padding-top: max(clamp(24px, 5vh, 56px), env(safe-area-inset-top));
  }
  html.gs-playing .game-panel > .gs-bar { margin-bottom: 28px; }
  html.gs-playing .gs-hud, html.gs-playing .sn-stage { margin-bottom: 24px; }
}
@media (orientation: landscape) and (max-height: 500px) {
  html.gs-playing .game-panel {
    grid-template-columns: minmax(160px, 240px) minmax(0, 480px);
    grid-template-rows: auto auto 1fr;
    column-gap: 16px;
  }
  html.gs-playing .game-panel > .gs-bar { grid-area: 1 / 1; }
  html.gs-playing .gs-hud { grid-area: 2 / 1; }
  html.gs-playing .game-controls { grid-area: 1 / 1; justify-self: end; width: auto; justify-content: end; }
  html.gs-playing .sn-stage {
    grid-area: 1 / 2 / 4;
    width: min(100%, calc(100dvh - 24px));
    margin: 0 auto;
  }
}
