* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0b0d;
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, sans-serif;
  overscroll-behavior: none;
}

/* Game always runs at a mobile-web aspect ratio, letterboxed on wider
   (PC) viewports, so PC and mobile play the same layout. */
#app {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  height: 100dvh;
}

#game-frame {
  position: relative;
  background: #1c1f26;
  width: min(100vw, calc(100dvh * 9 / 19.5));
  height: min(100dvh, calc(100vw * 19.5 / 9));
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.5);
  overflow: hidden;
}

#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  touch-action: none;
  display: block;
}

.top-text {
  position: absolute;
  top: max(32px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  color: #e8eaed;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  width: 90%;
  pointer-events: none;
  opacity: 1;
  transition: opacity 0.2s ease;
}

.top-text.fade {
  opacity: 0;
}

.top-subtext {
  position: absolute;
  top: calc(max(32px, env(safe-area-inset-top)) + 26px);
  left: 50%;
  transform: translateX(-50%);
  color: #ff8080;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-align: center;
  width: 90%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.top-subtext.visible {
  opacity: 1;
}

.score-modal {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 1;
  transition: opacity 0.3s ease;
}

.score-modal.hidden {
  opacity: 0;
  pointer-events: none;
}

.score-modal-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  transform: scale(1);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.score-modal.hidden .score-modal-inner {
  transform: scale(0.9);
  opacity: 0;
}

.score-label {
  color: #cfd2d8;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.15em;
}

.score-value {
  color: #ffffff;
  font-size: 64px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.failed-label {
  color: #ff5b5b;
  font-size: 40px;
  font-weight: 800;
  letter-spacing: 0.05em;
}

.failed-label.hidden,
.score-value.hidden {
  display: none;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.modal-btn {
  min-width: 96px;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1.5px solid #e8eaed;
  background: transparent;
  color: #e8eaed;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.modal-btn:hover {
  background: #e8eaed;
  color: #1c1f26;
}
