:root {
  --bg: #f6f8fb;
  --card: #ffffff;
  --text: #1d2433;
  --muted: #6a7488;
  --accent: #0f6fff;
  --border: #dce3ef;
  --bubble-in: #f1f4fa;
  --bubble-out: #dfeeff;
}

body.theme-dark {
  --bg: #0f141d;
  --card: #1a2230;
  --text: #e5edf8;
  --muted: #99a6bb;
  --accent: #4f8dff;
  --border: #2a364b;
  --bubble-in: #273247;
  --bubble-out: #20457a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", "Segoe UI", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at 10% 10%, #eaf2ff 0%, var(--bg) 55%);
}

.container { max-width: 1100px; margin: 0 auto; padding: 24px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: 16px; padding: 16px; }
button { border: none; border-radius: 10px; padding: 10px 14px; cursor: pointer; background: var(--accent); color: #fff; font-weight: 600; }
button.secondary { background: #eef4ff; color: #123d8e; }
input, textarea { width: 100%; border: 1px solid var(--border); border-radius: 10px; padding: 10px; font: inherit; background: transparent; color: inherit; }
h1, h2, h3, h4 { margin-top: 0; }
.muted { color: var(--muted); }
.grid { display: grid; gap: 12px; }
.auth-grid { grid-template-columns: 1fr 1fr; }
.app-grid { grid-template-columns: 320px 1fr; min-height: 72vh; }
.actions { display: flex; gap: 8px; }

.me-row, .user-main, .chat-header { display: flex; gap: 10px; align-items: center; }
.chat-header { justify-content: space-between; }
.chat-header-actions { display: flex; gap: 8px; }
.user-row { display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 10px; border: 1px solid var(--border); border-radius: 10px; }

.avatar { border-radius: 999px; object-fit: cover; border: 1px solid var(--border); }
.avatar-fallback { display: flex; align-items: center; justify-content: center; background: #5c8dff; color: #fff; font-weight: 700; }

.chat-header.clickable { cursor: pointer; }
.messages { display: flex; flex-direction: column; gap: 8px; max-height: 56vh; overflow-y: auto; padding: 6px; }
.bubble-row { display: flex; justify-content: flex-start; }
.bubble-row.mine { justify-content: flex-end; }
.bubble { max-width: 80%; padding: 9px 12px; border-radius: 14px; background: var(--bubble-in); border: 1px solid var(--border); }
.bubble.mine { background: var(--bubble-out); }
.bubble .time { font-size: 12px; color: var(--muted); margin-top: 6px; text-align: right; }
.bubble .spoiler { background: #5b667a; color: #e6edf9; border-radius: 6px; padding: 0 4px; }
.bubble .mention { color: var(--accent); text-decoration: none; font-weight: 700; }

.row-input { display: flex; gap: 8px; align-items: end; }
.row-input textarea { flex: 1; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { width: min(560px, 100%); }
.call-card { display: grid; gap: 10px; }
.call-card audio { width: 100%; }
.call-videos { display: grid; grid-template-columns: 1fr 150px; gap: 8px; align-items: end; }
.call-videos video { width: 100%; background: #0c1018; border-radius: 12px; min-height: 110px; object-fit: cover; border: 1px solid var(--border); }
.landing-wrap { max-width: 1060px; margin: 0 auto; padding: 24px; display: grid; gap: 16px; }
.hero { display: grid; gap: 14px; align-items: center; grid-template-columns: 120px 1fr; }
.hero-logo { width: 96px; height: 96px; border-radius: 24px; }
.features { grid-template-columns: repeat(3, 1fr); }
.center { text-align: center; }

@media (max-width: 900px) {
  .auth-grid, .app-grid { grid-template-columns: 1fr; }
  .hero, .features { grid-template-columns: 1fr; }
}
