/* ==========================================================================
   WishLister – festive, mobile-first styles
   ========================================================================== */

:root {
  --bg: #f8f2e7;
  --bg-dot: rgba(29, 77, 54, 0.06);
  --surface: #fffdf9;
  --surface-2: #f3ece0;
  --ink: #1d2a23;
  --muted: #69766e;
  --line: #e7dccb;
  --pine: #1d4d36;
  --pine-dark: #10301f;
  --pine-soft: #e3efe6;
  --berry: #b3261e;
  --berry-dark: #8f1c16;
  --berry-soft: #fbe7e4;
  --gold: #c9972b;
  --gold-soft: #f8edd3;
  --heart-off: #dccfbd;
  --shadow: 0 1px 2px rgba(40, 30, 10, 0.06), 0 6px 20px rgba(40, 30, 10, 0.07);
  --radius: 18px;
  --radius-sm: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1712;
    --bg-dot: rgba(255, 255, 255, 0.035);
    --surface: #15231b;
    --surface-2: #1b2d23;
    --ink: #eef2ec;
    --muted: #9fb0a5;
    --line: #26392e;
    --pine: #6fbf8e;
    --pine-dark: #0a1d13;
    --pine-soft: #1c3527;
    --berry: #e2554b;
    --berry-dark: #c43e35;
    --berry-soft: #3a1c1a;
    --gold: #e3b44f;
    --gold-soft: #3a3019;
    --heart-off: #34473b;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 6px 20px rgba(0, 0, 0, 0.25);
    color-scheme: dark;
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: 16px; }

body {
  margin: 0;
  font: 16px/1.5 var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 1.5px, transparent 1.6px);
  background-size: 22px 22px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
body.has-nav { padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px)); }

img { max-width: 100%; }
[hidden] { display: none !important; }
a { color: var(--pine); text-underline-offset: 2px; }
h1, h2, h3 { font-family: var(--serif); line-height: 1.2; margin: 0 0 0.4em; }
h1 { font-size: clamp(1.6rem, 5vw, 2.1rem); }
h2 { font-size: 1.3rem; }
p { margin: 0 0 0.75em; }

