/* ============================================================
   QUANTA — cyberpunk / quantum-secure messenger UI
   ============================================================ */
:root {
  --bg: #05060a;
  --bg-2: #080c14;
  --panel: rgba(12, 17, 28, 0.72);
  --panel-solid: #0b1018;
  --line: rgba(70, 220, 255, 0.16);
  --line-strong: rgba(70, 220, 255, 0.38);
  --cyan: #22e6ff;
  --cyan-dim: #0fb7d6;
  --magenta: #ff2fa0;
  --violet: #7b5cff;
  --lime: #a8ff60;
  --text: #e6f4ff;
  --muted: #7c92ad;
  --muted-2: #55677d;
  --danger: #ff4d6d;
  --radius: 16px;
  --radius-sm: 11px;
  --shadow: 0 24px 60px -28px rgba(0, 0, 0, 0.95);
  --glow-cyan: 0 0 24px rgba(34, 230, 255, 0.28);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --display: 'Orbitron', 'Inter', system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background:
    radial-gradient(900px 620px at 12% -10%, rgba(123, 92, 255, 0.20), transparent 62%),
    radial-gradient(760px 560px at 92% 4%, rgba(34, 230, 255, 0.16), transparent 66%),
    radial-gradient(700px 700px at 68% 108%, rgba(255, 47, 160, 0.13), transparent 62%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.hidden { display: none !important; }
.mono { font-family: var(--mono); letter-spacing: -0.01em; }
.tiny { font-size: 11px; }

#bg-canvas { position: fixed; inset: 0; width: 100%; height: 100%; z-index: 0; opacity: 0.55; pointer-events: none; }
.grid-overlay {
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background-image:
    linear-gradient(rgba(80, 200, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(80, 200, 255, 0.045) 1px, transparent 1px);
  background-size: 46px 46px;
  mask-image: radial-gradient(circle at 50% 40%, rgba(0, 0, 0, 0.9), transparent 78%);
}
.scanlines {
  position: fixed; inset: 0; z-index: 1; pointer-events: none; opacity: 0.35;
  background: repeating-linear-gradient(180deg, rgba(255, 255, 255, 0.028) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay;
}

.screen { position: relative; z-index: 2; height: 100dvh; }
.glass {
  background: linear-gradient(160deg, rgba(18, 25, 39, 0.82), rgba(9, 13, 21, 0.86));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
}

/* ============================== AUTH ============================== */
.auth-screen { display: grid; place-items: center; padding: 28px 20px; overflow-y: auto; }
.auth-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 56px;
  width: min(1060px, 100%);
  align-items: center;
}
.auth-brand { max-width: 460px; }
.brand-mark { position: relative; width: 86px; height: 86px; margin-bottom: 22px; }
.brand-mark .orbit {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(34, 230, 255, 0.55);
  box-shadow: 0 0 22px rgba(34, 230, 255, 0.35), inset 0 0 18px rgba(34, 230, 255, 0.18);
}
.brand-mark .orbit-a { animation: spin 9s linear infinite; border-color: rgba(34, 230, 255, 0.45); }
.brand-mark .orbit-b { inset: 14px -6px; border-color: rgba(255, 47, 160, 0.5); animation: spin 6s linear infinite reverse; box-shadow: 0 0 20px rgba(255, 47, 160, 0.3); }
.brand-mark .nucleus {
  position: absolute; inset: 33px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #d9fdff, var(--cyan) 55%, #0a7f96);
  box-shadow: 0 0 26px rgba(34, 230, 255, 0.85), 0 0 60px rgba(34, 230, 255, 0.35);
  animation: pulse 3.4s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 0%,100% { transform: scale(1); opacity: 1; } 50% { transform: scale(0.86); opacity: 0.82; } }

.brand-title {
  font-family: var(--display);
  font-size: clamp(38px, 7vw, 58px);
  font-weight: 700;
  letter-spacing: 0.16em;
  margin: 0 0 6px;
  background: linear-gradient(96deg, #d9fdff 0%, var(--cyan) 38%, var(--violet) 72%, var(--magenta) 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 22px rgba(34, 230, 255, 0.35));
}
.brand-sub {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0.32em;
  color: var(--muted); margin: 0 0 28px; text-transform: uppercase;
}
.algo-list { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 10px; }
.algo-list li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 15px;
  border: 1px solid rgba(70, 220, 255, 0.13);
  border-left: 2px solid var(--cyan);
  border-radius: 10px;
  background: linear-gradient(90deg, rgba(34, 230, 255, 0.07), transparent 70%);
  font-size: 13.5px;
}
.algo-list li span {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em;
  color: var(--cyan); min-width: 42px;
}
.algo-list li em { margin-left: auto; font-style: normal; color: var(--muted-2); font-family: var(--mono); font-size: 10.5px; }
.brand-note { color: var(--muted); font-size: 13px; max-width: 420px; line-height: 1.65; margin: 0; }

.auth-card { padding: 26px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px; background: rgba(255,255,255,0.03); border: 1px solid var(--line); border-radius: 12px; margin-bottom: 22px; }
.tab {
  padding: 10px; border-radius: 9px; color: var(--muted);
  font-weight: 600; font-size: 13.5px; letter-spacing: 0.02em;
  transition: 0.22s;
}
.tab.active { color: #04121a; background: linear-gradient(120deg, var(--cyan), #6ff0ff); box-shadow: var(--glow-cyan); }
.auth-form { display: grid; gap: 15px; }
.field { display: grid; gap: 7px; }
.field > span { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; font-family: var(--mono); }
input[type='text'], input[type='password'], input[type='search'], textarea {
  width: 100%; padding: 12px 14px;
  background: rgba(4, 8, 14, 0.75);
  border: 1px solid rgba(70, 220, 255, 0.16);
  border-radius: 11px; color: var(--text);
  outline: none; transition: 0.2s;
}
input:focus, textarea:focus {
  border-color: var(--cyan);
  box-shadow: 0 0 0 3px rgba(34, 230, 255, 0.12), 0 0 22px -6px rgba(34, 230, 255, 0.55);
}
input::placeholder, textarea::placeholder { color: var(--muted-2); }
.btn {
  padding: 12px 18px; border-radius: 11px; font-weight: 650; font-size: 14px;
  border: 1px solid transparent; transition: 0.2s; letter-spacing: 0.01em;
}
.btn.primary {
  background: linear-gradient(110deg, var(--cyan), #4bb8ff 45%, var(--violet));
  color: #04121a; box-shadow: 0 10px 30px -12px rgba(34, 230, 255, 0.9);
}
.btn.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.primary:active { transform: translateY(0); }
.btn.sm { padding: 8px 14px; font-size: 13px; }
.btn.ghost { border-color: var(--line-strong); color: var(--text); }
.btn.danger { border-color: rgba(255, 77, 109, 0.5); color: var(--danger); }
.form-hint { margin: 2px 0 0; font-size: 11.5px; color: var(--muted-2); line-height: 1.55; }
.form-error {
  margin: 16px 0 0; padding: 11px 13px; border-radius: 10px; font-size: 13px;
  background: rgba(255, 77, 109, 0.1); border: 1px solid rgba(255, 77, 109, 0.35); color: #ffb3c0;
}
.busy { display: flex; align-items: center; gap: 10px; margin-top: 16px; color: var(--muted); font-size: 13px; }
.spinner {
  width: 15px; height: 15px; border-radius: 50%;
  border: 2px solid rgba(34, 230, 255, 0.2); border-top-color: var(--cyan);
  animation: spin 0.8s linear infinite;
}

/* ============================== APP SHELL ============================== */
.app-screen { display: grid; grid-template-columns: 352px minmax(0, 1fr); height: 100dvh; }
.sidebar {
  display: flex; flex-direction: column; min-height: 0;
  background: linear-gradient(180deg, rgba(9, 13, 21, 0.92), rgba(6, 9, 15, 0.94));
  border-right: 1px solid var(--line);
  backdrop-filter: blur(18px);
}
.side-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 16px 12px; }
.me-chip { display: flex; align-items: center; gap: 11px; min-width: 0; }
.me-text { display: grid; min-width: 0; }
.me-text strong { font-size: 14.5px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-text span { color: var(--cyan); font-size: 11px; opacity: 0.8; }
.side-actions { display: flex; gap: 6px; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  color: var(--muted); border: 1px solid transparent; transition: 0.2s; flex: none;
}
.icon-btn:hover { color: var(--cyan); background: rgba(34, 230, 255, 0.08); border-color: var(--line); }
.icon-btn.ghost { background: rgba(255, 255, 255, 0.03); border-color: var(--line); }
.icon-btn.send { background: linear-gradient(120deg, var(--cyan), var(--violet)); color: #04121a; box-shadow: 0 8px 24px -12px rgba(34, 230, 255, 0.9); }
.icon-btn.send:hover { filter: brightness(1.1); }
.icon-btn.danger { color: var(--danger); border-color: rgba(255, 77, 109, 0.4); }

.avatar {
  width: 42px; height: 42px; border-radius: 13px; flex: none;
  display: grid; place-items: center; position: relative; overflow: hidden;
  font-family: var(--display); font-weight: 700; font-size: 15px; color: #05080f;
  background-image: var(--img, linear-gradient(135deg, hsl(var(--h, 190) 95% 66%), hsl(calc(var(--h, 190) + 55) 92% 58%)));
  background-size: cover; background-position: center; background-repeat: no-repeat;
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.14), 0 8px 20px -10px rgba(34, 230, 255, 0.8);
}
.avatar.has-img > span { opacity: 0; }
.avatar.editable { cursor: pointer; }
.avatar.editable:hover::before {
  content: 'UBAH'; position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(3, 7, 14, 0.72); font-family: var(--mono); font-size: 9px;
  letter-spacing: 0.1em; color: var(--cyan);
}
.avatar.sm { width: 38px; height: 38px; border-radius: 11px; font-size: 13.5px; }
.avatar.online::after {
  content: ''; position: absolute; right: -2px; bottom: -2px;
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--lime); border: 2px solid #070a12;
  box-shadow: 0 0 10px var(--lime);
}

.side-search { position: relative; margin: 0 16px 12px; }
.side-search .s-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted-2); width: 16px; height: 16px; }
.side-search input { padding-left: 38px; background: rgba(255,255,255,0.035); border-color: rgba(255,255,255,0.07); font-size: 13.5px; }

.status-rail {
  display: flex; align-items: center; gap: 12px; width: calc(100% - 32px);
  margin: 0 16px 12px; padding: 11px 13px; border-radius: 13px;
  background: linear-gradient(100deg, rgba(123, 92, 255, 0.16), rgba(255, 47, 160, 0.07));
  border: 1px solid rgba(123, 92, 255, 0.28); text-align: left; transition: 0.2s;
}
.status-rail:hover { border-color: rgba(123, 92, 255, 0.6); box-shadow: 0 0 24px -8px rgba(123, 92, 255, 0.7); }
.status-rings { display: flex; }
.status-rings .ring-empty {
  width: 34px; height: 34px; border-radius: 50%;
  border: 2px dashed rgba(168, 255, 96, 0.55);
  display: grid; place-items: center; color: var(--lime); font-size: 15px;
}
.status-rings .ring {
  width: 34px; height: 34px; border-radius: 50%; margin-left: -8px;
  padding: 2px; background: conic-gradient(from 200deg, var(--cyan), var(--violet), var(--magenta), var(--cyan));
  display: grid; place-items: center;
}
.status-rings .ring:first-child { margin-left: 0; }
.status-rings .ring.seen { background: rgba(255, 255, 255, 0.14); }
.status-rings .ring > .avatar { width: 100%; height: 100%; border-radius: 50%; font-size: 12px; box-shadow: none; }
.status-rail-text { display: grid; min-width: 0; flex: 1; }
.status-rail-text strong { font-size: 13px; }
.status-rail-text span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plus-dot { color: var(--lime); font-size: 19px; font-weight: 600; }

.chat-scroll { flex: 1; overflow-y: auto; min-height: 0; padding: 0 8px 8px; }
.chat-list { display: grid; gap: 4px; }
.chat-item {
  display: flex; gap: 12px; align-items: center; width: 100%;
  padding: 11px 10px; border-radius: 13px; text-align: left;
  border: 1px solid transparent; transition: 0.18s; position: relative;
}
.chat-item:hover { background: rgba(255, 255, 255, 0.035); }
.chat-item.active {
  background: linear-gradient(90deg, rgba(34, 230, 255, 0.12), rgba(123, 92, 255, 0.06));
  border-color: rgba(34, 230, 255, 0.28);
}
.chat-item.active::before {
  content: ''; position: absolute; left: 0; top: 18%; bottom: 18%; width: 2px;
  background: var(--cyan); box-shadow: 0 0 12px var(--cyan); border-radius: 2px;
}
.ci-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.ci-top { display: flex; align-items: baseline; gap: 8px; }
.ci-top strong { font-size: 14px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-top .time { margin-left: auto; font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); flex: none; }
.ci-sub { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 12.5px; min-width: 0; }
.ci-sub .preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ci-sub .ticks { flex: none; }
.badge {
  min-width: 19px; height: 19px; padding: 0 6px; border-radius: 10px;
  background: linear-gradient(120deg, var(--cyan), var(--violet)); color: #04121a;
  font-size: 11px; font-weight: 700; display: grid; place-items: center; flex: none;
}
.empty-hint { padding: 34px 22px; text-align: center; color: var(--muted-2); font-size: 13px; }
.empty-hint p { color: var(--muted); margin: 0 0 4px; font-size: 14px; }
.side-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 16px; border-top: 1px solid rgba(255, 255, 255, 0.05); color: var(--muted-2);
}
.lock-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--lime); }
.lock-pill i { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); animation: pulse 2.6s infinite; }

