:root {
  --bg: #15121a; --panel: #1e1a25; --panel2: #29232f; --line: #352d3d;
  --text: #f3eef6; --muted: #a59bb0; --pink: #ff5c7a; --pink2: #ff8aa0; --green: #4ade80; --red: #ef4444;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
button { font: inherit; cursor: pointer; }
button:disabled { opacity: .45; cursor: default; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }

.btn { border: 0; border-radius: 999px; padding: .6rem 1.2rem; background: var(--panel2); color: var(--text); }
.btn.primary { background: var(--pink); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--pink2); }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--muted); }
.btn.big { padding: .9rem 1.8rem; font-size: 1.05rem; }
.btn.small { padding: .35rem .8rem; font-size: .85rem; }
.icon-btn { background: none; border: 0; color: var(--muted); font-size: 1.3rem; }
.link { background: none; border: 0; padding: 0; color: var(--muted); font-size: .75rem; text-decoration: underline; }

/* login */
body.login { display: grid; place-items: center; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 20px; padding: 2rem; display: flex; flex-direction: column; gap: 1rem; width: min(380px, 92vw); text-align: center; color: var(--text); }
.card h1, .card h2 { margin: 0; }
.card input:not([type=radio]) { background: var(--bg); border: 1px solid var(--line); color: var(--text); border-radius: 12px; padding: .75rem 1rem; font: inherit; width: 100%; }
.card label { display: flex; flex-direction: column; gap: .4rem; text-align: left; font-size: .9rem; color: var(--muted); }
.heart { font-size: 2.4rem; color: var(--pink); line-height: 1; }
.heart.sm { font-size: 1.1rem; }
.err { color: var(--red); margin: 0; }
dialog { padding: 0; border: 0; background: none; }
dialog::backdrop { background: rgba(0,0,0,.6); }
.langs { border: 1px solid var(--line); border-radius: 12px; display: flex; gap: 1.5rem; justify-content: center; padding: .6rem 1rem 1rem; }
.langs legend { color: var(--muted); font-size: .9rem; padding: 0 .4rem; }
.langs label { flex-direction: row; align-items: center; gap: .4rem; color: var(--text); font-size: 1rem; }

/* app */
.top { height: 56px; display: flex; align-items: center; gap: 1rem; padding: 0 1.2rem; border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; font-size: 1.1rem; }
.presence { display: flex; align-items: center; gap: .5rem; color: var(--muted); font-size: .9rem; margin-left: auto; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #6b6475; }
.dot.half { background: #eab308; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }

.layout { display: grid; grid-template-columns: 1fr 380px; height: calc(100% - 56px); }
.stage { position: relative; background: #0c0a0f; overflow: hidden; }
#remote { width: 100%; height: 100%; object-fit: contain; display: none; background: #000; }
.stage.live #remote { display: block; }
#local { position: absolute; right: 16px; bottom: 90px; width: 22%; max-width: 260px; aspect-ratio: 16/9; object-fit: cover; border-radius: 12px; border: 2px solid rgba(255,255,255,.15); transform: scaleX(-1); background: #222; z-index: 2; }
.overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.2rem; text-align: center; padding: 2rem; background: radial-gradient(circle at 50% 40%, #2a1f2e, #0c0a0f 70%); }
.big-text { font-size: 1.5rem; margin: 0; }
.row { display: flex; gap: 1rem; }
.controls { position: absolute; left: 0; right: 0; bottom: 18px; display: flex; justify-content: center; gap: 1rem; z-index: 3; }
.round { width: 56px; height: 56px; border-radius: 50%; border: 0; background: rgba(40,34,48,.85); color: #fff; font-size: 1.3rem; backdrop-filter: blur(6px); }
.round.off { background: #fff; filter: grayscale(1); opacity: .8; }
.round.danger { background: var(--red); }

.chat { display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--panel); min-height: 0; }
.translate-bar { padding: .7rem 1rem; background: var(--panel2); font-size: .85rem; color: var(--muted); display: flex; gap: .6rem; align-items: center; justify-content: space-between; }
.messages { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .5rem; }
.day { align-self: center; font-size: .75rem; color: var(--muted); margin: .6rem 0; }
.day::first-letter { text-transform: uppercase; }
.msg { max-width: 82%; padding: .55rem .85rem; border-radius: 16px; display: flex; flex-direction: column; gap: .2rem; word-wrap: break-word; white-space: pre-wrap; }
.msg.mine { align-self: flex-end; background: var(--pink); color: #fff; border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--panel2); border-bottom-left-radius: 4px; }
.msg .time { font-size: .7rem; opacity: .7; align-self: flex-end; }
.composer { display: flex; gap: .5rem; padding: .8rem; border-top: 1px solid var(--line); }
.composer textarea { flex: 1; resize: none; background: var(--bg); color: var(--text); border: 1px solid var(--line); border-radius: 18px; padding: .65rem 1rem; font: inherit; max-height: 140px; }
.composer .btn { width: 46px; padding: 0; }

@media (max-width: 800px) {
  .layout { grid-template-columns: 1fr; grid-template-rows: 45% 55%; }
  .chat { border-left: 0; border-top: 1px solid var(--line); }
}

/* profile picker */
.who { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.who-btn { border-radius: 16px; padding: 1.2rem .8rem; display: flex; flex-direction: column; gap: .3rem; border: 1px solid var(--line); }
.who-btn:hover { border-color: var(--pink); }
.who-btn b { font-size: 1.2rem; }
.who-btn span { color: var(--muted); font-size: .85rem; }

/* translated message: big translation, small original in parentheses */
.msg .orig { font-size: .8rem; color: var(--muted); }
.msg .typing { opacity: .6; letter-spacing: .15em; }
.who-btn { position: relative; cursor: pointer; align-items: center; text-align: center; background: var(--panel2); }
.who-btn input { position: absolute; opacity: 0; pointer-events: none; }
.who-btn:has(input:checked) { border-color: var(--pink); background: #3a2532; }
.who-btn.slim { padding: .8rem; }
.who-btn.slim b { font-size: 1rem; }
.small-note { font-size: .8rem; margin: 0; }
