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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  min-height: 100vh;
  padding: 20px;
}

.container {
  max-width: 900px;
  margin: 0 auto;
  background: white;
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

header {
  text-align: center;
  margin-bottom: 30px;
  padding: 40px 20px;
  margin: -30px -30px 30px -30px;
  border-radius: 20px 20px 0 0;
  background:
    linear-gradient(rgba(255,255,255,0.85), rgba(255,255,255,0.95)),
    url('og-image.jpg') center/cover;
}

h1 {
  font-size: 2rem;
  margin-bottom: 8px;
}

.subtitle {
  color: #666;
  font-size: 1.1rem;
}

/* Sections */
.section {
  margin-bottom: 30px;
}

.section > label {
  display: block;
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.hint {
  color: #888;
  font-size: 0.9rem;
  margin-bottom: 12px;
}

/* Name Input */
#name-input {
  width: 100%;
  padding: 12px 15px;
  font-size: 1.1rem;
  border: 2px solid #ddd;
  border-radius: 10px;
}

#name-input:focus {
  outline: none;
  border-color: #667eea;
}

/* Dates Grid */
.dates-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.date-card {
  padding: 12px 16px;
  border: 2px solid #ddd;
  border-radius: 10px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 100px;
}

.date-card:hover {
  border-color: #667eea;
}

.date-card.high {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: transparent;
}

.date-card.low {
  background: #a5b4fc;
  border-color: #a5b4fc;
  color: white;
}

.date-status {
  font-size: 0.75rem;
  margin-top: 4px;
  min-height: 1em;
}

.date-card .day-name {
  font-size: 0.8rem;
  opacity: 0.8;
}

.date-card .day-num {
  font-size: 1.1rem;
  font-weight: bold;
}

/* Cereals Grid */
.cereals-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
}

.cereal-card {
  border: 3px solid #eee;
  border-radius: 12px;
  padding: 12px 8px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.cereal-card:hover {
  border-color: #667eea;
  transform: scale(1.02);
}

.cereal-card.selected {
  border-color: #667eea;
  background: linear-gradient(135deg, rgba(102,126,234,0.15) 0%, rgba(118,75,162,0.15) 100%);
}

.cereal-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.cereal-img-wrap {
  position: relative;
}

.cereal-card .cereal-img {
  width: 100%;
  height: 140px;
  object-fit: contain;
  margin-bottom: 8px;
}

.zoom-btn {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(255,255,255,0.9);
  border: none;
  border-radius: 50%;
  width: 28px;
  height: 28px;
  font-size: 14px;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

.zoom-btn:hover {
  opacity: 1;
}

/* Lightbox */
.lightbox {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.85);
  justify-content: center;
  align-items: center;
  z-index: 1000;
  cursor: pointer;
}

.lightbox.active {
  display: flex;
}

.lightbox img {
  max-width: 90%;
  max-height: 90%;
  object-fit: contain;
  border-radius: 8px;
}

.cereal-card .cereal-name {
  font-size: 0.85rem;
  font-weight: 600;
  color: #333;
  line-height: 1.2;
}

.cereal-card .cereal-desc {
  font-size: 0.7rem;
  color: #888;
  margin-top: 4px;
}

.selection-count {
  text-align: center;
  color: #667eea;
  font-weight: 600;
  margin-top: 10px;
}

/* Drinks */
.drinks-section {
  display: flex;
  gap: 30px;
  flex-wrap: wrap;
}

.drink-group {
  flex: 1;
  min-width: 200px;
}

.drink-group > label {
  display: block;
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 10px;
}

.options-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.option-card {
  display: block;
  padding: 10px 14px;
  border: 2px solid #ddd;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.9rem;
}

.option-card:hover {
  border-color: #667eea;
}

.option-card input {
  display: none;
}

.option-card:has(input:checked) {
  background: linear-gradient(135deg, rgba(102,126,234,0.15) 0%, rgba(118,75,162,0.15) 100%);
  border-color: #667eea;
  font-weight: 600;
}

/* Submit Button */
.btn {
  display: block;
  width: 100%;
  padding: 15px;
  font-size: 1.1rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.1s;
  margin-top: 20px;
}

.btn.primary {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
}

.btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 20px rgba(102, 126, 234, 0.4);
}

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

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Thanks */
.thanks {
  text-align: center;
  padding: 60px 20px;
}

.thanks h2 {
  font-size: 2.5rem;
  margin-bottom: 15px;
}

.thanks p {
  font-size: 1.2rem;
  color: #667eea;
}

.edit-link {
  display: inline-block;
  margin-top: 15px;
  color: #667eea;
  font-size: 1rem;
}

/* Stats */
.stats {
  margin-top: 30px;
}

.stats h3 {
  text-align: center;
  margin-bottom: 20px;
  color: #333;
}

.stats-section {
  margin-bottom: 25px;
}

.stats-section h4 {
  font-size: 0.95rem;
  color: #555;
  margin-bottom: 12px;
  text-align: center;
}

/* Date heatmap */
.date-heatmap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.heatmap-cell {
  width: 70px;
  padding: 10px 8px;
  border-radius: 10px;
  text-align: center;
  transition: transform 0.2s;
}

.heatmap-cell:hover {
  transform: scale(1.05);
}

.heatmap-day {
  font-size: 0.7rem;
  opacity: 0.7;
  text-transform: uppercase;
}

.heatmap-num {
  font-size: 1.3rem;
  font-weight: bold;
}

.heatmap-votes {
  font-size: 0.75rem;
  margin-top: 4px;
  opacity: 0.8;
}

/* Cereal ranks */
.cereal-ranks {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.rank-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #f8f8f8;
  border-radius: 8px;
  position: relative;
  overflow: hidden;
}

.rank-bar {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: linear-gradient(135deg, rgba(102,126,234,0.2) 0%, rgba(118,75,162,0.2) 100%);
  z-index: 0;
  border-radius: 8px;
}

.rank-medal {
  font-size: 1.1rem;
  width: 24px;
  z-index: 1;
}

.rank-name {
  flex: 1;
  font-weight: 500;
  z-index: 1;
}

.rank-count {
  font-weight: bold;
  color: #667eea;
  z-index: 1;
}

/* Drink pills */
.pills-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  align-items: center;
}

.pill {
  background: linear-gradient(135deg, rgba(102,126,234,0.15) 0%, rgba(118,75,162,0.15) 100%);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.9rem;
}

.pill b {
  color: #667eea;
  margin-left: 4px;
}

.pill-divider {
  color: #ddd;
}

.hidden {
  display: none;
}

/* Steps */
.step {
  display: none;
}

.step.active {
  display: block;
}

.greeting {
  text-align: center;
  font-size: 1.1rem;
  margin-bottom: 15px;
}

.greeting a {
  color: #888;
  font-size: 0.9rem;
}

.welcome-back {
  background: linear-gradient(135deg, rgba(102,126,234,0.1) 0%, rgba(118,75,162,0.1) 100%);
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 0.95rem;
  color: #555;
}

/* Responsive */
@media (min-width: 700px) {
  .cereals-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 500px) {
  .container {
    padding: 20px 15px;
  }

  .cereal-card .cereal-img {
    height: 100px;
  }

  .drinks-section {
    flex-direction: column;
    gap: 20px;
  }
}
