/* Theme 2: Campfire Night. Dark pine forest, a small fire, ember accents. */

@font-face { font-family: 'Fraunces'; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/fraunces-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: 'Fraunces'; font-weight: 400; font-style: italic; font-display: swap; src: url("fonts/fraunces-latin-400-italic.woff2") format("woff2"); }
@font-face { font-family: 'Figtree'; font-weight: 400; font-style: normal; font-display: swap; src: url("fonts/figtree-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: 'Figtree'; font-weight: 600; font-style: normal; font-display: swap; src: url("fonts/figtree-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: 'Figtree'; font-weight: 700; font-style: normal; font-display: swap; src: url("fonts/figtree-latin-700-normal.woff2") format("woff2"); }

:root {
  --mb-bg: #0b0e14;
  --mb-fg: #f4e9dc;
  --mb-muted: #cdbda8;
  --mb-card: #1b1713;
  --mb-border: #4a3a2c;
  --mb-input-bg: #110d0a;
  --mb-accent: #ff8a3d;
  --mb-accent-fg: #1a0e06;
  --mb-link: #ffc078;
  --mb-error: #ffa59a;
  --mb-focus: #ffd9a8;
  --mb-radius: 16px;
  --mb-gap: 16px;
  --mb-font: 'Figtree', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mb-font-heading: 'Fraunces', Georgia, 'Times New Roman', serif;
  --mb-font-mono: ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --mb-cat-suggestion: #9bd6a8;
  --mb-cat-complaint: #ff9f73;
  --mb-cat-confession: #d9b0ff;
  --mb-cat-bug: #ff94a4;
  --mb-cat-other: #c3cbdb;
  --cf-ember: #ff8a3d;
  --cf-amber: #ffc078;
  --cf-cream: #f4e9dc;
  --cf-panel: rgba(27, 23, 19, 0.95);
  color-scheme: dark;
}

body {
  background: #0b0e14;
  color: var(--mb-fg);
  font-weight: 400;
}

/* ---------- Scene ---------- */
.mb-scene {
  background:
    radial-gradient(ellipse 120% 50% at 50% 108%, rgba(255, 120, 40, 0.22), transparent 70%),
    linear-gradient(180deg, #070a11 0%, #0b0e14 38%, #12100f 78%, #14110f 100%);
  --cf-heat: 0;
}
.cf-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.cf-moon {
  position: absolute; top: 22px; right: 20px; width: 54px; height: 54px;
  background: url("art/moon.svg") center / contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(243, 232, 210, 0.45));
  opacity: 0.92;
}
.cf-ridge, .cf-ridge-near {
  position: absolute; left: 0; right: 0; bottom: 0; background-repeat: repeat-x; background-position: 40% bottom;
}
.cf-ridge { height: 210px; background-image: url("art/ridge.svg"); background-size: auto 100%; bottom: 20px; opacity: 0.95; }
.cf-ridge-near { height: 120px; background-image: url("art/ridge-near.svg"); background-size: auto 100%; background-position: 0 bottom; bottom: 8px; }
.cf-pines { position: absolute; bottom: 0; height: 78vh; width: 42vh; background-size: auto 100%; background-repeat: no-repeat; }
.cf-pines-l { left: -6vh; background-image: url("art/pines-left.svg"); background-position: left bottom; }
.cf-pines-r { right: -6vh; background-image: url("art/pines-right.svg"); background-position: right bottom; }
.cf-glow {
  position: absolute; left: 50%; bottom: -40px; width: 150vw; max-width: 1400px; height: 420px;
  transform: translateX(-50%);
  background: radial-gradient(ellipse 50% 56% at 50% 100%, rgba(255, 138, 61, 0.55), rgba(255, 120, 40, 0.2) 42%, transparent 74%);
  opacity: calc(0.78 + var(--cf-heat) * 0.22);
  animation: cf-glow 3.4s ease-in-out infinite;
  transform-origin: 50% 100%;
}
.cf-ground {
  position: absolute; left: 0; right: 0; bottom: 0; height: 54px;
  background: linear-gradient(180deg, #0a0b0e, #060709);
  border-top: 1px solid #14181f;
}
.cf-fire {
  position: absolute; left: 50%; bottom: 40px; width: clamp(120px, 34vw, 150px); aspect-ratio: 120 / 140;
  transform: translateX(-50%);
}
.cf-fire-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.cf-flames { transform-origin: 50% 118px; transform-box: view-box; transform: scale(calc(1 + var(--cf-heat) * 0.1)); transition: transform 0.6s ease; }
.cf-fl { transform-box: fill-box; transform-origin: 50% 100%; }
.cf-fl-outer { animation: cf-flick-a 1.7s ease-in-out infinite; }
.cf-fl-mid { animation: cf-flick-b 1.3s ease-in-out infinite; }
.cf-fl-inner { animation: cf-flick-a 0.95s ease-in-out infinite reverse; }
.cf-fl-core { animation: cf-flick-b 0.8s ease-in-out infinite; }
.cf-fl-side-l { animation: cf-flick-b 1.15s ease-in-out infinite; }
.cf-fl-side-r { animation: cf-flick-a 1.4s ease-in-out infinite; }
.cf-bed { animation: cf-bed 2.4s ease-in-out infinite; }
.cf-flare .cf-fire { animation: cf-flare-fire 1.5s ease-out; }
.cf-flare .cf-glow { animation: cf-flare-glow 1.5s ease-out; }

@keyframes cf-flick-a {
  0%, 100% { transform: scale(1, 1) skewX(0deg); }
  25% { transform: scale(0.94, 1.08) skewX(2.5deg); }
  55% { transform: scale(1.04, 0.94) skewX(-2deg); }
  80% { transform: scale(0.97, 1.05) skewX(1deg); }
}
@keyframes cf-flick-b {
  0%, 100% { transform: scale(1, 1) skewX(0deg); }
  30% { transform: scale(1.06, 0.92) skewX(-3deg); }
  60% { transform: scale(0.92, 1.1) skewX(2deg); }
  85% { transform: scale(1.02, 0.97) skewX(-1deg); }
}
@keyframes cf-bed { 0%, 100% { opacity: 0.5; } 50% { opacity: 0.85; } }
@keyframes cf-glow { 0%, 100% { transform: translateX(-50%) scale(1); } 40% { transform: translateX(-50%) scale(1.04, 1.02); } 70% { transform: translateX(-50%) scale(0.98); } }
@keyframes cf-flare-fire { 0% { transform: translateX(-50%) scale(1); filter: brightness(1); } 18% { transform: translateX(-50%) scale(1.28, 1.42); filter: brightness(1.4) saturate(1.2); } 100% { transform: translateX(-50%) scale(1); filter: brightness(1); } }
@keyframes cf-flare-glow { 0% { opacity: 0.8; } 20% { opacity: 1; filter: brightness(1.6); } 100% { opacity: 0.8; filter: none; } }

/* banked fire when the mailbox is closed */
html[data-view="closed"] .cf-flames { transform: scale(0.5); }
html[data-view="closed"] .cf-glow { opacity: 0.4; }

.cf-still .cf-glow, .cf-still .cf-fl, .cf-still .cf-bed { animation: none; }

.cf-hearth { background: linear-gradient(180deg, transparent, rgba(255, 110, 30, 0.07) 70%); position: absolute; left: 0; right: 0; bottom: 0; height: 440px; z-index: 0; pointer-events: none; overflow: hidden; }
body { position: relative; }
.cf-flare .cf-hearth .cf-glow { animation: cf-flare-glow 1.5s ease-out; }

/* ---------- Layout ---------- */
.mb-app { padding-top: max(26px, env(safe-area-inset-top)); padding-bottom: 210px; max-width: 580px; gap: 18px; }

.mb-header { padding: 6px 0 4px; }
.mb-header .mb-deco[data-slot="header-art"] {
  width: 34px; height: 34px; margin: 0 auto 6px;
  background: url("art/flame-mark.svg") center / contain no-repeat;
  filter: drop-shadow(0 0 8px rgba(255, 138, 61, 0.7));
  animation: cf-flick-a 1.8s ease-in-out infinite; transform-origin: 50% 100%;
}
.mb-kicker { color: var(--cf-amber); font-size: 13px; letter-spacing: 0.16em; }
.mb-title {
  font-family: var(--mb-font-heading); font-weight: 600; color: var(--cf-cream);
  font-size: clamp(38px, 11vw, 54px); letter-spacing: -0.01em; margin: 6px 0 10px;
  text-shadow: 0 0 28px rgba(255, 138, 61, 0.35), 0 2px 0 rgba(0, 0, 0, 0.5);
}
.mb-sub { color: #e4d5c1; font-size: 17px; max-width: 34ch; font-family: var(--mb-font-heading); font-style: italic; text-shadow: 0 1px 8px #000; }

/* ---------- Cards ---------- */
.mb-card {
  background: var(--cf-panel);
  border: 1px solid rgba(255, 170, 100, 0.2);
  border-radius: var(--mb-radius);
  padding: 22px 20px;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 -14px 46px -22px rgba(255, 138, 61, 0.28), 0 24px 40px -24px rgba(0, 0, 0, 0.9), inset 0 1px 0 rgba(255, 200, 140, 0.08);
}
.mb-view:not([hidden]) { animation: cf-rise 0.5s ease-out both; }
@keyframes cf-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.mb-h2 { font-family: var(--mb-font-heading); font-weight: 600; color: var(--cf-cream); font-size: 24px; }
.mb-h3 { font-family: var(--mb-font-heading); font-weight: 600; color: var(--cf-amber); font-size: 18px; }
.mb-label { color: var(--cf-amber); font-size: 15px; font-weight: 600; letter-spacing: 0.02em; }
.mb-text { color: var(--cf-cream); }

/* ---------- Category chips ---------- */
.mb-cat-list { gap: 10px; }
.mb-cat-name {
  position: relative; gap: 8px; padding: 8px 16px 8px 14px; color: #e9d9c4; background: rgba(255, 255, 255, 0.015);
  border: 1.5px solid #6b533d; border-radius: 999px; font-weight: 600; font-size: 16px;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.25s, color 0.2s;
}
.mb-cat-name::before {
  content: ""; width: 9px; height: 9px; border-radius: 50%; background: #5a4634; flex: none;
  transition: background-color 0.25s, box-shadow 0.25s;
}
.mb-cat:hover .mb-cat-name { border-color: #b38a5f; color: #fff3e2; }
.mb-cat input:checked + .mb-cat-name {
  color: #fff0dc; background: rgba(255, 138, 61, 0.16); border-color: var(--cf-ember);
  box-shadow: 0 0 0 1px rgba(255, 138, 61, 0.35), 0 0 18px rgba(255, 138, 61, 0.45), inset 0 0 14px rgba(255, 138, 61, 0.2);
  animation: cf-ember 2.6s ease-in-out infinite;
}
.mb-cat input:checked + .mb-cat-name::before { background: #ffc078; box-shadow: 0 0 8px 2px rgba(255, 168, 80, 0.9); }
@keyframes cf-ember {
  0%, 100% { box-shadow: 0 0 0 1px rgba(255, 138, 61, 0.35), 0 0 16px rgba(255, 138, 61, 0.4), inset 0 0 14px rgba(255, 138, 61, 0.18); }
  50% { box-shadow: 0 0 0 1px rgba(255, 138, 61, 0.5), 0 0 24px rgba(255, 138, 61, 0.6), inset 0 0 16px rgba(255, 138, 61, 0.28); }
}

/* ---------- Fields ---------- */
.mb-textarea, .mb-input {
  background: var(--mb-input-bg); color: var(--cf-cream); border: 1.5px solid #4f3d2d; border-radius: 12px;
  font-size: 17px; line-height: 1.55; box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s, box-shadow 0.25s;
}
.mb-textarea::placeholder, .mb-input::placeholder { color: #ad9b86; opacity: 1; }
.mb-textarea:focus, .mb-input:focus {
  outline: none; border-color: var(--cf-ember);
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.5), 0 0 0 3px rgba(255, 138, 61, 0.28), 0 0 22px rgba(255, 138, 61, 0.25);
}
.mb-input { color: var(--cf-amber); font-weight: 700; font-size: 19px; }
.mb-hint, .mb-counter { color: #bfae99; }
.mb-counter.is-near { color: var(--cf-amber); }
.mb-counter.is-over { color: #ffa59a; }
.mb-error { color: #ffb4a8; background: rgba(120, 30, 20, 0.35); border: 1px solid rgba(255, 140, 120, 0.4); border-radius: 10px; padding: 10px 12px; }

/* ---------- Buttons ---------- */
.mb-btn {
  font-weight: 700; border-radius: 12px; min-height: 50px; font-size: 17px; color: var(--cf-cream);
  background: #241d17; border: 1.5px solid #6b533d; transition: transform 0.15s, box-shadow 0.25s, border-color 0.2s, background-color 0.2s;
}
.mb-btn:hover { border-color: var(--cf-amber); }
.mb-btn:active { transform: translateY(1px) scale(0.99); }
.mb-btn-primary {
  color: #1a0e06; background-color: #ff8a3d; border-color: #ffa869;
  background-image: linear-gradient(180deg, rgba(255, 220, 170, 0.35), rgba(255, 138, 61, 0) 60%);
  box-shadow: 0 0 22px rgba(255, 138, 61, 0.4), 0 6px 16px -6px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 235, 205, 0.5);
}
.mb-btn-primary:hover { background-color: #ff9a57; border-color: #ffc078; box-shadow: 0 0 30px rgba(255, 138, 61, 0.6), 0 6px 16px -6px rgba(0, 0, 0, 0.8), inset 0 1px 0 rgba(255, 235, 205, 0.5); }
.mb-btn-ghost { background: transparent; color: var(--cf-amber); border-color: #6b533d; }
.mb-btn:disabled { opacity: 0.75; }
html[data-state="sending"] #send-btn { animation: cf-pulse 1.1s ease-in-out infinite; }
@keyframes cf-pulse { 50% { box-shadow: 0 0 36px rgba(255, 138, 61, 0.75), 0 6px 16px -6px rgba(0, 0, 0, 0.8); } }

.mb-link { color: var(--cf-amber); font-weight: 600; text-decoration-color: rgba(255, 192, 120, 0.5); text-shadow: 0 1px 6px #000; }
.mb-link:hover { color: #ffe2bd; }
:focus-visible { outline: 3px solid var(--mb-focus); outline-offset: 3px; }

/* ---------- Privacy ---------- */
.mb-privacy { background: rgba(20, 17, 14, 0.96); border-color: rgba(255, 170, 100, 0.14); padding: 20px; }
.mb-privacy .mb-h2 { font-size: 20px; }
.mb-list { padding-left: 22px; color: #eadcc8; }
.mb-list li::marker { color: var(--cf-ember); }
.mb-list li + li { margin-top: 6px; }
.mb-note { color: #d6c6b1; font-family: var(--mb-font-heading); }

/* ---------- Sent / closed ---------- */
.mb-deco[data-slot="sent-art"], .mb-deco[data-slot="closed-art"] { margin: -2px 0 8px; height: 40px; }
.mb-deco[data-slot="sent-art"] { background: url("art/flame-mark.svg") left center / contain no-repeat; height: 34px; filter: drop-shadow(0 0 8px rgba(255, 138, 61, 0.6)); }
.mb-deco[data-slot="closed-art"] { background: url("art/embers.svg") left center / contain no-repeat; }
.mb-code-box { margin: 18px 0 4px; }
.mb-code {
  color: var(--cf-amber); background: #120d09; border: 2px dashed rgba(255, 192, 120, 0.5); border-radius: 12px;
  padding: 12px 16px; text-shadow: 0 0 14px rgba(255, 150, 60, 0.7); letter-spacing: 0.06em;
  box-shadow: inset 0 0 26px rgba(255, 138, 61, 0.14), 0 0 20px rgba(255, 138, 61, 0.15);
}
.mb-code.cf-reveal { animation: cf-write 2s ease-out both; }
@keyframes cf-write {
  0% { opacity: 0; filter: blur(8px); letter-spacing: 0.2em; text-shadow: 0 0 0 rgba(255, 150, 60, 0); }
  35% { opacity: 0.85; filter: blur(2px); text-shadow: 0 0 34px rgba(255, 170, 80, 1), 0 0 10px rgba(255, 220, 160, 0.9); }
  100% { opacity: 1; filter: blur(0); letter-spacing: 0.06em; text-shadow: 0 0 14px rgba(255, 150, 60, 0.7); }
}
.mb-copy-status { color: var(--cf-amber); }

/* ---------- Thread ---------- */
.mb-badge {
  background: #2a211a; border: 1.5px solid currentColor; color: var(--mb-cat-other); font-size: 14px; padding: 3px 13px;
}
.mb-badge[data-cat="suggestion"] { background: #2a211a; color: var(--mb-cat-suggestion); }
.mb-badge[data-cat="complaint"] { background: #2a211a; color: var(--mb-cat-complaint); }
.mb-badge[data-cat="confession"] { background: #2a211a; color: var(--mb-cat-confession); }
.mb-badge[data-cat="bug"] { background: #2a211a; color: var(--mb-cat-bug); }
.mb-time { color: #bfae99; }
.mb-msg { background: #14100d; border: 1px solid #3a2e24; border-radius: 12px; padding: 14px 16px; }
.mb-msg-who { color: #cdbda8; font-size: 12.5px; letter-spacing: 0.1em; }
.mb-msg-you { border-left: 3px solid #6b6f86; margin-right: 18px; }
.mb-msg-text { color: var(--cf-cream); font-size: 17.5px; line-height: 1.6; }
.mb-replies { gap: 14px; margin-top: 16px; }
.mb-msg-host {
  margin-left: 18px; background: #231a12; border: 1px solid rgba(255, 170, 100, 0.3); border-left: 4px solid var(--cf-ember);
  box-shadow: -10px 0 30px -14px rgba(255, 138, 61, 0.55), 0 0 24px -12px rgba(255, 138, 61, 0.4);
}
.mb-msg-host .mb-msg-who { color: var(--cf-amber); display: flex; align-items: center; gap: 8px; }
.mb-msg-host .mb-msg-who::before {
  content: ""; width: 14px; height: 14px; background: url("art/flame-mark.svg") center / contain no-repeat; flex: none;
}
.mb-msg-host .mb-msg-text { font-family: var(--mb-font-heading); font-size: 18.5px; }
.mb-empty { font-family: var(--mb-font-heading); font-style: italic; color: #e4d5c1; font-size: 18px; text-align: center; padding: 18px 8px 4px; margin: 12px 0 0; }
.mb-empty::before { content: ""; display: block; width: 44px; height: 28px; margin: 0 auto 8px; background: url("art/embers.svg") center / contain no-repeat; }

/* ---------- Footer ---------- */
.mb-footer { color: #c4b39d; text-shadow: 0 1px 4px #000; padding-top: 10px; }

/* ---------- Send animation (in #fx) ---------- */
.cf-note-wrap { position: fixed; left: 0; top: 0; will-change: transform, opacity; filter: drop-shadow(0 0 14px rgba(255, 150, 60, 0.65)); }
.cf-note { width: 100%; height: 100%; background: linear-gradient(160deg, #fbf1de, #ecd9b6); clip-path: polygon(0% 0%, 50% 0%, 100% 0%, 100% 50%, 100% 100%, 50% 100%, 0% 100%, 0% 50%); padding: 16px; overflow: hidden; }
.cf-note-text { margin: 0; font-family: var(--mb-font-heading); font-style: italic; font-size: 15px; line-height: 1.45; color: #3a2a1a; overflow-wrap: anywhere; }

/* ---------- Desktop ---------- */
@media (min-width: 900px) {
  .mb-app { padding-top: 40px; padding-bottom: 300px; max-width: 600px; }
  .cf-moon { top: 44px; right: 8vw; width: 92px; height: 92px; }
  .cf-pines { height: 92vh; width: 48vh; }
  .cf-pines-l { left: -2vw; }
  .cf-pines-r { right: -2vw; }
  .cf-fire { width: 230px; bottom: 56px; }
  .cf-ground { height: 70px; }
  .cf-ridge { height: 300px; bottom: 30px; }
  .cf-ridge-near { height: 170px; bottom: 20px; }
  .mb-title { font-size: 62px; }
}
@media (max-width: 420px) {
  .mb-card { padding: 20px 16px; }
  .cf-pines { opacity: 0.9; }
}
@media (prefers-reduced-motion: reduce) {
  .cf-glow, .cf-fl, .cf-bed, .mb-cat input:checked + .mb-cat-name, .mb-header .mb-deco[data-slot="header-art"] { animation: none !important; }
}
