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

:root {
  --primary: #6c3ff5;
  --primary-dark: #5530d0;
  --accent: #ff6b35;
  --accent-dark: #e05a28;
  --success: #2ecc71;
  --danger: #e74c3c;
  --bg: #f0ecff;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-muted: #6b6b8a;
  --border-radius: 18px;
  --shadow: 0 4px 24px rgba(108, 63, 245, 0.12);
  --shadow-lg: 0 8px 40px rgba(108, 63, 245, 0.2);
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* ===== App Shell ===== */
#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ===== Screens ===== */
.screen {
  display: none;
  min-height: 100vh;
  padding: env(safe-area-inset-top, 16px) 16px env(safe-area-inset-bottom, 32px);
  overflow-y: auto;
}

.screen.active {
  display: block;
}

.screen-inner {
  max-width: 480px;
  margin: 0 auto;
  padding-top: 32px;
  padding-bottom: 32px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* ===== Heads Header ===== */
.heads-header {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 16px;
  padding: 12px 0 0;
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 100;
}

.head-wrap {
  position: relative;
  display: flex;
  align-items: flex-end;
}

.head-img {
  width: 80px;
  height: 100px;
  border-radius: 50%;
  object-fit: cover;
  object-position: top;
  animation: sway 1.8s ease-in-out infinite;
  transform-origin: bottom center;
  position: relative;
  z-index: 1;
}

.head-wrap:nth-child(2) .head-img {
  animation-delay: 0.2s;
}

@keyframes sway {
  0%,100% { transform: rotate(0deg); }
  25%      { transform: rotate(-10deg); }
  75%      { transform: rotate(10deg); }
}

.hand {
  font-size: 32px;
  display: inline-block;
  line-height: 1;
  margin-bottom: 6px;
  position: relative;
  z-index: 2;
}

.hand-right {
  margin-right: -4px;
  animation: wave-right 1.8s ease-in-out infinite;
  transform-origin: bottom right;
}

.hand-left {
  margin-left: -4px;
  transform: scaleX(-1);
  animation: wave-left 1.8s ease-in-out infinite;
  transform-origin: bottom right;
}

@keyframes wave-right {
  0%,100% { transform: rotate(0deg); }
  25%      { transform: rotate(25deg); }
  75%      { transform: rotate(-10deg); }
}

@keyframes wave-left {
  0%,100% { transform: scaleX(-1) rotate(0deg); }
  25%      { transform: scaleX(-1) rotate(25deg); }
  75%      { transform: scaleX(-1) rotate(-10deg); }
}

/* ===== Header Emoji ===== */
.trophy-header {
  font-size: 72px;
  text-align: center;
  line-height: 1;
  filter: drop-shadow(0 4px 8px rgba(0,0,0,0.15));
}

.confetti-header {
  font-size: 56px;
  text-align: center;
}

/* ===== Typography ===== */
h1 {
  font-size: 2rem;
  font-weight: 800;
  text-align: center;
  color: var(--primary);
  line-height: 1.2;
}

h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
}

.big-text {
  font-size: 1.2rem;
  font-weight: 600;
  text-align: center;
}

/* ===== Cards ===== */
.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 22px 20px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.instructions-card ol {
  padding-left: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.instructions-card li {
  font-size: 1rem;
}

.clue-card {
  background: linear-gradient(135deg, #fff9f0, #fffbf5);
  border: 2px solid #ffe0b2;
}

.card-label {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--accent);
}

#clue-text {
  font-size: 1.05rem;
  white-space: pre-line;
  line-height: 1.65;
}

/* ===== Step Badge ===== */
.step-badge {
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 0.9rem;
  padding: 8px 18px;
  border-radius: 100px;
  text-align: center;
  align-self: center;
  box-shadow: var(--shadow);
  letter-spacing: 0.04em;
}

/* ===== Form ===== */
label {
  display: block;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

input[type="text"] {
  width: 100%;
  padding: 16px;
  font-size: 1.2rem;
  font-weight: 600;
  border: 2.5px solid #e0d9ff;
  border-radius: 12px;
  background: #f8f6ff;
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
  -webkit-appearance: none;
}

input[type="text"]:focus {
  border-color: var(--primary);
  background: white;
}

/* ===== Buttons ===== */
.btn {
  display: block;
  width: 100%;
  padding: 18px 24px;
  font-size: 1.1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: transform 0.12s, box-shadow 0.12s, opacity 0.12s;
  letter-spacing: 0.02em;
  -webkit-appearance: none;
  text-align: center;
}

.btn:active {
  transform: scale(0.97);
  opacity: 0.9;
}

.btn:disabled {
  opacity: 0.5;
  pointer-events: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 6px 20px rgba(108, 63, 245, 0.35);
}

.btn-primary:hover {
  box-shadow: 0 8px 28px rgba(108, 63, 245, 0.45);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2.5px solid var(--primary);
}

.btn-danger {
  background: white;
  color: var(--danger);
  border: 2.5px solid var(--danger);
}

.btn-checkin {
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: white;
  box-shadow: 0 6px 20px rgba(255, 107, 53, 0.35);
  font-size: 1.2rem;
  padding: 22px 24px;
}

.btn-checkin:hover {
  box-shadow: 0 8px 28px rgba(255, 107, 53, 0.45);
}

/* ===== Status Messages ===== */
#location-status {
  margin-top: 14px;
  padding: 16px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
}

#location-status.error {
  background: #fdecea;
  color: var(--danger);
  border: 2px solid #f5c6c6;
}

