@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;600;700;800&display=swap');

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

body {
  overflow: hidden;
  font-family: 'Outfit', sans-serif;
  background: #1a1a2e;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

canvas {
  display: block;
}

#speed-lines {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 4;
  opacity: 0;
  transition: opacity 0.3s ease;
}

#vignette {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 5;
  background: radial-gradient(ellipse at center, transparent 55%, rgba(0, 0, 0, 0.25) 100%);
}

#splash {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #0f0f1a;
  color: #ffffff;
  transition: opacity 1s cubic-bezier(0.4, 0, 0.2, 1), visibility 1s;
  overflow: hidden;
}

.splash-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 30% 40%, rgba(255, 71, 126, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 70% 60%, rgba(139, 92, 246, 0.12) 0%, transparent 50%),
    radial-gradient(circle at 50% 80%, rgba(236, 72, 153, 0.08) 0%, transparent 40%);
  animation: bgPulse 8s ease-in-out infinite alternate;
}

@keyframes bgPulse {
  0% {
    opacity: 0.6;
    transform: scale(1);
  }

  100% {
    opacity: 1;
    transform: scale(1.05);
  }
}

#splash.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.splash-content {
  position: relative;
  z-index: 2;
  text-align: center;
}

.splash-badge {
  display: inline-block;
  padding: 6px 20px;
  border-radius: 100px;
  background: rgba(255, 71, 126, 0.15);
  border: 1px solid rgba(255, 71, 126, 0.3);
  color: #ff477e;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 20px;
}

#splash-title {
  font-size: clamp(48px, 12vw, 80px);
  font-weight: 800;
  background: linear-gradient(135deg, #ff477e 0%, #ff7eb3 40%, #ff477e 80%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
  letter-spacing: -2px;
  line-height: 1;
  animation: titleGlow 3s ease-in-out infinite alternate;
}

@keyframes titleGlow {
  0% {
    filter: drop-shadow(0 0 20px rgba(255, 71, 126, 0.3));
  }

  100% {
    filter: drop-shadow(0 0 40px rgba(255, 71, 126, 0.6));
  }
}

#splash-subtitle {
  font-size: clamp(14px, 3vw, 18px);
  font-weight: 300;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 48px;
  letter-spacing: 0.5px;
}

.start-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 18px 48px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #ff477e, #e8395b);
  color: white;
  font-family: 'Outfit', sans-serif;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  position: relative;
  z-index: 2;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 4px 24px rgba(255, 71, 126, 0.4), 0 0 0 0 rgba(255, 71, 126, 0);
}

.start-btn:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 8px 32px rgba(255, 71, 126, 0.5), 0 0 0 4px rgba(255, 71, 126, 0.15);
}

.start-btn:active {
  transform: translateY(1px) scale(0.98);
}

.btn-icon {
  font-size: 22px;
  animation: carBounce 1.5s ease-in-out infinite;
}

@keyframes carBounce {

  0%,
  100% {
    transform: translateX(0);
  }

  50% {
    transform: translateX(4px);
  }
}

.splash-particles {
  position: absolute;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  z-index: 1;
}

.splash-particles span {
  position: absolute;
  bottom: -50px;
  font-size: 20px;
  opacity: 0;
  animation: floatUp 8s infinite ease-in-out;
}

.splash-particles span:nth-child(1) {
  left: 5%;
  animation-delay: 0s;
}

.splash-particles span:nth-child(2) {
  left: 15%;
  animation-delay: 1.5s;
}

.splash-particles span:nth-child(3) {
  left: 25%;
  animation-delay: 0.8s;
  font-size: 26px;
}

.splash-particles span:nth-child(4) {
  left: 40%;
  animation-delay: 3s;
}

.splash-particles span:nth-child(5) {
  left: 50%;
  animation-delay: 4.5s;
  font-size: 24px;
}

.splash-particles span:nth-child(6) {
  left: 60%;
  animation-delay: 2s;
}

.splash-particles span:nth-child(7) {
  left: 70%;
  animation-delay: 5s;
}

