:root {
  --bg: #fffbea;
  --surface: #ffffff;
  --text: #2b2a1f;
  --muted: #7a7660;
  --border: #f0e6b8;
  --accent: #f5c400;
  --shadow: 0 2px 10px rgba(120, 100, 0, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17160f;
    --surface: #222118;
    --text: #f3f0dc;
    --muted: #a9a487;
    --border: #3a382a;
    --shadow: none;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  line-height: 1.4;
}

header {
  text-align: center;
  padding: 28px 16px 8px;
}

h1 { margin: 0; font-size: clamp(1.6rem, 5vw, 2.4rem); }
h2 { margin: 0 0 12px; font-size: 1rem; color: var(--muted); font-weight: 600; }

.total { margin: 6px 0 0; color: var(--muted); }
.total span { color: var(--text); font-weight: 800; font-size: 1.2em; font-variant-numeric: tabular-nums; }

main {
  max-width: 1000px;
  margin: 0 auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.buttons {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
}

@media (max-width: 640px) {
  .buttons { grid-template-columns: repeat(2, 1fr); }
}

.drink-btn {
  --c: var(--accent);
  border: 2px solid var(--c);
  background: var(--surface);
  color: var(--text);
  border-radius: 18px;
  padding: 16px 8px 14px;
  cursor: pointer;
  font: inherit;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  box-shadow: var(--shadow);
  transition: transform 0.08s ease, background 0.2s;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

@media (hover: hover) {
  .drink-btn:hover { background: color-mix(in srgb, var(--c) 12%, var(--surface)); }
}
.drink-btn:active { transform: scale(0.95); }
.drink-btn:disabled { opacity: 0.6; cursor: wait; }

.drink-btn .name { font-weight: 700; font-size: 1.05rem; }
.drink-btn .count { font-size: 2.2rem; font-weight: 800; color: var(--c); font-variant-numeric: tabular-nums; }
.drink-btn .plus {
  background: var(--c);
  color: #1d1b10;
  border-radius: 999px;
  padding: 2px 14px;
  font-weight: 800;
}
.drink-btn .last { font-size: 0.75rem; color: var(--muted); min-height: 1em; }

.drink-btn.pop .count { animation: pop 0.35s ease; }
@keyframes pop {
  40% { transform: scale(1.35); }
}

.kpis {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px;
  text-align: center;
  box-shadow: var(--shadow);
}
.kpi span { display: block; font-size: 1.6rem; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 16px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

@media (max-width: 720px) {
  .grid { grid-template-columns: minmax(0, 1fr); }
}

.chart { position: relative; height: 240px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 10px 12px 10px 16px;
  border-radius: 22px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
  width: max-content;
  max-width: calc(100% - 32px);
}
.toast[hidden] { display: none; }
.toast button {
  background: var(--accent);
  color: #1d1b10;
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}

/* ---------- touche fun ---------- */

.tagline { margin: 4px 0 0; font-style: italic; color: var(--muted); min-height: 1.4em; }

.wiggle { display: inline-block; animation: wiggle 2.5s ease-in-out infinite; }
.wiggle:last-child { animation-delay: 1.25s; }
@keyframes wiggle {
  0%, 100% { transform: rotate(0); }
  10% { transform: rotate(-15deg); }
  20% { transform: rotate(12deg); }
  30% { transform: rotate(0); }
}

.drink-btn { position: relative; }
.drink-btn .badge {
  position: absolute;
  top: -12px;
  right: -6px;
  font-size: 1.6rem;
  transform: rotate(15deg);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.2));
}

.awards {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
}
.awards li {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
}
.awards .emoji { font-size: 1.8rem; }
.awards b { display: block; }
.awards small { color: var(--muted); }

.confetti { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 10; }
.confetti span {
  position: absolute;
  font-size: 1.6rem;
  animation: fall var(--d) cubic-bezier(0.2, 0.6, 0.4, 1) forwards;
}
@keyframes fall {
  from { transform: translate(0, 0) rotate(0); opacity: 1; }
  to { transform: translate(var(--x), var(--y)) rotate(var(--r)); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .wiggle, .confetti span { animation: none; }
  .confetti { display: none; }
}
