/* ==========================================================================
   TikChat — TikTok-faithful dark UI
   Palette: #000 bg · #FE2C55 pink · #25F4EE cyan · #2F2F2F surfaces
   ========================================================================== */

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

:root {
  --bg: #000000;
  --surface: #121212;
  --surface-2: #1C1C1C;
  --bubble: #2F2F2F;
  --line: rgba(255,255,255,.08);
  --pink: #FE2C55;
  --cyan: #25F4EE;
  --text: #FFFFFF;
  --text-2: rgba(255,255,255,.55);
  --text-3: rgba(255,255,255,.35);
  --radius-bubble: 18px;
  --radius-media: 12px;
  --ease-out: cubic-bezier(.22,.61,.36,1);
}

html, body { height: 100%; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

button { font-family: inherit; color: inherit; background: none; border: none; cursor: pointer; }
input  { font-family: inherit; }

.hidden { display: none !important; }
.small  { font-size: 12px; color: var(--text-3); line-height: 1.5; text-align: center; }
.error  { color: var(--pink); font-size: 13px; min-height: 18px; margin-top: 4px; }

/* ---------- SVG icon system (replaces emojis) ---------- */
.icon {
  width: 22px; height: 22px;
  display: inline-block;
  stroke: currentColor;
  stroke-width: 1.8;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
  flex-shrink: 0;
}
.icon-btn .icon { width: 20px; height: 20px; }

/* ==========================================================================
   LANDING
   ========================================================================== */

.landing {
  min-height: 100dvh;
  max-width: 480px;
  margin: 0 auto;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 28px;
  padding: 40px 28px calc(40px + env(safe-area-inset-bottom, 0px));
  animation: fadeIn .5s var(--ease-out);
}

/* Logo lockup with cyan/pink glitch offset */
.logo {
  font-size: 56px;
  font-weight: 800;
  letter-spacing: -2.5px;
  line-height: 1;
  user-select: none;
  animation: slideUp .6s var(--ease-out);
}
.logo-tik {
  color: var(--text);
  text-shadow: -2px -1px 0 var(--cyan), 2px 1px 0 var(--pink);
}
.logo-chat { color: var(--text); }

.tagline {
  color: var(--text-2);
  text-align: center;
  font-size: 15px;
  line-height: 1.55;
  max-width: 300px;
  animation: slideUp .6s var(--ease-out) .08s both;
}

/* Card — airy, borderless feel */
.card {
  width: 100%;
  background: var(--surface);
  border-radius: 20px;
  padding: 26px 22px;
  display: flex; flex-direction: column; gap: 16px;
  animation: slideUp .6s var(--ease-out) .16s both;
}
.card h3 { font-size: 17px; font-weight: 700; }

/* Buttons */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 15px 20px;
  border-radius: 14px;
  font-size: 16px; font-weight: 700;
  cursor: pointer;
  transition: transform .1s var(--ease-out), opacity .15s, background .2s;
}
.btn:active { transform: scale(.96); }
.btn-primary { background: var(--pink); color: #fff; }
.btn-primary:hover { opacity: .92; }
.btn-secondary {
  background: transparent;
  color: var(--text);
  box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.25);
}
.btn-secondary:hover { box-shadow: inset 0 0 0 1.5px rgba(255,255,255,.5); background: rgba(255,255,255,.04); }

.divider {
  display: flex; align-items: center; gap: 12px;
  color: var(--text-3); font-size: 12px;
}
.divider::before, .divider::after { content: ''; flex: 1; height: 1px; background: var(--line); }

.join-row { display: flex; gap: 10px; }
.join-row input {
  flex: 1; min-width: 0;
  background: var(--bubble);
  border: none; outline: none;
  border-radius: 12px;
  padding: 14px;
  color: var(--text);
  font-size: 18px; font-weight: 700;
  letter-spacing: 5px; text-align: center; text-transform: uppercase;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow .2s;
}
.join-row input::placeholder { color: var(--text-3); letter-spacing: 5px; }
.join-row input:focus { box-shadow: 0 0 0 2px var(--cyan); }
.join-row .btn { width: auto; padding: 14px 22px; border-radius: 12px; }

