@import url('https://fonts.googleapis.com/css2?family=Fredoka:wght@400;600;700&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-user-select: none;
}

body {
  font-family: 'Fredoka', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: linear-gradient(135deg, #ffd3b6 0%, #ffaaa5 50%, #a8e6cf 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  color: #4a4a4a;
  overflow-x: hidden;
}

.game-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  max-width: 520px;
  width: 100%;
}

/* Header & Scoreboard */
.game-header {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  padding: 12px 20px;
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.title-section h1 {
  font-size: 24px;
  font-weight: 700;
  color: #ff6b6b;
  letter-spacing: -0.5px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.title-section .subtitle {
  font-size: 11px;
  color: #888;
  font-weight: 600;
}

.score-boards {
  display: flex;
  gap: 12px;
}

.score-box {
  background: #fff;
  border: 2px solid #ffd3b6;
  border-radius: 12px;
  padding: 6px 14px;
  text-align: center;
  min-width: 72px;
}

.score-box .label {
  font-size: 10px;
  font-weight: 700;
  color: #ff8b94;
  text-transform: uppercase;
}

.score-box .val {
  font-size: 20px;
  font-weight: 700;
  color: #333;
}

/* Controls Bar */
.game-controls {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 4px;
}

.next-preview-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.85);
  padding: 6px 14px;
  border-radius: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.next-preview-box .next-label {
  font-size: 12px;
  font-weight: 700;
  color: #ff6b6b;
}

.next-preview-canvas {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px dashed #ffaaa5;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn-icon:hover {
  transform: translateY(-2px);
  background: #fff8f5;
}

.btn-icon:active {
  transform: translateY(1px);
}

/* Canvas Area */
.canvas-wrapper {
  position: relative;
  width: 100%;
  max-width: 460px;
  aspect-ratio: 460 / 650;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.12), inset 0 0 0 4px #ffe3d8;
  overflow: hidden;
  touch-action: none;
}

#gameCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* Evolution Tier Roadmap Bar */
.evolution-bar {
  width: 100%;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(8px);
  border-radius: 16px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  overflow-x: auto;
  gap: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}

.evo-item {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
}

.evo-img {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  object-fit: cover;
  border: 1.5px solid #ffaaa5;
}

.evo-arrow {
  color: #ffaaa5;
  font-size: 11px;
  font-weight: 700;
}

/* Modal Overlay */
.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
  z-index: 100;
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-card {
  background: #ffffff;
  border-radius: 24px;
  padding: 32px 28px;
  text-align: center;
  max-width: 320px;
  width: 90%;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
  animation: popIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
  from { transform: scale(0.7); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

.modal-icon {
  font-size: 52px;
  margin-bottom: 8px;
}

.modal-card h2 {
  font-size: 26px;
  color: #ff6b6b;
  margin-bottom: 8px;
  font-weight: 700;
}

.modal-card .final-score {
  font-size: 38px;
  font-weight: 700;
  color: #333;
  margin: 12px 0 6px;
}

.modal-card .best-score-info {
  font-size: 13px;
  color: #888;
  margin-bottom: 20px;
}

.btn-primary {
  width: 100%;
  background: linear-gradient(135deg, #ff6b6b, #ff8b94);
  color: white;
  border: none;
  padding: 14px;
  font-size: 17px;
  font-weight: 700;
  border-radius: 16px;
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(255, 107, 107, 0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 20px rgba(255, 107, 107, 0.45);
}

.btn-primary:active {
  transform: translateY(1px);
}
