/* ========== Just us: a quiet chat under the dusk sky ========== */
:root {
  --sky-0: #120f1a;
  --sky-1: #1c1726;
  --sky-2: #2c2235;
  --sky-3: #46323f;
  --glass: rgba(255, 255, 255, 0.055);
  --glass-strong: rgba(255, 255, 255, 0.09);
  --line: rgba(236, 227, 232, 0.08);
  --line-strong: rgba(236, 227, 232, 0.16);
  --text: #efe6ea;
  --text-soft: #bcadb8;
  --text-faint: #85778a;
  --moon: #f1e2c4;
  --rose: #d9a6b3;
  --rose-deep: #a76b80;
  --mine-a: #8a5a6e;
  --mine-b: #6a4560;
  --danger: #e49a9a;
  --r: 1.25rem;
  --r-tight: 0.4rem;
}

[hidden] { display: none !important; }

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background-color: var(--sky-0);
  color: var(--text);
  font-family: 'Nunito', 'Amiri', system-ui, sans-serif;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
}

body { position: relative; overflow: hidden; }

::selection { background: rgba(217, 166, 179, 0.32); }

/* ---------- the sky ---------- */
.sky {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse 90% 45% at 50% 105%, rgba(214, 150, 160, 0.22), transparent 65%),
    radial-gradient(ellipse 60% 35% at 85% 0%, rgba(241, 226, 196, 0.06), transparent 70%),
    linear-gradient(180deg, var(--sky-0) 0%, var(--sky-1) 35%, var(--sky-2) 72%, var(--sky-3) 100%);
}

.stars {
  position: absolute;
  inset: 0;
  background-repeat: repeat;
}

.stars--a {
  background-image:
    radial-gradient(1px 1px at 12% 18%, rgba(255, 245, 230, 0.8), transparent 60%),
    radial-gradient(1px 1px at 37% 9%, rgba(255, 245, 230, 0.55), transparent 60%),
    radial-gradient(1.4px 1.4px at 68% 22%, rgba(255, 245, 230, 0.7), transparent 60%),
    radial-gradient(1px 1px at 84% 41%, rgba(255, 245, 230, 0.5), transparent 60%),
    radial-gradient(1px 1px at 22% 53%, rgba(255, 245, 230, 0.45), transparent 60%),
    radial-gradient(1.2px 1.2px at 55% 66%, rgba(255, 245, 230, 0.4), transparent 60%),
    radial-gradient(1px 1px at 91% 78%, rgba(255, 245, 230, 0.35), transparent 60%);
  background-size: 420px 420px;
  animation: twinkle 7s ease-in-out infinite;
}

.stars--b {
  background-image:
    radial-gradient(1px 1px at 8% 72%, rgba(255, 240, 235, 0.55), transparent 60%),
    radial-gradient(1.3px 1.3px at 46% 34%, rgba(255, 240, 235, 0.7), transparent 60%),
    radial-gradient(1px 1px at 63% 88%, rgba(255, 240, 235, 0.4), transparent 60%),
    radial-gradient(1px 1px at 77% 12%, rgba(255, 240, 235, 0.6), transparent 60%),
    radial-gradient(1px 1px at 29% 31%, rgba(255, 240, 235, 0.45), transparent 60%);
  background-size: 300px 300px;
  animation: twinkle 9s ease-in-out 3s infinite reverse;
  mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 90%);
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 55%, transparent 90%);
}

.screen { position: relative; z-index: 1; min-height: 100dvh; }

/* ---------- loading ---------- */
.screen--loading { display: grid; place-items: center; }

.loading-duck {
  width: 40px;
  opacity: 0.4;
  filter: brightness(0) invert(0.9) sepia(0.3);
  animation: breathe 2.2s ease-in-out infinite;
}

/* ---------- gate ---------- */
.gate {
  display: grid;
  place-items: center;
  padding: 1.5rem 1.25rem;
}

.gate-home {
  position: fixed;
  top: max(1rem, env(safe-area-inset-top));
  left: 1rem;
  z-index: 2;
  color: var(--text-soft);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.4rem 0.8rem;
  border-radius: 2rem;
  background: var(--glass);
  border: 1px solid var(--line);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: color 0.2s ease, background 0.2s ease;
}

.gate-home:hover { color: var(--text); background: var(--glass-strong); }