.link-box {
  background: var(--bubble);
  border-radius: 12px;
  padding: 14px;
  font-size: 13px;
  word-break: break-all;
  color: var(--cyan);
  text-align: center;
}

.footnote {
  font-size: 12px; color: var(--text-3);
  text-align: center; line-height: 1.7;
  animation: slideUp .6s var(--ease-out) .24s both;
}

/* ==========================================================================
   JOIN SCREEN
   ========================================================================== */

.join-overlay {
  min-height: 100dvh;
  max-width: 420px; margin: 0 auto;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 18px;
  padding: 32px 28px calc(32px + env(safe-area-inset-bottom, 0px));
  animation: fadeIn .4s var(--ease-out);
}
.join-overlay .logo { font-size: 38px; }
.join-overlay h2 { font-size: 20px; font-weight: 700; text-align: center; }

.form-field { width: 100%; display: flex; flex-direction: column; gap: 6px; }
.form-field label {
  font-size: 12px; font-weight: 600;
  color: var(--text-2);
  letter-spacing: .2px;
}
.form-field input {
  width: 100%;
  background: var(--bubble);
  border: none; outline: none;
  border-radius: 12px;
  padding: 15px 16px;
  color: var(--text);
  font-size: 16px;
  box-shadow: 0 0 0 0 transparent;
  transition: box-shadow .2s;
}
.form-field input::placeholder { color: var(--text-3); }
.form-field input:focus { box-shadow: 0 0 0 2px var(--cyan); }
.form-field input::-webkit-outer-spin-button,
.form-field input::-webkit-inner-spin-button { -webkit-appearance: none; }

.my-code {
  width: 100%;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px dashed rgba(255,255,255,.15);
  border-radius: 12px;
  font-size: 12px;
  color: var(--text-2);
  text-align: center;
}
.my-code b { color: var(--cyan); letter-spacing: 1px; }

/* ==========================================================================
   CHAT
   ========================================================================== */

.chat-app {
  height: 100dvh;
  display: flex; flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  background: var(--bg);
  animation: fadeIn .35s var(--ease-out);
}

