:root {
  color-scheme: light dark;
  --accent: #b3244c;
  --bg: #fafafa;
  --fg: #1a1a1a;
  --card: #ffffff;
  --border: #e0e0e0;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14141a;
    --fg: #f0f0f0;
    --card: #1e1e26;
    --border: #333;
  }
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--fg);
  max-width: 640px;
  margin: 0 auto;
  padding: 1.5rem;
  line-height: 1.5;
}

header { margin-bottom: 2rem; }

h1, h2, h3 { line-height: 1.2; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.25rem;
  margin-bottom: 1rem;
}

label { display: block; font-weight: 600; margin-bottom: 0.25rem; }

input, select {
  width: 100%;
  padding: 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--fg);
  margin-bottom: 1rem;
  font-size: 1rem;
}

button, .button {
  display: inline-block;
  background: var(--accent);
  color: white;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
}

button.secondary, .button.secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

.error {
  background: #fdeaea;
  color: #a12222;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

.notice {
  background: #e8f5ec;
  color: #1c6b3a;
  border-radius: 6px;
  padding: 0.75rem;
  margin-bottom: 1rem;
}

@media (prefers-color-scheme: dark) {
  .error { background: #3a1f1f; color: #ff8f8f; }
  .notice { background: #1d3325; color: #8fe0ab; }
}

.muted { opacity: 0.7; font-size: 0.9rem; }

.thread { display: flex; flex-direction: column; gap: 0.5rem; }

.bubble {
  padding: 0.5rem 0.9rem 0.6rem;
  border-radius: 10px;
  max-width: 80%;
}
.bubble-meta { display: block; font-size: 0.72rem; opacity: 0.75; margin-bottom: 0.15rem; }

.bubble.mine { background: var(--accent); color: white; align-self: flex-end; }
.bubble.theirs { background: var(--card); border: 1px solid var(--border); align-self: flex-start; }

/* --- Roster ------------------------------------------------------------ */
.roster { list-style: none; padding: 0; }
.roster li { padding: 0.35rem 0; border-bottom: 1px solid rgba(128,128,128,0.18); }
.ready { color: #1c6b3a; }
.waiting { opacity: 0.65; }

/* --- Invitation -------------------------------------------------------- */
.invite { display: flex; gap: 0.5rem; align-items: center; }
.invite input { flex: 1; font-family: ui-monospace, monospace; font-size: 0.85rem; }

/* --- Wishlist ---------------------------------------------------------- */
.wishlist { list-style: none; padding: 0; }
.wishlist li {
  display: flex; gap: 0.75rem; align-items: flex-start;
  padding: 0.6rem 0; border-bottom: 1px solid rgba(128,128,128,0.18);
}
/* `min-width: 0` is load-bearing. A flex item defaults to `min-width: auto`,
   which refuses to shrink below its longest unbreakable run — so one pasted
   line held together by non-breaking spaces, or a bare URL, stops wrapping,
   overflows the card and shoves `.wish-actions` off the right edge, out of
   the card and off a phone screen entirely. `overflow-wrap: anywhere` is the
   second half: it lets such a run break when nothing else can. */
.wish-body { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.wish-body p { margin: 0.25rem 0; }
.wish-body ul { margin: 0.25rem 0 0.25rem 1.1rem; padding: 0; }
.thumb { width: 72px; height: 72px; object-fit: cover; border-radius: 6px; }

.toolbar { display: flex; gap: 0.35rem; margin-bottom: 0.3rem; }
.toolbar button { padding: 0.15rem 0.6rem; font-size: 0.9rem; }
.editor {
  min-height: 5rem; padding: 0.6rem; border-radius: 6px;
  border: 1px solid rgba(128,128,128,0.45); background: inherit; color: inherit;
}
.editor:empty::before { content: attr(data-placeholder); opacity: 0.5; }
.editor:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

@media (prefers-color-scheme: dark) {
  .ready { color: #8fe0ab; }
}

/* `flex: none` so the buttons keep their own width whatever the
   description does — they are what the person needs to reach. */
.wish-actions { display: flex; flex-direction: column; gap: 0.3rem; flex: none; }
.wish-actions .button, .wish-actions button { font-size: 0.85rem; padding: 0.2rem 0.7rem; }
a.button {
  display: inline-block; text-decoration: none; text-align: center;
  border-radius: 6px; padding: 0.4rem 0.9rem;
}
a.button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--accent); }
