:root {
  color-scheme: light;
  --paper: #f8f5ec;
  --pine: #173b31;
  --pine-dark: #102d25;
  --ink: #162a24;
  --muted: #5d6057;
  --cranberry: #a63240;
  --gold: #81601f;
  --line: #d6cebd;
  --wash: #ebe5d7;
  --serif: "Playfair Display", Georgia, serif;
  --sans: Inter, system-ui, sans-serif;
  --safe-top: calc(max(env(safe-area-inset-top, 0px), var(--tg-safe-area-inset-top, 0px)) + var(--tg-content-safe-area-inset-top, 0px));
  --safe-bottom: calc(max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px)) + var(--tg-content-safe-area-inset-bottom, 0px));
  --safe-left: calc(max(env(safe-area-inset-left, 0px), var(--tg-safe-area-inset-left, 0px)) + var(--tg-content-safe-area-inset-left, 0px));
  --safe-right: calc(max(env(safe-area-inset-right, 0px), var(--tg-safe-area-inset-right, 0px)) + var(--tg-content-safe-area-inset-right, 0px));
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--pine-dark); font: 15px/1.55 var(--sans); }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
button:disabled { opacity: .55; cursor: wait; }
a { color: var(--pine); }
:focus-visible { outline: 2px solid var(--cranberry); outline-offset: 3px; }
h1, h2, p { margin: 0; }
h1, h2, .brand, .card-title { font-family: var(--serif); color: var(--pine-dark); }
h1 { font-size: clamp(30px, 7.6vw, 42px); line-height: 1.1; letter-spacing: -.035em; }
h1[tabindex="-1"]:focus { outline: none; }
h2 { font-size: 22px; line-height: 1.25; }
img { display: block; width: 100%; object-fit: cover; }

.shell {
  width: min(100%, 480px);
  height: min(100dvh, var(--tg-viewport-stable-height, 100dvh));
  margin: auto;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  overflow: hidden;
}
.topbar {
  display: flex;
  flex-shrink: 0;
  justify-content: space-between;
  align-items: center;
  min-height: 53px;
  padding: 4px 18px;
  border-bottom: 1px solid var(--line);
  gap: 10px;
}
.brand { font-size: 21px; }
.content {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 16px 16px 18px;
}
.content > * + * { margin-top: 14px; }
.stack > * + * { margin-top: 12px; }
.section > * + * { margin-top: 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.status {
  display: inline-flex;
  width: fit-content;
  align-items: center;
  background: var(--wash);
  color: var(--pine-dark);
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.icon-button, .back {
  border: 0;
  padding: 0;
  min-height: 44px;
  background: transparent;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.icon-button { min-width: 44px; justify-content: center; color: var(--gold); font-size: 23px; }
.back { color: var(--pine-dark); font-weight: 600; text-decoration: none; }
.back-symbol, .chevron { color: var(--gold); font: 28px/1 Georgia, serif; }
.card {
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: transparent;
}
.card-button { width: 100%; text-align: left; }
.card-button:hover, .row-button:hover { background: #f0ebdf; }
.hero-card { display: block; padding: 0; }
.hero-card img { height: auto; max-height: 200px; aspect-ratio: 3 / 2; object-position: center; }
.hero-body { padding: 12px 14px 14px; }
.hero-body > * + * { margin-top: 10px; }
.card-title { display: block; font-size: 20px; line-height: 1.25; font-weight: 700; }
.hero-title { font-size: clamp(22px, 6vw, 30px); }
.between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-button, .compact-card, .wish-row {
  width: 100%;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  text-align: left;
  align-items: center;
  gap: 12px;
  padding: 11px;
}
.row-button { min-height: 56px; }
.thumb { width: 62px; height: 62px; border-radius: 11px; }
.wish-thumb { width: 81px; height: 81px; }
.placeholder {
  display: grid;
  place-items: center;
  background: var(--wash);
  color: var(--gold);
  font-size: 24px;
}
.summary { padding: 14px 16px; }
.summary > * + * { margin-top: 8px; }
.progress { width: 100%; height: 10px; display: block; border: 0; border-radius: 99px; overflow: hidden; background: var(--wash); }
.progress::-webkit-progress-bar { background: var(--wash); }
.progress::-webkit-progress-value { background: #317651; border-radius: 99px; }
.progress::-moz-progress-bar { background: #317651; border-radius: 99px; }
.date-list { margin: 0; padding: 0; }
.date-row { display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding: 9px 0; }
.date-row + .date-row { border-top: 1px solid var(--line); }
.date-row dt { font-weight: 700; }
.date-row dd { margin: 0; color: var(--muted); }
.ornament { color: var(--gold); font-size: 20px; }
.action-bar {
  flex-shrink: 0;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding: 8px 16px 10px;
  display: grid;
  gap: 8px;
}
.button {
  display: inline-flex;
  min-height: 44px;
  width: 100%;
  justify-content: center;
  align-items: center;
  text-align: center;
  text-decoration: none;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 13px;
  font-weight: 700;
}
.button.primary { color: white; background: var(--pine); }
.button.accent { color: white; background: var(--cranberry); }
.button.secondary { background: transparent; color: var(--pine-dark); border-color: var(--line); }
.button.danger { color: var(--cranberry); }
.button:not(:disabled):hover { filter: brightness(.94); }
.empty { padding: 18px; color: var(--muted); }
.form { display: grid; gap: 15px; }
.field { display: grid; gap: 5px; font-weight: 600; }
.field input, .field textarea, .field select {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  font-size: 16px;
  padding: 10px 12px;
  color: var(--ink);
  background: #fffdf6;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.field textarea { min-height: 100px; resize: vertical; }
.inline-check { display: flex; gap: 8px; align-items: center; }
.flash { color: var(--cranberry); font-size: 14px; }
.flash:empty { display: none; }
.notice { border-left: 2px solid var(--gold); padding-left: 10px; }
.result { padding: 19px; }
.result strong { color: var(--pine-dark); font: 700 27px/1.2 var(--serif); }
@media (min-width: 600px) {
  .shell {
    height: min(900px, calc(100dvh - 40px), var(--tg-viewport-stable-height, 100dvh));
    border-radius: 22px;
    margin: 20px auto;
  }
}

[hidden] { display: none !important; }
.card-link { display: block; text-decoration: none; color: inherit; }
.card-link:hover { background: #f0ebdf; }
.compact-card.card-link, .row-button.card-link { display: grid; }
.icon-button { text-decoration: none; }
.wish-description { white-space: pre-line; overflow-wrap: anywhere; }
.wish-preview { max-height: 300px; border-radius: 12px; }
.member-row .button { width: auto; min-height: 38px; padding: 4px 10px; font-size: 13px; }
#invite-link:empty { display: none; }
