/* CheSeMagna — mobile first */
* { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --orange: #e8590c;
  --orange-soft: #fff0e6;
  --green: #2f9e44;
  --green-soft: #e6f7ea;
  --red: #e03131;
  --red-soft: #ffe6e6;
  --gold: #f4b400;
  --ink: #2b2118;
  --muted: #8a7a6d;
  --bg: #fdf7f0;
  --card: #ffffff;
  --radius: 16px;
  --shadow: 0 2px 10px rgba(60, 40, 20, .08);
}

html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  min-height: 100dvh;
}

.hidden { display: none !important; }

.screen { max-width: 520px; margin: 0 auto; padding: 16px 14px 90px; }

/* ── hero / topbar ── */
.hero { text-align: center; padding: 28px 8px 18px; }
.hero h1 { font-size: 1.9rem; }
.hero p { color: var(--muted); margin-top: 6px; }

.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 4px 14px; gap: 10px;
  position: sticky; top: 0; background: var(--bg); z-index: 5;
}
.topbar-title { font-weight: 800; font-size: 1.15rem; }
.topbar-sub { color: var(--muted); font-size: .85rem; }
.topbar-sub a { color: var(--orange); }

/* ── card / list ── */
.card {
  background: var(--card); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px; margin-bottom: 16px;
}
.card h3 { margin-bottom: 10px; }

.list .item, .dish {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 12px; border-radius: 12px; margin-bottom: 8px;
  background: var(--orange-soft);
}
.list .item { cursor: pointer; font-weight: 600; }
.list .item:active { transform: scale(.98); }
.item-date { font-size: .78rem; color: var(--muted); font-weight: 400; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.chip {
  padding: 10px 16px; border-radius: 999px; background: var(--orange-soft);
  border: 2px solid transparent; font-weight: 600; cursor: pointer; font-size: 1rem;
}
.chip:active { border-color: var(--orange); }

/* ── forms ── */
.add-row { display: flex; gap: 8px; margin-top: 10px; }
input[type="text"] {
  flex: 1; min-width: 0; padding: 12px; font-size: 1rem;
  border: 2px solid #eadfd4; border-radius: 12px; background: #fffdfb;
}
input[type="text"]:focus { outline: none; border-color: var(--orange); }

.btn {
  border: none; border-radius: 12px; padding: 12px 18px;
  font-size: 1rem; font-weight: 700; cursor: pointer;
  background: #eee; color: var(--ink); touch-action: manipulation;
}
.btn:active { transform: scale(.97); }
.btn.primary { background: var(--orange); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.small { padding: 8px 12px; font-size: .85rem; margin-top: 10px; }
.btn.wide { width: 100%; margin-top: 12px; }
.btn.gold { background: var(--gold); color: #4a3600; }
.btn.round {
  width: 40px; height: 40px; border-radius: 50%; padding: 0;
  background: var(--orange-soft); color: var(--orange); font-size: 1.1rem; flex-shrink: 0;
}

/* ── tabs ── */
.tab { padding-bottom: 10px; }
.tab-hint { color: var(--muted); font-size: .88rem; margin: 4px 2px 14px; }

.course-block { margin-bottom: 18px; }
.course-title {
  font-size: 1.05rem; font-weight: 800; margin-bottom: 8px;
  display: flex; align-items: center; gap: 6px;
}

.dish { background: var(--card); box-shadow: var(--shadow); }
.dish-name { font-weight: 600; flex: 1; }
.dish-meta { font-size: .75rem; color: var(--muted); font-weight: 400; }

.badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: var(--green-soft); color: var(--green);
  border-radius: 999px; padding: 4px 10px; font-weight: 800; font-size: .85rem;
  flex-shrink: 0;
}
.badge.zero { background: #f1ece7; color: var(--muted); }
.badge.top { background: var(--gold); color: #4a3600; }

/* ── voto ── */
.vote-btns { display: flex; gap: 6px; flex-shrink: 0; }
.vote-btn {
  border: 2px solid #eadfd4; background: #fff; border-radius: 10px;
  padding: 8px 12px; font-size: .9rem; font-weight: 700; cursor: pointer;
}
.vote-btn.yes.on { background: var(--green); border-color: var(--green); color: #fff; }
.vote-btn.no.on { background: var(--red); border-color: var(--red); color: #fff; }

/* ── spesa ── */
.shop-row {
  display: flex; justify-content: space-between; align-items: center; gap: 10px;
  padding: 10px 4px; border-bottom: 1px dashed #eadfd4;
}
.shop-row:last-of-type { border-bottom: none; }
.shop-qty { font-weight: 800; color: var(--orange); white-space: nowrap; }
.shop-course { font-size: .72rem; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.shop-who { font-size: .78rem; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 18px 6px; }

/* ── scommessa ── */
.bet-card { background: linear-gradient(160deg, #fff8e6, #fff); border: 2px solid var(--gold); }
.bet-option {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border-radius: 10px; margin-bottom: 6px; cursor: pointer;
  border: 2px solid transparent; background: #fffdf5;
}
.bet-option.selected { border-color: var(--gold); background: #fff4d6; font-weight: 700; }
#bet-status { margin-top: 10px; font-size: .9rem; color: var(--muted); }
#bet-result {
  margin-top: 14px; padding: 16px; border-radius: 12px; text-align: center;
  background: var(--orange-soft); font-size: 1rem;
}
#bet-result.win { background: var(--green-soft); }

/* ── bottom nav ── */
.bottomnav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10;
  display: flex; background: var(--card);
  box-shadow: 0 -2px 12px rgba(60,40,20,.1);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-btn {
  flex: 1; border: none; background: none; padding: 10px 0 8px;
  font-size: 1.4rem; cursor: pointer; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
}
.nav-btn span { font-size: .7rem; font-weight: 700; }
.nav-btn.active { color: var(--orange); }

/* ── tutorial ── */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(43, 33, 24, .55); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.tutorial-card {
  background: var(--card); border-radius: 20px; padding: 28px 22px 20px;
  max-width: 380px; width: 100%; text-align: center;
}
.tut-emoji { font-size: 3rem; margin-bottom: 10px; }
.tut-step h2 { margin-bottom: 10px; font-size: 1.25rem; }
.tut-step p { color: var(--muted); line-height: 1.5; min-height: 88px; }
.tut-dots { display: flex; justify-content: center; gap: 6px; margin: 16px 0; }
.tut-dots i { width: 8px; height: 8px; border-radius: 50%; background: #eadfd4; }
.tut-dots i.on { background: var(--orange); }
.tut-actions { display: flex; justify-content: space-between; gap: 10px; }

/* ── toast & confetti ── */
#toast {
  position: fixed; bottom: 84px; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 10px 18px;
  border-radius: 999px; font-size: .9rem; z-index: 60; max-width: 90vw;
}
#confetti-box { position: fixed; inset: 0; pointer-events: none; z-index: 100; overflow: hidden; }
.confetto {
  position: absolute; top: -20px; width: 10px; height: 14px;
  animation: fall linear forwards;
}
@keyframes fall {
  to { transform: translateY(110vh) rotate(720deg); }
}