/* ============================== CHAT PANE ============================== */
.chat-pane { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-placeholder {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 16px; padding: 40px; text-align: center;
}
.ph-orbit { position: relative; width: 132px; height: 132px; margin-bottom: 8px; }
.ph-orbit span {
  position: absolute; inset: 0; border-radius: 50%;
  border: 1px solid rgba(34, 230, 255, 0.35); animation: spin 14s linear infinite;
}
.ph-orbit span:nth-child(2) { inset: 20px; border-color: rgba(255, 47, 160, 0.4); animation-duration: 9s; animation-direction: reverse; }
.ph-orbit span:nth-child(3) {
  inset: 44px; border-color: rgba(168, 255, 96, 0.45); animation-duration: 6s;
  box-shadow: 0 0 30px rgba(34, 230, 255, 0.25);
}
.chat-placeholder h2 { font-family: var(--display); font-size: 21px; letter-spacing: 0.09em; margin: 0; font-weight: 500; }
.chat-placeholder p { color: var(--muted); max-width: 480px; font-size: 13.5px; line-height: 1.7; margin: 0; }
.ph-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-top: 12px; width: min(620px, 100%); }
.ph-grid > div {
  padding: 15px; border-radius: 13px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025); display: grid; gap: 4px;
}
.ph-grid b { font-family: var(--mono); font-size: 12px; color: var(--cyan); font-weight: 500; }
.ph-grid span { font-size: 11.5px; color: var(--muted-2); }