.splash-particles span:nth-child(8) {
  left: 80%;
  animation-delay: 1s;
}

.splash-particles span:nth-child(9) {
  left: 88%;
  animation-delay: 3.5s;
}

.splash-particles span:nth-child(10) {
  left: 95%;
  animation-delay: 2.5s;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) rotate(0deg);
    opacity: 0;
  }

  10% {
    opacity: 0.5;
  }

  90% {
    opacity: 0.3;
  }

  100% {
    transform: translateY(-105vh) rotate(360deg);
    opacity: 0;
  }
}

#ui-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 10;
}

#ui-overlay>* {
  pointer-events: auto;
}

#score-panel {
  position: absolute;
  top: 28px;
  left: 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 22px;
  background: rgba(15, 15, 26, 0.6);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  color: #ffffff;
  font-size: 22px;
  font-weight: 700;
}

#heart-icon {
  font-size: 24px;
  animation: heartPulse 1.5s ease-in-out infinite;
}

@keyframes heartPulse {

  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.15);
  }
}

#score-count {
  min-width: 28px;
  text-align: center;
  color: #ff477e;
}

#quest-panel {
  position: absolute;
  bottom: 28px;
  right: 28px;
  width: 250px;
  background: rgba(15, 15, 26, 0.65);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 18px;
  color: #ffffff;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
  transition: all 0.3s ease;
}

#quest-panel h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
  color: #ff477e;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 8px;
}

#quest-panel ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quest-item {
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
  color: rgba(255, 255, 255, 0.65);
  transition: all 0.3s ease;
}

.quest-item .checkbox {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.25s ease;
  position: relative;
}

.quest-item.completed {
  color: #ff477e;
  text-shadow: 0 0 10px rgba(255, 71, 126, 0.2);
}

.quest-item.completed .checkbox {
  border-color: #ff477e;
  background: #ff477e;
}

.quest-item.completed .checkbox::after {
  content: '✓';
  color: #ffffff;
  font-size: 11px;
  font-weight: 800;
  position: absolute;
}

#world-toast {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(-20px);
  padding: 10px 28px;
  background: rgba(15, 15, 26, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  color: rgba(255, 255, 255, 0.9);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 1px;
  opacity: 0;
  transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  white-space: nowrap;
}

#world-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

#milestone-msg {
  position: absolute;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.85);
  padding: 20px 44px;
  background: rgba(15, 15, 26, 0.8);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(255, 71, 126, 0.3);
  border-radius: 20px;
  color: #ffffff;
  font-size: 26px;
  font-weight: 700;
  text-align: center;
  opacity: 0;
  transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1), transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  pointer-events: none;
  box-shadow: 0 20px 60px rgba(255, 71, 126, 0.15);
  white-space: nowrap;
}

#milestone-msg.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

#controls-info {
  position: absolute;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 22px;
  background: rgba(15, 15, 26, 0.4);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.35);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.8px;
  white-space: nowrap;
}

.mobile-controls {
  display: none;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(15, 15, 26, 0.6);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  width: 90%;
  max-width: 420px;
  background: rgba(20, 20, 35, 0.95);
  border: 1px solid rgba(255, 71, 126, 0.2);
  border-radius: 24px;
  padding: 36px;
  position: relative;
  text-align: center;
  box-shadow: 0 24px 80px rgba(255, 71, 126, 0.15);
  transform: scale(0.9) translateY(20px);
  transition: transform 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active .modal-card {
  transform: scale(1) translateY(0);
}

.close-modal {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: rgba(255, 255, 255, 0.06);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  font-size: 16px;
  color: rgba(255, 255, 255, 0.4);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.close-modal:hover {
  background: rgba(255, 71, 126, 0.15);
  color: #ff477e;
}

.modal-header {
  margin-bottom: 24px;
}

.modal-icon {
  font-size: 48px;
  display: block;
  margin-bottom: 14px;
  animation: floatIcon 3s ease-in-out infinite;
}

@keyframes floatIcon {

  0%,
  100% {
    transform: translateY(0) rotate(-3deg);
  }

  50% {
    transform: translateY(-10px) rotate(3deg);
  }
}

.modal-header h2 {
  font-size: 24px;
  font-weight: 700;
  color: #ffffff;
}

.modal-prompt {
  font-size: 13px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.4);
  margin-bottom: 12px;
}

#love-message {
  width: 100%;
  height: 110px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 400;
  color: #ffffff;
  background: rgba(255, 255, 255, 0.04);
  resize: none;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

#love-message:focus {
  border-color: rgba(255, 71, 126, 0.4);
  box-shadow: 0 0 0 4px rgba(255, 71, 126, 0.08);
}