.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.muted { color: var(--muted); }
.small { font-size: 0.875rem; }
.center { text-align: center; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* ---------- Header ---------------------------------------------------------- */

.site-header {
  position: relative;
  background: linear-gradient(160deg, #174a33 0%, #10301f 60%, #0b2417 100%);
  color: #fff;
  overflow: hidden;
  padding-top: env(safe-area-inset-top, 0px);
}
.header-inner {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 14px 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-family: var(--serif);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}
.brand-tree { font-size: 1.6rem; filter: drop-shadow(0 0 6px rgba(255, 220, 120, 0.5)); }

.top-nav { display: none; align-items: center; gap: 4px; }
.top-nav a {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.95rem;
}
.top-nav a:hover { background: rgba(255, 255, 255, 0.1); color: #fff; }
.top-nav a.active { background: rgba(255, 255, 255, 0.16); color: #fff; }
.top-nav .nav-me { padding: 4px; margin-left: 6px; }
.top-nav .nav-me.active { background: none; }
.top-nav .nav-me .avatar { box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.5); }
.top-nav .nav-me.active .avatar { box-shadow: 0 0 0 2px var(--gold); }

/* String of fairy lights under the header */
.lights {
  position: relative;
  height: 18px;
  margin-top: -6px;
  background:
    radial-gradient(circle at 12px 10px, #ff5a4e 4px, transparent 5px) 0 0 / 96px 18px,
    radial-gradient(circle at 36px 12px, #ffd25a 4px, transparent 5px) 0 0 / 96px 18px,
    radial-gradient(circle at 60px 10px, #6fe08f 4px, transparent 5px) 0 0 / 96px 18px,
    radial-gradient(circle at 84px 12px, #70b8ff 4px, transparent 5px) 0 0 / 96px 18px;
  animation: twinkle 3s ease-in-out infinite alternate;
}
.lights::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 10px;
  border-bottom: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 0 0 50% 50% / 0 0 100% 100%;
}
@keyframes twinkle { from { filter: brightness(0.85) saturate(0.9); } to { filter: brightness(1.15) saturate(1.2); } }

.snow { position: absolute; inset: 0; pointer-events: none; }
.flake {
  position: absolute;
  top: -10px;
  color: #fff;
  opacity: 0.8;
  user-select: none;
  animation: fall linear infinite;
}
@keyframes fall {
  from { transform: translate3d(0, -10px, 0) rotate(0deg); }
  to   { transform: translate3d(20px, 140px, 0) rotate(240deg); }
}

@media (prefers-reduced-motion: reduce) {
  .lights { animation: none; }
  .flake { display: none; }
  html { scroll-behavior: auto; }
}

/* ---------- Layout ---------------------------------------------------------- */

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
  padding: 20px 16px 32px;
  flex: 1;
}
.site-footer { text-align: center; color: var(--muted); font-size: 0.8rem; padding: 8px 16px 20px; }

.bottom-nav {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  height: var(--nav-h);
  text-decoration: none;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
}
.bottom-nav a span { font-size: 1.35rem; line-height: 1; filter: grayscale(0.6); opacity: 0.8; }
.bottom-nav a.active { color: var(--berry); }
.bottom-nav a.active span { filter: none; opacity: 1; transform: translateY(-1px); }

@media (min-width: 760px) {
  .top-nav { display: flex; }
  .bottom-nav { display: none; }
  body.has-nav { padding-bottom: 0; }
  .container { padding-top: 32px; }
}

/* ---------- Cards, flash, banners ------------------------------------------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 18px;
}

.flash {
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 16px;
  font-weight: 500;
  border: 1px solid transparent;
}
.flash-success { background: var(--pine-soft); color: var(--ink); border-color: color-mix(in srgb, var(--pine) 30%, transparent); }
.flash-error { background: var(--berry-soft); color: var(--ink); border-color: color-mix(in srgb, var(--berry) 35%, transparent); }

.secret-banner {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--gold-soft);
  border: 1px dashed color-mix(in srgb, var(--gold) 60%, transparent);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 18px;
  font-size: 0.93rem;
}
.secret-banner > span { font-size: 1.4rem; line-height: 1.2; }
.secret-banner p { margin: 0; }

.removed-notice {
  background: var(--berry-soft);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  margin-bottom: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
}
.removed-notice p { margin: 0; flex: 1 1 240px; }

.empty { text-align: center; padding: 48px 16px; }
.empty.small { padding: 28px 16px; color: var(--muted); }
.empty-emoji { font-size: 3rem; margin-bottom: 8px; }

.back { margin: 0 0 12px; }
.back a { text-decoration: none; font-weight: 600; }

/* ---------- Buttons & forms ------------------------------------------------- */

.btn {
  --b: var(--surface-2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid transparent;
  background: var(--b);
  color: var(--ink);
  font: inherit;
  font-weight: 650;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-tap-highlight-color: transparent;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--berry); color: #fff; box-shadow: 0 2px 0 var(--berry-dark); }
.btn-primary:hover { background: var(--berry-dark); }
.btn-soft { background: var(--pine-soft); color: var(--pine); }
.btn-soft:hover { background: color-mix(in srgb, var(--pine-soft) 80%, var(--pine) 20%); }
.btn-ghost { background: transparent; color: var(--muted); border-color: var(--line); }
.btn-ghost:hover { color: var(--ink); background: var(--surface-2); }
.btn-danger { background: transparent; color: var(--berry); border-color: color-mix(in srgb, var(--berry) 45%, transparent); }
.btn-danger:hover { background: var(--berry-soft); }
.btn-sm { min-height: 36px; padding: 6px 14px; font-size: 0.9rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: 0.6; cursor: progress; }

.link-button {
  background: none; border: 0; padding: 4px; color: var(--muted); font: inherit; font-size: 0.85rem;
  text-decoration: underline; cursor: pointer;
}
.link-button:hover { color: var(--berry); }

.stack > * + * { margin-top: 14px; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-row { display: flex; gap: 12px; flex-wrap: wrap; }
.field-row .grow { flex: 1 1 180px; }
label, legend { font-weight: 650; font-size: 0.92rem; }
.optional { font-weight: 400; color: var(--muted); font-size: 0.82rem; margin-left: 4px; }
.hint { color: var(--muted); font-size: 0.83rem; margin: 0; }
.hint.is-ok { color: var(--pine); }
.hint.is-error { color: var(--berry); }

input[type="text"], input[type="password"], input[type="url"], textarea, select {
  width: 100%;
  font: inherit;
  font-size: 16px; /* prevents iOS zoom */
  color: var(--ink);
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 11px 13px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
textarea { resize: vertical; min-height: 64px; }
select { appearance: none; padding-right: 32px; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--pine);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pine) 20%, transparent);
}

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input { flex: 1 1 160px; width: auto; }

.checkbox { display: flex; gap: 10px; align-items: center; font-weight: 500; cursor: pointer; }
.checkbox input { width: 20px; height: 20px; accent-color: var(--berry); }

.url-row { display: flex; gap: 8px; }
.url-row input { flex: 1; min-width: 0; }

/* Heart rating picker (pure CSS, row-reverse trick) */
fieldset { border: 0; padding: 0; margin: 0; min-width: 0; }
.rating-field { display: block; }
.rating-field legend { padding: 0; margin-bottom: 6px; }
.heart-picker { display: inline-flex; flex-direction: row-reverse; vertical-align: middle; margin-left: -3px; margin-right: 10px; }
.heart-picker label {
  font-size: 2rem;
  line-height: 1;
  padding: 2px 3px;
  color: var(--heart-off);
  cursor: pointer;
  transition: color 0.1s ease, transform 0.1s ease;
}
.heart-picker input:checked ~ label { color: var(--berry); }
.heart-picker:hover input ~ label { color: var(--heart-off); }
.heart-picker:hover label:hover,
.heart-picker:hover label:hover ~ label { color: var(--berry); }
.heart-picker label:hover { transform: scale(1.15); }
.heart-picker input:focus-visible + label { outline: 3px solid var(--gold); border-radius: 6px; }
.rating-text { font-weight: 600; color: var(--berry); font-size: 0.95rem; vertical-align: middle; }

.image-preview { display: flex; align-items: center; gap: 12px; }
.image-preview img { width: 72px; height: 72px; object-fit: contain; background: #fff; border-radius: var(--radius-sm); border: 1px solid var(--line); }
.image-preview.is-empty { display: none; }

/* ---------- Avatars --------------------------------------------------------- */

.avatar {
  --av: var(--berry);
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--av);
  background-image: radial-gradient(circle at 30% 25%, rgba(255, 255, 255, 0.35), transparent 55%);
  color: #fff;
  font-weight: 700;
  font-family: var(--serif);
  font-size: 1.15rem;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.25);
}
.avatar-sm { width: 32px; height: 32px; font-size: 0.9rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.5rem; }

/* ---------- Home ------------------------------------------------------------ */

.hero { margin-bottom: 18px; }
.hero h1 { margin-bottom: 4px; }
.countdown { color: var(--muted); font-size: 1.05rem; margin: 0; }
.countdown strong { color: var(--berry); font-size: 1.35rem; font-family: var(--serif); }

.quick-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 26px; }
.quick-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  border-radius: var(--radius);
  text-decoration: none;
  color: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  min-height: 118px;
  transition: transform 0.12s ease;
}
.quick-card:hover { transform: translateY(-2px); }
.quick-card::after {
  /* ribbon */
  content: "";
  position: absolute;
  top: 0; bottom: 0; right: 26px;
  width: 12px;
  background: rgba(255, 255, 255, 0.16);
}
.quick-mine { background: linear-gradient(150deg, #c0342a, #8f1c16); }
.quick-shop { background: linear-gradient(150deg, #22603f, #10301f); }
.quick-emoji { font-size: 1.6rem; }
.quick-title { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; }
.quick-sub { font-size: 0.86rem; opacity: 0.92; }
.quick-alert { font-size: 0.8rem; background: rgba(0, 0, 0, 0.25); border-radius: 8px; padding: 2px 8px; margin-top: 4px; align-self: flex-start; }

.section-title { display: flex; align-items: center; gap: 10px; }
.section-title::after { content: ""; flex: 1; height: 2px; background: repeating-linear-gradient(90deg, var(--berry) 0 10px, #fff0 10px 14px, var(--pine) 14px 24px, #fff0 24px 28px); opacity: 0.35; border-radius: 2px; }

.members { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.member-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  color: var(--ink);
  text-decoration: none;
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.member-card:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--pine) 35%, var(--line)); }
.member-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.member-name { font-family: var(--serif); font-weight: 700; font-size: 1.15rem; }
.member-stats { font-size: 0.85rem; color: var(--muted); }
.member-stats strong { color: var(--pine); }
.member-chat { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.progress { display: block; height: 6px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--pine), var(--gold)); border-radius: 6px; }

/* ---------- Page heads ------------------------------------------------------ */

.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.page-head h1 { margin: 0; }
.page-head p { margin: 2px 0 0; }
.page-head > div { flex: 1; min-width: 0; }
.page-emoji { font-size: 2.4rem; }
.head-chat { flex: none; }

/* ---------- Add wish -------------------------------------------------------- */

.add-wish { padding: 0; }
.add-wish summary {
  list-style: none;
  cursor: pointer;
  padding: 16px 18px;
  font-weight: 700;
  font-size: 1.05rem;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--berry);
}
.add-wish summary::-webkit-details-marker { display: none; }
.add-wish .plus {
  display: inline-grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--berry); color: #fff; font-size: 1.1rem;
  transition: transform 0.2s ease;
}
.add-wish[open] .plus { transform: rotate(45deg); }
.add-wish > form, .add-wish > .flash { margin: 0 18px 18px; }

/* ---------- Wishes ---------------------------------------------------------- */

.wishes { display: grid; gap: 12px; margin-bottom: 26px; }
.wish {
  position: relative;
  display: grid;
  grid-template-columns: 76px 1fr;
  grid-template-areas: "media body" "actions actions";
  gap: 12px 14px;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  scroll-margin-top: 16px;
}
.wish:target { border-color: var(--gold); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 35%, transparent), var(--shadow); }
.wish-media {
  grid-area: media;
  position: relative;
  width: 76px; height: 76px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: grid; place-items: center;
  overflow: hidden;
}
.wish-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #fff; }
.wish-placeholder { font-size: 2rem; }
.wish-body { grid-area: body; min-width: 0; }
.wish-title { font-family: var(--font); font-size: 1.05rem; font-weight: 700; margin: 0 0 2px; overflow-wrap: anywhere; }
.wish-title a { color: var(--ink); text-decoration: none; }
.wish-title a:hover { color: var(--berry); text-decoration: underline; }
.wish-title .ext { color: var(--muted); font-size: 0.85em; }
.wish-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.88rem; color: var(--muted); margin-bottom: 4px; }
.wish-meta .price { color: var(--pine); font-weight: 700; font-size: 0.98rem; }
.wish-note {
  margin: 6px 0 0;
  font-size: 0.9rem;
  background: var(--surface-2);
  padding: 6px 10px;
  border-radius: 10px;
  white-space: pre-line;
  overflow-wrap: anywhere;
}
.wish-actions, .claim {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
}
.wish-actions { justify-content: flex-end; }
.claim-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-left: auto; }

