:root { --bg:#06061A; --glass:rgba(24,22,66,.62); --edge:rgba(140,150,255,.18); --tx:#F2F1FB; --mu:#9CA0D2; --dim:#6A70A6;
  --violet:#7357FF; --cyan:#25D6E8; --pink:#F052A1; --ok:#3DDC97; --amber:#FFB547; color-scheme: dark; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--tx); font-family: 'Readex Pro', system-ui, -apple-system, sans-serif; font-size: 16px; }
body { overflow: hidden; width: 100%; }
.glow { position: fixed; inset: -20%; z-index: -1; pointer-events: none;
  background: radial-gradient(40% 30% at 50% 0%, rgba(115,87,255,.35), transparent 70%), radial-gradient(35% 30% at 90% 90%, rgba(37,214,232,.12), transparent 70%); }
[hidden] { display: none !important; }
.btn { min-height: 46px; border-radius: 14px; border: 1px solid var(--edge); background: rgba(255,255,255,.05); color: var(--tx); font: inherit; font-weight: 600; padding: 0 16px; }
.btn.primary { background: linear-gradient(135deg, var(--violet), #5a3ff0); border-color: transparent; }
.err { color: #ff8ec4; min-height: 1.2em; margin: 0; font-size: 14px; }

.pair { height: 100dvh; display: grid; align-content: center; gap: 12px; padding: max(24px, env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); max-width: 460px; margin: 0 auto; }
.pair-face { width: 96px; height: 96px; border-radius: 26px; justify-self: center; box-shadow: 0 0 40px rgba(115,87,255,.55); }
.pair h1 { text-align: center; margin: 4px 0 0; font-size: 26px; }
.pair .lead { color: var(--mu); text-align: center; margin: 0 0 6px; line-height: 1.6; font-size: 15px; }
.pair label { color: var(--mu); font-size: 14px; }
.pair textarea { width: 100%; border-radius: 14px; border: 1px solid var(--edge); background: rgba(255,255,255,.05); color: var(--tx); padding: 12px; font: 14px ui-monospace, Menlo, monospace; }

.chat { height: 100dvh; display: grid; grid-template-rows: auto 1fr auto auto; grid-template-columns: minmax(0, 1fr); width: 100%; }
.bar { display: flex; align-items: center; gap: 10px; padding: calc(10px + env(safe-area-inset-top)) 14px 10px; background: rgba(6,6,26,.75); border-bottom: 1px solid var(--edge); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); }
.face { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 16px rgba(115,87,255,.5); }
.who { flex: 1; min-width: 0; } .who b { display: block; font-size: 17px; } .who small { color: var(--dim); font-size: 12.5px; }
.who small.on { color: var(--ok); }
.icon-btn { width: 44px; height: 44px; border-radius: 50%; border: 1px solid var(--edge); background: rgba(255,255,255,.05); color: var(--tx); font-size: 18px; flex: none; }
.icon-btn.send { background: linear-gradient(135deg, var(--violet), #5a3ff0); border-color: transparent; transform: scaleX(-1); }
.icon-btn.mic.rec { background: var(--pink); border-color: transparent; animation: pulse 1.2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(240,82,161,.25); } }

.list { overflow-y: auto; padding: 14px 12px 8px; display: flex; flex-direction: column; gap: 8px; -webkit-overflow-scrolling: touch; }
.msg { max-width: 86%; padding: 10px 13px; border-radius: 18px; line-height: 1.6; font-size: 15.5px; word-wrap: break-word; overflow-wrap: anywhere; white-space: pre-wrap; }
.msg.reem { align-self: flex-start; background: var(--glass); border: 1px solid var(--edge); border-start-start-radius: 6px; }
.msg.me { align-self: flex-end; background: linear-gradient(135deg, #3b2bb0, #5a3ff0); border-start-end-radius: 6px; }
.msg.note { align-self: center; background: none; color: var(--dim); font-size: 13px; padding: 2px 8px; }
.msg a { color: var(--cyan); }
.msg code { font-family: ui-monospace, Menlo, monospace; font-size: 13px; background: rgba(255,255,255,.08); padding: 1px 5px; border-radius: 6px; }
.msg pre { max-width: 100%; overflow-x: auto; white-space: pre-wrap; background: rgba(0,0,0,.3); padding: 8px; border-radius: 10px; font-size: 13px; direction: ltr; text-align: left; margin: 6px 0 0; }
.msg time { display: block; color: var(--dim); font-size: 11px; margin-top: 4px; }
.msg audio { width: 240px; max-width: 100%; margin-top: 4px; }
.rows { display: grid; gap: 6px; margin-top: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 6px; }
.row button { flex: 1 1 auto; min-height: 38px; border-radius: 12px; border: 1px solid rgba(37,214,232,.35); background: rgba(37,214,232,.08); color: var(--tx); font: inherit; font-size: 14px; font-weight: 600; padding: 0 10px; }
.row button[disabled] { opacity: .5; }
.row button.done { border-color: var(--edge); background: none; color: var(--mu); }
details.doc { margin-top: 6px; } details.doc summary { color: var(--cyan); cursor: pointer; }

.composer { display: flex; align-items: flex-end; gap: 8px; padding: 8px 10px calc(8px + env(safe-area-inset-bottom)); background: rgba(6,6,26,.8); border-top: 1px solid var(--edge); }
.composer textarea { flex: 1; min-width: 0; width: 100%; min-height: 44px; max-height: 140px; resize: none; border-radius: 22px; border: 1px solid var(--edge); background: rgba(255,255,255,.06); color: var(--tx); font: inherit; font-size: 16px; padding: 10px 14px; line-height: 1.4; }
@media (prefers-reduced-motion: reduce) { .icon-btn.mic.rec { animation: none; } }

.chips { display: flex; gap: 6px; overflow-x: auto; padding: 6px 10px 2px; scrollbar-width: none; background: rgba(6,6,26,.8); }
.chips::-webkit-scrollbar { display: none; }
.chips button { flex: none; min-height: 34px; padding: 0 12px; border-radius: 17px; border: 1px solid var(--edge); background: rgba(255,255,255,.05); color: var(--tx); font: inherit; font-size: 13.5px; white-space: nowrap; }

.msg b.h1 { display: block; font-size: 16.5px; margin: 10px 0 2px; color: #fff; }
.msg b.h2 { display: block; font-size: 15px; margin: 8px 0 2px; color: var(--cyan); }
.msg hr { border: 0; border-top: 1px solid var(--edge); margin: 8px 0; }
details.doc .docbody { margin-top: 8px; padding: 10px 12px; border-radius: 12px; background: rgba(0,0,0,.25); font-size: 14px; line-height: 1.65; white-space: pre-wrap; }
