*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #ffd700 0%, #ffeb3b 25%, #fff176 50%, #ffcc02 75%, #ffc107 100%);
  background-size: 400% 400%;
  animation: gradientShift 8s ease infinite;
  color: #2d2d2d;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes hotdogFall {
  0% {
    transform: translateY(0px) rotate(0deg);
    opacity: 0;
  }
  5% {
    opacity: 1;
  }
  95% {
    opacity: 1;
  }
  100% {
    transform: translateY(calc(100vh + 400px)) rotate(360deg);
    opacity: 0;
  }
}

.hotdog {
  position: fixed;
  font-size: 4rem;
  z-index: 999;
  pointer-events: none;
  top: -200px; /* Start above the screen */
}

/* All hotdogs fall down from top */
.hotdog {
  animation: hotdogFall 8s linear infinite;
}

/* Positioning 9 hotdogs across the screen width with randomized timing */
.hotdog:nth-child(1) { left: 10%; animation-delay: 3.2s; font-size: 4rem; }
.hotdog:nth-child(2) { left: 25%; animation-delay: 0.5s; font-size: 5.5rem; }
.hotdog:nth-child(3) { left: 40%; animation-delay: 6.8s; font-size: 3.5rem; }
.hotdog:nth-child(4) { left: 55%; animation-delay: 1.9s; font-size: 6rem; }
.hotdog:nth-child(5) { left: 70%; animation-delay: 4.7s; font-size: 4.5rem; }
.hotdog:nth-child(6) { left: 85%; animation-delay: 2.1s; font-size: 5rem; }
.hotdog:nth-child(7) { left: 15%; animation-delay: 7.4s; font-size: 7rem; }
.hotdog:nth-child(8) { left: 60%; animation-delay: 0.3s; font-size: 3.8rem; }
.hotdog:nth-child(9) { left: 80%; animation-delay: 5.6s; font-size: 6.5rem; }

.lockbox {
  max-width: 900px;
  width: 100%;
  background: rgba(255, 255, 255, 0.6);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(255, 193, 7, 0.4);
  border-radius: 1rem;
  padding: 2rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1), 0 0 40px rgba(255, 215, 0, 0.3);
}

.lockbox-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.lockbox-header h1 {
  margin: 0;
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.subtitle {
  margin: 0.5rem 0 0;
  font-size: 0.95rem;
  opacity: 0.85;
}

.game-section p {
  margin: 0 0 0.5rem;
}

.round-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.round-label {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 0.5rem;
  opacity: 0.9;
}

.round-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0;
  background: linear-gradient(45deg, #ff8f00, #ffc107, #ffb300);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.hint-label {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  opacity: 0.8;
  margin-bottom: 0.25rem;
}

.hint {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.15), rgba(255, 235, 59, 0.15));
  padding: 1rem;
  border-radius: 0.5rem;
  margin-bottom: 1.25rem;
  line-height: 1.5;
  border-left: 4px solid #ffc107;
  border-image: linear-gradient(45deg, #ffc107, #ffeb3b) 1;
}

.code-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.code-form label {
  font-size: 0.9rem;
  font-weight: 500;
}

#code-input {
  font-size: 1.5rem;
  letter-spacing: 0.25em;
  text-align: center;
  padding: 0.75rem 1rem;
  border: 2px solid rgba(255, 193, 7, 0.3);
  border-radius: 0.5rem;
  background: rgba(255, 255, 255, 0.8);
  color: #333;
  width: 100%;
}

#code-input::placeholder {
  color: rgba(51, 51, 51, 0.5);
}

#code-input:focus {
  outline: none;
  border-color: #ff8f00;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.3), 0 0 20px rgba(255, 193, 7, 0.2);
}

#submit-btn {
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #ff8f00, #ffc107);
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

#submit-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 143, 0, 0.4), 0 8px 25px rgba(255, 193, 7, 0.3);
  background: linear-gradient(135deg, #f57f17, #ff9800);
}

#submit-btn:active {
  transform: translateY(0);
}

.feedback {
  min-height: 1.5em;
  margin-top: 0.75rem;
  font-size: 0.95rem;
  font-weight: 500;
}

.feedback.success {
  color: #4caf50;
  text-shadow: 0 0 10px rgba(76, 175, 80, 0.5);
  font-weight: 600;
}

.feedback.error {
  color: #f44336;
  text-shadow: 0 0 10px rgba(244, 67, 54, 0.5);
  font-weight: 600;
}

.prize-section {
  text-align: center;
  padding: 1rem 0;
}

.prize-content h2 {
  margin: 0 0 1rem;
  font-size: 1.5rem;
  background: linear-gradient(45deg, #ff8f00, #ffc107, #ffb300);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.prize-message {
  font-size: 1.1rem;
  line-height: 1.6;
  margin: 0;
}

.hidden {
  display: none !important;
}

/* Matching Game Styles */
.matching-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2rem;
  margin-bottom: 1.5rem;
}

.names-column,
.passages-column {
  background: rgba(255, 255, 255, 0.5);
  border-radius: 0.5rem;
  padding: 1rem;
}

