* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  background: #0a0a14;
  display: flex;
  justify-content: center;
  align-items: center;
  height: 100vh;
  overflow: hidden;
  font-family: -apple-system, 'Hiragino Sans', 'Noto Sans CJK JP', 'Helvetica Neue', Arial, sans-serif;
  color: #e8e8f0;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
#game-container {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 0 60px rgba(100,100,255,0.15);
  border: 1px solid rgba(255,255,255,0.06);
}
#canvas { display: block; background: #1a1a2e; }
#hud {
  position: absolute;
  top: 0; left: 0; right: 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 12px 18px;
  pointer-events: none;
  z-index: 10;
  background: linear-gradient(180deg, rgba(0,0,0,0.6) 0%, transparent 100%);
}
.hud-left { display: flex; gap: 20px; align-items: flex-start; }
.hud-score { display: flex; flex-direction: column; gap: 2px; }
.hud-best { display: flex; flex-direction: column; gap: 2px; }
.hud-label { font-size: 11px; letter-spacing: 2px; text-transform: uppercase; color: #8888aa; }
.hud-value { font-size: 22px; font-weight: bold; color: #fbbf24; line-height: 1; }
.hud-value-sm { font-size: 16px; font-weight: bold; color: #8888aa; line-height: 1; }
#warning {
  color: #ff4444;
  font-weight: bold;
  font-size: 13px;
  opacity: 1;
  transition: opacity 0.3s;
}
#warning.hidden { display: none; }
#warning.hud-flash {
  animation: warnPulse 0.3s ease-in-out infinite alternate;
}
@keyframes warnPulse {
  from { opacity: 0.4; transform: scale(1); }
  to { opacity: 1; transform: scale(1.1); }
}
#game-over {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 20;
  background: rgba(0,0,0,0.88);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 400ms ease-out, transform 400ms ease-out;
}
#game-over:not(.hidden) { display: flex; }
#game-over.hidden { display: none; }
#game-over h1 {
  font-size: 48px;
  color: #eee;
  margin-bottom: 4px;
  letter-spacing: 10px;
  font-weight: 300;
}
.go-divider {
  width: 60px;
  height: 1px;
  background: rgba(255,255,255,0.1);
  margin: 16px 0;
}
.go-label { font-size: 11px; letter-spacing: 2px; color: #8888aa; margin-bottom: 4px; }
.go-dec-line {
  width: 120px;
  height: 1px;
  background: rgba(255,255,255,0.04);
  margin: 24px 0;
}
#final-score {
  font-size: 48px;
  font-weight: bold;
  color: #fbbf24;
  margin-bottom: 4px;
  line-height: 1;
}
#new-best {
  font-size: 14px;
  font-weight: bold;
  color: #fbbf24;
  letter-spacing: 3px;
  margin-bottom: 8px;
  animation: bestPulse 0.6s ease-in-out infinite alternate;
}
#new-best.hidden { display: none; }
@keyframes bestPulse {
  from { opacity: 0.5; transform: scale(1); }
  to { opacity: 1; transform: scale(1.05); }
}
.go-best { font-size: 13px; color: #666; margin-bottom: 20px; }
.go-best span { color: #8888aa; }
#restart-btn {
  padding: 14px 48px;
  font-size: 16px;
  font-family: inherit;
  background: transparent;
  color: #2dd4bf;
  border: 1px solid rgba(45, 212, 191, 0.3);
  border-radius: 8px;
  cursor: pointer;
  letter-spacing: 2px;
  opacity: 0;
  transform: scale(0.95);
  transition: all 200ms ease;
}
#restart-btn:hover {
  background: rgba(45, 212, 191, 0.12);
  box-shadow: 0 0 20px rgba(45, 212, 191, 0.2);
  transform: scale(1) !important;
}
#restart-btn:active { transform: scale(0.97) !important; }
#score { color: inherit; }
