/* === RESET & BASE === */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Fredoka', sans-serif;
  background: #FFF8E7;
  color: #2d2d2d;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

/* === SCREENS === */
.screen {
  position: fixed;
  inset: 0;
  overflow-y: auto;
  z-index: 1;
}

/* === START SCREEN === */
#screen-start {
  background: linear-gradient(145deg, #0f2027 0%, #203a43 30%, #2c5364 60%, #d4a44c 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
}

.start-content {
  max-width: 400px;
  width: 100%;
}

.start-emoji-row {
  font-size: 40px;
  margin-bottom: 16px;
  letter-spacing: 12px;
}

.start-title {
  font-size: 2.2rem;
  font-weight: 700;
  color: #FFD700;
  text-shadow: 0 2px 8px rgba(0,0,0,0.4);
  line-height: 1.2;
  margin-bottom: 16px;
}

.start-subtitle {
  color: rgba(255,255,255,0.9);
  font-size: 1rem;
  font-weight: 400;
  line-height: 1.5;
  margin-bottom: 12px;
}

.start-location {
  color: rgba(255,255,255,0.7);
  font-size: 0.85rem;
  margin-bottom: 32px;
}

.btn-start {
  display: block;
  width: 100%;
  min-height: 60px;
  border: none;
  border-radius: 16px;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  color: #2d2d2d;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255,165,0,0.4);
  transition: transform 0.1s;
  margin-bottom: 12px;
}

.btn-start:active {
  transform: scale(0.96);
}

.btn-continue {
  background: linear-gradient(135deg, #4CAF50, #2E7D32);
  color: white;
  box-shadow: 0 4px 16px rgba(76,175,80,0.4);
}

.btn-replay {
  background: linear-gradient(135deg, #7C4DFF, #536DFE);
  color: white;
  box-shadow: 0 4px 16px rgba(124,77,255,0.4);
}

.start-completed {
  margin-top: 16px;
}

.start-completed p {
  color: rgba(255,255,255,0.9);
  font-size: 1rem;
  margin-bottom: 16px;
}

.start-reset {
  display: inline-block;
  color: rgba(255,255,255,0.5);
  font-size: 0.85rem;
  text-decoration: underline;
  margin-top: 8px;
}

/* === HUNT BOARD === */
#screen-hunt {
  background: #FFF8E7;
  z-index: 2;
}

.hunt-header {
  position: sticky;
  top: 0;
  background: white;
  padding: 12px 16px 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  z-index: 10;
}

.hunt-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.hunt-title {
  font-size: 1rem;
  font-weight: 700;
}

.hunt-score {
  font-size: 1.1rem;
  font-weight: 700;
  color: #d4a44c;
}

.progress-bar {
  height: 10px;
  background: #eee;
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 6px;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4CAF50, #8BC34A, #FFD700);
  border-radius: 5px;
  transition: width 0.6s ease-out;
}

.progress-fill.complete {
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  0% { filter: brightness(1); }
  50% { filter: brightness(1.3); }
  100% { filter: brightness(1); }
}

.hunt-counter {
  font-size: 0.8rem;
  color: #888;
  text-align: center;
}

/* === CARD GRID === */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 16px;
  padding-bottom: 80px;
}

.card {
  position: relative;
  border-radius: 16px;
  padding: 16px 12px;
  text-align: center;
  min-height: 140px;
  cursor: pointer;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transition: transform 0.15s, box-shadow 0.15s;
  background: linear-gradient(135deg, var(--card-color), var(--card-color-light));
}

.card:active {
  transform: scale(0.96);
}

.card-emoji {
  font-size: 48px;
  line-height: 1;
}

.card-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: white;
  text-shadow: 0 1px 3px rgba(0,0,0,0.3);
  line-height: 1.2;
}

.card-points {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.9);
  color: #2d2d2d;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 10px;
}

/* Unfound card pulse */
.card:not(.card--found) {
  animation: cardPulse 2.5s ease-in-out infinite;
}

@keyframes cardPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

/* Found card state */
.card--found {
  opacity: 0.65;
  animation: none;
}

.card--found::after {
  content: '✅';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 48px;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3));
}

/* === MINI CONFETTI === */
.confetti-particle {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 20;
  animation: confettiPop 0.8s ease-out forwards;
  animation-delay: var(--delay);
  opacity: 0;
}

@keyframes confettiPop {
  0% {
    transform: translate(0, 0) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translate(var(--x), var(--y)) rotate(var(--r));
    opacity: 0;
  }
}

/* === MODAL === */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-sheet {
  position: relative;
  width: 100%;
  max-width: 500px;
  max-height: 85vh;
  background: white;
  border-radius: 24px 24px 0 0;
  padding: 24px;
  padding-top: 32px;
  overflow-y: auto;
  animation: slideUp 0.3s ease-out;
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

.modal-image-wrap {
  position: relative;
  width: calc(100% + 48px);
  margin: -32px -24px 16px;
  height: 220px;
  overflow: hidden;
  border-radius: 24px 24px 0 0;
  background: #eee;
}

.modal-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-emoji--overlay {
  position: absolute;
  bottom: 8px;
  right: 16px;
  font-size: 48px;
  margin: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.5));
  text-align: left;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 16px;
  width: 40px;
  height: 40px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
}