#love-message::placeholder {
  color: rgba(255, 255, 255, 0.2);
}

.modal-footer-note {
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.25);
  margin-top: 14px;
  margin-bottom: 22px;
}

.save-modal-btn {
  width: 100%;
  padding: 14px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #ff477e, #e8395b);
  color: white;
  font-family: 'Outfit', sans-serif;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 20px rgba(255, 71, 126, 0.3);
}

.save-modal-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(255, 71, 126, 0.4);
}

.save-modal-btn:active {
  transform: translateY(1px);
}

#mobile-steering-pad {
  display: none;
  position: fixed;
  bottom: 32px;
  left: 24px;
  z-index: 50;
  gap: 14px;
}

#mobile-pedal-pad {
  display: none;
  position: fixed;
  bottom: 32px;
  right: 24px;
  z-index: 50;
  gap: 14px;
}

.ctrl-btn {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: rgba(15, 15, 26, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 22px;
  color: rgba(255, 255, 255, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  transition: all 0.15s ease;
}

.ctrl-btn:active {
  transform: scale(0.92);
  background: rgba(255, 71, 126, 0.2);
  border-color: rgba(255, 71, 126, 0.4);
}

.gas-btn {
  background: rgba(255, 71, 126, 0.15);
  border-color: rgba(255, 71, 126, 0.25);
}

#mobile-light-btn {
  display: none;
  position: fixed;
  top: 28px;
  right: 28px;
  z-index: 50;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: rgba(15, 15, 26, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(255, 255, 255, 0.5);
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}

.score-popup {
  position: fixed;
  color: #ff477e;
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 800;
  pointer-events: none;
  z-index: 15;
  text-shadow: 0 2px 12px rgba(255, 71, 126, 0.4);
  animation: scoreFloat 1.2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes scoreFloat {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.7);
  }

  25% {
    opacity: 1;
    transform: translateY(-10px) scale(1.1);
  }

  100% {
    opacity: 0;
    transform: translateY(-80px) scale(0.8);
  }
}

@media (max-width: 768px) {
  .desktop-controls {
    display: none;
  }

  .mobile-controls {
    display: inline;
  }

  #mobile-steering-pad {
    display: flex;
  }

  #mobile-pedal-pad {
    display: flex;
  }

  #mobile-light-btn {
    display: flex;
  }

  #splash-title {
    font-size: 48px;
  }

  #splash-subtitle {
    font-size: 14px;
    padding: 0 20px;
  }

  .start-btn {
    font-size: 16px;
    padding: 16px 36px;
  }

  #score-panel {
    font-size: 18px;
    padding: 8px 16px;
    top: 16px;
    left: 16px;
  }

  #heart-icon {
    font-size: 20px;
  }

  #quest-panel {
    bottom: 110px;
    right: 16px;
    width: 170px;
    padding: 10px;
    font-size: 11px;
    border-radius: 10px;
  }

  #quest-panel h3 {
    font-size: 11px;
    margin-bottom: 6px;
    padding-bottom: 4px;
  }

  .quest-item {
    font-size: 10px;
    gap: 6px;
  }

  .quest-item .checkbox {
    width: 12px;
    height: 12px;
    border-radius: 3px;
  }

  .quest-item.completed .checkbox::after {
    font-size: 8px;
  }

  #milestone-msg {
    font-size: 18px;
    padding: 14px 24px;
  }

  #controls-info {
    bottom: 110px;
    font-size: 10px;
    padding: 5px 14px;
  }
}