.gate-card {
  width: 100%;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: rise 1s ease-out both;
}

.gate-moon {
  width: 150px;
  height: auto;
  overflow: visible;
  margin-bottom: 0.25rem;
}

.moon-drift { transform-box: view-box; transform-origin: 50% 50%; animation: moonDrift 10s ease-in-out infinite; }
.moon-halo, .moon-glow { animation: moonBreathe 6s ease-in-out infinite; }
.moon-duck { transform-box: fill-box; transform-origin: 45% 100%; animation: duckSway 7s ease-in-out 1s infinite; }

.gate-title {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-weight: 500;
  font-size: 3rem;
  line-height: 1;
  margin: 0;
  letter-spacing: 0.01em;
  color: #f6ecef;
  text-shadow: 0 0 24px rgba(241, 226, 196, 0.15);
}

.gate-hint {
  margin: 0.6rem 0 1.6rem;
  color: var(--text-soft);
  font-size: 1rem;
}

.gate-input {
  width: 100%;
  font: inherit;
  font-size: 1.15rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  color: var(--text);
  color-scheme: dark;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  padding: 0.9rem 1rem;
  min-height: 3.4rem;
  -webkit-appearance: none;
  appearance: none;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.gate-input:focus {
  outline: none;
  border-color: rgba(217, 166, 179, 0.55);
  box-shadow: 0 0 0 5px rgba(217, 166, 179, 0.1);
}

.gate-btn {
  margin-top: 1rem;
  font: inherit;
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: 0.02em;
  color: #2b1720;
  background: linear-gradient(135deg, #ecc3cd, var(--rose));
  border: none;
  border-radius: 2rem;
  padding: 0.8rem 2.6rem;
  cursor: pointer;
  box-shadow: 0 8px 28px rgba(217, 166, 179, 0.25);
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.gate-btn:hover { transform: translateY(-1px); box-shadow: 0 10px 34px rgba(217, 166, 179, 0.35); }
.gate-btn:active { transform: scale(0.98); }
.gate-btn:disabled { opacity: 0.5; cursor: default; transform: none; }
.gate-btn:focus-visible { outline: 2px solid var(--rose); outline-offset: 3px; }

.gate-status {
  min-height: 2.6rem;
  margin: 1rem 0 0;
  font-size: 0.92rem;
  color: var(--text-soft);
}

.gate-card.shake .gate-input { animation: shake 0.4s ease; border-color: rgba(228, 154, 154, 0.5); }

/* ---------- chat layout ---------- */
.chat {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 760px;
  margin: 0 auto;
}

.chat-head {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: max(0.7rem, env(safe-area-inset-top)) 0.6rem 0.7rem;
  background: linear-gradient(180deg, rgba(18, 15, 26, 0.92), rgba(18, 15, 26, 0.7));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px) saturate(1.2);
  -webkit-backdrop-filter: blur(14px) saturate(1.2);
  z-index: 3;
}

.chat-back {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  color: var(--text-soft);
  text-decoration: none;
  font-size: 1.25rem;
  border-radius: 50%;
  transition: background 0.2s ease, color 0.2s ease;
}

.chat-back:hover { background: var(--glass); color: var(--text); }

.chat-head-title { flex: 1; display: flex; align-items: center; gap: 0.7rem; min-width: 0; }

/* little crescent */
.chat-moon {
  position: relative;
  width: 2.3rem;
  height: 2.3rem;
  flex: none;
  border-radius: 50%;
  background: radial-gradient(circle at 50% 50%, rgba(241, 226, 196, 0.16), transparent 70%);
}

.chat-moon::before {
  content: '';
  position: absolute;
  inset: 0.45rem;
  border-radius: 50%;
  box-shadow: inset -0.32rem 0.2rem 0 0 var(--moon);
  transform: rotate(-20deg);
  filter: drop-shadow(0 0 5px rgba(241, 226, 196, 0.45));
}

.chat-head-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }

.chat-name {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 1.5rem;
  font-weight: 600;
  color: #f6ecef;
}

.chat-sub {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.72rem;
  color: var(--text-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lock-dot {
  width: 0.4rem;
  height: 0.4rem;
  border-radius: 50%;
  background: #9fc7a5;
  box-shadow: 0 0 6px rgba(159, 199, 165, 0.7);
  flex: none;
}

.chat-icon {
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  flex: none;
  color: var(--text-soft);
  background: none;
  border: none;
  border-radius: 50%;
  font-size: 1.35rem;
  cursor: pointer;
  transition: background 0.2s ease, color 0.2s ease;
}

.chat-icon:hover { background: var(--glass); color: var(--text); }
.chat-icon:focus-visible, .composer-send:focus-visible, .menu-item:focus-visible, .viewer-btn:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }

.chat-menu {
  position: absolute;
  top: calc(100% + 0.4rem);
  right: 0.6rem;
  min-width: 250px;
  background: rgba(36, 29, 44, 0.96);
  border: 1px solid var(--line-strong);
  border-radius: 1rem;
  padding: 0.4rem;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  animation: drop 0.18s ease-out both;
  transform-origin: top right;
}

.menu-status {
  margin: 0.45rem 0.7rem 0.55rem;
  font-size: 0.78rem;
  color: var(--text-faint);
  line-height: 1.5;
}

.menu-admin { border-bottom: 1px solid var(--line); margin-bottom: 0.3rem; padding-bottom: 0.3rem; }

.menu-item {
  display: block;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  background: none;
  border: none;
  border-radius: 0.65rem;
  padding: 0.65rem 0.75rem;
  cursor: pointer;
}

.menu-item:hover { background: var(--glass-strong); }

/* ---------- messages ---------- */
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.75rem 0.85rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
  mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 calc(100% - 10px), transparent 100%);
  -webkit-mask-image: linear-gradient(180deg, transparent 0, #000 14px, #000 calc(100% - 10px), transparent 100%);
}

.chat-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.chat-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 26vh;
  color: var(--text-faint);
  animation: rise 0.8s ease-out both;
}