.chat-view { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px;
  border-bottom: 1px solid var(--line); background: rgba(8, 12, 20, 0.75);
  backdrop-filter: blur(16px);
}
.chat-head-text { display: grid; min-width: 0; flex: 1; }
.chat-head-text strong { font-size: 15px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-head-text span { font-size: 11px; color: var(--cyan); opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.back-btn { display: none; }

.crypto-banner {
  display: flex; align-items: center; gap: 9px;
  padding: 9px 18px; font-size: 11.5px; color: var(--muted);
  background: linear-gradient(90deg, rgba(34, 230, 255, 0.06), rgba(123, 92, 255, 0.04), transparent);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.crypto-banner .dot { width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); flex: none; }

.messages { flex: 1; overflow-y: auto; padding: 22px 22px 8px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.msg { display: flex; gap: 8px; max-width: min(660px, 82%); animation: msgIn 0.22s ease-out; }
@keyframes msgIn { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.msg.in { align-self: flex-start; }
.msg.out { align-self: flex-end; flex-direction: row-reverse; }
.msg .avatar { width: 30px; height: 30px; border-radius: 9px; font-size: 11.5px; margin-top: 2px; }
.bubble {
  position: relative; padding: 9px 13px 7px; border-radius: 15px;
  background: rgba(20, 27, 41, 0.9); border: 1px solid rgba(255, 255, 255, 0.06);
  min-width: 92px;
}
.msg.in .bubble { border-bottom-left-radius: 5px; }
.msg.out .bubble {
  background: linear-gradient(135deg, rgba(18, 96, 122, 0.95), rgba(46, 44, 118, 0.92));
  border-color: rgba(34, 230, 255, 0.3); border-bottom-right-radius: 5px;
  box-shadow: 0 0 26px -14px rgba(34, 230, 255, 0.9);
}
.bubble .sender { font-size: 11.5px; font-weight: 600; color: hsl(var(--h, 190) 90% 70%); margin-bottom: 3px; }
.bubble .body { font-size: 14.5px; line-height: 1.5; word-break: break-word; white-space: pre-wrap; }
.bubble .meta {
  display: flex; align-items: center; justify-content: flex-end; gap: 6px;
  margin-top: 4px; font-family: var(--mono); font-size: 10px; color: rgba(198, 224, 240, 0.55);
}
.bubble .meta button { color: rgba(198, 224, 240, 0.4); display: grid; place-items: center; }
.bubble .meta button:hover { color: var(--cyan); }
.bubble .meta svg { width: 12px; height: 12px; }
.ticks { display: inline-flex; color: rgba(198, 224, 240, 0.55); }
.ticks svg { width: 15px; height: 15px; stroke-width: 2.2; }
.ticks.read { color: var(--cyan); filter: drop-shadow(0 0 6px rgba(34, 230, 255, 0.8)); }
.msg.pending { opacity: 0.62; }

/* voice note */
.voice { display: flex; align-items: center; gap: 10px; min-width: 190px; padding: 2px 0; }
.voice .play {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: rgba(34, 230, 255, 0.16); border: 1px solid rgba(34, 230, 255, 0.4); color: var(--cyan);
}
.voice .bars { display: flex; align-items: center; gap: 2px; height: 26px; flex: 1; }
.voice .bars i { width: 2.5px; border-radius: 2px; background: rgba(140, 220, 245, 0.55); display: block; }
.voice.playing .bars i { background: var(--cyan); }
.voice .dur { font-family: var(--mono); font-size: 10.5px; color: rgba(198, 224, 240, 0.65); }

.typing-line { min-height: 20px; padding: 0 24px 4px; font-size: 11.5px; color: var(--cyan); display: flex; align-items: center; gap: 7px; opacity: 0; transition: 0.2s; }
.typing-line.show { opacity: 1; }
.typing-dots { display: inline-flex; gap: 3px; }
.typing-dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--cyan); animation: bounce 1.2s infinite; }
.typing-dots i:nth-child(2) { animation-delay: 0.15s; }
.typing-dots i:nth-child(3) { animation-delay: 0.3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.45; } 30% { transform: translateY(-4px); opacity: 1; } }

.composer { padding: 12px 18px calc(14px + env(safe-area-inset-bottom)); border-top: 1px solid rgba(255, 255, 255, 0.05); background: rgba(7, 11, 18, 0.8); backdrop-filter: blur(16px); }
.composer-main { display: flex; align-items: flex-end; gap: 9px; }
#msg-input {
  resize: none; max-height: 130px; padding: 11px 14px; border-radius: 14px;
  background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 14.5px; line-height: 1.45;
}
#msg-input:focus { border-color: rgba(34, 230, 255, 0.5); box-shadow: 0 0 0 3px rgba(34, 230, 255, 0.08); }
.rec-bar { display: flex; align-items: center; gap: 12px; padding: 6px 4px; }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); box-shadow: 0 0 14px var(--danger); animation: pulse 1s infinite; }
.rec-wave { flex: 1; height: 26px; display: flex; align-items: center; gap: 2px; }
.rec-wave i { width: 3px; border-radius: 2px; background: var(--cyan); opacity: 0.8; }

