:root {
  --bg-color: #fce4ec;
  --board-bg: rgba(255, 255, 255, 0.4);
  --text-main: #333;
  --accent: #ff4081;
  --accent-hover: #c60055;

  --yellow: #fbc02d;
  --orange: #f57c00;
  --blue: #1976d2;
  --green: #388e3c;

  --font-heading: "Fredoka One", cursive;
  --font-body: "Nunito", sans-serif;
}

[v-cloak] {
  display: none;
}

body,
html {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  background-color: var(--bg-color);
  background-image:
    radial-gradient(#f8bbd0 20%, transparent 20%),
    radial-gradient(#f8bbd0 20%, transparent 20%);
  background-color: #fce4ec;
  background-position:
    0 0,
    25px 25px;
  background-size: 50px 50px;
  font-family: var(--font-body);
  color: var(--text-main);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none; /* Prevent browser refreshing on pull-down */
}

#app {
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

#game-container {
  width: 100%;
  max-width: 500px;
  height: 100%;
  display: flex;
  flex-direction: column;
  position: relative;
  padding: 10px;
  box-sizing: border-box;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 30px rgba(0, 0, 0, 0.1);
}

.text-yellow {
  color: var(--yellow);
}
.text-orange {
  color: var(--orange);
}
.text-blue {
  color: var(--blue);
}
.text-green {
  color: var(--green);
}

/* Header */
.header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: 20px;
  margin-bottom: 20px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
  margin-top: 10px;
}

.stats {
  display: flex;
  gap: 15px;
}

.stat-item {
  font-size: 1.1rem;
  font-weight: 700;
}

.stat-item.highlight {
  color: var(--accent);
  font-size: 1.2rem;
}

.timer {
  font-size: 1.4rem;
  font-family: var(--font-heading);
  color: var(--text-main);
  background: #eee;
  padding: 5px 15px;
  border-radius: 15px;
  transition: all 0.3s ease;
}

.timer.danger {
  color: white;
  background: #d32f2f;
  animation: pulse 1s infinite;
}

/* Board */
.board-wrapper {
  flex: 1;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 20px;
}

.board {
  display: grid;
  gap: 4px;
  background: var(--board-bg);
  padding: 10px;
  border-radius: 20px;
  box-shadow:
    inset 0 0 20px rgba(0, 0, 0, 0.05),
    0 10px 30px rgba(0, 0, 0, 0.1);
  width: 100%;
  aspect-ratio: 1 / 1;
  max-height: 100%;
}

.cell {
  background: rgba(255, 255, 255, 0.5);
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  position: relative;
  transition:
    transform 0.2s,
    background-color 0.2s;
  overflow: hidden;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.1);
}

.cell.empty {
  background: transparent;
  box-shadow: none;
}

.cell.selected {
  transform: scale(0.9);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 0 15px var(--accent);
  z-index: 10;
}

.candy-emoji {
  font-size: 2.2rem;
  filter: drop-shadow(0 4px 2px rgba(0, 0, 0, 0.2));
  transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  pointer-events: none; /* Prevent dragging emoji image directly */
}

@media (max-width: 400px) {
  .candy-emoji {
    font-size: 1.8rem;
  }
}

/* Animations */
.pop-anim {
  animation: popping 0.4s ease-out forwards;
}

@keyframes popping {
  0% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.4);
    opacity: 0.8;
  }
  100% {
    transform: scale(0);
    opacity: 0;
  }
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Overlay & Modals */
.overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal {
  background: white;
  padding: 30px;
  border-radius: 30px;
  text-align: center;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.15);
  width: 90%;
  max-width: 400px;
}

.modal h1 {
  font-family: var(--font-heading);
  color: var(--accent);
  font-size: 2.5rem;
  margin: 0 0 10px 0;
  text-shadow: 2px 2px 0px rgba(255, 64, 129, 0.2);
}

.modal .subtitle {
  color: #666;
  margin-bottom: 25px;
  font-weight: 700;
}

.mode-selection {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
}

.mode-card {
  flex: 1;
  background: #f8f9fa;
  border: 2px solid #eee;
  border-radius: 20px;
  padding: 20px 10px;
  cursor: pointer;
  transition: all 0.3s;
  position: relative;
  overflow: hidden;
}

.mode-card:hover {
  transform: translateY(-5px);
  border-color: var(--accent);
  background: #fff0f5;
}

.mode-icon {
  font-size: 2.5rem;
  margin-bottom: 10px;
}

.mode-card h3 {
  margin: 0;
  font-size: 1.1rem;
  font-family: var(--font-heading);
  line-height: 1.2;
}

.mode-card p {
  margin: 5px 0 0 0;
  font-size: 0.9rem;
  color: #888;
}

.best-badge {
  display: block;
  margin-top: 10px;
  background: #e0e0e0;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: bold;
  color: #555;
}

.title-over {
  font-family: var(--font-heading);
  color: #d32f2f;
  font-size: 2.2rem;
  margin: 0 0 10px 0;
}

.final-score {
  font-size: 3.5rem;
  font-family: var(--font-heading);
  color: var(--accent);
  margin: 15px 0;
}

.new-record {
  color: var(--orange);
  font-weight: bold;
  font-size: 1.2rem;
  animation: pulse 1.5s infinite;
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 20px;
}

.btn {
  border: none;
  padding: 15px 20px;
  border-radius: 15px;
  font-size: 1.1rem;
  font-weight: bold;
  font-family: var(--font-heading);
  cursor: pointer;
  transition: transform 0.2s;
  width: 100%;
}

.btn:active {
  transform: scale(0.95);
}

.btn-primary {
  background: var(--accent);
  color: white;
  box-shadow: 0 5px 15px rgba(255, 64, 129, 0.3);
}

.btn-secondary {
  background: #e0e0e0;
  color: #333;
}

.btn-back {
  display: inline-block;
  margin-top: 15px;
  color: #888;
  text-decoration: none;
  font-weight: bold;
  transition: color 0.2s;
}

.btn-back:hover {
  color: var(--accent);
}
