:root {
  --bg: #f6f1e9;
  --surface: #fffdf9;
  --surface-selected: #fffaf1;
  --ink: #2b2219;
  --ink-soft: #5b5047;
  --muted: #8a7d70;
  --line: rgba(43, 34, 25, 0.12);
  --accent: #9a7b4f;
  --accent-ink: #7c6039;
  --accent-soft: #f3ebdd;
  --accent-glow: rgba(154, 123, 79, 0.18);
  --danger: #a8483d;
  --radius: 16px;
  --font-display: 'Cormorant Garamond', 'Times New Roman', Georgia, serif;
  --font-body: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(70% 45% at 50% -5%, rgba(154, 123, 79, 0.16), transparent 70%),
    radial-gradient(40% 30% at 100% 100%, rgba(154, 123, 79, 0.08), transparent 70%);
}

[hidden] { display: none !important; }

.page {
  max-width: 640px;
  margin: 0 auto;
  padding: 36px 20px 150px;
}

/* ---------- hero ---------- */

.hero {
  text-align: center;
  padding: 20px 0 8px;
}

.hero-names {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-ink);
}

.hero-title {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(42px, 9vw, 58px);
  line-height: 1.04;
  letter-spacing: -0.01em;
}

.hero-date {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.ornament {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin: 24px auto;
}

.ornament span { width: 56px; height: 1px; background: var(--line); }
.ornament i { width: 7px; height: 7px; transform: rotate(45deg); background: var(--accent); }

.hero-greeting {
  margin: 0 0 10px;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 27px;
  line-height: 1.2;
}

.hero-intro {
  max-width: 480px;
  margin: 0 auto;
  color: var(--ink-soft);
  font-size: 15.5px;
}

.hero-note {
  display: inline-block;
  margin: 16px auto 0;
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 13.5px;
  font-weight: 600;
}

/* ---------- sections ---------- */

.section { margin-top: 42px; }

.section-head { margin-bottom: 14px; }

.section-index {
  display: block;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.22em;
  color: var(--accent);
}

.section-title {
  margin: 2px 0 4px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 31px;
  line-height: 1.1;
}

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

.dishes { display: grid; gap: 10px; }

.dish {
  position: relative;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s, transform 0.12s;
  -webkit-tap-highlight-color: transparent;
}

.dish:hover { border-color: rgba(154, 123, 79, 0.55); }
.dish:active { transform: scale(0.992); }

.dish.is-selected {
  border-color: var(--accent);
  background: var(--surface-selected);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.dish:has(.dish-input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dish-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.dish.has-photo { padding: 12px 16px 12px 12px; }

.dish-photo {
  flex: none;
  width: 84px;
  height: 84px;
  border-radius: 12px;
  overflow: hidden;
  background: #a08a72;
  cursor: zoom-in;
  box-shadow: inset 0 0 0 1px rgba(43, 34, 25, 0.08);
}

.dish-photo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.dish-photo:hover img { transform: scale(1.05); }

.dish-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.dish-name {
  font-weight: 600;
  font-size: 16px;
  line-height: 1.3;
}

.dish-desc {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.4;
}

.dish-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 5px;
}

.tag {
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.dish-check {
  flex: none;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--line);
  border-radius: 50%;
  color: transparent;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
}

.dish-check svg { width: 15px; height: 15px; }

.dish.is-selected .dish-check {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}

/* ---------- fields ---------- */

.field { display: block; }

.field-label {
  display: block;
  margin-bottom: 8px;
  font-weight: 600;
  font-size: 15px;
}

.field-label em {
  margin-left: 6px;
  font-style: normal;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field textarea {
  display: block;
  width: 100%;
  padding: 14px 16px;
  font: inherit;
  color: inherit;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s;
}

.field textarea { resize: vertical; min-height: 96px; }

.field input:focus,
.field textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.field input::placeholder,
.field textarea::placeholder { color: #b3a89b; }

.name-section { margin-top: 32px; }

/* ---------- bottom bar ---------- */

.bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: rgba(246, 241, 233, 0.86);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  border-top: 1px solid var(--line);
}

.bar-inner {
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 16px;
}

.bar-progress { flex: 1; min-width: 0; }

.bar-label {
  display: block;
  margin-bottom: 7px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
}

.bar-track {
  display: block;
  height: 4px;
  border-radius: 999px;
  background: rgba(43, 34, 25, 0.1);
  overflow: hidden;
}

.bar-fill {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.25s ease;
}

.bar-error {
  max-width: 640px;
  margin: 8px auto 0;
  color: var(--danger);
  font-size: 13.5px;
}

/* ---------- buttons ---------- */

.btn {
  padding: 14px 26px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s, color 0.18s, transform 0.1s;
  -webkit-tap-highlight-color: transparent;
}

.btn:active { transform: scale(0.98); }

.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #3d3227; }

.btn-primary:disabled {
  background: rgba(43, 34, 25, 0.22);
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--accent-ink);
  border: 1px solid var(--accent);
}

.btn-ghost:hover { background: var(--accent-soft); }

/* ---------- success ---------- */

.done {
  text-align: center;
  padding: 60px 0 24px;
}

.done-check {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  margin: 0 auto 24px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 0 0 12px var(--accent-glow);
  animation: pop 0.5s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

.done-check svg { width: 36px; height: 36px; }

.done-title {
  margin: 0 0 8px;
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(36px, 8vw, 44px);
  line-height: 1.1;
}

.done-text {
  max-width: 420px;
  margin: 0 auto 28px;
  color: var(--ink-soft);
}

.summary {
  list-style: none;
  margin: 0 0 18px;
  padding: 0;
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.summary li {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
}

.summary li:last-child { border-bottom: 0; }

.summary-cat { flex: none; color: var(--muted); font-size: 14px; }
.summary-item { font-weight: 600; text-align: right; }

.summary-comment {
  margin: 0 0 26px;
  color: var(--ink-soft);
  font-size: 14.5px;
}

/* ---------- lightbox ---------- */

.no-scroll { overflow: hidden; }

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(43, 34, 25, 0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  cursor: zoom-out;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.lightbox.is-open { opacity: 1; visibility: visible; }

.lightbox-figure {
  margin: 0;
  text-align: center;
  transform: scale(0.96);
  transition: transform 0.25s ease;
}

.lightbox.is-open .lightbox-figure { transform: none; }

.lightbox img {
  display: block;
  width: min(92vw, 520px);
  max-height: 70vh;
  object-fit: cover;
  border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.45);
}

.lightbox-caption {
  margin: 18px auto 0;
  max-width: 520px;
  color: #fff;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.2;
}

/* ---------- states ---------- */

.state-msg {
  padding: 90px 0;
  text-align: center;
  color: var(--muted);
}

.state-msg p { margin: 0 0 18px; color: var(--ink-soft); }

/* ---------- motion ---------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

@keyframes pop {
  from { opacity: 0; transform: scale(0.6); }
  to { opacity: 1; transform: scale(1); }
}

.hero, .section, .done { animation: rise 0.45s ease both; }
.section:nth-of-type(1) { animation-delay: 0.05s; }
.section:nth-of-type(2) { animation-delay: 0.1s; }
.section:nth-of-type(3) { animation-delay: 0.15s; }
.section:nth-of-type(4) { animation-delay: 0.2s; }
.section:nth-of-type(n + 5) { animation-delay: 0.25s; }

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

/* ---------- small screens ---------- */

@media (min-width: 481px) {
  .dish-photo { width: 96px; height: 96px; border-radius: 14px; }
}

@media (max-width: 480px) {
  .page { padding: 28px 16px 150px; }
  .section { margin-top: 36px; }
  .dish { padding: 14px 16px; }
  .bar-inner { gap: 12px; }
  .btn-primary { padding: 13px 18px; font-size: 15px; }
  .summary li { flex-direction: column; gap: 2px; }
  .summary-item { text-align: left; }
}
