:root {
  --bg: #f6efe3;
  --paper: #fffdf8;
  --ink: #2b211a;
  --muted: #7a6a5c;
  --line: #eadfce;
  --tomato: #d9532b;
  --tomato-dark: #b8401c;
  --olive: #5d7a3a;
  --olive-soft: #edf2e2;
  --butter: #f7d774;
  --radius: 18px;
  --shadow: 0 1px 0 rgba(43, 33, 26, 0.04), 0 8px 24px -12px rgba(43, 33, 26, 0.18);
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(247, 215, 116, 0.35), transparent 40%),
    radial-gradient(circle at 100% 30%, rgba(217, 83, 43, 0.10), transparent 35%),
    var(--bg);
  color: var(--ink);
  font: 16px/1.5 "Inter", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

.page {
  max-width: 760px;
  margin: 0 auto;
  /* bottom padding keeps the last row clear of the corner badge */
  padding: 28px 16px 96px;
}

/* --- hero --- */

.hero { padding: 12px 4px 8px; }

.eyebrow {
  margin: 0 0 6px;
  color: var(--tomato);
  font-weight: 600;
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: clamp(36px, 9vw, 60px);
  line-height: 1.02;
  letter-spacing: -0.02em;
}

.when { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0 0; }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px 6px 10px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  font-weight: 600;
  font-size: 14px;
}
.chip svg {
  width: 16px; height: 16px;
  fill: none; stroke: var(--tomato); stroke-width: 2; stroke-linecap: round;
}

.lede { margin: 16px 0 0; color: var(--muted); max-width: 56ch; }

.progress { margin-top: 22px; }
.progress-bar {
  height: 10px;
  border-radius: 999px;
  background: rgba(43, 33, 26, 0.08);
  overflow: hidden;
}
.progress-bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--butter), var(--tomato));
  transition: width 0.6s cubic-bezier(.2,.8,.2,1);
}
#progress-text { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
#progress-text strong { color: var(--ink); }

/* --- notice + toast --- */

.notice {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}
.notice-error { background: #fdecea; color: #8a2414; border: 1px solid #f5c6bd; }
.notice-warn { background: #fff6dc; color: #6b5310; border: 1px solid #f1df9f; }
.notice a { color: inherit; font-weight: 600; }

.toast {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 14px;
  background: var(--ink);
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  box-shadow: 0 12px 32px -12px rgba(0, 0, 0, 0.45);
  z-index: 10;
  animation: drop 0.25s ease-out;
}
@keyframes drop { from { opacity: 0; transform: translate(-50%, -8px); } }

/* --- summary chips --- */

.summary {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 22px -16px 0;
  padding: 10px 16px;
  background: rgba(246, 239, 227, 0.86);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  scrollbar-width: none;
}
.summary::-webkit-scrollbar { display: none; }

.sum {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--paper);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  box-shadow: var(--shadow);
}
.sum-label { font-weight: 600; }
.sum-left {
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--olive-soft);
  color: var(--olive);
  font-weight: 600;
  font-size: 12px;
}
.sum-full .sum-left { background: rgba(43, 33, 26, 0.07); color: var(--muted); }

/* --- board --- */

.board { display: grid; gap: 16px; margin-top: 8px; }

.loading { display: flex; gap: 6px; justify-content: center; padding: 48px 0; }
.loading span {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--tomato);
  animation: bounce 1s infinite ease-in-out;
}
.loading span:nth-child(2) { animation-delay: 0.15s; }
.loading span:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 80%, 100% { opacity: 0.25; transform: scale(0.8); } 40% { opacity: 1; transform: scale(1); } }

.cat {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 16px 16px;
  box-shadow: var(--shadow);
  scroll-margin-top: 64px;
}

.cat-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

h2 {
  margin: 0;
  font-family: "Fraunces", Georgia, serif;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: -0.01em;
}

.badge {
  flex: 0 0 auto;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--olive-soft);
  color: var(--olive);
  font-weight: 600;
  font-size: 13px;
}
.badge-full { background: rgba(43, 33, 26, 0.07); color: var(--muted); }

.cat-hint { margin: 2px 0 12px; color: var(--muted); font-size: 14px; }

.slots { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }

.slot { border-radius: 14px; }

.slot-taken {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  background: #fbf6ee;
  border: 1px solid var(--line);
  animation: settle 0.35s ease-out;
}
@keyframes settle { from { transform: scale(0.98); opacity: 0.4; } }

.avatar {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--butter);
  color: var(--ink);
  font-weight: 700;
  font-family: "Fraunces", Georgia, serif;
}
.slot-text { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.dish { font-weight: 600; overflow-wrap: anywhere; }
.who { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }

.tag {
  flex: 0 0 auto;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}
.tag-free { cursor: pointer; font: inherit; font-size: 12px; font-weight: 600; color: var(--tomato-dark); }
.tag-free:hover { border-color: var(--tomato); }

.open-btn {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1.5px dashed #d8c7ae;
  background: transparent;
  color: var(--muted);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.open-btn strong { color: var(--tomato); }
.open-btn:hover, .open-btn:focus-visible {
  border-color: var(--tomato);
  background: #fff6f1;
  color: var(--ink);
  outline: none;
}
.plus {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1.5px dashed #d8c7ae;
  font-size: 20px;
  line-height: 1;
  color: var(--tomato);
}

.slot-form {
  padding: 14px;
  background: #fff6f1;
  border: 1.5px solid var(--tomato);
  animation: settle 0.2s ease-out;
}
.claim { display: grid; gap: 12px; }
.claim label { display: grid; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.claim input {
  width: 100%;
  padding: 11px 12px;
  border-radius: 10px;
  border: 1px solid #e3d3bd;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-size: 16px; /* no zoom on iOS */
}
.claim input:focus { outline: 2px solid rgba(217, 83, 43, 0.35); border-color: var(--tomato); }

.form-actions { display: flex; justify-content: flex-end; gap: 8px; }

.btn, .btn-ghost {
  padding: 10px 16px;
  border-radius: 10px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.btn { border: 0; background: var(--tomato); color: #fff; }
.btn:hover { background: var(--tomato-dark); }
.btn:disabled { opacity: 0.6; cursor: progress; }
.btn-ghost { border: 1px solid var(--line); background: var(--paper); color: var(--ink); }

.foot { margin-top: 28px; text-align: center; color: var(--muted); font-size: 13px; }

@media (min-width: 720px) {
  .page { padding-top: 56px; }
  .cat { padding: 22px 22px 20px; }
  .slots { grid-template-columns: 1fr 1fr; }
  .slot-form { grid-column: 1 / -1; }
  .summary {
    justify-content: space-between;
    gap: 6px;
    margin: 22px -10px 0;
    padding: 10px;
    border-radius: 0 0 18px 18px;
    overflow: visible;
  }
  .sum { padding: 7px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
