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

:root {
  --primary: #E8603C;
  --primary-dark: #D04E2C;
  --primary-light: #FFF0EB;
  --green: #2E7D32;
  --green-light: #E8F5E9;
  --bg: #FFFAF6;
  --card: #FFFFFF;
  --text: #1E1E2E;
  --text-light: #64748B;
  --border: #E2E8F0;
  --shadow: 0 1px 3px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.04);
  --shadow-hover: 0 4px 16px rgba(0,0,0,.12);
  --radius: 16px;
  --radius-sm: 10px;
  --premium-bg: #FEF3C7;
  --premium-border: #F59E0B;
}

html { font-size: 16px; }

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

.logo {
  font-family: 'Playfair Display', serif;
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.5px;
}
.logo span { color: var(--primary); }

#logo-link { text-decoration: none; color: inherit; }

.tagline {
  color: var(--text-light);
  font-size: .95rem;
  margin-top: .25rem;
}

main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 1rem;
}

/* Views */
.view { display: none; }
.view.active { display: block; }

/* Loader */
.loader {
  width: 40px; height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  margin: 3rem auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Cards */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
}

/* Setup */
.setup-card {
  max-width: 440px;
  margin: 2rem auto;
}
.setup-card h2 { margin-bottom: .5rem; }
.setup-card > p { color: var(--text-light); font-size: .9rem; margin-bottom: 1.5rem; }

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-weight: 500;
  font-size: .85rem;
  margin-bottom: .35rem;
  color: var(--text);
}
.field input, .field select {
  width: 100%;
  padding: .7rem .9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-family: inherit;
  transition: border-color .15s;
  background: var(--card);
  color: var(--text);
}
.field input:focus, .field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.field-inline {
  display: flex;
  align-items: center;
  gap: .6rem;
}
.field-inline label { margin-bottom: 0; white-space: nowrap; }
.field-inline input { width: 180px; }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  padding: .7rem 1.5rem;
  border: none;
  border-radius: var(--radius-sm);
  font-size: .95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all .15s;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--primary);
  color: white;
  width: 100%;
}
.btn-primary:hover:not(:disabled) { background: var(--primary-dark); }

.btn-large { padding: 1rem 2rem; font-size: 1.05rem; border-radius: var(--radius); }

.error-msg {
  color: #DC2626;
  font-size: .85rem;
  margin-top: .75rem;
  min-height: 1.2em;
}

/* Weeks */
.view h2 { text-align: center; margin-bottom: 1.5rem; }

.weeks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1rem;
  max-width: 700px;
  margin: 0 auto;
}

.week-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  border: 2px solid transparent;
  text-decoration: none;
  color: inherit;
  display: block;
}
.week-card:hover {
  box-shadow: var(--shadow-hover);
  border-color: var(--primary);
  transform: translateY(-2px);
}
.week-card .week-id {
  font-size: .8rem;
  color: var(--text-light);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.week-card .week-dates {
  font-size: 1.1rem;
  font-weight: 600;
  margin-top: .4rem;
}

/* Menu */
.menu-header {
  text-align: center;
  margin-bottom: 1.5rem;
}

.voter-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding: 1rem;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.selection-counter {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  white-space: nowrap;
}
.selection-counter.complete { color: var(--green); }

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.meal-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  cursor: pointer;
  transition: all .2s;
  border: 3px solid transparent;
  position: relative;
}
.meal-card:hover { box-shadow: var(--shadow-hover); }
.meal-card.selected {
  border-color: var(--green);
  box-shadow: 0 0 0 1px var(--green), var(--shadow-hover);
}
.meal-card.selected .meal-check { opacity: 1; transform: scale(1); }

.meal-card.premium {
  opacity: .55;
  cursor: not-allowed;
  border-color: var(--premium-border);
}
.meal-card.premium:hover { box-shadow: var(--shadow); }

.meal-img {
  width: 100%;
  aspect-ratio: 16/10;
  object-fit: cover;
  display: block;
  background: #F1F5F9;
}

.meal-body { padding: 1rem; }

.meal-name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.3;
  margin-bottom: .3rem;
}

.meal-headline {
  color: var(--text-light);
  font-size: .85rem;
  line-height: 1.4;
}

.meal-meta {
  display: flex;
  gap: .75rem;
  margin-top: .6rem;
  font-size: .78rem;
  color: var(--text-light);
}

.meal-badge {
  display: inline-block;
  padding: .2rem .6rem;
  border-radius: 6px;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .3px;
}
.badge-premium {
  background: var(--premium-bg);
  color: #92400E;
  border: 1px solid var(--premium-border);
}
.badge-tag {
  background: #F1F5F9;
  color: var(--text-light);
}

.meal-check {
  position: absolute;
  top: .75rem;
  right: .75rem;
  width: 32px;
  height: 32px;
  background: var(--green);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 1.1rem;
  opacity: 0;
  transform: scale(.5);
  transition: all .2s cubic-bezier(.34,1.56,.64,1);
  z-index: 2;
}

.meal-badges {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-top: .5rem;
}

/* Vote footer */
.vote-footer {
  position: sticky;
  bottom: 1rem;
  z-index: 10;
  max-width: 400px;
  margin: 0 auto 1rem;
}

/* Results */
.results-section {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid var(--border);
}
.results-section h3 {
  text-align: center;
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.results-empty {
  text-align: center;
  color: var(--text-light);
  padding: 2rem;
}

.voter-row {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1rem 1.25rem;
  margin-bottom: .75rem;
}
.voter-name {
  font-weight: 700;
  font-size: 1rem;
  margin-bottom: .5rem;
  color: var(--primary);
}
.voter-picks {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
}
.voter-pick {
  background: var(--green-light);
  color: var(--green);
  font-size: .82rem;
  font-weight: 500;
  padding: .3rem .7rem;
  border-radius: 6px;
}

.top-picks {
  margin-top: 1.5rem;
}
.top-picks h4 {
  text-align: center;
  margin-bottom: .75rem;
  color: var(--text-light);
  font-weight: 500;
  font-size: .9rem;
}

.top-pick-row {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .6rem 0;
  border-bottom: 1px solid var(--border);
}
.top-pick-row:last-child { border-bottom: none; }

.top-pick-rank {
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .8rem;
  flex-shrink: 0;
}
.top-pick-name { flex: 1; font-weight: 500; }
.top-pick-votes {
  font-size: .85rem;
  color: var(--text-light);
  font-weight: 500;
}

@media (max-width: 600px) {
  .menu-grid { grid-template-columns: 1fr; }
  .voter-bar { flex-direction: column; gap: .75rem; }
  .field-inline { flex-direction: column; align-items: stretch; }
  .field-inline input { width: 100%; }
  header { padding: 1.5rem 1rem .75rem; }
  .logo { font-size: 1.8rem; }
}
