* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  background: #f5f5f5;
  transition: background-color 0.2s ease;
}

body.mistake {
  background: #ff6b6b;
}

body.success {
  background: #63d471;
}

#game {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding:
    max(30px, env(safe-area-inset-top))
    20px
    max(20px, env(safe-area-inset-bottom));
}

#targetSection {
  position: absolute;
  top: 20%;
  left: 50%;
  transform: translateX(-50%);
  text-align: center;
}

.label {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 2px;
  opacity: 0.5;
  margin-bottom: 8px;
}

#target {
  font-size: clamp(80px, 25vw, 150px);
  line-height: 1;
  font-weight: 800;
}

#selectionSection {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 15px;
}

.selection {
  position: relative;
  width: 110px;
  height: 80px;
  border: 3px dashed rgba(0, 0, 0, 0.25);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.45);
  font-size: 40px;
  font-weight: 700;
  cursor: pointer;
}

.selection .placeholder {
  opacity: 0.3;
}

.selection .selectedValue {
  display: none;
}

.selection.filled {
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.2);
  background: rgba(255, 255, 255, 0.8);
}

.selection.filled .placeholder {
  display: none;
}

.selection.filled .selectedValue {
  display: inline;
}

.remove {
  position: absolute;
  top: 2px;
  right: 5px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  font-size: 19px;
  line-height: 22px;
  font-weight: 400;
  opacity: 0.45;
  cursor: pointer;
}

.remove:hover {
  opacity: 1;
}

.plus {
  font-size: 36px;
  font-weight: 500;
}

#choices {
  position: absolute;
  bottom: max(30px, env(safe-area-inset-bottom));
  left: 0;
  width: 100%;
  display: flex;
  justify-content: center;
  gap: clamp(6px, 2vw, 16px);
  padding: 0 15px;
}

.choice {
  flex: 1;
  max-width: 100px;
  aspect-ratio: 1;
  border: 0;
  border-radius: 18px;
  background: white;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.12);
  font-size: clamp(28px, 8vw, 48px);
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    opacity 0.15s ease,
    background-color 0.15s ease;
}

.choice:active {
  transform: scale(0.92);
}

.choice.disabled {
  opacity: 0.2;
  transform: scale(0.9);
  pointer-events: none;
}

#message {
  position: absolute;
  bottom: calc(max(30px, env(safe-area-inset-bottom)) + 115px);
  font-size: 20px;
  font-weight: 700;
  opacity: 0;
  transition: opacity 0.2s ease;
}

body.mistake #message {
  opacity: 1;
}

#fireworks {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.emoji {
  position: absolute;
  font-size: 35px;
  animation: firework 1.4s ease-out forwards;
}

@keyframes firework {
  0% {
    transform: translate(0, 0) scale(0.3) rotate(0deg);
    opacity: 1;
  }

  70% {
    opacity: 1;
  }

  100% {
    transform: translate(var(--x), var(--y)) scale(1.3) rotate(var(--rotation));
    opacity: 0;
  }
}

@media (max-width: 500px) {
  .selection {
    width: 95px;
    height: 70px;
  }

  .plus {
    font-size: 30px;
  }
}
