:root {
  --bg: #fbf1e0; --card: #fffaf0; --ink: #3b2f2f; --muted: #8a7a6a;
  --accent: #d9693b; --glow: #ffd36b; --line: #ead9bd;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink);
  font: 18px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
#app { max-width: 560px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
h1, h2 { margin: 0 0 8px; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.muted { color: var(--muted); }
button { font: inherit; border: 0; border-radius: 16px; padding: 14px 18px; min-height: 52px;
  background: var(--accent); color: #fff; cursor: pointer; }
button.ghost { background: transparent; color: var(--ink); border: 2px solid var(--line); }
button.big { width: 100%; font-size: 20px; margin-top: 12px; }
button:disabled { opacity: .5; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; }

/* the house */
.house { width: 100%; height: auto; display: block; margin: 8px 0; }
.win { cursor: pointer; }
.win rect.pane { fill: #cfe3ee; stroke: #8a6a4a; stroke-width: 3; }
.win.glow rect.pane { fill: var(--glow); animation: pulse 2s ease-in-out infinite; }
.win text { font-size: 13px; fill: var(--ink); text-anchor: middle; pointer-events: none; }
.win .badge { fill: var(--accent); }
.win .badge-n { fill: #fff; font-weight: 700; }
@keyframes pulse { 50% { filter: drop-shadow(0 0 8px var(--glow)); } }
@media (prefers-reduced-motion: reduce) { .win.glow rect.pane { animation: none; } }

/* items */
.card { background: var(--card); border: 2px solid var(--line); border-radius: 18px; padding: 14px; margin: 12px 0; }
.card.new { border-color: var(--accent); }
.meta { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.card img { width: 100%; border-radius: 12px; display: block; background: #fff; }
.card audio { width: 100%; height: 48px; }
.card p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.reply-to { font-size: 14px; color: var(--muted); margin-bottom: 6px; }
.empty { text-align: center; padding: 32px 0; }

/* composer */
.tabs { display: flex; gap: 6px; margin: 12px 0; }
.tabs button { flex: 1; padding: 10px 4px; background: transparent; color: var(--ink); border: 2px solid var(--line); }
.tabs button[aria-selected="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
textarea, input[type=text] { width: 100%; font: inherit; padding: 12px; border-radius: 14px;
  border: 2px solid var(--line); background: #fff; color: var(--ink); }
canvas { width: 100%; touch-action: none; background: #fff; border: 2px solid var(--line); border-radius: 14px; }
.colors { display: flex; gap: 10px; margin: 8px 0; }
.colors button { width: 40px; min-height: 40px; padding: 0; border-radius: 50%; flex: none; border: 3px solid transparent; }
.colors button[aria-pressed="true"] { border-color: var(--ink); }
.preview { max-height: 260px; object-fit: contain; }
.rec { font-size: 40px; width: 120px; height: 120px; border-radius: 50%; display: block; margin: 16px auto; }
.rec.on { background: #c0392b; animation: pulse 1s infinite; }
.error { color: #b03a2e; margin: 8px 0; }

.sendbar { position: sticky; bottom: 0; background: var(--bg); padding: 8px 0 calc(8px + env(safe-area-inset-bottom)); margin-top: 8px; }
.sendbar .error { margin: 0 0 6px; font-weight: 600; }
.sendbar button.big { margin-top: 0; }
.flash { background: #dff0d8; border: 2px solid #9bc27d; border-radius: 14px; padding: 12px 14px; margin: 8px 0; font-weight: 600; }
