:root {
  --red: #c8102e;
  --gold: #ffd34d;
  --snow: #ffffff;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.45);
}

html, body {
  margin: 0;
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

canvas {
  touch-action: none;
}

.hud, .prompt, .toast, .finale {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 20;
  text-align: center;
  color: var(--snow);
  font-family: 'Fredoka', system-ui, sans-serif;
  text-shadow: var(--shadow);
  pointer-events: none;
}

/* HUD: title + five gift slots */
.hud {
  top: max(14px, env(safe-area-inset-top));
  transition: opacity 0.4s;
}

.hud.hidden {
  opacity: 0;
}

.hud-title {
  font-family: 'Mountains of Christmas', 'Fredoka', cursive;
  font-size: 30px;
  line-height: 1.1;
}

.slots {
  display: inline-flex;
  gap: 10px;
  margin-top: 8px;
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(20, 10, 30, 0.35);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.slot {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  border: 2px dashed rgba(255, 255, 255, 0.7);
  box-sizing: border-box;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}

.slot.filled {
  border: 2px solid var(--gold);
  background:
    linear-gradient(90deg, transparent 40%, var(--gold) 40%, var(--gold) 60%, transparent 60%),
    linear-gradient(0deg, transparent 40%, var(--gold) 40%, var(--gold) 60%, transparent 60%),
    var(--red);
  box-shadow: 0 0 12px rgba(255, 211, 77, 0.8);
}

.slot.pop {
  animation: slot-pop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes slot-pop {
  0% { transform: scale(0.4); }
  100% { transform: scale(1); }
}

/* Swipe-up instructions */
.prompt {
  bottom: max(28px, env(safe-area-inset-bottom));
  font-size: 22px;
  font-weight: 700;
  transition: opacity 0.4s;
}

.prompt.hidden {
  opacity: 0;
}

.swipe-hint {
  height: 56px;
  position: relative;
}

.swipe-hint .arrow {
  display: inline-block;
  font-size: 40px;
  animation: swipe-up 1.3s ease-in-out infinite;
}

@keyframes swipe-up {
  0% { transform: translateY(24px); opacity: 0; }
  30% { opacity: 1; }
  100% { transform: translateY(-16px); opacity: 0; }
}

/* Placement instructions */
.place-prompt {
  bottom: 0;
  padding: 60px 16px max(28px, env(safe-area-inset-bottom));
  font-size: 18px;
  font-weight: 500;
  background: linear-gradient(to bottom, rgba(20, 5, 15, 0), rgba(20, 5, 15, 0.55));
}

.place-title {
  font-family: 'Mountains of Christmas', 'Fredoka', cursive;
  font-size: 30px;
  font-weight: 700;
  color: var(--gold);
  line-height: 1.1;
}

.place-hint {
  margin-top: 4px;
}

.phone-hint {
  height: 64px;
  perspective: 200px;
}

.phone-hint svg {
  animation: tilt-down 2.2s ease-in-out infinite;
  transform-origin: 50% 100%;
}

@keyframes tilt-down {
  0%, 15% { transform: rotateX(0deg); }
  50%, 70% { transform: rotateX(50deg); }
  100% { transform: rotateX(0deg); }
}

/* Feedback messages */
.toast {
  top: 34%;
  font-size: 30px;
  font-weight: 700;
  color: var(--gold);
  text-shadow: 0 0 2px #5a0610, 0 2px 10px rgba(0, 0, 0, 0.7);
  opacity: 0;
}

.toast.show {
  animation: toast 1.2s ease-out forwards;
}

@keyframes toast {
  0% { opacity: 0; transform: translateY(12px) scale(0.8); }
  15% { opacity: 1; transform: translateY(0) scale(1.05); }
  70% { opacity: 1; transform: translateY(-6px) scale(1); }
  100% { opacity: 0; transform: translateY(-20px) scale(1); }
}

/* End screen */
.finale {
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  opacity: 0;
  transition: opacity 0.6s;
}

.finale.visible {
  opacity: 1;
  pointer-events: auto;
}

.finale-card {
  max-width: 320px;
  padding: 26px 24px;
  border-radius: 20px;
  background: rgba(120, 8, 28, 0.82);
  border: 2px solid var(--gold);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.4), 0 0 30px rgba(255, 211, 77, 0.35);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.finale-title {
  font-family: 'Mountains of Christmas', 'Fredoka', cursive;
  font-size: 44px;
  color: var(--gold);
}

.finale-text {
  margin: 8px 0 20px;
  font-size: 18px;
}

.replay {
  font: 700 18px 'Fredoka', system-ui, sans-serif;
  color: var(--red);
  background: var(--snow);
  border: none;
  border-radius: 999px;
  padding: 12px 28px;
  cursor: pointer;
  box-shadow: 0 4px 0 #d9d9d9;
}

.replay:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 #d9d9d9;
}
