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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a0a1e;
  font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 50% 30%, #1a1a3e 0%, #0a0a1e 70%);
}

#game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  position: relative;
}

#game-header {
  display: flex;
  gap: 24px;
  width: 100%;
  justify-content: center;
}

.stat-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 6px 28px;
  min-width: 120px;
  backdrop-filter: blur(8px);
}

.stat-label {
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
}

.stat-value {
  font-size: 28px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 0%, #88ccff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.level-total {
  font-size: 16px;
  opacity: 0.6;
}

#canvas-container {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  box-shadow:
    0 0 40px rgba(68, 136, 255, 0.15),
    0 0 80px rgba(68, 136, 255, 0.05),
    inset 0 0 60px rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

#game-canvas {
  display: block;
  background: linear-gradient(180deg, #0d0d2b 0%, #141438 50%, #1a1a45 100%);
}

#danger-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: repeating-linear-gradient(
    90deg,
    rgba(255, 68, 85, 0.6) 0px,
    rgba(255, 68, 85, 0.6) 8px,
    transparent 8px,
    transparent 16px
  );
  pointer-events: none;
  opacity: 0.7;
}

/* Health Tip Overlay */
#health-tip {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, rgba(10, 20, 60, 0.95), rgba(20, 10, 50, 0.95));
  border: 1px solid rgba(100, 180, 255, 0.3);
  border-radius: 20px;
  padding: 24px 28px;
  max-width: 340px;
  min-width: 280px;
  text-align: center;
  z-index: 50;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(68, 136, 255, 0.15);
  animation: tipFadeIn 0.4s ease;
  cursor: pointer;
}

#health-tip.hidden {
  display: none;
}

#tip-category {
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #44DDDD;
  background: rgba(68, 221, 221, 0.12);
  border: 1px solid rgba(68, 221, 221, 0.25);
  border-radius: 20px;
  padding: 4px 14px;
  margin-bottom: 12px;
}

#tip-text {
  font-size: 16px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 16px;
  font-weight: 500;
}

#tip-progress-bar {
  width: 100%;
  height: 3px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 10px;
}

#tip-progress-fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #44DDDD, #4488FF);
  border-radius: 2px;
  transition: width 0.1s linear;
}

#tip-hint {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  letter-spacing: 1px;
}

@keyframes tipFadeIn {
  from { opacity: 0; transform: translate(-50%, -50%) scale(0.9); }
  to { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

#game-footer {
  display: flex;
  align-items: center;
  gap: 20px;
  width: 100%;
  justify-content: center;
}

#next-bubble-display {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 6px 16px;
  backdrop-filter: blur(8px);
}

.footer-label {
  font-size: 12px;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.5);
}

#next-canvas {
  display: block;
}

#restart-btn {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  letter-spacing: 1px;
  padding: 8px 24px;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: 600;
}

#restart-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
  color: #fff;
  transform: translateY(-1px);
}

#restart-btn:active {
  transform: translateY(0);
}

/* Overlay */
#overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.3s ease;
}

#overlay.hidden {
  display: none;
}

#overlay-content {
  text-align: center;
  background: linear-gradient(135deg, rgba(30, 30, 60, 0.95), rgba(20, 20, 50, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 24px;
  padding: 40px 60px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: scaleIn 0.3s ease;
}

#overlay-title {
  font-size: 32px;
  font-weight: 800;
  letter-spacing: 4px;
  margin-bottom: 8px;
  background: linear-gradient(135deg, #fff 0%, #88ccff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

#overlay-subtitle {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 12px;
}

#overlay-score {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 28px;
}

#overlay-score span {
  font-size: 28px;
  font-weight: 700;
  color: #ffcc00;
}

#overlay-btn {
  background: linear-gradient(135deg, #4488ff, #6644ff);
  border: none;
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 2px;
  padding: 14px 40px;
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(68, 136, 255, 0.3);
}

#overlay-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(68, 136, 255, 0.5);
}

#overlay-btn:active {
  transform: translateY(0);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.9); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

/* Responsive */
@media (max-height: 780px) {
  .stat-box {
    padding: 4px 20px;
    min-width: 100px;
  }
  .stat-value {
    font-size: 22px;
  }
  #game-footer {
    gap: 12px;
  }
}