.modal-emoji {
  font-size: 72px;
  text-align: center;
  margin-bottom: 12px;
}

.modal-name {
  font-size: 1.4rem;
  font-weight: 700;
  text-align: center;
  margin-bottom: 16px;
  color: #2d2d2d;
}

.modal-clue {
  background: #FFF9C4;
  border: 2px dashed #FFC107;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 14px;
}

.modal-clue-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #F57F17;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.modal-clue p {
  margin-top: 6px;
  font-size: 0.95rem;
  line-height: 1.5;
  color: #5D4037;
}

.modal-description {
  font-size: 0.9rem;
  line-height: 1.5;
  color: #555;
  margin-bottom: 14px;
}

.modal-funfact {
  background: #E3F2FD;
  border-left: 4px solid #2196F3;
  border-radius: 0 8px 8px 0;
  padding: 12px 14px;
  margin-bottom: 20px;
}

.modal-funfact-label {
  font-size: 0.8rem;
  font-weight: 700;
  color: #1565C0;
}

.modal-funfact p {
  margin-top: 4px;
  font-size: 0.85rem;
  line-height: 1.4;
  color: #37474F;
  font-style: italic;
}

.btn-maps {
  display: block;
  width: 100%;
  min-height: 48px;
  border: 2px solid #4285F4;
  border-radius: 14px;
  background: white;
  color: #4285F4;
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  text-align: center;
  text-decoration: none;
  line-height: 48px;
  margin-bottom: 10px;
  transition: background 0.15s, color 0.15s;
}

.btn-maps:active {
  background: #4285F4;
  color: white;
}

.btn-found {
  display: block;
  width: 100%;
  min-height: 56px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #4CAF50, #2E7D32);
  color: white;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(76,175,80,0.4);
  transition: transform 0.1s;
}

.btn-found:active {
  transform: scale(0.96);
}

.modal-already-found {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
}

.modal-found-badge {
  font-size: 1rem;
  font-weight: 600;
  color: #4CAF50;
}

.btn-unfound {
  border: 2px solid #e53935;
  border-radius: 10px;
  background: white;
  color: #e53935;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.95rem;
  font-weight: 600;
  padding: 8px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, color 0.15s;
}

.btn-unfound:active {
  background: #e53935;
  color: white;
}

/* === HUNT FOOTER === */
.hunt-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 12px 16px;
  background: linear-gradient(transparent, #FFF8E7 30%);
  text-align: center;
  z-index: 5;
}

.btn-reset {
  border: none;
  background: none;
  color: #aaa;
  font-family: 'Fredoka', sans-serif;
  font-size: 0.8rem;
  text-decoration: underline;
  cursor: pointer;
  padding: 8px 16px;
}

/* === FINALE === */
#screen-finale {
  background: rgba(0,0,0,0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  z-index: 200;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  z-index: 201;
  pointer-events: none;
}

.finale-content {
  position: relative;
  z-index: 202;
  padding: 24px;
  max-width: 400px;
}

.finale-emoji {
  font-size: 48px;
  letter-spacing: 8px;
  margin-bottom: 16px;
}

.finale-title {
  font-size: 2.8rem;
  font-weight: 700;
  color: #FFD700;
  text-shadow: 0 0 20px rgba(255,215,0,0.6);
  animation: bounce 0.6s ease-out;
  margin-bottom: 12px;
}

@keyframes bounce {
  0% { transform: scale(0.3); opacity: 0; }
  50% { transform: scale(1.1); }
  70% { transform: scale(0.95); }
  100% { transform: scale(1); opacity: 1; }
}

.finale-score {
  font-size: 1.3rem;
  color: white;
  margin-bottom: 8px;
}

.finale-message {
  font-size: 1.4rem;
  font-weight: 600;
  color: #FFD700;
  line-height: 1.3;
  margin-bottom: 16px;
}

.finale-badge {
  font-size: 64px;
  animation: spinBadge 2s ease-in-out infinite;
  margin-bottom: 24px;
}

@keyframes spinBadge {
  0%, 100% { transform: rotate(0deg) scale(1); }
  25% { transform: rotate(10deg) scale(1.1); }
  75% { transform: rotate(-10deg) scale(1.1); }
}

/* === RESPONSIVE === */
@media (min-width: 480px) {
  .start-title { font-size: 2.6rem; }
  .card-name { font-size: 0.9rem; }
  .card { min-height: 150px; }
}

@media (min-width: 600px) {
  .card-grid {
    grid-template-columns: repeat(3, 1fr);
    max-width: 600px;
    margin: 0 auto;
  }
}

@media (min-width: 768px) {
  .card-grid {
    max-width: 700px;
  }
  .hunt-header {
    max-width: 700px;
    margin: 0 auto;
    border-radius: 0 0 16px 16px;
  }
}