#location-status.loading {
  background: #fffde7;
  color: #856404;
  border: 2px solid #ffeaa0;
}

.error-msg {
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 600;
  margin-top: 4px;
}

/* ===== Prize Reveal ===== */
.prize-reveal {
  background: white;
  border-radius: var(--border-radius);
  padding: 28px 20px;
  box-shadow: var(--shadow-lg);
  text-align: center;
  border: 3px solid #c3a9ff;
  animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
  margin-bottom: 16px;
}

.prize-reveal h2 {
  font-size: 1.7rem;
  text-align: center;
  margin: 8px 0;
}

.prize-reveal p {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--primary);
  margin: 8px 0 16px;
}

.prize-img {
  width: 100%;
  max-width: 320px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  display: block;
  margin: 0 auto;
}

/* ===== All Prizes at the End ===== */
#all-prizes {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#prizes-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.prize-item {
  background: white;
  border-radius: 14px;
  padding: 16px;
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  gap: 14px;
}

.prize-item img {
  width: 70px;
  height: 70px;
  object-fit: contain;
  border-radius: 8px;
  flex-shrink: 0;
}

.prize-item-info {
  flex: 1;
}

.prize-item-step {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.prize-item-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--text);
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 100;
  backdrop-filter: blur(2px);
  animation: fadeIn 0.2s ease both;
}

.modal {
  background: white;
  border-radius: var(--border-radius);
  padding: 32px 24px;
  max-width: 400px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  text-align: center;
  box-shadow: var(--shadow-lg);
  animation: popIn 0.25s cubic-bezier(0.175, 0.885, 0.32, 1.275) both;
}

.modal-emoji {
  font-size: 52px;
  line-height: 1;
}

.modal h2 {
  text-align: center;
}

.modal p {
  color: var(--text-muted);
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ===== Utilities ===== */
.hidden {
  display: none !important;
}

/* ===== Animation ===== */
@keyframes popIn {
  0% { transform: scale(0.8); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes fadeSlideUp {
  0% { transform: translateY(20px); opacity: 0; }
  100% { transform: translateY(0); opacity: 1; }
}

.screen.active .screen-inner {
  animation: fadeSlideUp 0.3s ease both;
}

/* ===== Responsive tweaks for very small screens ===== */
@media (max-width: 360px) {
  h1 { font-size: 1.7rem; }
  .trophy-header { font-size: 56px; }
  .btn { font-size: 1rem; padding: 16px 20px; }
}