/* Header */
.chat-header {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 8px 8px 4px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.back {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  font-size: 28px; line-height: 1;
  text-decoration: none;
  border-radius: 50%;
  transition: background .15s;
}
.back:hover { background: rgba(255,255,255,.08); }
.room-info { flex: 1; min-width: 0; }
.room-title { font-size: 16px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.room-sub { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.share-btn {
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  color: var(--text); font-size: 20px;
  border-radius: 50%;
  transition: background .15s, transform .1s;
}
.share-btn:hover { background: rgba(255,255,255,.08); }
.share-btn:active { transform: scale(.96); }

/* Messages scroll area */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 12px 8px;
  display: flex; flex-direction: column; gap: 14px;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.messages::-webkit-scrollbar { display: none; }

/* Message row */
.msg-row {
  display: flex; align-items: flex-end; gap: 8px;
  animation: bubbleIn .3s var(--ease-out);
}
.msg-row.mine { flex-direction: row-reverse; }

.avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 15px; font-weight: 700; color: #fff;
  user-select: none;
}
.msg-row.mine .avatar { display: none; }

.bubble-wrap {
  display: flex; flex-direction: column;
  max-width: 75%;
}
.msg-row.mine .bubble-wrap { align-items: flex-end; }

.sender-name {
  font-size: 12px;
  color: var(--text-3);
  margin: 0 4px 4px;
}

.bubble {
  padding: 10px 14px;
  border-radius: var(--radius-bubble);
  font-size: 15px; line-height: 1.4;
  word-break: break-word;
  white-space: pre-wrap;
  background: var(--bubble);
  color: var(--text);
  border-bottom-left-radius: 6px;
}
.msg-row.mine .bubble {
  background: var(--pink);
  color: #fff;
  border-bottom-left-radius: var(--radius-bubble);
  border-bottom-right-radius: 6px;
}
.bubble audio { max-width: 220px; height: 36px; }

.msg-time {
  font-size: 11px;
  color: var(--text-3);
  margin: 4px 4px 0;
}

.sys-msg {
  align-self: center;
  font-size: 12px;
  color: var(--text-3);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 6px 14px;
  animation: bubbleIn .3s var(--ease-out);
}

/* ---------- Media bubble ---------- */
.media-bubble {
  padding: 0;
  background: none;
  border-radius: var(--radius-media);
  overflow: hidden;
  line-height: 0;
}
.media-bubble img,
.media-bubble video {
  display: block;
  max-width: 240px;
  max-height: 320px;
  width: 100%;
  height: auto;
  border-radius: var(--radius-media);
  object-fit: cover;
}

/* ---------- Voice bubble ---------- */
.voice-bubble {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px 8px 8px;
  border-radius: 999px;
  background: var(--bubble);
  min-width: 180px;
}
.msg-row.mine .voice-bubble { background: var(--pink); }
.play-btn {
  width: 32px; height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,.18);
  color: #fff;
  transition: background .15s, transform .1s;
}
.play-btn:hover { background: rgba(255,255,255,.28); }
.play-btn:active { transform: scale(.96); }
.play-btn .icon { width: 16px; height: 16px; fill: currentColor; stroke: none; }

.waveform {
  display: flex; align-items: center; gap: 2.5px;
  height: 22px; flex: 1;
}
.waveform span {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: currentColor;
  opacity: .85;
}
.waveform span:nth-child(1)  { height: 6px; }
.waveform span:nth-child(2)  { height: 12px; }
.waveform span:nth-child(3)  { height: 18px; }
.waveform span:nth-child(4)  { height: 10px; }
.waveform span:nth-child(5)  { height: 20px; }
.waveform span:nth-child(6)  { height: 14px; }
.waveform span:nth-child(7)  { height: 8px; }
.waveform span:nth-child(8)  { height: 16px; }
.waveform span:nth-child(9)  { height: 22px; }
.waveform span:nth-child(10) { height: 12px; }
.waveform span:nth-child(11) { height: 7px; }
.waveform span:nth-child(12) { height: 15px; }
.waveform span:nth-child(13) { height: 10px; }
.waveform span:nth-child(14) { height: 18px; }
.waveform span:nth-child(15) { height: 8px; }
.voice-bubble.playing .waveform span { animation: wave 1s ease-in-out infinite; }
.voice-bubble.playing .waveform span:nth-child(3n)   { animation-delay: .15s; }
.voice-bubble.playing .waveform span:nth-child(3n+1) { animation-delay: .3s; }
.voice-duration { font-size: 12px; opacity: .85; flex-shrink: 0; }

/* ---------- Typing indicator ---------- */
.typing-indicator {
  padding: 4px 16px 8px;
  font-size: 12px;
  color: var(--text-3);
  min-height: 24px;
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.typing-indicator:empty { padding: 0; min-height: 0; }
.typing-dots { display: inline-flex; align-items: center; gap: 4px; }
.typing-dots span {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  animation: dotBounce 1.2s ease-in-out infinite;
}
.typing-dots span:nth-child(2) { animation-delay: .15s; }
.typing-dots span:nth-child(3) { animation-delay: .3s; }

/* ---------- Recording hint ---------- */
.rec-hint {
  padding: 6px 16px;
  font-size: 12px;
  color: var(--pink);
  display: flex; align-items: center; gap: 6px;
  flex-shrink: 0;
}
.rec-hint::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--pink);
  animation: blink 1s ease-in-out infinite;
}

/* ---------- Input bar (TikTok DM style) ---------- */
.input-bar {
  display: flex; align-items: flex-end; gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px));
  flex-shrink: 0;
  background: var(--bg);
}
.input-wrap {
  flex: 1;
  display: flex; align-items: center;
  background: var(--bubble);
  border-radius: 24px;
  padding: 4px 6px 4px 16px;
  min-height: 44px;
}
.input-wrap input {
  flex: 1; min-width: 0;
  background: none;
  border: none; outline: none;
  color: var(--text);
  font-size: 15px;
  padding: 8px 0;
}
.input-wrap input::placeholder { color: var(--text-3); }

.icon-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-2);
  transition: background .15s, transform .1s, color .15s;
}
.input-wrap .icon-btn { width: 36px; height: 36px; }
.icon-btn:hover { background: rgba(255,255,255,.08); color: var(--text); }
.icon-btn:active { transform: scale(.96); }

