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

body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
  color: #e2e8f0;
  min-height: 100vh;
  overflow-x: hidden;
}

.game-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

.header {
  text-align: center;
  padding: 30px 0 20px;
  position: relative;
}

.title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  background: linear-gradient(135deg, #0d9488, #14b8a6, #2dd4bf);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 0 40px rgba(13, 148, 136, 0.3);
  letter-spacing: -0.5px;
}

.subtitle {
  font-size: clamp(0.9rem, 2vw, 1.1rem);
  color: #94a3b8;
  margin-top: 8px;
  font-weight: 500;
}

.info-bar {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 24px;
  background: rgba(15, 23, 42, 0.8);
  border-radius: 16px;
  border: 1px solid rgba(13, 148, 136, 0.2);
  backdrop-filter: blur(10px);
  margin-bottom: 20px;
}

.info-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  background: rgba(13, 148, 136, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(13, 148, 136, 0.15);
}

.info-label {
  font-size: 12px;
  font-weight: 700;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.info-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: #0d9488;
  min-width: 40px;
  text-align: right;
}

.lives-display {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hp-bar-container {
  width: 80px;
  height: 12px;
  background: rgba(239, 68, 68, 0.2);
  border-radius: 6px;
  overflow: hidden;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.hp-bar {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ef4444, #f97316, #22c55e);
  border-radius: 6px;
  transition: width 0.3s ease;
  box-shadow: 0 0 10px rgba(34, 197, 94, 0.5);
}

.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 900px;
  margin: 0 auto 20px;
  border-radius: 20px;
  overflow: hidden;
  box-shadow:
    0 0 60px rgba(13, 148, 136, 0.15),
    0 25px 50px rgba(0, 0, 0, 0.4),
    inset 0 0 0 1px rgba(255, 255, 255, 0.05);
  background: linear-gradient(180deg, #1a1a2e 0%, #16213e 100%);
  border: 2px solid rgba(13, 148, 136, 0.3);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.start-overlay,
.pause-overlay,
.level-complete-overlay,
.game-over-overlay,
.victory-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(12px);
  z-index: 100;
  animation: fadeIn 0.3s ease;
}

.hidden {
  display: none !important;
}

.start-content,
.pause-content,
.level-complete-content,
.game-over-content,
.victory-content {
  text-align: center;
  padding: 40px;
  max-width: 500px;
}

.game-logo {
  margin-bottom: 30px;
}

.logo-character {
  font-size: 80px;
  display: block;
  margin-bottom: 10px;
  animation: bounce 1s ease infinite;
}

.logo-text {
  font-size: 2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 2px;
}

.control-guide {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 30px;
}

.guide-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 18px;
  background: rgba(13, 148, 136, 0.08);
  border-radius: 10px;
  border: 1px solid rgba(13, 148, 136, 0.15);
}

.guide-key {
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 14px;
  font-weight: 700;
  color: #0d9488;
  background: rgba(13, 148, 136, 0.15);
  padding: 6px 12px;
  border-radius: 6px;
}

.guide-desc {
  font-size: 14px;
  color: #94a3b8;
}

.start-btn,
.next-level-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 16px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  color: white;
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 8px 30px rgba(13, 148, 136, 0.35);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.start-btn:hover,
.next-level-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 40px rgba(13, 148, 136, 0.45);
}

.btn-icon-large {
  font-size: 1.4rem;
}

.pause-icon,
.complete-icon,
.game-over-icon,
.victory-icon {
  font-size: 70px;
  margin-bottom: 15px;
  animation: pulse 1.5s ease infinite;
}

.pause-content h2,
.level-complete-content h2,
.game-over-content h2,
.victory-content h2 {
  font-size: 1.8rem;
  font-weight: 800;
  color: #0d9488;
  margin-bottom: 10px;
}

.pause-hint,
.game-over-subtitle,
.victory-subtitle {
  color: #64748b;
  margin-bottom: 25px;
  font-size: 1rem;
}

.pause-controls {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 15px;
}

.pause-control-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 0.95rem;
  font-weight: 600;
  background: rgba(13, 148, 136, 0.1);
  color: #0d9488;
  border: 2px solid rgba(13, 148, 136, 0.3);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.pause-control-btn:hover {
  background: #0d9488;
  color: white;
  transform: translateY(-2px);
}

.pause-tips {
  font-size: 12px;
  color: #64748b;
}

.pause-tips kbd {
  background: rgba(13, 148, 136, 0.15);
  padding: 3px 8px;
  border-radius: 4px;
  font-family: inherit;
  color: #0d9488;
}

.complete-stats,
.game-over-stats,
.victory-stats {
  margin: 25px 0;
}

.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.stat-row .stat-label {
  color: #94a3b8;
  font-size: 0.95rem;
}