.wish.is-claimed { background: linear-gradient(var(--surface), var(--surface)) padding-box; }
.wish.is-claimed::before {
  /* gift ribbon on the left edge */
  content: "";
  position: absolute;
  left: -1px; top: 14px; bottom: 14px;
  width: 5px;
  border-radius: 0 5px 5px 0;
  background: var(--gold);
}
.wish.is-mine::before { background: var(--pine); }
.wish.is-claimed:not(.is-mine) .wish-media { filter: saturate(0.6); }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 650;
}
.tag-taken { background: var(--gold-soft); color: color-mix(in srgb, var(--gold) 55%, var(--ink)); }
.tag-mine { background: var(--pine-soft); color: var(--pine); }

.hearts { display: inline-flex; align-items: center; gap: 1px; font-size: 1rem; margin-top: 2px; }
.heart { color: var(--heart-off); }
.heart.on { color: var(--berry); }
.hearts-label { margin-left: 8px; font-size: 0.82rem; font-weight: 600; color: var(--muted); }

.rate-inline { display: flex; align-items: center; flex-wrap: wrap; margin-top: 4px; }
.rate-buttons { display: inline-flex; }
.heart-btn {
  background: none; border: 0; padding: 2px 2px; margin: 0;
  font-size: 1.35rem; line-height: 1; cursor: pointer;
  color: var(--heart-off);
  transition: transform 0.1s ease, color 0.1s ease;
  min-width: 30px; min-height: 34px;
}
.heart-btn.on { color: var(--berry); }
.heart-btn:hover { transform: scale(1.2); }
.rate-buttons:hover .heart-btn { color: var(--berry); }
.rate-buttons .heart-btn:hover ~ .heart-btn { color: var(--heart-off); }