.mic-btn {
  width: 44px; height: 44px;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bubble);
  color: var(--text);
  transition: background .15s, transform .1s;
  position: relative;
}
.mic-btn:hover { background: #3a3a3a; }
.mic-btn:active { transform: scale(.96); }
.mic-btn.recording { background: var(--pink); color: #fff; }
.mic-btn.recording::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--pink);
  animation: pulseRing 1.2s ease-out infinite;
}

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: calc(16px + env(safe-area-inset-top, 0px));
  left: 50%;
  transform: translateX(-50%);
  background: #1E1E1E;
  color: var(--text);
  font-size: 13px;
  padding: 10px 20px;
  border-radius: 999px;
  box-shadow: 0 6px 24px rgba(0,0,0,.5);
  z-index: 999;
  animation: toastIn .25s var(--ease-out);
  white-space: nowrap;
}

/* ==========================================================================
   ATTACH BOTTOM SHEET + CAMERA MODAL
   ========================================================================== */

.attach-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 100;
  opacity: 0;
  transition: opacity .25s;
}
.attach-backdrop.open { opacity: 1; }

.attach-sheet {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  max-width: 480px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
  z-index: 101;
  transform: translateY(100%);
  transition: transform .3s var(--ease-out);
}
.attach-sheet.open { transform: translateY(0); }
.attach-sheet::before {
  content: '';
  display: block;
  width: 36px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,.2);
  margin: 8px auto 12px;
}
.attach-option {
  display: flex; align-items: center; gap: 14px;
  width: 100%;
  padding: 14px 12px;
  border-radius: 12px;
  font-size: 16px; font-weight: 600;
  color: var(--text);
  text-align: left;
  transition: background .15s;
}
.attach-option:hover { background: rgba(255,255,255,.06); }
.attach-option:active { transform: scale(.98); }
.attach-option .icon { color: var(--text-2); flex-shrink: 0; }
.attach-option span { display: flex; flex-direction: column; gap: 2px; }
.attach-option small { font-size: 12px; color: var(--text-2); font-weight: 400; }
.attach-cancel { color: var(--text-2); }
.attach-cancel .icon { width: 18px; height: 18px; }

.camera-modal {
  position: fixed; inset: 0;
  background: #000;
  z-index: 200;
  display: flex; flex-direction: column;
  opacity: 0;
  pointer-events: none;
  transition: opacity .25s;
}
.camera-modal.open { opacity: 1; pointer-events: auto; }
.camera-modal video {
  flex: 1;
  width: 100%;
  object-fit: cover;
  min-height: 0;
}
.camera-close {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  right: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5);
  color: #fff;
  z-index: 2;
  transition: background .15s;
}
.camera-close:hover { background: rgba(0,0,0,.7); }
.camera-flip {
  position: absolute;
  top: calc(14px + env(safe-area-inset-top, 0px));
  left: 14px;
  width: 40px; height: 40px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5);
  color: #fff;
  z-index: 2;
  border: none; cursor: pointer;
  transition: background .15s;
}
.camera-flip:hover { background: rgba(0,0,0,.7); }
.camera-close { border: none; cursor: pointer; }
.camera-controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 48px calc(28px + env(safe-area-inset-bottom, 0px));
}
.cam-spacer { width: 64px; }
.cam-video-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: rgba(255,255,255,.12); border: none; cursor: pointer;
  color: #fff; border-radius: 14px; padding: 10px 14px;
  font-size: 11px; font-weight: 600;
  width: 64px;
}
.cam-video-btn.recording { background: var(--pink); }
.shutter-btn {
  width: 72px; height: 72px;
  border-radius: 50%;
  border: 4px solid #fff;
  background: transparent;
  position: relative;
  transition: transform .1s;
}
.shutter-btn::after {
  content: '';
  position: absolute;
  inset: 5px;
  border-radius: 50%;
  background: var(--pink);
  transition: transform .1s;
}
.shutter-btn:active::after { transform: scale(.9); }

/* ==========================================================================
   ADMIN
   ========================================================================== */