.stat-row .stat-value {
  color: #0d9488;
  font-weight: 700;
  font-size: 1rem;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  background: rgba(13, 148, 136, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(13, 148, 136, 0.15);
  margin-bottom: 10px;
}

.stat-icon {
  font-size: 28px;
}

.stat-info {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.stat-info .stat-label {
  font-size: 11px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-info .stat-value {
  font-size: 1.3rem;
  font-weight: 800;
  color: #0d9488;
}

.modal-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 25px;
}

.modal-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.modal-btn.primary {
  background: linear-gradient(135deg, #0d9488, #14b8a6);
  color: white;
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.3);
}

.modal-btn.primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(13, 148, 136, 0.4);
}

.modal-btn.secondary {
  background: rgba(100, 116, 139, 0.15);
  color: #94a3b8;
  border: 1px solid rgba(100, 116, 139, 0.3);
}

.modal-btn.secondary:hover {
  background: rgba(100, 116, 139, 0.25);
  color: #e2e8f0;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.control-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  background: rgba(13, 148, 136, 0.08);
  color: #0d9488;
  border: 2px solid rgba(13, 148, 136, 0.25);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: #0d9488;
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(13, 148, 136, 0.3);
}

.btn-icon {
  font-size: 16px;
}

.btn-text {
  font-size: 13px;
}

.mobile-controls {
  display: none;
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  gap: 20px;
  z-index: 50;
  padding: 15px 25px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 20px;
  border: 1px solid rgba(13, 148, 136, 0.3);
}

.mobile-btn {
  width: 65px;
  height: 65px;
  font-size: 24px;
  font-weight: 700;
  color: white;
  background: rgba(13, 148, 136, 0.2);
  border: 2px solid rgba(13, 148, 136, 0.4);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.mobile-btn:active {
  background: #0d9488;
  transform: scale(0.92);
}

.mobile-jump {
  width: 85px;
  height: 85px;
  font-size: 13px;
  background: rgba(13, 148, 136, 0.35);
  border-color: rgba(13, 148, 136, 0.6);
}

.instructions {
  max-width: 900px;
  margin: 0 auto;
  padding: 30px;
  background: rgba(15, 23, 42, 0.6);
  border-radius: 20px;
  border: 1px solid rgba(13, 148, 136, 0.15);
}

.instructions-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.3rem;
  font-weight: 700;
  color: #0d9488;
  margin-bottom: 25px;
}

.title-icon {
  font-size: 1.5rem;
}

.instructions-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 25px;
}

.instruction-card {
  padding: 20px;
  background: rgba(13, 148, 136, 0.05);
  border-radius: 14px;
  border: 1px solid rgba(13, 148, 136, 0.12);
  transition: all 0.3s ease;
}

.instruction-card:hover {
  background: rgba(13, 148, 136, 0.1);
  transform: translateY(-3px);
  border-color: rgba(13, 148, 136, 0.25);
}

.card-icon {
  font-size: 32px;
  display: block;
  margin-bottom: 10px;
}

.instruction-card h4 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #e2e8f0;
  margin-bottom: 8px;
}

.instruction-card p {
  font-size: 0.85rem;
  color: #94a3b8;
  line-height: 1.5;
}

.score-info {
  padding-top: 20px;
  border-top: 1px solid rgba(13, 148, 136, 0.15);
}

.score-info h4 {
  font-size: 1rem;
  font-weight: 700;
  color: #0d9488;
  margin-bottom: 15px;
}

.score-table {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.score-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 16px;
  background: rgba(13, 148, 136, 0.05);
  border-radius: 10px;
}

.item-preview {
  font-size: 24px;
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(13, 148, 136, 0.1);
  border-radius: 8px;
}

.score-value {
  font-size: 0.9rem;
  color: #94a3b8;
  font-weight: 500;
}

kbd {
  background: rgba(13, 148, 136, 0.15);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: 'Consolas', 'Monaco', monospace;
  font-size: 13px;
  font-weight: 600;
  color: #0d9488;
  border: 1px solid rgba(13, 148, 136, 0.25);
}

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

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-15px); }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.85; }
}

@media (max-width: 768px) {
  .game-container {
    padding: 12px;
  }

  .info-bar {
    padding: 12px 16px;
    gap: 10px;
  }

  .info-item {
    padding: 8px 12px;
    gap: 6px;
  }

  .info-label {
    font-size: 10px;
  }

  .info-value {
    font-size: 1rem;
  }

  .hp-bar-container {
    width: 55px;
    height: 10px;
  }

  .canvas-wrapper {
    border-radius: 14px;
  }

  .mobile-controls {
    display: flex;
  }

  .instructions {
    padding: 20px 16px;
  }

  .instructions-grid {
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .instruction-card {
    padding: 16px;
  }

  .start-content,
  .pause-content,
  .level-complete-content,
  .game-over-content,
  .victory-content {
    padding: 25px 20px;
  }

  .logo-character {
    font-size: 60px;
  }

  .logo-text {
    font-size: 1.5rem;
  }

  .guide-item {
    flex-direction: column;
    gap: 6px;
    text-align: center;
  }

  .modal-buttons {
    flex-direction: column;
  }

  .modal-btn {
    width: 100%;
    justify-content: center;
  }
}

@media (max-width: 480px) {
  .instructions-grid {
    grid-template-columns: 1fr;
  }

  .info-bar {
    flex-wrap: wrap;
    justify-content: center;
  }

  .control-btn {
    padding: 10px 16px;
    font-size: 12px;
  }
}