:root {
  --bg: #fbf7f0;
  --paper: #ffffff;
  --ink: #161616;
  --muted: #6b6560;
  --line: #ece5da;
  --red: #c8102e;
  --red-soft: #fbe7ea;
  --veg: #2f7a3a;
  --veg-soft: #e5f3e3;
  --bar: #fde7b0;
  --bar-mine: #ffd36b;
  --blob1: #ffd9d2;
  --blob2: #fff0b8;
  --blob3: #dcefd2;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171412;
    --paper: #211d1a;
    --ink: #f4efe8;
    --muted: #b0a79d;
    --line: #36302a;
    --red: #ff5a6e;
    --red-soft: #3d1f24;
    --veg: #8fd18f;
    --veg-soft: #22331f;
    --bar: #4a3c1c;
    --bar-mine: #7a5e1c;
    --blob1: #3a2421;
    --blob2: #352d17;
    --blob3: #22301d;
  }
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 8% 12%, var(--blob1) 0 90px, transparent 91px),
    radial-gradient(circle at 92% 22%, var(--blob3) 0 120px, transparent 121px),
    radial-gradient(circle at 4% 62%, var(--blob2) 0 110px, transparent 111px),
    radial-gradient(circle at 96% 78%, var(--blob1) 0 80px, transparent 81px),
    var(--bg);
  background-attachment: fixed;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

.paper {
  max-width: 620px;
  margin: 0 auto;
  padding: 28px 16px 56px;
  text-align: center;
}

.head h1 {
  font-size: clamp(2.6rem, 11vw, 3.4rem);
  font-weight: 800;
  letter-spacing: .01em;
  margin: 8px 0 12px;
  line-height: 1;
}

.logo {
  width: 132px;
  height: 132px;
  border-radius: 50%;
  border: 4px solid #111;
  object-fit: cover;
  object-position: 42% 50%;
  background: #fff;
  display: block;
  margin: 0 auto;
}

.week-label {
  margin: 14px 0 0;
  color: var(--muted);
  font-weight: 500;
}

/* --- navigazione giorni --- */
.day-nav {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
  padding: 10px 0;
  margin: 18px -16px 4px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(6px);
}
.day-nav a {
  min-width: 52px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: .85rem;
  text-transform: uppercase;
}
.day-nav a.is-today { background: var(--red); border-color: var(--red); color: #fff; }

/* --- giorni --- */
.day {
  margin-top: 22px;
  padding: 18px 14px 16px;
  border-radius: 18px;
  scroll-margin-top: 64px;
}
.day.is-today {
  background: var(--paper);
  box-shadow: 0 1px 0 var(--line), 0 10px 30px -18px rgba(0, 0, 0, .35);
  outline: 2px solid var(--red-soft);
}
.day h2 {
  font-size: 1.15rem;
  font-weight: 800;
  margin: 0 0 6px;
  letter-spacing: .02em;
}
.badge-today {
  display: inline-block;
  vertical-align: 2px;
  margin-left: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-size: .68rem;
  letter-spacing: .06em;
}

.courses { list-style: none; margin: 0; padding: 0; }
.course { padding: 5px 0; font-size: 1.05rem; }
.course + .course { border-top: 1px dashed var(--line); }

.course-label {
  display: block;
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  color: var(--muted);
}
.dish-name { display: block; }
.dish-veg {
  display: block;
  font-size: .95rem;
  color: var(--muted);
}
.tag-veg {
  display: inline-block;
  margin-right: 6px;
  padding: 0 7px;
  border-radius: 6px;
  background: var(--veg-soft);
  color: var(--veg);
  font-size: .7rem;
  font-weight: 700;
  line-height: 1.6;
  vertical-align: 1px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.badge-chosen {
  display: inline-block;
  margin-top: 4px;
  padding: 1px 9px;
  border-radius: 999px;
  background: var(--red-soft);
  color: var(--red);
  font-size: .7rem;
  font-weight: 700;
}

/* --- votazione --- */
.poll { padding: 12px 0; }
.poll-q { margin: 0 0 8px; font-weight: 700; font-size: .9rem; color: var(--red); }
.poll-form { display: grid; gap: 8px; }
.option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 52px;
  padding: 10px 14px;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: border-color .15s, transform .1s;
}
.option:hover:not(:disabled) { border-color: var(--red); }
.option:active:not(:disabled) { transform: scale(.99); }
.option:focus-visible { outline: 3px solid var(--red); outline-offset: 2px; }
.option:disabled { cursor: default; }
.option.is-mine { border-color: var(--red); }
.option-body { position: relative; flex: 1; }
.option-body .dish-name { font-weight: 500; }
.option-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  background: var(--bar);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform .5s cubic-bezier(.2, .8, .2, 1);
}
.option.is-mine .option-bar { background: var(--bar-mine); }
.option-pct { position: relative; font-weight: 700; font-size: .9rem; visibility: hidden; }
.show-results .option-bar { transform: scaleX(var(--p)); }
.show-results .option-pct { visibility: visible; }
.option.is-mine .option-body::after {
  content: '✓ Il tuo voto';
  display: block;
  font-size: .72rem;
  font-weight: 700;
  color: var(--red);
}
.poll-foot { margin: 8px 0 0; font-size: .8rem; color: var(--muted); }
.poll.is-busy { opacity: .6; pointer-events: none; }

/* --- note e anteprima --- */
.notes {
  margin-top: 30px;
  font-size: .98rem;
}
.notes p { margin: 0 0 12px; }

.preview {
  margin-top: 40px;
  padding: 22px 12px 8px;
  border-top: 3px solid var(--ink);
}
.preview-title { font-size: 1.5rem; font-weight: 800; margin: 0; text-transform: uppercase; }
.preview-sub { margin: 4px 0 0; color: var(--muted); font-size: .92rem; }

.flash {
  margin: 18px auto 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--veg-soft);
  color: var(--veg);
  font-weight: 500;
}
.flash-ko { background: var(--red-soft); color: var(--red); }
.empty { color: var(--muted); margin: 6px 0; }
.empty.big { margin-top: 40px; font-size: 1.1rem; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .option-bar, .option { transition: none; }
}

/* --- prossima settimana --- */
.next-week {
  margin-top: 36px;
  border-top: 3px solid var(--ink);
  padding-top: 20px;
}
.next-week summary {
  list-style: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--ink);
  color: var(--bg);
  font-weight: 700;
  cursor: pointer;
  user-select: none;
}
.next-week summary::-webkit-details-marker { display: none; }
.next-week summary::after {
  content: '';
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-2px) rotate(45deg);
  transition: transform .2s;
}
.next-week[open] summary::after { transform: translateY(2px) rotate(-135deg); }
.next-week summary:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }
.next-week-body { padding-top: 14px; }
.not-ready {
  margin: 8px auto 0;
  max-width: 420px;
  padding: 16px 18px;
  border-radius: 14px;
  background: var(--paper);
  border: 1px dashed var(--line);
  font-weight: 500;
}
