:root {
  --red: #b3202a; --red-dark: #8c1820; --green: #1f6b45; --gold: #e8b64c;
  --bg: #fff8f0; --card: #ffffff; --text: #2b2323; --muted: #7a6c6c; --line: #eadfd3;
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1d1717; --card: #2a2121; --text: #f6ecec; --muted: #b3a2a2; --line: #3c2f2f; --red: #d6404a; }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 18px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(84px + env(safe-area-inset-bottom));
}
#app { max-width: 720px; margin: 0 auto; padding: 0 16px; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5em; }
h2 { font-size: 1.4rem; margin-top: 1.2em; }
a { color: var(--red); }
.muted { color: var(--muted); font-size: .9rem; }

/* header */
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 0 6px; }
.brand { font-weight: 800; color: var(--red); font-size: 1.05rem; }
.who { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 8px; font-size: .9rem; }
.top { flex-wrap: wrap; }
.hero { text-align: center; padding: 28px 0 12px; }
.hero h1 { font-size: 1.9rem; color: var(--red); }
.hero p { color: var(--muted); }

/* buttons & fields */
button, .btn {
  font: inherit; font-weight: 700; border: 0; border-radius: 999px; cursor: pointer;
  background: var(--red); color: #fff; padding: 12px 20px; min-height: 48px;
}
button:hover { background: var(--red-dark); }
button.ghost { background: transparent; color: var(--red); border: 2px solid var(--red); }
button.green { background: var(--green); }
button.small { padding: 6px 14px; min-height: 38px; font-size: .9rem; }
button.link { background: none; color: var(--muted); padding: 6px 10px; min-height: 0; font-weight: 500; text-decoration: underline; }
button:disabled { opacity: .5; cursor: default; }
label { display: block; font-weight: 700; margin: 14px 0 4px; }
input, textarea, select {
  width: 100%; font: inherit; padding: 12px 14px; border-radius: 12px;
  border: 2px solid var(--line); background: var(--card); color: var(--text);
}
input:focus, textarea:focus, select:focus { outline: 3px solid var(--gold); border-color: var(--gold); }
textarea { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.stack > * + * { margin-top: 14px; }
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.04);
}

/* gifts */
.gift { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; overflow: hidden; }
.gift img { width: 100%; max-height: 280px; object-fit: cover; border-radius: 12px; }
.gift h3 { margin: 0; font-size: 1.15rem; }
.gift p { margin: 0; white-space: pre-wrap; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-size: .85rem; font-weight: 700; background: var(--line); }
.badge.reserved { background: var(--gold); color: #3a2a00; }
.badge.bought { background: var(--green); color: #fff; }
.badge.idea { background: transparent; border: 1px dashed var(--muted); color: var(--muted); }
.note { background: color-mix(in srgb, var(--gold) 25%, transparent); border-radius: 10px; padding: 8px 12px; font-size: .95rem; }
.empty { text-align: center; color: var(--muted); padding: 30px 10px; }

/* people grid */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.person { text-align: center; padding: 18px 8px; cursor: pointer; }
.person .em { font-size: 2.6rem; }
.person:hover { border-color: var(--gold); }

/* bottom nav */
nav.tabs {
  position: fixed; left: 0; right: 0; bottom: 0; display: flex; justify-content: space-around;
  background: var(--card); border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
}
nav.tabs button { background: none; color: var(--muted); flex: 1; border-radius: 12px; font-size: .8rem; display: flex; flex-direction: column; gap: 2px; padding: 6px; }
nav.tabs button span { font-size: 1.5rem; line-height: 1; }
nav.tabs button.active { color: var(--red); background: color-mix(in srgb, var(--red) 10%, transparent); }
nav.tabs button.add { color: #fff; background: var(--green); }

dialog { border: 0; border-radius: 20px; padding: 20px; width: min(94vw, 520px); background: var(--bg); color: var(--text); }
dialog::backdrop { background: rgba(0,0,0,.5); }

#toast {
  position: fixed; left: 50%; bottom: calc(100px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #222; color: #fff; padding: 12px 20px; border-radius: 999px; font-size: .95rem;
  opacity: 0; pointer-events: none; transition: opacity .25s; max-width: 92vw; text-align: center;
}
#toast.show { opacity: 1; }