/* ============================== MODALS ============================== */
.modal-root { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 20px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(2, 4, 8, 0.76); backdrop-filter: blur(6px); }
.modal {
  position: relative; width: min(520px, 100%); max-height: min(86dvh, 780px);
  overflow-y: auto; padding: 24px; animation: modalIn 0.2s ease-out;
}
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(0.985); } to { opacity: 1; transform: none; } }
.modal h3 { margin: 0 0 4px; font-family: var(--display); font-size: 17px; letter-spacing: 0.06em; }
.modal .sub { margin: 0 0 18px; color: var(--muted); font-size: 12.5px; }
.modal-close { position: absolute; top: 14px; right: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }
.user-list { display: grid; gap: 6px; max-height: 46dvh; overflow-y: auto; margin: 12px 0 0; }
.user-row {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 10px 11px;
  border-radius: 12px; border: 1px solid transparent; text-align: left; transition: 0.16s;
}
.user-row:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--line); }
.user-row .ur-text { display: grid; min-width: 0; flex: 1; }
.user-row strong { font-size: 13.5px; }
.user-row span { font-size: 11.5px; color: var(--muted); }
.user-row.picked { border-color: rgba(34, 230, 255, 0.5); background: rgba(34, 230, 255, 0.09); }
.check { width: 18px; height: 18px; border-radius: 6px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; flex: none; }
.user-row.picked .check { background: var(--cyan); border-color: var(--cyan); color: #04121a; }
.check svg { width: 12px; height: 12px; stroke-width: 3; }
.field-inline { display: flex; gap: 10px; align-items: center; }
.kv { display: grid; gap: 10px; margin-top: 14px; }
.kv > div {
  display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; align-items: start;
  padding-bottom: 10px; border-bottom: 1px dashed rgba(255, 255, 255, 0.07);
}
.kv dt, .kv .k { font-family: var(--mono); font-size: 10.5px; color: var(--muted-2); letter-spacing: 0.06em; text-transform: uppercase; }
.kv .v { font-family: var(--mono); font-size: 11.5px; color: var(--tone, var(--cyan)); word-break: break-all; line-height: 1.5; }
.kv .v.plain { color: var(--text); font-family: var(--font); font-size: 13px; }
.cipher-box {
  margin-top: 14px; padding: 13px; border-radius: 11px; max-height: 200px; overflow: auto;
  background: rgba(0, 0, 0, 0.42); border: 1px solid rgba(34, 230, 255, 0.18);
  font-family: var(--mono); font-size: 10.5px; line-height: 1.6; color: #7fe3f7; word-break: break-all;
}
.fp-grid { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.fp-grid span {
  font-family: var(--mono); font-size: 12.5px; padding: 6px 9px; border-radius: 8px;
  background: rgba(34, 230, 255, 0.08); border: 1px solid rgba(34, 230, 255, 0.2); color: var(--cyan);
}

/* status viewer */
.story-modal { padding: 0; width: min(430px, 100%); overflow: hidden; }
.story-top { display: flex; gap: 2px; padding: 10px 10px 0; }
.story-top i { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); }
.story-top i.on { background: var(--cyan); box-shadow: 0 0 8px var(--cyan); }
.story-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; }
.story-head .st-text { display: grid; }
.story-head strong { font-size: 13.5px; }
.story-head span { font-size: 11px; color: var(--muted); }
.story-body {
  min-height: 320px; display: grid; place-items: center; padding: 26px 22px;
  font-size: 19px; text-align: center; line-height: 1.55; white-space: pre-wrap;
  background: linear-gradient(150deg, rgba(34, 230, 255, 0.16), rgba(123, 92, 255, 0.22), rgba(255, 47, 160, 0.16));
}
.story-foot { padding: 12px 16px 16px; display: grid; gap: 10px; }
.story-views { display: flex; flex-wrap: wrap; gap: 8px; }
.story-views span { font-size: 11.5px; color: var(--muted); padding: 4px 9px; border-radius: 20px; background: rgba(255, 255, 255, 0.06); }