.names-column h3,
.passages-column h3 {
  margin: 0 0 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  text-align: center;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid #ff8f00;
  background: linear-gradient(90deg, #ff8f00, #ffc107);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.names-list,
.passages-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.name-item,
.passage-item {
  padding: 0.75rem;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

.name-item {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.2), rgba(255, 235, 59, 0.2));
  border-color: rgba(255, 193, 7, 0.5);
  font-weight: 500;
  color: #333;
}

.name-item:hover {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.3), rgba(255, 235, 59, 0.3));
  border-color: rgba(255, 193, 7, 0.7);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.4);
}

.name-item.selected {
  background: linear-gradient(135deg, rgba(255, 193, 7, 0.5), rgba(255, 235, 59, 0.5));
  border-color: #ff8f00;
  box-shadow: 0 0 0 3px rgba(255, 193, 7, 0.4), 0 0 20px rgba(255, 193, 7, 0.3);
}

.name-item.matched {
  background: linear-gradient(135deg, rgba(76, 175, 80, 0.2), rgba(139, 195, 74, 0.2));
  border-color: #4caf50;
  color: #2e7d32;
  text-shadow: 0 0 8px rgba(76, 175, 80, 0.4);
  font-weight: 600;
}

.passage-item {
  background: rgba(255, 255, 255, 0.7);
  border-color: rgba(255, 193, 7, 0.3);
  line-height: 1.5;
  color: #333;
}

.passage-item:hover {
  background: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 193, 7, 0.5);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(255, 193, 7, 0.3);
}

.check-matches-btn {
  font-size: 1rem;
  font-weight: 600;
  padding: 0.75rem 1.25rem;
  border: none;
  border-radius: 0.5rem;
  background: linear-gradient(135deg, #ff8f00, #ffc107);
  color: #ffffff;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  margin-bottom: 0.75rem;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

.check-matches-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(255, 143, 0, 0.4), 0 8px 25px rgba(255, 193, 7, 0.3);
  background: linear-gradient(135deg, #f57f17, #ff9800);
}

.check-matches-btn:active {
  transform: translateY(0);
}

/* iPhone and mobile optimizations */
@media (max-width: 768px) {
  body {
    padding: 0.5rem;
  }

  .lockbox {
    max-width: 100%;
    padding: 1rem;
    border-radius: 0.75rem;
    background: rgba(255, 255, 255, 0.5);
    backdrop-filter: blur(6px);
  }

  /* Adjust hotdog sizes for mobile */
  .hotdog {
    font-size: 3rem;
  }

  .hotdog:nth-child(1) { font-size: 3rem; }
  .hotdog:nth-child(2) { font-size: 4.2rem; }
  .hotdog:nth-child(3) { font-size: 2.8rem; }
  .hotdog:nth-child(4) { font-size: 4.5rem; }
  .hotdog:nth-child(5) { font-size: 3.5rem; }
  .hotdog:nth-child(6) { font-size: 3.8rem; }
  .hotdog:nth-child(7) { font-size: 5.2rem; }
  .hotdog:nth-child(8) { font-size: 3rem; }
  .hotdog:nth-child(9) { font-size: 4.8rem; }

  .lockbox-header h1 {
    font-size: 1.5rem;
  }

  .subtitle {
    font-size: 0.9rem;
  }

  .round-title {
    font-size: 1.25rem;
    letter-spacing: 0.05em;
  }

  .matching-container {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .names-column,
  .passages-column {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.4);
  }

  .name-item,
  .passage-item {
    padding: 0.75rem;
    font-size: 0.9rem;
    min-height: 48px; /* iOS touch target minimum */
    display: flex;
    align-items: center;
    line-height: 1.4;
  }

  .passage-item {
    font-size: 0.85rem;
  }

  .check-matches-btn {
    padding: 1rem;
    font-size: 1.1rem;
    min-height: 48px;
  }
}

@media (max-width: 480px) {
  .lockbox {
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(5px);
  }

  .lockbox-header h1 {
    font-size: 1.25rem;
  }

  .round-title {
    font-size: 1.1rem;
  }

  .names-column,
  .passages-column {
    padding: 0.5rem;
    background: rgba(255, 255, 255, 0.35);
  }

  .name-item,
  .passage-item {
    padding: 0.65rem;
    font-size: 0.85rem;
  }

  .passage-item {
    font-size: 0.8rem;
  }
}

/* Touch-specific optimizations for iOS */
@media (hover: none) and (pointer: coarse) {
  .name-item:hover,
  .passage-item:hover,
  .check-matches-btn:hover {
    transform: none;
    box-shadow: none;
  }

  .name-item:active {
    background: linear-gradient(135deg, rgba(255, 193, 7, 0.6), rgba(255, 235, 59, 0.6));
    transform: scale(0.98);
  }

  .passage-item:active {
    background: rgba(255, 255, 255, 0.95);
    transform: scale(0.98);
  }

  .check-matches-btn:active {
    transform: scale(0.98);
    background: linear-gradient(135deg, #f57f17, #ff9800);
  }
}
