/* ==========================================================================
   『スキマを抜けろ！』 Style Sheet - Neon Arcade Theme
   ========================================================================== */

:root {
  --bg-dark: #070b19;
  --bg-card: rgba(13, 22, 44, 0.92);
  --cyan-main: #00f2fe;
  --cyan-glow: rgba(0, 242, 254, 0.6);
  --cyan-dim: #05445e;
  --magenta-accent: #ff007f;
  --white-ball: #ffffff;
  --gold-best: #ffd700;
  --font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Meiryo", sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background-color: var(--bg-dark);
  font-family: var(--font-family);
  color: #ffffff;
  touch-action: manipulation;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
}

/* 画面揺れ演出用クラス */
.screen-shake {
  animation: shakeAnim 0.38s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shakeAnim {
  10%, 90% { transform: translate3d(-3px, 2px, 0); }
  20%, 80% { transform: translate3d(4px, -3px, 0); }
  30%, 50%, 70% { transform: translate3d(-6px, 4px, 0); }
  40%, 60% { transform: translate3d(6px, -4px, 0); }
}

#game-container {
  position: relative;
  width: 100%;
  max-width: 480px;
  height: 100%;
  max-height: 920px;
  background: radial-gradient(circle at 50% 50%, #0d1a38 0%, #060914 100%);
  display: flex;
  flex-direction: column;
  box-shadow: 0 0 40px rgba(0, 242, 254, 0.15);
  overflow: hidden;
}

@media (min-width: 500px) and (min-height: 600px) {
  #game-container {
    height: 94vh;
    border-radius: 20px;
    border: 1px solid rgba(0, 242, 254, 0.25);
  }
}

/* Header UI */
.game-header {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  z-index: 10;
  background: linear-gradient(180deg, rgba(7, 11, 25, 0.8) 0%, rgba(7, 11, 25, 0) 100%);
  pointer-events: auto;
}

.score-box {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-box .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #7f99b8;
}

.score-box .value {
  font-size: 20px;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 0 10px rgba(0, 242, 254, 0.5);
  font-variant-numeric: tabular-nums;
}

#best-display {
  color: var(--gold-best);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.4);
}

.icon-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.icon-btn:hover {
  background: rgba(0, 242, 254, 0.2);
  border-color: var(--cyan-main);
  box-shadow: 0 0 12px var(--cyan-glow);
}

.icon {
  pointer-events: none;
}

.hidden {
  display: none !important;
}

/* Canvas Area */
.canvas-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Overlays & Modals */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(4, 7, 18, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
  transition: opacity 0.25s ease;
}

.modal-card {
  width: 86%;
  max-width: 380px;
  background: var(--bg-card);
  border: 1px solid rgba(0, 242, 254, 0.35);
  border-radius: 24px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 0 30px rgba(0, 242, 254, 0.2), inset 0 0 20px rgba(0, 242, 254, 0.05);
}

.game-title {
  font-size: 28px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #ffffff 20%, var(--cyan-main) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 8px;
  text-shadow: 0 0 15px rgba(0, 242, 254, 0.4);
}

.tagline {
  font-size: 14px;
  color: #8faec9;
  font-style: italic;
  margin-bottom: 24px;
  letter-spacing: 1px;
}

.how-to-play {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 12px;
  padding: 16px 12px;
  margin-bottom: 28px;
  border: 1px dashed rgba(0, 242, 254, 0.3);
}

.guide-text {
  font-size: 14px;
  color: #e0f2fe;
  margin-bottom: 10px;
  line-height: 1.5;
}

.instruction-badge {
  display: inline-block;
  background: rgba(0, 242, 254, 0.15);
  color: var(--cyan-main);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.5px;
  border: 1px solid rgba(0, 242, 254, 0.4);
}

.gameover-title {
  font-size: 30px;
  font-weight: 900;
  color: #ff3366;
  letter-spacing: 3px;
  text-shadow: 0 0 20px rgba(255, 51, 102, 0.6);
  margin-bottom: 20px;
}

.result-stats {
  background: rgba(0, 0, 0, 0.4);
  border-radius: 16px;
  padding: 18px 20px;
  margin-bottom: 26px;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 15px;
  color: #a0aec0;
  margin-bottom: 10px;
}

.stat-row:last-child {
  margin-bottom: 0;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.stat-row .highlight {
  font-size: 22px;
  font-weight: 800;
  color: var(--cyan-main);
  text-shadow: 0 0 10px var(--cyan-glow);
}

.best-row span:last-child {
  font-size: 20px;
  font-weight: 800;
  color: var(--gold-best);
  text-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
}

.primary-btn {
  width: 100%;
  padding: 16px 0;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 2px;
  color: #070b19;
  background: linear-gradient(135deg, #00f2fe 0%, #4facfe 100%);
  border: none;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 242, 254, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.primary-btn:active {
  transform: scale(0.96);
  box-shadow: 0 0 10px rgba(0, 242, 254, 0.4);
}

.pulse {
  animation: pulseAnim 1.8s infinite;
}

@keyframes pulseAnim {
  0% { transform: scale(1); box-shadow: 0 0 20px rgba(0, 242, 254, 0.5); }
  50% { transform: scale(1.03); box-shadow: 0 0 30px rgba(0, 242, 254, 0.8); }
  100% { transform: scale(1); box-shadow: 0 0 20px rgba(0, 242, 254, 0.5); }
}