/* ---------------------------- photo bubbles ---------------------------- */
.bubble.photo-bubble { padding: 4px 4px 2px; }
.bubble.photo-bubble .ph-img {
  display: block; max-width: 268px; max-height: 320px; width: auto; height: auto;
  border-radius: 11px; cursor: zoom-in; background: rgba(0, 0, 0, 0.35);
  object-fit: cover;
}
.bubble.photo-bubble .meta { padding: 3px 8px 2px; }
.ph-loading {
  width: 210px; height: 150px; border-radius: 11px; display: grid; place-items: center;
  background: linear-gradient(110deg, rgba(34,230,255,0.09), rgba(123,92,255,0.15), rgba(34,230,255,0.09));
  background-size: 200% 100%; animation: shimmer 1.6s linear infinite; color: var(--muted);
  font-family: var(--mono); font-size: 11px;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.lightbox-img { display: block; width: 100%; border-radius: 12px; background: rgba(0,0,0,0.4); }
.lightbox-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 14px; }

/* ------------------------------ call dialog ----------------------------- */
.call-screen {
  position: fixed; inset: 0; z-index: 120; display: flex; flex-direction: column;
  align-items: center; justify-content: space-between; padding: 24px 20px calc(28px + env(safe-area-inset-bottom));
  background: radial-gradient(900px 620px at 50% 0%, rgba(34, 230, 255, 0.14), transparent 62%),
              radial-gradient(700px 600px at 80% 100%, rgba(123, 92, 255, 0.22), transparent 62%),
              #04060b;
  animation: callIn 0.24s ease-out;
}
@keyframes callIn { from { opacity: 0; transform: scale(0.98); } to { opacity: 1; transform: none; } }
.call-bg {
  position: absolute; inset: 0; pointer-events: none; opacity: 0.5;
  background-image: linear-gradient(rgba(80, 200, 255, 0.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(80, 200, 255, 0.05) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 45%, #000 10%, transparent 72%);
}
.call-remote {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  background: #04060b; opacity: 0; transition: opacity 0.35s;
}
.call-screen[data-video="remote"] .call-remote { opacity: 1; }
.call-veil { position: absolute; inset: 0; pointer-events: none; opacity: 0;
  background: linear-gradient(180deg, rgba(4, 6, 11, 0.86), rgba(4, 6, 11, 0.1) 30%, rgba(4, 6, 11, 0.1) 66%, rgba(4, 6, 11, 0.9)); }
.call-screen[data-video="remote"] .call-veil { opacity: 1; }
.call-topbar {
  position: relative; z-index: 3; width: 100%; display: flex; align-items: center; justify-content: space-between;
  color: var(--muted);
}
.call-crypto {
  display: inline-flex; align-items: center; gap: 8px; font-size: 10.5px; letter-spacing: 0.14em;
  color: var(--lime); padding: 6px 11px; border-radius: 20px;
  border: 1px solid rgba(168, 255, 96, 0.3); background: rgba(168, 255, 96, 0.07);
}
.call-crypto i { width: 6px; height: 6px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 10px var(--lime); animation: pulse 2s infinite; }
#call-timer { color: var(--cyan); font-size: 12px; }
.call-center {
  position: relative; z-index: 3; display: flex; flex-direction: column; align-items: center; gap: 12px;
  margin-top: clamp(20px, 8vh, 90px);
}
.call-avatar-ring { position: relative; display: grid; place-items: center; }
.call-avatar-ring::before, .call-avatar-ring::after {
  content: ''; position: absolute; border-radius: 50%; border: 1px solid rgba(34, 230, 255, 0.4);
  width: 132px; height: 132px; animation: callRing 2.6s ease-out infinite;
}
.call-avatar-ring::after { animation-delay: 1.3s; border-color: rgba(255, 47, 160, 0.35); }
@keyframes callRing { 0% { transform: scale(0.78); opacity: 0.9; } 100% { transform: scale(1.5); opacity: 0; } }
.call-avatar-ring .avatar { width: 96px; height: 96px; border-radius: 50%; font-size: 30px; box-shadow: 0 0 50px -12px rgba(34, 230, 255, 0.9); }
.call-screen[data-state="active"] .call-avatar-ring::before,
.call-screen[data-state="active"] .call-avatar-ring::after { animation-duration: 4.2s; }
.call-center h2 { font-family: var(--display); font-size: 20px; letter-spacing: 0.08em; margin: 6px 0 0; font-weight: 500; }
#call-status { color: var(--cyan); font-size: 12px; letter-spacing: 0.08em; margin: 0; }
.call-screen[data-video="remote"] .call-center { opacity: 0; pointer-events: none; }
.call-local {
  position: absolute; right: 18px; bottom: 122px; width: 108px; height: 148px; z-index: 4;
  object-fit: cover; border-radius: 14px; border: 1px solid rgba(34, 230, 255, 0.45);
  box-shadow: 0 18px 40px -18px #000, 0 0 24px -10px rgba(34, 230, 255, 0.8);
  background: #070b12;
}
.call-controls { position: relative; z-index: 4; display: flex; align-items: center; justify-content: center; gap: 16px; }
.call-btn {
  width: 58px; height: 58px; border-radius: 50%; display: grid; place-items: center;
  color: var(--text); border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(18, 26, 40, 0.86); backdrop-filter: blur(14px);
  transition: 0.2s; box-shadow: 0 14px 30px -18px #000;
}
.call-btn svg { width: 23px; height: 23px; }
.call-btn:hover { border-color: var(--line-strong); color: var(--cyan); }
.call-btn.off { background: rgba(226, 240, 255, 0.92); color: #0a1018; }
.call-btn.danger { background: linear-gradient(140deg, #ff4d6d, #c2113c); border-color: transparent; color: #fff; box-shadow: 0 0 34px -10px rgba(255, 77, 109, 0.9); }
.call-btn.danger:hover { filter: brightness(1.08); color: #fff; }
.call-btn.accept { background: linear-gradient(140deg, #a8ff60, #2fd07a); border-color: transparent; color: #04120a; box-shadow: 0 0 34px -10px rgba(168, 255, 96, 0.9); animation: pulse 1.8s infinite; }
.call-btn.accept:hover { color: #04120a; }

/* --------------------------- call: badges & grid --------------------------- */
.call-badges {
  position: relative; z-index: 5; display: flex; flex-wrap: wrap; gap: 8px;
  justify-content: center; margin: 10px 0 0; min-height: 0;
}
.badge-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em;
  padding: 5px 10px; border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.14); background: rgba(10, 16, 26, 0.72);
  color: var(--muted); backdrop-filter: blur(10px);
}
.badge-pill.crypto { color: var(--lime); border-color: rgba(168, 255, 96, 0.32); background: rgba(168, 255, 96, 0.08); }
.badge-pill.route.relay { color: var(--cyan); border-color: rgba(34, 230, 255, 0.4); background: rgba(34, 230, 255, 0.09); }
.badge-pill.route.direct { color: #b7a6ff; border-color: rgba(123, 92, 255, 0.4); background: rgba(123, 92, 255, 0.1); }

.call-grid {
  position: relative; z-index: 3; flex: 1; width: 100%;
  display: grid; gap: 12px; padding: 14px 4px; align-content: center;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  grid-auto-rows: minmax(140px, 1fr);
  max-height: 62vh;
}
.call-screen[data-layout='grid'] .call-center { display: none; }
.call-screen[data-layout='grid'] .call-remote { opacity: 0; }
.call-screen[data-layout='grid'] .call-veil { opacity: 0; }
.call-tile {
  position: relative; border-radius: 16px; overflow: hidden;
  background: linear-gradient(150deg, rgba(20, 30, 48, 0.95), rgba(9, 14, 22, 0.95));
  border: 1px solid rgba(34, 230, 255, 0.16);
  display: grid; place-items: center; min-height: 140px;
  box-shadow: 0 20px 50px -30px #000;
}
.call-tile.self { border-color: rgba(168, 255, 96, 0.32); }
.call-tile .tile-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: 0; transition: opacity 0.3s; background: #05080e;
}
.call-tile.has-video .tile-video { opacity: 1; }
.call-tile .tile-avatar {
  width: 74px; height: 74px; border-radius: 50%; font-size: 24px;
  box-shadow: 0 0 40px -14px rgba(34, 230, 255, 0.9);
}
.call-tile.has-video .tile-avatar { opacity: 0; }
.call-tile .tile-name {
  position: absolute; left: 10px; bottom: 9px; z-index: 2;
  font-size: 11.5px; font-weight: 600; padding: 3px 9px; border-radius: 8px;
  background: rgba(4, 8, 14, 0.7); backdrop-filter: blur(6px);
  max-width: calc(100% - 20px); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.call-tile .tile-flag { position: absolute; right: 9px; bottom: 9px; z-index: 2; font-size: 12px; }

/* turn settings block in the menu modal */
.turn-form { display: grid; gap: 10px; margin-top: 12px; }
.turn-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .turn-form .row { grid-template-columns: 1fr; } }

/* --------------------------- PWA prompts & offline --------------------------- */
.pwa-prompts { display: grid; gap: 8px; padding: 0 12px 10px; }
.pwa-card {
  position: relative; padding: 11px 12px 12px; border-radius: 13px;
  border: 1px solid rgba(123, 92, 255, 0.34);
  background: linear-gradient(105deg, rgba(123, 92, 255, 0.16), rgba(34, 230, 255, 0.07));
  display: grid; gap: 8px; animation: promptIn 0.3s ease-out;
}
@keyframes promptIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.pwa-card .pc-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 650; }
.pwa-card .pc-head svg { width: 15px; height: 15px; color: var(--cyan); flex: none; }
.pwa-card p { margin: 0; font-size: 11.5px; line-height: 1.55; color: var(--muted); }
.pwa-card .pc-actions { display: flex; gap: 8px; }
.pwa-card .pc-actions .btn { flex: 1; padding: 8px 10px; font-size: 12px; }
.pwa-card .pc-close {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  display: grid; place-items: center; color: var(--muted-2); border-radius: 7px;
}
.pwa-card .pc-close:hover { color: var(--text); background: rgba(255, 255, 255, 0.07); }
.pwa-card .pc-close svg { width: 12px; height: 12px; }
.pwa-card .ios-step {
  display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--text);
}
.pwa-card .ios-step b {
  width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  background: rgba(34, 230, 255, 0.16); color: var(--cyan); font-size: 10px; flex: none;
}

.net-banner {
  position: fixed; left: 50%; transform: translateX(-50%); top: 10px; z-index: 70;
  display: flex; align-items: center; gap: 9px; padding: 9px 15px; border-radius: 22px;
  font-size: 12px; color: #ffd9a8; border: 1px solid rgba(255, 176, 32, 0.45);
  background: rgba(28, 18, 6, 0.94); backdrop-filter: blur(12px);
  box-shadow: 0 14px 34px -18px #000; max-width: calc(100% - 24px);
}
.net-banner svg { width: 15px; height: 15px; color: #ffb020; flex: none; }

/* ------------------------------ contacts UI ------------------------------ */
.contact-row {
  display: flex; align-items: center; gap: 11px; padding: 9px 10px;
  border-radius: 11px; border: 1px solid transparent; text-align: left; width: 100%;
}
.contact-row:hover { background: rgba(255, 255, 255, 0.04); border-color: var(--line); }
.contact-row .cr-text { display: grid; min-width: 0; flex: 1; gap: 1px; }
.contact-row strong { font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.contact-row span { font-size: 11.5px; color: var(--muted); font-family: var(--mono); }
.contact-row .cr-actions { display: flex; gap: 6px; flex: none; }
.contact-row .cr-actions .icon-btn { width: 30px; height: 30px; }
.contact-row .cr-actions .icon-btn svg { width: 15px; height: 15px; }
.contact-av {
  width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center;
  font-family: var(--display); font-size: 12px; font-weight: 700; color: #05080f;
  background: linear-gradient(135deg, hsl(var(--h, 190) 90% 68%), hsl(calc(var(--h, 190) + 50) 85% 60%));
}
.import-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 4px 0 12px; }
.import-tabs button {
  padding: 9px 6px; border-radius: 10px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line); color: var(--muted); background: rgba(255, 255, 255, 0.02);
}
.import-tabs button.active { color: #04121a; background: linear-gradient(120deg, var(--cyan), #6ff0ff); border-color: transparent; }
.dropzone {
  display: grid; place-items: center; gap: 6px; padding: 20px 14px; border-radius: 13px;
  border: 1.5px dashed rgba(34, 230, 255, 0.34); background: rgba(34, 230, 255, 0.04);
  text-align: center; cursor: pointer; transition: 0.2s;
}
.dropzone:hover { border-color: var(--cyan); background: rgba(34, 230, 255, 0.08); }
.dropzone svg { width: 22px; height: 22px; color: var(--cyan); }
.dropzone b { font-size: 12.5px; }
.dropzone span { font-size: 11px; color: var(--muted-2); }
.notif-state { display: flex; align-items: center; gap: 9px; font-size: 12px; margin-top: 10px; }
.notif-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted-2); flex: none; }
.notif-dot.on { background: var(--lime); box-shadow: 0 0 10px var(--lime); }
.notif-dot.blocked { background: var(--danger); box-shadow: 0 0 10px var(--danger); }

/* toasts */
.toast-root { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(420px, calc(100% - 32px)); }
.toast {
  padding: 12px 16px; border-radius: 12px; font-size: 13px;
  background: rgba(12, 18, 28, 0.96); border: 1px solid var(--line-strong);
  box-shadow: 0 18px 40px -20px #000; animation: toastIn 0.2s ease-out;
}
.toast.err { border-color: rgba(255, 77, 109, 0.55); color: #ffc2cc; }
.toast.ok { border-color: rgba(168, 255, 96, 0.5); color: #d5ffb0; }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* scrollbars */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: rgba(34, 230, 255, 0.18); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(34, 230, 255, 0.34); }
::-webkit-scrollbar-track { background: transparent; }

/* ============================== RESPONSIVE ============================== */
@media (max-width: 940px) {
  .pwa-prompts { padding: 0 10px 8px; }
  .net-banner { top: calc(6px + env(safe-area-inset-top)); font-size: 11.5px; }
  .call-local { width: 86px; height: 116px; right: 12px; bottom: 108px; }
  .call-btn { width: 54px; height: 54px; }
  .call-controls { gap: 12px; }
  .chat-head .icon-btn { width: 34px; height: 34px; }
  .auth-wrap { grid-template-columns: minmax(0, 1fr); gap: 30px; justify-items: center; }
  .auth-brand { max-width: 460px; text-align: center; }
  .brand-mark { margin: 0 auto 18px; }
  .algo-list { text-align: left; }
  .brand-note { margin: 0 auto; }
  .auth-card { width: min(430px, 100%); }
  .app-screen { grid-template-columns: minmax(0, 1fr); }
  .sidebar { border-right: 0; }
  .chat-pane { position: fixed; inset: 0; z-index: 40; background: var(--bg); transform: translateX(100%); transition: transform 0.26s cubic-bezier(0.4, 0, 0.2, 1); }
  .app-screen.chat-open .chat-pane { transform: none; }
  .back-btn { display: grid; }
  .messages { padding: 18px 14px 8px; }
  .msg { max-width: 88%; }
  .composer { padding: 10px 12px calc(12px + env(safe-area-inset-bottom)); }
  .chat-head { padding: 11px 12px; }
  .crypto-banner { font-size: 10.5px; padding: 8px 14px; }
  .chat-placeholder { display: none; }
  .ph-grid { grid-template-columns: minmax(0, 1fr); }
  .modal { width: 100%; max-height: 92dvh; padding: 20px; }
}
@media (max-width: 420px) {
  .brand-title { font-size: 36px; letter-spacing: 0.13em; }
  .status-rail-text span { display: none; }
}

/* compact auth for small phones: keep the form above the fold */
@media (max-width: 640px) {
  .auth-screen { padding: 16px 14px 26px; align-items: start; }
  .auth-wrap { gap: 18px; padding-top: 8px; }
  .brand-mark { width: 54px; height: 54px; margin-bottom: 10px; }
  .brand-mark .nucleus { inset: 20px; }
  .brand-mark .orbit-b { inset: 9px -4px; }
  .brand-title { font-size: 32px; letter-spacing: 0.12em; }
  .brand-sub { margin-bottom: 12px; font-size: 10px; letter-spacing: 0.22em; }
  .algo-list, .brand-note { display: none; }
  .auth-card { padding: 20px 18px; }
  .tabs { margin-bottom: 16px; }
  .auth-form { gap: 12px; }
}
