:root {
  /* Palette taken from the watercolor wildflowers on the invitation (theme/image.png). */
  --bg: #fffaf6;       /* warm white */
  --card: #ffffff;
  --ink: #3a2a33;
  --muted: #86727c;
  --accent: #b8326f;   /* magenta bloom */
  --accent-2: #ee8fb3; /* soft pink */
  --blue: #8fa9e0;     /* forget-me-not */
  --yellow: #f5d98a;   /* butter yellow */
  --sage: #7d8a4a;     /* stems */
  --good: #2f8a57;
  --bad: #c0392b;
  --line: #f3e3ea;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 17px;
  line-height: 1.4;
  padding-bottom: calc(76px + env(safe-area-inset-bottom));
}
[hidden] { display: none !important; }

/* The flower garland hangs from the top edge; the couple's names sit underneath it. */
#top {
  position: relative;
  background: #fff; /* same white as the garland image, so its edges do not show */
  color: var(--accent);
  text-align: center;
  padding: env(safe-area-inset-top) 16px 14px;
  display: flex; flex-direction: column; align-items: center;
  border-bottom: 3px solid var(--accent-2);
}
#top::before {
  content: '';
  display: block;
  width: calc(100% + 32px); max-width: 1036px; /* bleed through the header's side padding */
  aspect-ratio: 1036 / 330;
  background: url(theme/flowers.png) center top / 100% auto no-repeat;
}
#langBtn {
  position: absolute; top: calc(10px + env(safe-area-inset-top)); right: 12px; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  background: rgba(255, 255, 255, .92);
  color: var(--accent);
  box-shadow: 0 2px 8px rgba(120, 40, 80, .15);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: .9rem;
}
#langBtn .caret { opacity: .8; font-size: .75rem; }