.admin {
  max-width: 900px;
  margin: 0 auto;
  padding: 28px 20px calc(40px + env(safe-area-inset-bottom, 0px));
  animation: fadeIn .4s var(--ease-out);
}
.admin h1 { font-size: 24px; font-weight: 800; margin-bottom: 4px; }
.admin .sub { color: var(--text-2); font-size: 13px; margin-bottom: 22px; }

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}
.stat {
  background: var(--surface);
  border-radius: 16px;
  padding: 18px 16px;
  transition: transform .15s var(--ease-out), background .2s;
}
.stat:hover { background: var(--surface-2); transform: translateY(-2px); }
.stat .n { font-size: 28px; font-weight: 800; color: var(--pink); line-height: 1.1; }
.stat .l { font-size: 12px; color: var(--text-2); margin-top: 4px; }

.admin table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin thead th {
  position: sticky; top: 0;
  background: var(--surface);
  text-align: left;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--text-2);
  padding: 12px 14px;
  z-index: 1;
}
.admin tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
.admin tbody tr { transition: background .12s; }
.admin tbody tr:hover { background: rgba(255,255,255,.04); }

.btn-xs {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 6px 12px;
  border-radius: 8px;
  background: var(--bubble);
  color: var(--text);
  font-size: 12px; font-weight: 600;
  cursor: pointer;
  margin-right: 6px;
  transition: background .15s, transform .1s;
}
.btn-xs:hover { background: #3d3d3d; }
.btn-xs:active { transform: scale(.96); }
.btn-xs.danger { background: rgba(254,44,85,.15); color: var(--pink); }
.btn-xs.danger:hover { background: rgba(254,44,85,.28); }

.msgs-box {
  margin-top: 18px;
  background: var(--surface);
  border-radius: 16px;
  padding: 16px;
  max-height: 420px;
  overflow-y: auto;
  animation: fadeIn .3s var(--ease-out);
}
.msg-line {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}
.msg-line:last-child { border-bottom: none; }
.msg-line .who { color: var(--cyan); font-weight: 700; flex-shrink: 0; }
.msg-line .what { flex: 1; color: var(--text); word-break: break-word; }
.msg-line .what audio { height: 30px; max-width: 200px; }
.msg-line time { color: var(--text-3); font-size: 11px; flex-shrink: 0; }

.login-box {
  max-width: 360px;
  margin: 12vh auto 0;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */

@keyframes fadeIn   { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp  { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: translateY(0); } }
@keyframes bubbleIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toastIn  { from { opacity: 0; transform: translateX(-50%) translateY(-8px); } to { opacity: 1; transform: translateX(-50%) translateY(0); } }
@keyframes dotBounce { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
@keyframes pulseRing { 0% { transform: scale(1); opacity: 1; } 100% { transform: scale(1.5); opacity: 0; } }
@keyframes blink    { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
@keyframes wave     { 0%, 100% { transform: scaleY(1); } 50% { transform: scaleY(.5); } }

/* ==========================================================================
   RESPONSIVE — mobile-first, 360px floor
   ========================================================================== */

@media (max-width: 360px) {
  .logo { font-size: 44px; }
  .bubble-wrap { max-width: 82%; }
  .btn { font-size: 15px; }
}

@media (min-width: 481px) {
  body { background: var(--bg); }
  .chat-app, .landing { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

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

/* invio + landing features */
.send-btn { color: var(--pink); }
.btn .icon { width: 18px; height: 18px; vertical-align: -3px; margin-right: 4px; }
.feat { display: inline-flex; align-items: center; gap: 5px; margin: 0 8px; }
.feat .icon { width: 14px; height: 14px; color: var(--text-2); }

/* ---- i18n lang switcher ---- */
.lang-switch { position: fixed; top: 14px; right: 14px; z-index: 50; }
.lang-btn {
  display: flex; align-items: center; gap: 6px;
  background: var(--surface); border: 1px solid var(--line);
  color: var(--text); border-radius: 20px; padding: 8px 14px;
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.lang-btn:hover { background: var(--surface-2); }
.lang-menu {
  position: fixed; top: 52px; right: 14px; z-index: 60;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; overflow: hidden; min-width: 150px;
  box-shadow: 0 12px 32px rgba(0,0,0,.5);
}
.lang-menu-chat { position: fixed; top: auto; }
.lang-opt {
  display: block; width: 100%; text-align: left;
  background: none; border: none; color: var(--text);
  padding: 11px 16px; font-size: 14px; cursor: pointer;
}
.lang-opt:hover { background: rgba(255,255,255,.06); }
.lang-opt.active { color: var(--cyan); font-weight: 700; }
.lang-mini {
  background: none; border: none; color: var(--text-2);
  font-size: 11px; font-weight: 700; cursor: pointer;
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 10px; padding: 2px 6px; border-radius: 8px;
}
.lang-mini:hover { color: var(--text); background: rgba(255,255,255,.06); }

/* ---- modali report / traduttore ---- */
.report-modal {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0,0,0,.7); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.report-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 18px; padding: 22px; width: 100%; max-width: 380px;
  display: flex; flex-direction: column; gap: 14px;
  animation: fadeIn .2s ease;
}
.report-card h3 { font-size: 17px; }
.report-card select {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px;
  padding: 13px; color: var(--text); font-size: 15px; outline: none; width: 100%;
}
.report-actions { display: flex; gap: 10px; }
.report-actions .btn { flex: 1; }

/* ---- traduzione bubble ---- */
.bubble.translated { font-style: italic; opacity: .92; }
.share-btn.active-tr { color: var(--cyan); }

/* ---- editor invio media ---- */
.editor-modal {
  position: fixed; inset: 0; z-index: 250;
  background: #000; display: flex; flex-direction: column;
}
.editor-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 14px 12px;
}
.editor-title { font-weight: 700; font-size: 16px; }
.editor-send {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--pink); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.editor-media {
  flex: 1; display: flex; align-items: center; justify-content: center;
  padding: 0 16px; min-height: 0; overflow: hidden;
}
.editor-media img, .editor-media video, .editor-media canvas { max-width: 100%; max-height: 100%; border-radius: 12px; }
.editor-tools {
  padding: 14px 16px calc(18px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 12px;
}
.crop-row { display: flex; align-items: center; gap: 8px; }
.crop-preset {
  background: var(--surface-2); border: 1px solid var(--line); color: var(--text-2);
  border-radius: 8px; padding: 7px 14px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.crop-preset.active { background: var(--pink); border-color: var(--pink); color: #fff; }
.once-toggle {
  display: flex; align-items: center; gap: 10px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 13px 16px; color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; width: 100%;
}
.once-toggle .once-dot {
  margin-left: auto; width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--text-3); transition: all .15s;
}
.once-toggle.on { border-color: var(--pink); color: var(--pink); }
.once-toggle.on .once-dot { background: var(--pink); border-color: var(--pink); }

/* ---- filtri fotocamera ---- */
#filterOverlay { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 2; }
.filter-bar {
  position: absolute; bottom: calc(118px + env(safe-area-inset-bottom));
  left: 0; right: 0; z-index: 3;
  display: flex; gap: 10px; overflow-x: auto;
  padding: 8px 14px; scrollbar-width: none;
}
.filter-bar::-webkit-scrollbar { display: none; }
.filter-btn {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  background: none; border: none; cursor: pointer; flex-shrink: 0;
  opacity: .55; transition: opacity .15s, transform .15s;
}
.filter-btn span { font-size: 10px; color: #fff; font-weight: 600; }
.filter-btn.active { opacity: 1; transform: scale(1.12); }
.filter-btn.active canvas { outline: 2px solid var(--pink); border-radius: 50%; }

/* ---- view-once ---- */
.once-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bubble); border: none; color: var(--text);
  border-radius: 18px; padding: 12px 18px; font-size: 14px; font-weight: 600;
  cursor: pointer;
}
.msg-row.mine .once-btn { background: var(--pink); }
.once-viewed { font-size: 12px; color: var(--text-3); font-style: italic; padding: 6px 4px; }

/* ---- media viewer fullscreen ---- */
.media-viewer {
  position: fixed; inset: 0; z-index: 400;
  background: rgba(0,0,0,.94);
  display: flex; align-items: center; justify-content: center;
}
.media-viewer img, .media-viewer video { max-width: 100%; max-height: 100%; }
.media-viewer-close {
  position: absolute; top: calc(14px + env(safe-area-inset-top)); right: 14px;
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.12); border: none; color: #fff;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