@media (min-width: 640px) {
  .wish {
    grid-template-columns: 88px 1fr auto;
    grid-template-areas: "media body actions";
    align-items: center;
  }
  .wish-media { width: 88px; height: 88px; }
  .wish-actions, .claim {
    border-top: 0;
    padding-top: 0;
    flex-direction: column;
    align-items: flex-end;
    justify-content: center;
    max-width: 260px;
  }
  .claim-actions { margin-left: 0; justify-content: flex-end; }
}

/* ---------- Chat ------------------------------------------------------------ */

.chat { scroll-margin-top: 16px; }
.chat h2 { margin-bottom: 2px; }
.bubbles { display: flex; flex-direction: column; gap: 12px; margin: 16px 0; }
.bubble { display: flex; gap: 10px; align-items: flex-end; max-width: 88%; }
.bubble-body {
  background: var(--surface-2);
  border-radius: 16px 16px 16px 4px;
  padding: 8px 12px;
  min-width: 0;
}
.bubble-body p { margin: 2px 0 0; white-space: pre-line; overflow-wrap: anywhere; }
.bubble-meta { font-size: 0.78rem; color: var(--muted); }
.bubble-mine { align-self: flex-end; flex-direction: row-reverse; }
.bubble-mine .bubble-body { background: var(--pine-soft); border-radius: 16px 16px 4px 16px; }
.bubble-delete { text-align: right; margin-top: -2px; }
.bubble-delete .link-button { font-size: 0.75rem; padding: 0; }
.chat-form { display: flex; gap: 8px; align-items: flex-end; }
.chat-form textarea { flex: 1; min-height: 48px; }

