:root {
  --bg: #fff8ef;
  --surface: #ffffff;
  --text: #2b2118;
  --muted: #8a7a6b;
  --border: #f1e3d3;
  --accent: #ff6b4a;
  --accent-ink: #ffffff;
  --sun: #ffc93c;
  --danger: #e0433a;
  --shadow: 0 2px 0 #f1e3d3, 0 8px 24px rgb(120 70 30 / 0.08);
  --p0: #ff8a65;
  --p1: #ffb53c;
  --p2: #5cc489;
  --p3: #4fb3e8;
  --p4: #9b7bea;
  --p5: #f26fa8;
  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1f1712;
    --surface: #2b211a;
    --text: #fbefe2;
    --muted: #b59f8b;
    --border: #3d2f25;
    --accent: #ff7d5e;
    --accent-ink: #1f1712;
    --sun: #ffd25e;
    --danger: #ff7b72;
    --shadow: 0 2px 0 #15100c, 0 8px 24px rgb(0 0 0 / 0.3);
  }
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.5 "Nunito", system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 64px;
}

h1, .brand {
  font-family: "Fredoka", "Nunito", system-ui, sans-serif;
  font-weight: 600;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.title { display: flex; align-items: center; gap: 12px; min-width: 0; }
.title img { width: 44px; height: 44px; flex: none; }
.title-text { min-width: 0; }
.title-text h1 { margin: 0; font-size: 1.6rem; line-height: 1.1; overflow-wrap: anywhere; }
.brand { font-size: 0.85rem; color: var(--accent); letter-spacing: 0.02em; }

label { display: block; font-weight: 700; margin-bottom: 4px; }

input, textarea, select {
  font: inherit;
  width: 100%;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.15s;
}

input:focus, textarea:focus, select:focus { border-color: var(--accent); }
textarea { resize: vertical; }

button {
  font: inherit;
  font-weight: 700;
  padding: 10px 22px;
  border: 0;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-ink);
  cursor: pointer;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 60%, #000);
  transition: transform 0.1s, box-shadow 0.1s;
}

button:active { transform: translateY(2px); box-shadow: 0 1px 0 color-mix(in srgb, var(--accent) 60%, #000); }
button:disabled { opacity: 0.5; cursor: default; }

.card {
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}

form.card { display: grid; gap: 10px; margin-bottom: 28px; }

.row { display: flex; align-items: center; gap: 8px; }
.between { justify-content: space-between; }
.muted { color: var(--muted); }
.error { color: var(--danger); margin: 0; }

#message { text-align: center; padding: 32px 0; }

#posts { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }

.post {
  border-left: 6px solid var(--who);
  animation: pop-in 0.3s ease-out both;
}

.post-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.arrow { color: var(--muted); }
.post-body { margin: 10px 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 1.05rem; }

.avatar {
  width: 34px;
  height: 34px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--who);
  color: #fff;
  font-family: "Fredoka", sans-serif;
  font-weight: 600;
}

.to-everyone {
  background: var(--sun);
  color: #2b2118;
  border-radius: 999px;
  padding: 0 10px;
  font-weight: 700;
  font-size: 0.9rem;
}

.empty { text-align: center; padding: 24px 0; }
.empty img { width: 96px; height: 96px; display: block; margin: 0 auto 12px; animation: bob 3s ease-in-out infinite; }

button.secondary, button.heart, button.link {
  background: none;
  color: var(--muted);
  padding: 4px 12px;
  box-shadow: none;
  font-weight: 700;
}

button.secondary { display: block; margin: 20px auto 0; border: 2px solid var(--border); }
button.heart { border: 2px solid var(--border); }
button.heart.on { color: var(--accent); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
button.heart.bump { animation: bump 0.35s ease-out; }
button.link { text-decoration: underline; padding: 4px; }

.menu { position: relative; flex: none; }
.menu summary {
  cursor: pointer;
  list-style: none;
  font-weight: 700;
  padding: 6px 14px;
  border: 2px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
}
.menu summary::-webkit-details-marker { display: none; }
.menu summary::after { content: " ▾"; color: var(--muted); }
.menu-body {
  position: absolute;
  right: 0;
  top: 46px;
  z-index: 1;
  width: min(320px, calc(100vw - 32px));
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: 20px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.menu-body p { margin: 16px 0 8px; font-size: 0.9rem; }

.confetti {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 10;
}

@keyframes pop-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

@keyframes bump {
  40% { transform: scale(1.25); }
  100% { transform: scale(1); }
}

@keyframes bob {
  50% { transform: translateY(-6px) rotate(-3deg); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
