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

body {
  font-family: 'Segoe UI', system-ui, sans-serif;
  background: linear-gradient(135deg, #fdf2f8, #fff7ed, #fefce8);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

#app {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 16px;
  width: 100%;
  max-width: 520px;
}

.top-bar {
  width: 100%;
  background: linear-gradient(135deg, #ec4899, #fb923c, #fbbf24);
  border-radius: 16px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.3);
}

.top-bar h1 {
  color: white;
  font-size: 1.3rem;
  font-weight: 700;
  text-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.status {
  background: rgba(255,255,255,0.25);
  color: white;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 4px 14px;
  border-radius: 20px;
  backdrop-filter: blur(4px);
}

.game-container {
  width: 100%;
  display: flex;
  justify-content: center;
}

canvas {
  border-radius: 8px;
  box-shadow: 0 6px 32px rgba(0,0,0,0.15);
  cursor: pointer;
  touch-action: none;
  background: #f5d88a;
}

.controls {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: center;
}

.mode-toggle {
  display: flex;
  background: white;
  border-radius: 30px;
  padding: 4px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  gap: 4px;
}

.mode-btn {
  background: transparent;
  border: none;
  padding: 8px 18px;
  border-radius: 26px;
  font-size: 0.9rem;
  font-weight: 600;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}

.mode-btn.active {
  background: linear-gradient(135deg, #ec4899, #fb923c);
  color: white;
  box-shadow: 0 2px 8px rgba(236, 72, 153, 0.4);
}

.action-row {
  display: flex;
  gap: 10px;
}

.btn {
  border: none;
  padding: 10px 22px;
  border-radius: 30px;
  font-size: 0.9rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
}

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

.btn-primary {
  background: linear-gradient(135deg, #ec4899, #fb923c);
  color: white;
  box-shadow: 0 4px 12px rgba(236, 72, 153, 0.4);
}

.btn-secondary {
  background: white;
  color: #555;
  border: 2px solid #eee;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.difficulty-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  color: #666;
  font-weight: 600;
}

.diff-btn {
  background: white;
  border: 2px solid #eee;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 700;
  color: #888;
  cursor: pointer;
  transition: all 0.2s;
}

.diff-btn.active {
  background: linear-gradient(135deg, #818cf8, #c084fc);
  color: white;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(129, 140, 248, 0.4);
}

/* Win highlight overlay */
.win-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}

.win-card {
  background: white;
  border-radius: 24px;
  padding: 32px 40px;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
  animation: popIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

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

.win-card h2 {
  font-size: 1.8rem;
  background: linear-gradient(135deg, #ec4899, #fb923c);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 16px;
}

.win-card p {
  color: #666;
  margin-bottom: 20px;
  font-size: 1rem;
}

.win-card button {
  background: linear-gradient(135deg, #ec4899, #fb923c);
  color: white;
  border: none;
  padding: 12px 32px;
  border-radius: 30px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4);
}