/* ---------- Shopping -------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 10px; margin-bottom: 18px; }
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  padding: 12px;
  text-align: center;
  display: flex; flex-direction: column;
}
.stat-num { font-family: var(--serif); font-size: 1.35rem; font-weight: 700; color: var(--berry); }
.stat-label { font-size: 0.8rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }

.shop-group h2 a { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.shop-items { list-style: none; margin: 8px 0 0; padding: 0; }
.shop-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.shop-item:first-child { border-top: 0; }
.shop-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.shop-title { font-weight: 650; overflow-wrap: anywhere; }
.shop-title a { color: var(--ink); text-decoration: none; }
.shop-sub { font-size: 0.85rem; color: var(--muted); }
.shop-warning { font-size: 0.82rem; color: var(--berry); font-weight: 600; }
.shop-item.is-bought .shop-title { text-decoration: line-through; color: var(--muted); }
.shop-item.is-bought .shop-title a { color: var(--muted); }
.check {
  width: 32px; height: 32px; border-radius: 50%;
  border: 2px solid var(--line); background: var(--surface);
  color: #fff; font-weight: 800; font-size: 1rem; cursor: pointer;
  display: grid; place-items: center;
}
.check:hover { border-color: var(--pine); }
.check.on { background: var(--pine); border-color: var(--pine); }

/* ---------- Auth pages ------------------------------------------------------ */

body.bare .container { display: grid; place-items: start center; padding-top: 6vh; }
.auth-card {
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 28px 22px;
  position: relative;
}
.auth-card::before {
  /* wrapping ribbon */
  content: "";
  position: absolute;
  top: 0; bottom: 0; left: 50%;
  width: 14px;
  transform: translateX(-50%);
  background: color-mix(in srgb, var(--berry) 10%, transparent);
  pointer-events: none;
  border-radius: 0;
}
.auth-card > * { position: relative; }
.auth-card h1 { text-align: center; }
.auth-emoji { text-align: center; font-size: 3rem; line-height: 1; margin-bottom: 6px; }
.lead { text-align: center; color: var(--muted); }
.auth-card .hint.center { margin-top: 16px; }

/* ---------- Account & admin ------------------------------------------------- */

.admin-link { display: block; text-decoration: none; color: var(--ink); }
.admin-link:hover { border-color: var(--gold); }

.credentials { border: 2px solid var(--gold); }
.credential-box {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  font-size: 0.95rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  margin: 0 0 10px;
}

.user-list { list-style: none; margin: 0; padding: 0; }
.user-row { padding: 12px 0; border-top: 1px solid var(--line); }
.user-row:first-child { border-top: 0; }
.user-main { display: flex; gap: 12px; align-items: center; }
.user-name { font-weight: 700; }
.user-name .muted { font-weight: 400; font-size: 0.88rem; }
.user-badges { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.badge { font-size: 0.75rem; font-weight: 650; padding: 2px 9px; border-radius: 999px; background: var(--berry-soft); color: var(--berry); }
.badge-gold { background: var(--gold-soft); color: color-mix(in srgb, var(--gold) 60%, var(--ink)); }
.badge-plain { background: var(--surface-2); color: var(--muted); }
.user-manage { margin-top: 10px; }
.user-manage summary { list-style: none; display: inline-flex; }
.user-manage summary::-webkit-details-marker { display: none; }
.user-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.user-actions .inline-form { flex: 1 1 100%; }
.danger-zone { border-color: color-mix(in srgb, var(--berry) 35%, var(--line)); }