.chat-empty p {
  margin: 0.8rem 0 0;
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-style: italic;
  font-size: 1.35rem;
}

.empty-duck {
  width: 38px;
  opacity: 0.35;
  filter: brightness(0) invert(0.9) sepia(0.3);
  animation: duckSway 7s ease-in-out infinite;
  transform-origin: 45% 100%;
}

/* day divider */
.day {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin: 1.1rem 0 0.7rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.day::before, .day::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line-strong), transparent);
}

.msg {
  display: flex;
  flex-direction: column;
  max-width: min(80%, 520px);
  animation: pop 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
}

.msg--mine { align-self: flex-end; align-items: flex-end; }
.msg--theirs { align-self: flex-start; align-items: flex-start; }
.msg--gap { margin-top: 0.7rem; }

.bubble {
  position: relative;
  padding: 0.6rem 0.95rem;
  font-size: 1rem;
  line-height: 1.45;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  cursor: default;
}

.bubble[dir="rtl"] { font-family: 'Amiri', 'Nunito', serif; font-size: 1.14rem; line-height: 1.75; padding-top: 0.45rem; padding-bottom: 0.5rem; }

/* mine: warm rose, grouped corners */
.msg--mine .bubble {
  color: #fbf1f4;
  background: linear-gradient(140deg, var(--mine-a), var(--mine-b));
  border-radius: var(--r) var(--r-tight) var(--r-tight) var(--r);
  box-shadow: 0 6px 18px rgba(20, 10, 18, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.msg--mine.msg--gap .bubble { border-top-right-radius: var(--r); }
.msg--mine.msg--last .bubble { border-bottom-right-radius: var(--r-tight); }
.msg--mine.msg--gap.msg--last .bubble { border-radius: var(--r) var(--r) var(--r-tight) var(--r); }

/* theirs: frosted glass */
.msg--theirs .bubble {
  color: var(--text);
  background: rgba(255, 255, 255, 0.075);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--r-tight) var(--r) var(--r) var(--r-tight);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.msg--theirs.msg--gap .bubble { border-top-left-radius: var(--r); }
.msg--theirs.msg--gap.msg--last .bubble { border-radius: var(--r) var(--r) var(--r) var(--r-tight); }

/* emoji-only messages: big, no bubble */
.bubble--emoji {
  font-size: 2.4rem !important;
  line-height: 1.15;
  padding: 0.1rem 0.15rem !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

/* media */
.bubble--media {
  padding: 0 !important;
  background: none !important;
  border: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
  overflow: hidden;
}

.media {
  display: block;
  max-width: 100%;
  max-height: 55vh;
  min-width: 120px;
  min-height: 80px;
  border-radius: 1.1rem;
  background: rgba(255, 255, 255, 0.05);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.35);
  object-fit: cover;
}

img.media { cursor: zoom-in; transition: transform 0.2s ease, filter 0.2s ease; }
img.media:hover { filter: brightness(1.05); }
video.media { cursor: default; }
audio.media-audio { width: min(280px, 68vw); display: block; height: 40px; }

.file-chip {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  color: inherit;
  text-decoration: none;
  min-width: 190px;
  padding: 0.15rem 0;
}

.file-chip-icon {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.75rem;
  background: rgba(255, 255, 255, 0.12);
  flex: none;
}

.file-chip-icon svg { width: 1.15rem; height: 1.15rem; }
.file-chip-name { font-weight: 700; font-size: 0.9rem; overflow-wrap: anywhere; }
.file-chip-size { font-size: 0.74rem; opacity: 0.7; }

/* time + actions: shown on the last bubble of a group, or when a bubble is tapped */
.meta {
  display: none;
  gap: 0.45rem;
  align-items: center;
  font-size: 0.68rem;
  color: var(--text-faint);
  padding: 0.28rem 0.4rem 0;
}

.msg--last .meta, .msg--open .meta, .msg--pending .meta, .msg--failed .meta { display: flex; }
.msg--open .meta { animation: rise 0.2s ease-out both; }

.msg-del {
  font: inherit;
  color: var(--text-faint);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  display: none;
}

.msg--open .msg-del { display: inline; }
.msg-del:hover { color: var(--danger); }

.seen { color: var(--rose); font-weight: 600; }
.msg--pending .bubble { opacity: 0.6; }
.msg--failed .bubble { opacity: 0.6; }
.msg--failed .meta { color: var(--danger); }

/* ---------- composer ---------- */
.composer {
  padding: 0.5rem 0.7rem max(0.75rem, env(safe-area-inset-bottom));
}

.composer-row {
  display: flex;
  align-items: flex-end;
  gap: 0.35rem;
  padding: 0.35rem;
  border-radius: 1.6rem;
  background: rgba(30, 24, 38, 0.72);
  border: 1px solid var(--line-strong);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  transition: border-color 0.25s ease;
}

.composer-row:focus-within { border-color: rgba(217, 166, 179, 0.35); }

.composer-attach { cursor: pointer; width: 2.4rem; height: 2.4rem; }

.composer-input {
  flex: 1;
  font: inherit;
  font-size: 1rem;
  line-height: 1.4;
  color: var(--text);
  background: none;
  border: none;
  padding: 0.55rem 0.3rem;
  resize: none;
  max-height: 9.5rem;
  min-height: 2.4rem;
}

.composer-input:dir(rtl) { font-family: 'Amiri', 'Nunito', serif; font-size: 1.1rem; }
.composer-input::placeholder { color: var(--text-faint); }
.composer-input:focus { outline: none; }

.composer-send {
  display: grid;
  place-items: center;
  width: 2.4rem;
  height: 2.4rem;
  flex: none;
  border: none;
  border-radius: 50%;
  color: #2b1720;
  background: linear-gradient(135deg, #ecc3cd, var(--rose));
  box-shadow: 0 4px 16px rgba(217, 166, 179, 0.35);
  cursor: pointer;
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.composer-send:disabled { opacity: 0; transform: scale(0.6); pointer-events: none; box-shadow: none; }
.composer-send:not(:disabled):active { transform: scale(0.92); }

.composer-upload {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-size: 0.78rem;
  color: var(--text-soft);
  margin: 0 0.9rem 0.5rem;
}

.composer-bar { flex: 1; height: 3px; border-radius: 2px; background: var(--glass-strong); overflow: hidden; }
.composer-bar span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--rose-deep), var(--rose)); transition: width 0.2s ease; }

/* ---------- photo viewer ---------- */
.viewer {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
  background: rgba(10, 8, 14, 0.9);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  animation: fade 0.2s ease-out both;
}

.viewer img {
  max-width: 100%;
  max-height: calc(100dvh - 7rem);
  border-radius: 0.9rem;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
  animation: zoomIn 0.25s ease-out both;
}

.viewer-bar { display: flex; gap: 0.5rem; }

.viewer-btn {
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  background: var(--glass-strong);
  border: 1px solid var(--line-strong);
  border-radius: 2rem;
  padding: 0.55rem 1.2rem;
  cursor: pointer;
}

.viewer-btn:hover { background: rgba(255, 255, 255, 0.14); }
.viewer-btn--danger { color: var(--danger); }

/* ---------- animation ---------- */
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes pop { from { opacity: 0; transform: translateY(6px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes drop { from { opacity: 0; transform: scale(0.95) translateY(-4px); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { opacity: 0.2; } 50% { opacity: 0.55; } }
@keyframes twinkle { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
@keyframes moonDrift { 0%, 100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-7px) rotate(-4deg); } }
@keyframes moonBreathe { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }
@keyframes duckSway { 0%, 100% { transform: rotate(0deg); } 25% { transform: rotate(-7deg); } 55% { transform: rotate(4deg); } 80% { transform: rotate(-2deg); } }
@keyframes shake {
  20% { transform: translateX(-6px); }
  40% { transform: translateX(5px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}

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

/* media always shows its time so it can be tapped for delete */
.msg--media .meta { display: flex; }

/* wide screens: float the header as a soft panel instead of a band */
@media (min-width: 800px) {
  .chat-head {
    margin: 0.75rem 0.75rem 0;
    border: 1px solid var(--line);
    border-radius: 1.2rem;
    padding: 0.6rem;
  }
  .media { max-height: 45vh; }
}

/* ---------- voice notes ---------- */
.composer-mic { width: 2.4rem; height: 2.4rem; }

.recorder {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.35rem;
  border-radius: 1.6rem;
  background: rgba(30, 24, 38, 0.72);
  border: 1px solid rgba(228, 154, 154, 0.35);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  animation: rise 0.2s ease-out both;
}

.rec-cancel { width: 2.4rem; height: 2.4rem; }
.rec-cancel:hover { color: var(--danger); }

.rec-dot {
  width: 0.6rem;
  height: 0.6rem;
  border-radius: 50%;
  background: #e46f7a;
  box-shadow: 0 0 10px rgba(228, 111, 122, 0.8);
  flex: none;
  animation: recPulse 1.2s ease-in-out infinite;
}

.rec-time {
  font-variant-numeric: tabular-nums;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
  min-width: 2.6rem;
}

.rec-bars, .voice-wave {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 2px;
  height: 1.8rem;
  min-width: 0;
  overflow: hidden;
}

.rec-bars span, .voice-wave span {
  flex: 1;
  min-width: 2px;
  max-width: 4px;
  border-radius: 2px;
  background: rgba(239, 230, 234, 0.35);
  transition: height 0.08s linear, background 0.15s ease;
}

.rec-bars span { background: var(--rose); }

.rec-send { opacity: 1; transform: none; pointer-events: auto; }

.bubble--voice { padding: 0.45rem 0.8rem 0.45rem 0.45rem; }

.voice {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: min(250px, 62vw);
  direction: ltr;
}

.voice-play {
  display: grid;
  place-items: center;
  width: 2.3rem;
  height: 2.3rem;
  flex: none;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.16);
  color: inherit;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.15s ease;
}

.voice-play:hover { background: rgba(255, 255, 255, 0.24); }
.voice-play:active { transform: scale(0.94); }
.voice-play:focus-visible { outline: 2px solid var(--rose); outline-offset: 2px; }

/* play triangle / pause bars, drawn in CSS */
.voice-play::before {
  content: '';
  width: 0;
  height: 0;
  margin-left: 3px;
  border-style: solid;
  border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent currentColor;
}

.voice.is-playing .voice-play::before {
  width: 10px;
  height: 13px;
  margin-left: 0;
  border: none;
  border-left: 3.5px solid currentColor;
  border-right: 3.5px solid currentColor;
}

.voice-wave { cursor: pointer; height: 1.6rem; }
.msg--mine .voice-wave span { background: rgba(255, 240, 245, 0.35); }
.voice-wave span.on { background: #fff4f7; }
.msg--theirs .voice-wave span.on { background: var(--rose); }

.voice-time {
  font-size: 0.75rem;
  font-variant-numeric: tabular-nums;
  opacity: 0.8;
  min-width: 2.2rem;
  text-align: right;
}

@keyframes recPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
