/* ============ Reset & Base ============ */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: linear-gradient(180deg, #0a1628 0%, #0d3b66 40%, #1a6b8a 70%, #2d9cdb 100%);
  min-height: 100vh;
  overflow: hidden;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

#app {
  width: 100%;
  max-width: 480px;
  height: 100vh;
  max-height: 860px;
  margin: 0 auto;
  position: relative;
  overflow: hidden;
}

/* ============ Screen System ============ */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
}
.screen.active {
  opacity: 1;
  pointer-events: auto;
}

/* ============ Bubbles Background ============ */
.bubbles-bg {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.bubbles-bg::before,
.bubbles-bg::after {
  content: '';
  position: absolute;
  bottom: -50px;
  border-radius: 50%;
  animation: rise linear infinite;
  opacity: 0.3;
}
.bubbles-bg::before {
  width: 60px; height: 60px;
  left: 15%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.6), rgba(100,200,255,0.1));
  animation-duration: 8s;
}
.bubbles-bg::after {
  width: 40px; height: 40px;
  left: 65%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.5), rgba(100,200,255,0.1));
  animation-duration: 6s;
  animation-delay: 2s;
}

@keyframes rise {
  0% { transform: translateY(0) scale(0.5); opacity: 0.2; }
  50% { opacity: 0.4; }
  100% { transform: translateY(-100vh) scale(1.5); opacity: 0; }
}

/* ============ Start Screen ============ */
.title-area {
  text-align: center;
  margin-bottom: 20px;
  z-index: 1;
}
.game-title {
  font-size: 2.4em;
  background: linear-gradient(180deg, #ffd700, #ff8c00);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
  filter: drop-shadow(0 2px 4px rgba(255,140,0,0.4));
  margin-bottom: 8px;
  animation: titlePulse 2s ease-in-out infinite;
}
@keyframes titlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}
.subtitle {
  color: #a0d8ef;
  font-size: 0.95em;
  letter-spacing: 1px;
}

.fish-preview {
  display: flex;
  gap: 16px;
  margin-bottom: 30px;
  z-index: 1;
}
.preview-fish {
  font-size: 2.5em;
  animation: fishSwim 3s ease-in-out infinite;
}
.preview-fish:nth-child(1) { animation-delay: 0s; }
.preview-fish:nth-child(2) { animation-delay: 0.3s; }
.preview-fish:nth-child(3) { animation-delay: 0.6s; }
.preview-fish:nth-child(4) { animation-delay: 0.9s; }
.preview-fish:nth-child(5) { animation-delay: 1.2s; }

@keyframes fishSwim {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  25% { transform: translateY(-12px) rotate(-5deg); }
  75% { transform: translateY(8px) rotate(5deg); }
}

/* ============ Buttons ============ */
.btn-primary {
  padding: 14px 48px;
  font-size: 1.2em;
  font-weight: bold;
  color: #fff;
  background: linear-gradient(135deg, #ff6b35, #f7931e);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(255,107,53,0.4);
  transition: all 0.2s ease;
  z-index: 1;
  letter-spacing: 2px;
}
.btn-primary:active {
  transform: scale(0.95);
  box-shadow: 0 2px 10px rgba(255,107,53,0.3);
}

.btn-secondary {
  padding: 12px 36px;
  font-size: 1em;
  color: #a0d8ef;
  background: rgba(255,255,255,0.1);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 50px;
  cursor: pointer;
  margin-top: 10px;
  z-index: 1;
  transition: all 0.2s ease;
}
.btn-secondary:active {
  background: rgba(255,255,255,0.2);
}

.btn-share {
  padding: 12px 36px;
  font-size: 1em;
  color: #fff;
  background: linear-gradient(135deg, #0084ff, #0066cc);
  border: none;
  border-radius: 50px;
  cursor: pointer;
  margin-top: 12px;
  z-index: 1;
  box-shadow: 0 4px 15px rgba(0,132,255,0.4);
  letter-spacing: 1px;
}
.btn-share:active {
  transform: scale(0.95);
}

.high-score {
  color: #ffd700;
  font-size: 1em;
  margin-top: 18px;
  z-index: 1;
  background: rgba(0,0,0,0.3);
  padding: 8px 20px;
  border-radius: 20px;
}

/* ============ Game Screen ============ */
#game-header {
  display: flex;
  justify-content: space-around;
  width: 100%;
  padding: 10px;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(10px);
  position: absolute;
  top: 0;
  z-index: 10;
}
.header-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}
.header-item .label {
  color: #a0d8ef;
  font-size: 0.75em;
}
.header-item .value {
  color: #fff;
  font-size: 1.3em;
  font-weight: bold;
}
#combo.value.fire {
  color: #ff6b35;
  animation: comboShake 0.3s ease;
}
@keyframes comboShake {
  0%,100% { transform: translateX(0); }
  25% { transform: translateX(-3px); }
  75% { transform: translateX(3px); }
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

#game-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 5;
}

/* ============ End Screen ============ */
.end-title {
  font-size: 2em;
  color: #ffd700;
  margin-bottom: 16px;
  z-index: 1;
  animation: titlePulse 1.5s ease-in-out infinite;
}
.end-score-card {
  background: rgba(255,255,255,0.12);
  backdrop-filter: blur(20px);
  border-radius: 20px;
  padding: 28px 40px;
  text-align: center;
  margin-bottom: 20px;
  z-index: 1;
  border: 2px solid rgba(255,255,255,0.15);
}
.end-score-label {
  color: #a0d8ef;
  font-size: 0.9em;
  margin-bottom: 4px;
}
.end-score-value {
  color: #ffd700;
  font-size: 3em;
  font-weight: bold;
  animation: scorePopIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
@keyframes scorePopIn {
  0% { transform: scale(0); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}
.end-stats {
  color: #cde;
  font-size: 0.9em;
  margin-top: 12px;
  line-height: 1.8;
}
.end-stats span {
  color: #ffd700;
  font-weight: bold;
}

/* ============ Pop-up score effect ============ */
.score-pop {
  position: absolute;
  color: #ffd700;
  font-weight: bold;
  font-size: 1.2em;
  pointer-events: none;
  animation: popUp 1s ease-out forwards;
  z-index: 20;
  text-shadow: 0 0 10px rgba(255,215,0,0.6);
}
@keyframes popUp {
  0% { transform: translateY(0) scale(0.5); opacity: 1; }
  100% { transform: translateY(-60px) scale(1.2); opacity: 0; }
}

/* ============ Responsive ============ */
@media (max-width: 360px) {
  .game-title { font-size: 1.8em; }
  .preview-fish { font-size: 1.8em; }
  .btn-primary { padding: 12px 36px; font-size: 1em; }
}
