/* Layout: caixão em pé (como na porta da capela) à esquerda, ações, formulário e livro à direita; em tela estreita tudo empilha. */
:root {
  color-scheme: dark;
  --night: #120d0f;
  --night-2: #1c1417;
  --night-3: #261b1f;
  --line: #3a2a2f;
  --flag: #c4162a;
  --flag-deep: #8a0e1d;
  --candle: #f2c36b;
  --bone: #ece4d8;
  --mute: #a99c9a;
  --wood: #2b1b15;
  --wood-edge: #4a3026;
  --font-display: "Old Standard TT", Georgia, serif;
  --font-ui: "Work Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { background: var(--night); }
body {
  margin: 0;
  background: var(--night);
  color: var(--bone);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.55;
  padding-block: 32px 48px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.wrap { max-width: 1040px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }

header { display: flex; flex-direction: column; gap: 10px; max-width: 640px; }
.eyebrow {
  font-size: 12px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: var(--candle); display: flex; align-items: center; gap: 10px;
}
.eyebrow::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--candle); box-shadow: 0 0 10px var(--candle); }
h1 {
  font-family: var(--font-display); font-weight: 700; font-size: clamp(44px, 9vw, 84px);
  line-height: 1; margin: 0; letter-spacing: -.01em; text-wrap: balance;
}
.dates { font-family: var(--font-display); font-style: italic; color: var(--mute); font-size: 19px; margin: 0; }
.dates b { color: var(--flag); font-style: normal; }

.layout { display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: 44px; align-items: start; }
.side { display: flex; flex-direction: column; gap: 36px; min-width: 0; }
@media (max-width: 860px) { .layout { grid-template-columns: minmax(0, 1fr); gap: 28px; } }

.stage {
  position: relative; border: 1px solid var(--line); border-radius: 6px; overflow: hidden;
  background: radial-gradient(ellipse at 50% 50%, #2a1b1f 0%, var(--night-2) 55%, var(--night) 100%);
  width: 100%; max-width: 440px; margin: 0 auto;
}
@media (min-width: 861px) { .stage { position: sticky; top: 24px; margin: 0; } }
.stage svg { display: block; width: 100%; height: auto; }
.plaque {
  position: absolute; left: 0; right: 0; bottom: 10px; text-align: center;
  font-family: var(--font-display); font-style: italic; font-size: clamp(12px, 3.4vw, 15px);
  color: var(--candle); opacity: .85;
}
.wood { fill: var(--wood); stroke: var(--wood-edge); stroke-width: 6; stroke-linejoin: round; }
.flag { fill: var(--flag); }
.lid-edge { fill: none; stroke: #000; stroke-opacity: .35; stroke-width: 2; }
.wax { fill: #e9dfcc; }
.flame { transform-box: fill-box; transform-origin: 50% 100%; animation: flicker 2.4s ease-in-out infinite; }
.flame.b { animation-delay: -1.1s; }
@keyframes flicker { 0%,100% { transform: scale(1,1) rotate(0); } 30% { transform: scale(.92,1.08) rotate(-2deg); } 60% { transform: scale(1.05,.95) rotate(1.5deg); } }
.rose-in { animation: drop 1s cubic-bezier(.3,.1,.35,1) both; }
@keyframes drop {
  0% { transform: translate(0,-420px) rotate(-140deg); opacity: 0; }
  12% { opacity: 1; }
  72% { transform: translate(0,5px) rotate(9deg); }
  100% { transform: translate(0,0) rotate(0); opacity: 1; }
}

.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; }
.count { font-family: var(--font-display); font-size: 22px; line-height: 1.2; }
.count small { display: block; font-family: var(--font-ui); font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--mute); }
.count output { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--flag); font-size: 34px; }

button, input, textarea { font: inherit; color: inherit; }
.btn {
  appearance: none; cursor: pointer; border: 0; border-radius: 4px;
  background: var(--flag); color: #fff; font-weight: 600; font-size: 17px;
  padding: 14px 24px; min-height: 48px; display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  transition: background .15s, transform .1s;
}
.btn:hover:not(:disabled) { background: #d91b31; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.quiet { background: transparent; border: 1px solid var(--mute); color: var(--bone); }
.btn.quiet:hover:not(:disabled) { background: var(--night-3); }
:focus-visible { outline: 2px solid var(--candle); outline-offset: 3px; }

.status { font-size: 14px; color: var(--mute); margin: 0; flex-basis: 100%; min-height: 1.5em; }
.status.warn { color: var(--candle); }

h2 { font-family: var(--font-display); font-size: 28px; margin: 0 0 14px; font-weight: 700; line-height: 1.15; }
form { display: flex; flex-direction: column; gap: 14px; max-width: 460px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
input[type=text], textarea {
  background: var(--night-2); border: 1px solid var(--line); border-radius: 4px;
  padding: 12px 14px; font-size: 16px; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--bone);
  width: 100%;
}
textarea { min-height: 130px; resize: vertical; }
input::placeholder, textarea::placeholder { color: #75686a; }
.hint { font-size: 12px; color: var(--mute); text-align: right; font-variant-numeric: tabular-nums; margin-top: -6px; }
#ts:empty { display: none; }

.book { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.book li { padding: 18px 0; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.book li:first-child { border-top: 0; padding-top: 0; }
.book blockquote { margin: 0; font-family: var(--font-display); font-size: 19px; line-height: 1.5; overflow-wrap: anywhere; white-space: pre-wrap; }
.book .who { font-size: 13px; color: var(--mute); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.book .who b { color: var(--candle); font-weight: 600; }
.empty { font-family: var(--font-display); font-style: italic; color: var(--mute); font-size: 19px; margin: 0; max-width: 40ch; }

footer { font-size: 13px; color: var(--mute); border-top: 1px solid var(--line); padding-top: 18px; max-width: 70ch; }
.sound {
  position: fixed; z-index: 5;
  top: max(14px, env(safe-area-inset-top, 0px)); right: max(16px, env(safe-area-inset-right, 0px));
  width: 44px; height: 44px; padding: 0; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--night-2); color: var(--mute); border: 1px solid var(--line); cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
}
.sound:hover { background: var(--night-3); color: var(--bone); border-color: var(--mute); }
.sound[aria-pressed="true"] { color: var(--candle); border-color: var(--candle); }
.sound .waves, .sound[aria-pressed="true"] .muted { display: none; }
.sound[aria-pressed="true"] .waves { display: inline; }
[hidden] { display: none !important; }
@media (prefers-reduced-motion: reduce) { .flame { animation: none; } .rose-in { animation-duration: .01s; } }