#langPicker {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(46, 35, 38, .6);
  display: flex; align-items: center; justify-content: center;
  padding: 16px;
}
.lang-card { width: 100%; max-width: 380px; margin: 0; }
.lang-list { display: grid; gap: 10px; }
.lang-opt {
  display: flex; align-items: center; gap: 14px;
  background: #fff; color: var(--ink);
  border: 2px solid var(--line);
  text-align: left; font-weight: 600; font-size: 1.1rem;
}
.lang-opt.on { border-color: var(--accent); background: #fdf1f6; }

.couple { font-family: Georgia, "Times New Roman", serif; font-size: 1.9rem; letter-spacing: .5px; }
.date { color: var(--muted); font-size: .9rem; margin-top: 2px; }

main { max-width: 620px; margin: 0 auto; padding: 16px; }
h2 { margin: 6px 0 12px; font-family: Georgia, serif; color: var(--accent); }
.muted { color: var(--muted); font-size: .92rem; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(80, 40, 50, .05);
}
.card.done { border-color: var(--good); }

button, .btn {
  font: inherit;
  border: 0;
  border-radius: 12px;
  padding: 14px 18px;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  display: inline-block;
  text-align: center;
}
button:disabled { opacity: .5; }
.btn.secondary, button.secondary { background: #fbe6ee; color: var(--accent); }
.btn.block, button.block { display: block; width: 100%; }

input[type=text], input[type=number] {
  font: inherit;
  width: 100%;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  margin: 6px 0 12px;
}
label { font-weight: 600; font-size: .92rem; }

.options { display: grid; gap: 10px; margin-top: 14px; }
.opt {
  background: #fff;
  color: var(--ink);
  border: 2px solid var(--line);
  text-align: left;
  font-weight: 500;
}
.opt:disabled { opacity: 1; }
.opt.correct { border-color: var(--good); background: #e6f5ec; }
.opt.wrong { border-color: var(--bad); background: #fbe8e5; }
.opt.dim { opacity: .55; }
.progress { height: 8px; background: var(--line); border-radius: 8px; overflow: hidden; margin-bottom: 14px; }
.progress > div { height: 100%; background: var(--accent-2); transition: width .3s; }
.verdict { font-weight: 700; margin: 14px 0 4px; }
.verdict.good { color: var(--good); }
.verdict.bad { color: var(--bad); }
.verdict.mid { color: #b7791f; }

.q-image { width: 100%; max-height: 300px; object-fit: contain; background: #f8eef2; border-radius: 12px; margin: 8px 0; display: block; }
.options.imgs { grid-template-columns: 1fr 1fr; }
.options.imgs .opt { padding: 8px; }
.opt-img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 8px; display: block; margin-bottom: 6px; }
.options.imgs .opt-img:last-child { margin-bottom: 0; }
.map { height: 320px; border-radius: 12px; overflow: hidden; margin: 8px 0 12px; background: #e8e0d8; z-index: 0; }
.map-msg { padding: 16px; text-align: center; }
.order-list { padding-left: 24px; margin: 8px 0 12px; }
.order-list li { margin: 6px 0; }
.chip { background: #fbe6ee; color: var(--accent); padding: 8px 12px; border-radius: 20px; font-weight: 600; }
.typed button { margin-top: 2px; }

.stats { display: flex; gap: 10px; margin-bottom: 14px; }
.stat { flex: 1; background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; text-align: center; }
.stat b { display: block; font-size: 1.6rem; color: var(--accent); }

.challenge { display: flex; gap: 12px; align-items: center; }
.challenge .info { flex: 1; }
.challenge h3 { margin: 0 0 2px; font-size: 1.05rem; }
.thumb { width: 72px; height: 72px; border-radius: 12px; object-fit: cover; background: var(--line); }
.row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.row > * { flex: 1; }

.wall { display: grid; grid-template-columns: 1fr; gap: 14px; }
.post { background: var(--card); border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.post img { width: 100%; display: block; max-height: 70vh; object-fit: cover; background: var(--line); }
.post .meta { display: flex; align-items: center; gap: 8px; padding: 10px 14px; }
.post .meta .who { flex: 1; }
.post .meta .who small { display: block; color: var(--muted); }
.like { background: #fbe6ee; color: var(--accent); padding: 8px 14px; }
.like.on { background: var(--accent); color: #fff; }

.msg-input {
  font: inherit; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 12px;
  background: #fff; resize: vertical; margin-bottom: 4px;
}
.msg-media { width: 100%; max-height: 60vh; border-radius: 12px; background: #000; display: block; margin-top: 10px; }
.msg-audio { width: 100%; margin-top: 10px; }
.vis-row { display: flex; gap: 8px; margin-top: 12px; }
.vis-row .vis { flex: 1; background: #fff; color: var(--ink); border: 2px solid var(--line); }
.vis-row .vis.on { border-color: var(--accent); background: #fdf1f6; color: var(--accent); }
button.recording { background: var(--bad); color: #fff; }
button.link { background: none; color: var(--accent); padding: 4px 8px; font-size: .9rem; }
button.link.danger { color: var(--bad); }
.msg-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.msg-body { white-space: pre-wrap; margin: 8px 0 0; overflow-wrap: anywhere; }
.msg-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.msg-actions { display: flex; gap: 2px; }
.badge { font-size: .78rem; font-weight: 600; background: #fbe6ee; color: var(--accent); padding: 3px 10px; border-radius: 12px; }
.badge.private { background: #3a2a33; color: #fff; }

table.rank { width: 100%; border-collapse: collapse; }
.rank td { padding: 10px 6px; border-bottom: 1px solid var(--line); }
.rank tr.me { background: #fdf1f6; font-weight: 700; }
.rank td:first-child { width: 44px; text-align: center; }
.rank td:last-child { text-align: right; font-variant-numeric: tabular-nums; }

#tabs {
  position: fixed; left: 0; right: 0; bottom: 0;
  display: flex; background: #fff; border-top: 1px solid var(--line); z-index: 10;
  padding-bottom: env(safe-area-inset-bottom);
}
#tabs button {
  flex: 1; background: none; color: var(--muted); border-radius: 0; padding: 8px 0;
  font-size: .72rem; font-weight: 600;
}
#tabs button span { display: block; font-size: 1.35rem; }
#tabs button i { font-style: normal; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; }
#tabs button.active { color: var(--accent); }

#lightbox {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .9); z-index: 20;
  display: flex; align-items: center; justify-content: center;
}
#lightbox img { max-width: 100%; max-height: 100%; }
#toast {
  position: fixed; left: 50%; bottom: calc(90px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #3a2a33; color: #fff; padding: 10px 18px; border-radius: 24px; z-index: 90; max-width: 90%;
}

/* ================= memory wall ================= */
#wallRoot { position: relative; z-index: 1; }
body.noscroll { overflow: hidden; }

/* drifting petals */
.petals { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.petal {
  position: absolute; top: -30px;
  width: var(--s); height: calc(var(--s) * 1.25);
  border-radius: 80% 0 80% 0;
  opacity: .55;
  animation: petalFall var(--d) linear var(--delay) infinite;
}
.petal.c0 { background: var(--accent-2); }
.petal.c1 { background: var(--yellow); }
.petal.c2 { background: var(--blue); }
.petal.c3 { background: #f4b6cf; }
@keyframes petalFall {
  0%   { transform: translate3d(0, -30px, 0) rotate(0deg); }
  50%  { transform: translate3d(var(--x), 55vh, 0) rotate(190deg); }
  100% { transform: translate3d(calc(var(--x) * -.6), 112vh, 0) rotate(410deg); }
}

/* filter bar */
.wall-bar {
  position: sticky; top: 0; z-index: 5;
  margin: 0 -16px; padding: 8px 16px 10px;
  background: linear-gradient(var(--bg) 82%, rgba(255, 250, 246, 0));
}
.fchips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0 6px; }
.fchips::-webkit-scrollbar { display: none; }
.fchip {
  flex: none; display: flex; align-items: center; gap: 6px;
  background: #fff; color: var(--ink); border: 2px solid var(--line);
  padding: 7px 13px; border-radius: 20px; font-size: .9rem; font-weight: 600;
  transition: transform .15s, background .2s, border-color .2s;
}
.fchip:active { transform: scale(.94); }
.fchip i { font-style: normal; background: var(--line); border-radius: 10px; padding: 0 7px; font-size: .78rem; }
.fchip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fchip.on i { background: rgba(255, 255, 255, .25); }
.wall-tools { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.seg { display: flex; background: #fff; border: 2px solid var(--line); border-radius: 20px; overflow: hidden; }
.seg button { background: none; color: var(--muted); padding: 6px 12px; border-radius: 0; font-size: .85rem; transition: background .2s, color .2s; }
.seg button.on { background: var(--accent-2); color: #fff; }
.show-btn {
  margin-left: auto; padding: 8px 14px; font-size: .9rem;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 4px 12px rgba(184, 50, 111, .3);
}

/* polaroids hanging in two (or three) columns */
.wall2 { columns: 2; column-gap: 14px; padding-top: 14px; position: relative; z-index: 1; }
@media (min-width: 560px) { .wall2 { columns: 3; } }
.polaroid {
  position: relative; display: block; margin: 0 0 20px; break-inside: avoid;
  background: #fff; padding: 8px 8px 0; border-radius: 4px; cursor: pointer;
  box-shadow: 0 8px 18px rgba(120, 40, 80, .16), 0 1px 3px rgba(0, 0, 0, .08);
  rotate: var(--tilt); transform-origin: 50% 0;
  opacity: 0;
  -webkit-user-select: none; user-select: none;
}
.polaroid.in {
  animation:
    pop .65s cubic-bezier(.2, .9, .3, 1.15) var(--rd, 0ms) both,
    sway var(--sway) ease-in-out var(--sway-delay) infinite alternate;
}
.polaroid.in:not(.vis) { animation-play-state: running, paused; }
.polaroid.fresh.in {
  animation:
    swing 1.3s cubic-bezier(.2, .8, .3, 1) both,
    sway var(--sway) ease-in-out var(--sway-delay) infinite alternate;
}
.polaroid:active { scale: .97; }
@keyframes pop   { from { opacity: 0; transform: translateY(40px) scale(.92); } to { opacity: 1; transform: none; } }
@keyframes sway  { from { rotate: calc(var(--tilt) - 1deg); } to { rotate: calc(var(--tilt) + 1deg); } }
@keyframes swing {
  0%   { opacity: 0; transform: translateY(-140px) rotate(-16deg); }
  45%  { opacity: 1; transform: translateY(10px) rotate(6deg); }
  65%  { transform: rotate(-3deg); }
  82%  { transform: rotate(1.5deg); }
  100% { opacity: 1; transform: none; }
}
/* washi tape */
.polaroid::before {
  content: ''; position: absolute; top: -9px; left: 50%; z-index: 2;
  width: 58px; height: 20px; margin-left: -29px; rotate: -3deg;
  background: rgba(245, 217, 138, .78); box-shadow: 0 1px 2px rgba(0, 0, 0, .12);
}
.polaroid.tape-1::before { background: rgba(238, 143, 179, .68); rotate: 2deg; }
.polaroid.tape-2::before { background: rgba(143, 169, 224, .68); rotate: -1deg; }
.polaroid .ph { position: relative; overflow: hidden; background: var(--line); min-height: 110px; }
.polaroid img { display: block; width: 100%; height: auto; opacity: 0; transition: opacity .6s, transform .7s; }
.polaroid img.loaded { opacity: 1; }
@media (hover: hover) { .polaroid:hover img { transform: scale(1.05); } }
.polaroid figcaption { display: flex; align-items: center; gap: 6px; padding: 8px 2px 10px; }
.cap { flex: 1; min-width: 0; }
.cap b {
  display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive; font-size: .95rem;
}
.cap small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: .72rem; }
.polaroid .like { padding: 6px 10px; font-size: .85rem; border-radius: 16px; }
.like.pop { animation: likePop .45s ease; }
@keyframes likePop { 0% { transform: scale(1); } 40% { transform: scale(1.4); } 100% { transform: scale(1); } }
.crown {
  position: absolute; left: 6px; top: 6px; z-index: 1;
  background: linear-gradient(135deg, #f8e4a0, #e8b84a); color: #5a3b00;
  font-size: .7rem; font-weight: 700; padding: 3px 9px; border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  animation: crownGlow 2.4s ease-in-out infinite alternate;
}
@keyframes crownGlow { from { box-shadow: 0 2px 8px rgba(0, 0, 0, .25); } to { box-shadow: 0 2px 14px rgba(232, 184, 74, .9); } }
.fly-heart {
  position: fixed; z-index: 95; pointer-events: none; font-size: 18px;
  animation: flyHeart .9s ease-out forwards;
}
@keyframes flyHeart {
  0%   { opacity: 1; transform: translate(-50%, -50%) scale(.6); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(1.5) rotate(var(--r)); }
}
.wall-empty { text-align: center; padding: 50px 10px; color: var(--muted); column-span: all; }
.wall-empty .big { font-size: 3.4rem; animation: bob 3s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-12px) rotate(4deg); } }

/* full-screen viewer */
#viewer, #show {
  position: fixed; inset: 0; z-index: 50; overflow: hidden;
  background: #150d12; color: #fff; display: flex; flex-direction: column;
  animation: fadeIn .25s ease;
}
#show { z-index: 60; background: #000; cursor: pointer; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.v-bg {
  position: absolute; inset: -30px; background-size: cover; background-position: center;
  filter: blur(28px) brightness(.45); transform: scale(1.1); transition: background-image .3s;
}
.v-stage {
  position: relative; flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center;
  padding: calc(60px + env(safe-area-inset-top)) 10px 8px; touch-action: none; user-select: none;
}
.v-img {
  max-width: 100%; max-height: 100%; object-fit: contain;
  border: 8px solid #fff; border-radius: 4px; background: #fff;
  box-shadow: 0 14px 50px rgba(0, 0, 0, .55); pointer-events: none;
}
.v-heart {
  position: absolute; left: 50%; top: 50%; translate: -50% -50%; opacity: 0; pointer-events: none;
  font-size: 110px; color: #ff5c93; text-shadow: 0 6px 30px rgba(0, 0, 0, .4);
}
.v-heart.go { animation: bigHeart .9s ease-out; }
@keyframes bigHeart { 0% { opacity: 0; scale: .3; } 25% { opacity: 1; scale: 1.2; } 60% { opacity: 1; scale: 1; } 100% { opacity: 0; scale: 1.35; } }
.v-close {
  position: absolute; top: calc(12px + env(safe-area-inset-top)); right: 12px; z-index: 3;
  width: 42px; height: 42px; padding: 0; border-radius: 50%; font-size: 1.1rem;
  background: rgba(255, 255, 255, .18); color: #fff;
}
.v-pos { position: absolute; top: calc(24px + env(safe-area-inset-top)); left: 16px; z-index: 3; font-size: .9rem; opacity: .85; }
.v-nav {
  position: absolute; top: 50%; translate: 0 -50%; z-index: 3;
  width: 44px; height: 44px; padding: 0; border-radius: 50%; font-size: 1.7rem; line-height: 1;
  background: rgba(255, 255, 255, .15); color: #fff;
}
.v-nav.prev { left: 8px; }
.v-nav.next { right: 8px; }
@media (hover: none) { .v-nav { display: none; } }
.v-hint {
  position: absolute; left: 0; right: 0; bottom: calc(86px + env(safe-area-inset-bottom)); z-index: 3;
  text-align: center; font-size: .9rem; opacity: 0; pointer-events: none;
  animation: hintFade 3.2s ease both;
}
@keyframes hintFade { 0%, 100% { opacity: 0; } 15%, 75% { opacity: .9; } }
.v-cap {
  position: relative; z-index: 3; display: flex; align-items: center; gap: 12px;
  padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, .65));
}
.v-cap > div { flex: 1; min-width: 0; }
.v-cap small { display: block; opacity: .75; }
.v-cap .like { padding: 10px 18px; font-size: 1.05rem; }

/* slideshow */
.s-layers { position: absolute; inset: 0; }
.slide { position: absolute; inset: 0; opacity: 0; transition: opacity 1.3s ease; }
.slide.on { opacity: 1; }
.s-bg {
  position: absolute; left: -40px; top: -40px; width: calc(100% + 80px); height: calc(100% + 80px);
  object-fit: cover; filter: blur(32px) brightness(.5);
}
.s-fg {
  position: absolute; left: 4%; top: 5%; width: 92%; height: 76%; object-fit: contain;
  filter: drop-shadow(0 14px 40px rgba(0, 0, 0, .65)); border-radius: 6px;
  animation-duration: 8.5s; animation-timing-function: ease-out; animation-fill-mode: forwards;
}
.kb0 { animation-name: kb0; }
.kb1 { animation-name: kb1; }
.kb2 { animation-name: kb2; }
.kb3 { animation-name: kb3; }
@keyframes kb0 { from { transform: scale(1); } to { transform: scale(1.1) translate(-1.5%, -1%); } }
@keyframes kb1 { from { transform: scale(1.1) translate(1.5%, 1%); } to { transform: scale(1); } }
@keyframes kb2 { from { transform: scale(1) translate(-1%, 1%); } to { transform: scale(1.1) translate(1.5%, -1%); } }
@keyframes kb3 { from { transform: scale(1.1); } to { transform: scale(1) translate(-1%, 1%); } }
.s-cap {
  position: absolute; left: 0; right: 0; bottom: calc(28px + env(safe-area-inset-bottom)); z-index: 3;
  text-align: center; font-family: Georgia, serif; font-size: 1.6rem; text-shadow: 0 2px 14px rgba(0, 0, 0, .8);
  animation: capIn 1.2s ease both;
}
.s-cap small { display: block; margin-top: 2px; font-family: system-ui, sans-serif; font-size: .95rem; opacity: .85; }
@keyframes capIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.s-hint { position: absolute; top: calc(18px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 3; text-align: center; font-size: .9rem; animation: hintFade 4.5s ease both; }
#show .petals { z-index: 2; }

@media (prefers-reduced-motion: reduce) {
  .petals { display: none; }
  .polaroid, .polaroid.in, .polaroid.fresh.in { animation: none !important; opacity: 1; }
  .s-fg, .crown, .wall-empty .big { animation: none !important; }
}

/* ================= free photos ================= */
.free-card { border: 2px dashed var(--accent-2); background: linear-gradient(#fff, #fff7fa); }
.free-card h3 { margin: 0 0 4px; font-family: Georgia, serif; color: var(--accent); font-size: 1.15rem; }
.mine-strip { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 8px; scrollbar-width: none; }
.mine-strip::-webkit-scrollbar { display: none; }
.mine-thumb { position: relative; flex: none; }
.mine-thumb img { width: 72px; height: 72px; object-fit: cover; border-radius: 10px; display: block; border: 2px solid #fff; box-shadow: 0 2px 8px rgba(120, 40, 80, .2); }
.mine-thumb .x {
  position: absolute; top: -6px; right: -6px; width: 24px; height: 24px; padding: 0; border-radius: 50%;
  font-size: .7rem; line-height: 1; background: var(--bad); color: #fff; box-shadow: 0 1px 4px rgba(0, 0, 0, .3);
}

/* floating "add photo" button on the wall */
.fab {
  position: fixed; right: 16px; bottom: calc(88px + env(safe-area-inset-bottom)); z-index: 8;
  display: flex; align-items: center; gap: 8px; padding: 12px 18px 12px 14px; border-radius: 30px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff;
  box-shadow: 0 8px 22px rgba(184, 50, 111, .45);
  animation: fabIn .6s cubic-bezier(.2, .9, .3, 1.3) .4s both, fabPulse 3.2s ease-in-out 1.5s infinite;
}
.fab span { font-size: 1.5rem; line-height: 1; }
.fab i { font-style: normal; font-weight: 700; }
.fab:active { scale: .94; }
@keyframes fabIn { from { opacity: 0; transform: translateY(30px) scale(.7); } to { opacity: 1; transform: none; } }
@keyframes fabPulse { 0%, 100% { box-shadow: 0 8px 22px rgba(184, 50, 111, .45); } 50% { box-shadow: 0 8px 30px rgba(238, 143, 179, .95); } }
@media (prefers-reduced-motion: reduce) { .fab { animation: none; } }

/* ================= podium + confetti ================= */
canvas.confetti { position: fixed; inset: 0; width: 100vw; height: 100vh; pointer-events: none; z-index: 85; }

.rank-chip {
  display: inline-block; margin: 0 0 12px; padding: 6px 14px; border-radius: 20px; font-weight: 700; font-size: .9rem;
  animation: chipIn .6s cubic-bezier(.2, .9, .3, 1.3) .2s both;
}
.rank-chip.up { background: #e6f5ec; color: var(--good); }
.rank-chip.down { background: #fbe8e5; color: var(--bad); }
@keyframes chipIn { from { opacity: 0; transform: translateY(-10px) scale(.8); } to { opacity: 1; transform: none; } }

.podium {
  display: flex; align-items: flex-end; justify-content: center; gap: 8px;
  margin: 8px 0 18px; padding: 24px 4px 0; cursor: pointer;
  background: radial-gradient(ellipse at 50% 100%, #fde7f0, rgba(253, 231, 240, 0) 70%);
}
.pod { flex: 1; max-width: 138px; min-width: 0; display: flex; flex-direction: column; align-items: center; text-align: center; position: relative; }
.pod-crown { position: relative; z-index: 2; font-size: 1.8rem; line-height: 1; margin-bottom: -16px; transform-origin: 50% 100%; animation: crownWiggle 2.6s ease-in-out infinite; }
@keyframes crownWiggle { 0%, 100% { rotate: -8deg; } 50% { rotate: 8deg; } }
.pod-avatar {
  width: 58px; height: 58px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.15rem; color: #fff; border: 3px solid #fff;
  box-shadow: 0 6px 16px rgba(120, 40, 80, .3);
}
.pod.p1 .pod-avatar { width: 70px; height: 70px; font-size: 1.4rem; background: linear-gradient(135deg, #f5d98a, #e0a92e); box-shadow: 0 0 0 3px #f5d98a, 0 8px 22px rgba(224, 169, 46, .5); }
.pod.p2 .pod-avatar { background: linear-gradient(135deg, #8fa9e0, #5d7bc4); }
.pod.p3 .pod-avatar { background: linear-gradient(135deg, #ee8fb3, #c9507f); }
.pod-name { margin-top: 8px; font-weight: 700; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.pod-name small { display: block; font-size: .68rem; font-weight: 700; color: var(--accent); text-transform: uppercase; letter-spacing: .06em; }
.pod-pts { color: var(--muted); font-size: .82rem; margin-bottom: 6px; font-variant-numeric: tabular-nums; }
.pod-block {
  width: 100%; display: flex; align-items: flex-start; justify-content: center; padding-top: 8px;
  font-family: Georgia, serif; font-size: 2rem; font-weight: 700; color: #fff;
  border-radius: 12px 12px 0 0; transform-origin: 50% 100%;
  background: linear-gradient(180deg, var(--accent-2), #f6c3d6);
  box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5);
}
.pod.p1 .pod-block { height: 118px; background: linear-gradient(180deg, #e8b84a, #f8e4a0); }
.pod.p2 .pod-block { height: 90px; background: linear-gradient(180deg, #8fa9e0, #c4d2f0); }
.pod.p3 .pod-block { height: 68px; background: linear-gradient(180deg, #ee8fb3, #f6c3d6); }
.pod.me .pod-name { color: var(--accent); }
.pod.me .pod-block { box-shadow: inset 0 2px 0 rgba(255, 255, 255, .5), 0 0 0 3px var(--accent); }

/* entrance: blocks grow, then the winners drop in (3rd, 2nd, then 1st) */
.pod.anim .pod-block { animation: blockGrow .7s cubic-bezier(.2, .9, .3, 1.1) both; }
.pod.anim .pod-avatar, .pod.anim .pod-name, .pod.anim .pod-pts, .pod.anim .pod-crown { animation-fill-mode: both; }
.pod.anim .pod-avatar { animation: avatarDrop .8s cubic-bezier(.3, 1.5, .5, 1) both; }
.pod.anim .pod-name, .pod.anim .pod-pts { animation: fadeUp .5s ease both; }
.pod.p3.anim .pod-block { animation-delay: .05s; }
.pod.p3.anim .pod-avatar { animation-delay: .6s; } .pod.p3.anim .pod-name, .pod.p3.anim .pod-pts { animation-delay: .8s; }
.pod.p2.anim .pod-block { animation-delay: .3s; }
.pod.p2.anim .pod-avatar { animation-delay: .85s; } .pod.p2.anim .pod-name, .pod.p2.anim .pod-pts { animation-delay: 1.05s; }
.pod.p1.anim .pod-block { animation-delay: .55s; }
.pod.p1.anim .pod-avatar { animation-delay: 1.1s; } .pod.p1.anim .pod-name, .pod.p1.anim .pod-pts { animation-delay: 1.3s; }
.pod.p1.anim .pod-crown { animation: crownDrop .7s ease 1.3s both, crownWiggle 2.6s ease-in-out 2s infinite; }
@keyframes blockGrow { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes avatarDrop { from { opacity: 0; transform: translateY(-70px) scale(.6); } to { opacity: 1; transform: none; } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes crownDrop { from { opacity: 0; transform: translateY(-30px) scale(.5); } to { opacity: 1; transform: none; } }
tr.rise { animation: fadeUp .5s ease both; }

/* ================= converting video / voice ================= */
.msg-proc {
  display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 12px 14px;
  background: var(--bg); border: 1px dashed var(--accent-2); border-radius: 12px; color: var(--muted); font-size: .92rem;
}
.msg-proc.failed { border-color: var(--bad); color: var(--bad); }
.spinner { flex: none; width: 18px; height: 18px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-reduced-motion: reduce) {
  .pod-crown, .rank-chip, .spinner { animation: none !important; }
  .pod.anim .pod-block, .pod.anim .pod-avatar, .pod.anim .pod-name, .pod.anim .pod-pts, tr.rise { animation: none !important; }
}
