:root {
  --bg: #f7f3ee;
  --card: #ffffff;
  --ink: #221f1a;
  --muted: #6d675e;
  --line: #e4ddd3;
  --accent: #b5473a;
  --accent-ink: #ffffff;
  --soft: #f1e8df;
  --danger: #9a2f24;
  --ok: #2f7a4a;
  --radius: 14px;
  --gutter: 16px;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1a17;
    --card: #26231f;
    --ink: #f1ece5;
    --muted: #a59d92;
    --line: #38342e;
    --accent: #e0705f;
    --accent-ink: #1c1a17;
    --soft: #2f2b26;
    --danger: #ef8a7c;
    --ok: #7fcf9a;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}

main {
  max-width: 640px;
  margin: 0 auto;
  padding: 12px var(--gutter) 48px;
}

h1 { font-size: 1.7rem; margin: 8px 0 4px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; color: var(--muted); font-weight: 600; }
p { margin: 8px 0; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.topbar a { text-decoration: none; font-weight: 600; }

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

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
}

.person {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  text-decoration: none;
  color: inherit;
  min-height: 64px;
}
.person .name { font-weight: 700; font-size: 1.15rem; }
.person .meta { color: var(--muted); font-size: 0.95rem; }
.person .chev { color: var(--muted); font-size: 1.4rem; }

.tag {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 0.85rem;
  margin-right: 6px;
}
.tag.fresh { background: var(--accent); color: var(--accent-ink); }

.wish { display: grid; grid-template-columns: 1fr; gap: 10px; }
.wish.has-image { grid-template-columns: 96px 1fr; }
.wish img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; background: var(--soft); }
.wish .title { font-weight: 700; font-size: 1.1rem; }
.wish .note { color: var(--muted); white-space: pre-wrap; }
.wish .price { font-weight: 600; }
.wish .row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 6px; }
.wish.done { opacity: 0.7; }

button, .btn {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  padding: 10px 14px;
  min-height: 44px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
button.primary, .btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
button.danger { color: var(--danger); }
button.quiet { background: transparent; border-color: transparent; padding-left: 8px; padding-right: 8px; }
button:disabled { opacity: 0.5; cursor: default; }
.wide { width: 100%; justify-content: center; }

form.wish-form { display: grid; gap: 10px; }
form.wish-form label { display: grid; gap: 4px; font-size: 0.95rem; color: var(--muted); }
form.wish-form label.inline { grid-template-columns: auto 1fr; align-items: center; gap: 10px; color: var(--ink); }
input[type="text"], input[type="url"], input[type="number"], textarea, select {
  font: inherit;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  width: 100%;
  min-height: 44px;
}
textarea { min-height: 72px; resize: vertical; }
input[type="checkbox"] { width: 24px; height: 24px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }
.error { color: var(--danger); font-weight: 600; }
.empty { color: var(--muted); padding: 24px 0; text-align: center; }
.signout { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: center; margin-top: 24px; text-align: center; }

.claim { border-top: 1px solid var(--line); padding-top: 10px; margin-top: 10px; }
.mine { color: var(--accent); font-weight: 600; }
.ok { color: var(--ok); font-weight: 600; }
h2 .tag { font-weight: 500; vertical-align: middle; }

form.wish-form .row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
form.wish-form .row input[type="url"] { flex: 1; min-width: 0; }
img.preview { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; background: var(--soft); }
