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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f7f8fc;
  color: #1a1a2e;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.4s ease;
}

body.theme-pokemon { background: linear-gradient(135deg, #fff1e0, #e0f7ff); }
body.theme-hockey { background: linear-gradient(135deg, #e6f2ff, #f4f8ff); }
body.theme-fotball { background: linear-gradient(135deg, #e9fbe9, #f4fff4); }

.theme-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.theme-bg span {
  position: absolute;
  opacity: 0.14;
  user-select: none;
  line-height: 1;
}

.theme-picker {
  display: flex;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.theme-picker button {
  background: #fff;
  border: 2px solid #dcdfea;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.theme-picker button:hover { transform: translateY(-2px); }

.theme-picker button.active {
  border-color: #4361ee;
  background: #eef0fe;
}

.back-link {
  position: fixed;
  top: 16px;
  left: 16px;
  color: #1a1a2e;
  text-decoration: none;
  font-weight: 500;
}

.wrap {
  text-align: center;
}

h1 { margin-bottom: 8px; }

.stats { color: #555; margin-bottom: 12px; }

.level-message {
  min-height: 24px;
  margin-bottom: 12px;
  font-weight: 600;
}

.level-message.success { color: #1a7f4b; }
.level-message.error { color: #c0392b; }

.board {
  position: relative;
  display: grid;
  grid-template-columns: repeat(4, 80px);
  grid-gap: 10px;
  justify-content: center;
}

.board.shake {
  animation: shake 0.5s ease;
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-8px); }
  40%, 60% { transform: translateX(8px); }
}

.explosion {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  pointer-events: none;
}

.particle {
  position: absolute;
  top: 0;
  left: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--color);
  transform: translate(-50%, -50%);
  animation: particle-burst 0.7s ease-out forwards;
}

@keyframes particle-burst {
  to {
    transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0.3);
    opacity: 0;
  }
}

.tile {
  width: 80px;
  height: 80px;
  background: #4361ee;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  cursor: pointer;
  user-select: none;
  transition: transform 0.15s ease, background 0.15s ease;
}

.tile.flipped, .tile.matched {
  background: #fff;
  box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.tile.matched {
  opacity: 0.5;
  cursor: default;
}

#restart {
  margin-top: 24px;
  background: #4361ee;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
}

#restart:hover { background: #3348c4; }

.credit {
  color: #888;
  margin-top: 16px;
  font-size: 0.8rem;
}
