/* =====================================================================
   Diskrit — Premium Dark Glassmorphism UI
   ===================================================================== */

:root{
  --bg-0:#05060a;
  --bg-1:#0a0c14;
  --bg-2:#10131c;
  --glass:rgba(255,255,255,0.045);
  --glass-strong:rgba(255,255,255,0.08);
  --border:rgba(255,255,255,0.08);
  --border-soft:rgba(255,255,255,0.06);
  --text-0:#eef0fa;
  --text-1:#aab0c4;
  --text-2:#6d7488;
  --accent-1:#7744ff;
  --accent-2:#a05aff;
  --accent-grad:linear-gradient(135deg,var(--accent-1),var(--accent-2));
  --success:#33d986;
  --danger:#ff5a7a;
  --warn:#ffb84d;
  --radius-lg:26px;
  --radius-md:18px;
  --radius-sm:12px;
  --safe-top:env(safe-area-inset-top,0px);
  --safe-bottom:env(safe-area-inset-bottom,0px);
  --shadow-soft:0 10px 40px rgba(0,0,0,0.35);
}

[hidden]{ display:none !important; }

*{box-sizing:border-box;}
html,body{
  margin:0; padding:0; height:100%;
  background:radial-gradient(circle at 50% 0%, rgba(110,50,220,0.10), transparent 55%),
             var(--bg-0);
  color:var(--text-0);
  font-family:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  overflow:hidden;
  -webkit-font-smoothing:antialiased;
  -webkit-tap-highlight-color:transparent;
  user-select:none;
}
input, textarea{ user-select:text; -webkit-user-select:text; }
button{ font-family:inherit; }

/* ─────────────────────────────────────────────────────────────────────
   SPLASH
   ───────────────────────────────────────────────────────────────────── */
/* ─────────────────────────────────────────────────────────────────────
   SPLASH SCREEN
   ───────────────────────────────────────────────────────────────────── */

/* === BACKGROUND === */
/* ─────────────────────────────────────────────────────────────────────
   SPLASH SCREEN
   PNG loaded via <img> (Vite public-folder files can't be referenced by
   CSS url() with a dynamic base path).  A sibling gradient div (.splash-img-fade)
   sits above the img and fades it to the background colour starting at 69 %
   — right after the tagline ends — so the baked-in slider handle inside the
   PNG is completely hidden.  The HTML .splash-continue renders above that on
   the dark background with no duplicate elements.
   ───────────────────────────────────────────────────────────────────── */
.splash{
  position:fixed; inset:0; z-index:9999;
  background:#010008;
  overflow:hidden;
}

/* Reference PNG — covers the whole splash */
.splash-bg-img{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:cover; object-position:center top;
  z-index:0; pointer-events:none;
}

/* Gradient overlay — fades the PNG out at 52–57 %, right after the shield's
   V-point and before the baked-in wordmark begins.  Wordmark and tagline are
   rendered as HTML below for independent sizing. */
.splash-img-fade{
  position:absolute; inset:0; z-index:1; pointer-events:none;
  background:linear-gradient(to bottom, transparent 52%, #010008 57%);
}

/* ── HTML wordmark + tagline ── */
.splash-brand{
  position:absolute;
  top:57%;
  left:50%; transform:translateX(-50%);
  z-index:2;
  display:flex; flex-direction:column; align-items:center; gap:8px;
  pointer-events:none;
  animation:fadeInDelay .65s ease .25s both;
  white-space:nowrap;
}
/* DISKRIT — 15–20 % smaller than the PNG equivalent; still dominant */
.splash-wordmark{
  font-family:'Orbitron', sans-serif; font-weight:900;
  font-size:clamp(1.85rem, 7.8vw, 2.35rem);
  letter-spacing:.05em;
  background:linear-gradient(160deg, #fff 0%, #ecdeff 35%, #c088ff 68%, #9044ee 100%);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
  filter:drop-shadow(0 0 18px rgba(160,90,255,.55));
  margin:0; line-height:1;
}
/* PRIVATE BY DESIGN. — supporting role; extra letter spacing, dimmer */
.splash-tagline{
  font-size:clamp(.50rem, 2.0vw, .62rem);
  letter-spacing:.28em;
  font-weight:500;
  color:rgba(200,175,240,.68);
  margin:0;
  display:flex; align-items:center; gap:10px;
}
.splash-tagline::before,.splash-tagline::after{
  content:''; display:block; height:1px; width:22px;
  background:rgba(180,140,255,.35);
  flex-shrink:0;
}

/* === INTERACTIVE SLIDER ===
   Anchored from the bottom so it always sits in the lower third of the
   screen regardless of device height.  The gap between the tagline (which
   ends at ~69 % of viewport) and the slider is the intentional luxury
   breathing room — no fixed top% needed.
   env(safe-area-inset-bottom) covers iPhone home indicator;
   the 48 px minimum keeps it above Android browser toolbars. */
.splash-continue{
  position:absolute;
  bottom: max(calc(env(safe-area-inset-bottom) + 48px), 60px);
  left:50%; transform:translateX(-50%);
  display:flex; flex-direction:column; align-items:center;
  animation:fadeInDelay .65s ease .4s both;
  width:min(90vw,340px);
  z-index:2;
}
@keyframes fadeInDelay{ from{opacity:0;} to{opacity:1;} }

.splash-slider{
  position:relative; height:76px; width:100%;
  background:rgba(6,2,14,.94);
  border:2px solid rgba(140,70,255,.60);
  border-radius:38px;
  box-shadow:
    0 0 28px rgba(110,50,240,.22),
    0 0 60px rgba(90,30,200,.10),
    inset 0 1px 0 rgba(255,255,255,.04);
  touch-action:none; user-select:none; overflow:hidden;
}

.splash-slider-text{
  position:absolute; left:92px; right:16px; top:50%; transform:translateY(-50%);
  font-size:.72rem; letter-spacing:.12em; font-weight:500;
  color:rgba(214,190,252,.68);
  pointer-events:none; white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

.splash-caption{
  margin:20px 0 0; font-size:11px; letter-spacing:.12em; font-weight:500;
  color:rgba(200,180,240,.72); text-align:center;
  display:flex; align-items:center; gap:5px;
}
.splash-lock-icon{
  width:12px; height:15px; stroke:currentColor; flex-shrink:0;
}

.splash-slider-handle{
  position:absolute; left:4px; top:4px;
  width:68px; height:68px; border-radius:50%;
  touch-action:none;
  background-image:
    radial-gradient(ellipse 60% 38% at 44% 26%, rgba(255,255,255,.30) 0%, transparent 72%),
    linear-gradient(138deg, #c080ff 0%, #7733dd 52%, #5422bb 100%);
  border:1px solid rgba(215,175,255,.32);
  box-shadow:
    0 0 24px rgba(140,80,255,.78),
    0 0 58px rgba(110,55,205,.40),
    0 3px 10px rgba(0,0,0,.65);
  display:flex; align-items:center; justify-content:center;
  cursor:grab; will-change:transform;
  /* Subtle idle glow, then a sharp burst every ~5 s to draw the eye */
  animation:handlePulse 5s ease-in-out 2.5s infinite;
}
.splash-slider-handle:active{ cursor:grabbing; }
.splash-chevrons{ width:26px; height:26px; flex-shrink:0; }
@keyframes handlePulse{
  /* Resting state — most of the cycle */
  0%, 75%  { box-shadow:0 0 24px rgba(140,80,255,.78),0 0 58px rgba(110,55,205,.40),0 3px 10px rgba(0,0,0,.65); }
  /* Sharp burst — eye-catching but not intrusive */
  88%      { box-shadow:0 0 52px rgba(190,130,255,1),0 0 120px rgba(160,100,255,.65),0 0 200px rgba(130,70,240,.25),0 3px 10px rgba(0,0,0,.65); }
  /* Return to rest */
  100%     { box-shadow:0 0 24px rgba(140,80,255,.78),0 0 58px rgba(110,55,205,.40),0 3px 10px rgba(0,0,0,.65); }
}

/* === SHARED ANIMATIONS (used by splash and auth screens) === */
@keyframes logoBreathe{
  0%,100%{ transform:scale(1) translateY(0); }
  50%     { transform:scale(1.02) translateY(-4px); }
}
@keyframes particleFloat{
  0%  { transform:translateY(0) scale(1);      opacity:.32; }
  50% { transform:translateY(-20px) scale(1.5); opacity:.88; }
  100%{ transform:translateY(0) scale(1);      opacity:.32; }
}

/* === DISMISS ANIMATIONS === */
@keyframes splashOut{
  0%  { transform:translateX(0);      opacity:1; }
  100%{ transform:translateX(-100vw); opacity:0; visibility:hidden; pointer-events:none; }
}
.splash.splash-out{ animation:splashOut .6s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes splashFadeOut{
  0%  { opacity:1; }
  100%{ opacity:0; visibility:hidden; pointer-events:none; }
}
.splash.splash-unlock{ animation:splashFadeOut .65s ease forwards; }

/* ─────────────────────────────────────────────────────────────────────
   APP SHELL
   ───────────────────────────────────────────────────────────────────── */
.app{
  position:fixed; inset:0;
  display:flex; flex-direction:column;
  height:100%;
  overflow:hidden; /* clips screens during slide transitions */
}

.app-bar{
  display:flex; align-items:center; justify-content:space-between;
  padding:calc(var(--safe-top) + 14px) 16px 12px;
  flex-shrink:0;
  background:rgba(8,9,14,0.6);
  backdrop-filter:blur(18px) saturate(140%);
  -webkit-backdrop-filter:blur(18px) saturate(140%);
  border-bottom:1px solid var(--border-soft);
  z-index:20;
}
.app-bar-left, .app-bar-right{ display:flex; align-items:center; gap:8px; }
.app-bar-title{ font-size:17px; font-weight:700; letter-spacing:.2px; }
.icon-btn{
  width:38px;height:38px;border-radius:14px;
  background:var(--glass); border:1px solid var(--border-soft);
  color:var(--text-0); display:flex;align-items:center;justify-content:center;
  font-size:15px; cursor:pointer; transition:transform .15s ease, background .15s ease;
}
.icon-btn:active{ transform:scale(0.92); background:var(--glass-strong); }

/* Back chevron — bare, no box, large touch target */
#back-btn{
  width:44px; height:44px;
  background:none !important; border:none !important; border-radius:0 !important;
  color:rgba(255,255,255,.72);
  font-size:22px;
  margin-left:-6px;
  transition:color .15s ease;
}
#back-btn:active{
  transform:none !important;
  background:none !important;
  color:rgba(255,255,255,1);
}

/* ─────────────────────────────────────────────────────────────────────
   SCREENS
   ───────────────────────────────────────────────────────────────────── */
.screen{
  flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:18px 18px calc(var(--safe-bottom) + 18px);
  /* No CSS animation — JS handles slide transitions via inline styles */
}
/* Screens become fixed overlays during animated transitions */
.screen.nav-transitioning{
  position:fixed; top:var(--nav-top,56px); left:0; right:0; bottom:0;
  overflow-y:auto; will-change:transform;
  background:var(--bg,#08080b);
}

/* ─────────────────────────────────────────────────────────────────────
   HOME
   ───────────────────────────────────────────────────────────────────── */
.home-screen{ display:flex; flex-direction:column; gap:14px; }
.home-identity{ display:flex; gap:8px; margin-bottom:6px; flex-wrap:wrap; }
.pill{
  padding:6px 12px; border-radius:20px; font-size:12px; font-weight:600;
  background:var(--glass); border:1px solid var(--border-soft); color:var(--text-1);
}
.pill-muted{ color:var(--text-2); }

.card{
  display:flex; align-items:center; gap:14px;
  padding:18px; border-radius:var(--radius-lg);
  background:var(--glass);
  border:1px solid var(--border);
  backdrop-filter:blur(16px);
  cursor:pointer;
  transition:transform .16s cubic-bezier(.2,.8,.2,1), background .16s ease, box-shadow .2s ease;
  position:relative;
}
.card:active{ transform:scale(0.97); }
.card-primary{
  background:linear-gradient(135deg, rgba(90,120,255,0.16), rgba(160,90,255,0.10));
  border:1px solid rgba(150,140,255,0.25);
  box-shadow:0 8px 30px rgba(90,80,255,0.12);
}
.card-active{
  background:linear-gradient(135deg, rgba(51,217,134,0.14), rgba(51,180,217,0.08));
  border:1px solid rgba(51,217,134,0.28);
}
.card-icon{
  width:48px;height:48px;border-radius:16px; flex-shrink:0;
  background:rgba(255,255,255,0.06);
  display:flex;align-items:center;justify-content:center; font-size:18px;
}
.card-icon.pulse{ animation:iconPulse 1.8s ease-in-out infinite; color:var(--success); }
@keyframes iconPulse{ 0%,100%{ opacity:1; } 50%{ opacity:.55; } }
.card-body{ flex:1; min-width:0; }
.card-body h2{ font-size:15.5px; margin:0 0 3px; font-weight:700; }
.card-body p{ font-size:12.5px; margin:0; color:var(--text-1); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.card-arrow{ color:var(--text-2); font-size:13px; }
.badge{
  position:absolute; top:14px; right:38px;
  background:var(--danger); color:#fff; font-size:11px; font-weight:700;
  min-width:20px; height:20px; border-radius:10px; display:flex; align-items:center; justify-content:center; padding:0 5px;
}
.home-footer{ margin-top:auto; padding-top:10px; display:flex; justify-content:center; }
.link-btn{
  background:none;border:none;color:var(--text-1); font-size:13px; font-weight:600; cursor:pointer;
  display:flex; align-items:center; gap:6px; padding:10px;
}

/* ─────────────────────────────────────────────────────────────────────
   CENTER PANELS
   ───────────────────────────────────────────────────────────────────── */
.panel-center{
  display:flex; flex-direction:column; align-items:center; text-align:center;
  padding-top:8vh; gap:10px; max-width:420px; margin:0 auto;
}
.glyph-ring{
  width:76px;height:76px;border-radius:26px;
  background:linear-gradient(145deg, rgba(90,120,255,.16), rgba(160,90,255,.10));
  border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center; font-size:26px;
  color:#c9d0ff; margin-bottom:6px;
}
.ring-danger{ background:linear-gradient(145deg, rgba(255,90,122,.18), rgba(255,140,90,.08)); color:#ffb1c0; }
.spin-ring i{ animation:spin 2.2s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg); } }
.screen-title{ font-size:20px; font-weight:700; margin:2px 0 0; }
.screen-title-sm{ font-size:19px; font-weight:700; margin:4px 0 14px; }
.screen-sub{ font-size:13.5px; color:var(--text-1); line-height:1.5; margin:0 0 8px; }

.field-label{ font-size:12px; color:var(--text-2); align-self:flex-start; margin-top:10px; font-weight:600; }
.select-field, .code-input{
  width:100%; padding:14px 16px; border-radius:var(--radius-md);
  background:var(--glass); border:1px solid var(--border); color:var(--text-0);
  font-size:15px; margin-top:6px; outline:none;
}
.code-input{ text-align:center; letter-spacing:4px; font-weight:700; font-size:22px; text-transform:uppercase; }
.select-field:focus, .code-input:focus{ border-color:var(--accent-1); }

.btn-primary{
  width:100%; margin-top:18px; padding:15px; border-radius:var(--radius-md);
  background:var(--accent-grad); color:#fff; border:none; font-size:15px; font-weight:700;
  display:flex; align-items:center; justify-content:center; gap:8px; cursor:pointer;
  box-shadow:0 10px 30px rgba(100,90,255,0.25);
  transition:transform .15s ease;
}
.btn-primary:active{ transform:scale(0.97); }
.btn-secondary{
  width:100%; padding:14px; border-radius:var(--radius-md); margin-top:10px;
  background:var(--glass); border:1px solid var(--border); color:var(--text-0);
  font-size:14px; font-weight:600; display:flex; align-items:center; justify-content:center; gap:8px; cursor:pointer;
}
.btn-secondary:active{ transform:scale(0.97); }
.btn-danger-ghost{
  margin-top:14px; padding:12px 18px; background:none; border:none;
  color:var(--danger); font-size:13.5px; font-weight:600; cursor:pointer;
}
.row-actions{ display:flex; gap:10px; width:100%; }
.row-actions .btn-secondary{ margin-top:14px; }

.code-display{
  font-size:38px; font-weight:800; letter-spacing:6px; margin:10px 0 4px;
  background:var(--accent-grad); -webkit-background-clip:text; background-clip:text; color:transparent;
}
.countdown{ font-size:13px; color:var(--text-2); font-weight:600; }
.qr-wrap{ margin:16px 0; padding:14px; background:#fff; border-radius:18px; }
.qr-wrap canvas, .qr-wrap img{ display:block; width:150px; height:150px; }
.hint{ font-size:13px; color:var(--text-1); margin-top:14px; }

.progress-steps{ list-style:none; padding:0; margin:22px 0 6px; width:100%; text-align:left; display:flex; flex-direction:column; gap:14px; }
.progress-steps li{ display:flex; align-items:center; gap:10px; font-size:13.5px; color:var(--text-2); }
.progress-steps li.done{ color:var(--success); }
.progress-steps li.active{ color:var(--text-0); }
.progress-steps li i{ width:18px; text-align:center; }

/* ─────────────────────────────────────────────────────────────────────
   JOIN / REQUEST LIST
   ───────────────────────────────────────────────────────────────────── */
.list-header{ padding-top:2px; }
.request-list{ list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:12px; }
.request-item{
  display:flex; align-items:center; gap:12px; padding:14px; border-radius:var(--radius-md);
  background:var(--glass); border:1px solid var(--border);
}
.request-avatar{
  width:42px;height:42px;border-radius:14px; background:var(--accent-grad);
  display:flex;align-items:center;justify-content:center; font-weight:700; color:#fff; flex-shrink:0;
}
.request-info{ flex:1; min-width:0; }
.request-info strong{ display:block; font-size:14px; }
.request-info span{ font-size:12px; color:var(--text-2); }
.request-actions{ display:flex; gap:8px; }
.req-btn{
  width:36px;height:36px;border-radius:12px; border:none; cursor:pointer;
  display:flex;align-items:center;justify-content:center; font-size:14px;
}
.req-accept{ background:rgba(51,217,134,0.18); color:var(--success); }
.req-reject{ background:rgba(255,90,122,0.15); color:var(--danger); }
.empty-state{ display:flex; flex-direction:column; align-items:center; gap:10px; margin-top:16vh; color:var(--text-2); }
.empty-state i{ font-size:30px; }
.empty-state p{ font-size:13.5px; margin:0; }

/* ─────────────────────────────────────────────────────────────────────
   CHAT
   ───────────────────────────────────────────────────────────────────── */
.chat-screen{ display:flex; flex-direction:column; padding:0; overflow:hidden; }
.chat-status-bar{
  display:flex; align-items:center; gap:10px; padding:10px 14px;
  background:rgba(10,12,20,0.7); backdrop-filter:blur(14px);
  border-bottom:1px solid var(--border-soft); flex-shrink:0; font-size:12px;
}
.status-left{ display:flex; align-items:center; gap:6px; color:var(--text-1); font-weight:600; }
.status-mid{ flex:1; text-align:center; overflow:hidden; }
.status-right{ display:flex; align-items:center; gap:6px; }
.dot{ width:8px;height:8px;border-radius:50%; background:var(--text-2); }
.dot-live{ background:var(--success); box-shadow:0 0 8px var(--success); animation:dotPulse 2s ease-in-out infinite; }
.dot-warn{ background:var(--warn); }
.dot-off{ background:var(--danger); }
@keyframes dotPulse{ 0%,100%{ opacity:1; } 50%{ opacity:.4; } }
.chip{
  padding:4px 9px; border-radius:12px; background:var(--glass); border:1px solid var(--border-soft);
  color:var(--text-1); font-weight:600; white-space:nowrap;
}
.chip-encrypted{ color:var(--success); border-color:rgba(51,217,134,0.3); background:rgba(51,217,134,0.08); }

/* ── Chat tab bar ───────────────────────────────────────────────────── */
.chat-tab-bar{
  display:flex; flex-shrink:0;
  background:rgba(10,12,20,0.72); backdrop-filter:blur(14px);
  border-bottom:1px solid var(--border-soft);
}
.chat-tab{
  flex:1; display:flex; align-items:center; justify-content:center; gap:6px;
  padding:11px 0; background:none; border:none; border-bottom:2px solid transparent;
  color:var(--text-2); font-size:12.5px; font-weight:600; font-family:inherit;
  cursor:pointer; transition:color .18s, border-color .18s;
}
.chat-tab.active{ color:var(--accent-1); border-bottom-color:var(--accent-1); }
.chat-tab i{ font-size:12px; }

/* ── Shared pane wrapper ────────────────────────────────────────────── */
.chat-tab-pane{
  display:flex; flex-direction:column; flex:1; min-height:0; overflow:hidden;
}

/* ── Session info pane ──────────────────────────────────────────────── */
.session-info-scroll{
  flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:18px 16px calc(var(--safe-bottom) + 80px);
}
.si-section{ margin-bottom:26px; }
.si-heading{
  font-size:10px; font-weight:700; letter-spacing:.12em; text-transform:uppercase;
  color:var(--accent-1); margin-bottom:8px;
  padding-bottom:7px; border-bottom:1px solid var(--border-soft);
}
.si-row{
  display:flex; justify-content:space-between; align-items:flex-start;
  gap:12px; padding:9px 0; border-bottom:1px solid rgba(255,255,255,0.04);
  font-size:13px;
}
.si-row span{ color:var(--text-2); flex-shrink:0; }
.si-row strong{ font-weight:600; text-align:right; word-break:break-all; }
.si-mono strong{
  font-family:'Courier New',monospace; font-size:10.5px;
  color:var(--text-1); letter-spacing:.03em;
}
.si-safety-row .si-safety-val{
  font-family:'Courier New',monospace !important;
  font-size:10.5px !important; color:var(--success) !important;
  letter-spacing:.04em !important;
}
.btn-danger-outline{
  width:100%; margin-top:8px; padding:13px; border-radius:14px;
  border:1px solid rgba(255,90,122,0.35); background:rgba(255,90,122,0.08);
  color:var(--danger); font-size:13.5px; font-weight:700; font-family:inherit;
  cursor:pointer; display:flex; align-items:center; justify-content:center; gap:8px;
  transition:background .18s, border-color .18s;
}
.btn-danger-outline:active{ background:rgba(255,90,122,0.18); }
.si-end-btn{ margin-top:24px; }

.messages{
  flex:1; overflow-y:auto; -webkit-overflow-scrolling:touch;
  padding:16px 14px; display:flex; flex-direction:column; gap:8px;
}
.msg-row{ display:flex; }
.msg-row.mine{ justify-content:flex-end; }
.msg-row.peer{ justify-content:flex-start; }
.msg-row.system{ justify-content:center; }
.bubble{
  max-width:76%; padding:10px 14px; border-radius:20px; font-size:14.5px; line-height:1.4;
  word-wrap:break-word; white-space:pre-wrap;
  animation:bubbleIn .22s cubic-bezier(.2,.8,.2,1);
}
@keyframes bubbleIn{ from{ opacity:0; transform:translateY(6px) scale(.98); } to{ opacity:1; transform:translateY(0) scale(1); } }
.bubble.mine{ background:var(--accent-grad); color:#fff; border-bottom-right-radius:6px; }
.bubble.peer{ background:var(--glass-strong); border:1px solid var(--border); border-bottom-left-radius:6px; }
.bubble.system{ background:transparent; color:var(--text-2); font-size:12px; text-align:center; }
.bubble img{ max-width:220px; border-radius:14px; display:block; margin-top:2px; }
.bubble audio{ width:200px; }
.msg-meta{ display:flex; align-items:center; gap:4px; margin-top:4px; font-size:10.5px; opacity:0.7; justify-content:flex-end; }
.msg-meta i{ font-size:10px; }

.typing-row{ padding:2px 18px 8px; font-size:12px; color:var(--text-2); display:flex; align-items:center; gap:8px; }
.typing-dots{ display:inline-flex; gap:3px; }
.typing-dots i{ width:5px;height:5px;border-radius:50%; background:var(--text-2); display:inline-block; animation:typingBounce 1.2s infinite ease-in-out; }
.typing-dots i:nth-child(2){ animation-delay:.15s; }
.typing-dots i:nth-child(3){ animation-delay:.3s; }
@keyframes typingBounce{ 0%,80%,100%{ transform:translateY(0); opacity:.5; } 40%{ transform:translateY(-4px); opacity:1; } }

.composer{
  display:flex; align-items:flex-end; gap:8px; padding:10px 12px calc(var(--safe-bottom) + 10px);
  background:rgba(10,12,20,0.75); backdrop-filter:blur(16px); border-top:1px solid var(--border-soft);
  flex-shrink:0;
}
.composer-btn{ flex-shrink:0; }
.composer-field-wrap{ flex:1; }
.composer-field{
  width:100%; resize:none; border:1px solid var(--border); background:var(--glass);
  color:var(--text-0); border-radius:20px; padding:11px 16px; font-size:14.5px; max-height:110px;
  font-family:inherit; outline:none; line-height:1.4;
}
.composer-field:focus{ border-color:var(--accent-1); }
.send-btn{ background:var(--accent-grad); color:#fff; }
.send-btn:active{ transform:scale(0.9); }

.end-session-fab{
  position:absolute; top:96px; right:12px;
  width:36px;height:36px;border-radius:12px; border:none; cursor:pointer;
  background:rgba(255,90,122,0.16); color:var(--danger); font-size:14px;
  display:flex; align-items:center; justify-content:center;
}
/* Hide the FAB when the session info tab is visible (it has its own End Session button). */
#chat-pane-session:not([hidden]) + .end-session-fab{ display:none; }

/* ─────────────────────────────────────────────────────────────────────
   SHEET (identity)
   ───────────────────────────────────────────────────────────────────── */
.sheet-overlay{
  position:fixed; inset:0; background:rgba(0,0,0,0.55); backdrop-filter:blur(4px);
  z-index:200; display:flex; align-items:flex-end;
  animation:fadeIn .2s ease;
}
@keyframes fadeIn{ from{ opacity:0; } to{ opacity:1; } }
.sheet{
  width:100%; background:var(--bg-2); border-radius:26px 26px 0 0;
  padding:10px 22px calc(var(--safe-bottom) + 22px);
  border:1px solid var(--border-soft); border-bottom:none;
  animation:sheetUp .28s cubic-bezier(.2,.8,.2,1);
}
@keyframes sheetUp{ from{ transform:translateY(100%); } to{ transform:translateY(0); } }
.sheet-handle{ width:36px;height:4px;border-radius:2px; background:var(--border); margin:8px auto 16px; }
.sheet h2{ font-size:18px; margin:0 0 8px; }
.sheet-desc{ font-size:12.5px; color:var(--text-1); line-height:1.5; margin:0 0 16px; }
.identity-row{ display:flex; justify-content:space-between; align-items:center; padding:10px 0; border-bottom:1px solid var(--border-soft); font-size:13px; }
.identity-row span{ color:var(--text-2); }
.identity-row strong{ font-weight:700; }

/* ─────────────────────────────────────────────────────────────────────
   TOAST
   ───────────────────────────────────────────────────────────────────── */
.toast{
  position:fixed; bottom:calc(var(--safe-bottom) + 20px); left:50%; transform:translateX(-50%) translateY(10px);
  background:rgba(20,22,32,0.92); border:1px solid var(--border); backdrop-filter:blur(14px);
  padding:11px 18px; border-radius:16px; font-size:13px; z-index:500; opacity:0;
  transition:opacity .25s ease, transform .25s ease; max-width:88vw; text-align:center;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(0); }

/* ─────────────────────────────────────────────────────────────────────
   INSTALL / UPDATE BANNERS
   ───────────────────────────────────────────────────────────────────── */
.install-banner, .update-banner{
  position:fixed; left:12px; right:12px; bottom:calc(var(--safe-bottom) + 12px);
  background:rgba(16,18,28,0.92); border:1px solid var(--border); backdrop-filter:blur(16px);
  border-radius:18px; padding:12px 14px; display:flex; align-items:center; gap:10px;
  font-size:13px; z-index:400; box-shadow:var(--shadow-soft);
}
.install-banner i{ color:var(--accent-1); }
.install-banner span, .update-banner span{ flex:1; }
.install-banner button, .update-banner button{
  background:var(--accent-grad); border:none; color:#fff; padding:8px 14px; border-radius:12px; font-weight:700; font-size:12.5px; cursor:pointer;
}
#dismiss-install-btn{ background:none; color:var(--text-2); padding:6px; }

/* ─────────────────────────────────────────────────────────────────────
   SCROLLBARS
   ───────────────────────────────────────────────────────────────────── */
.screen::-webkit-scrollbar, .messages::-webkit-scrollbar{ width:0; }

/* ─────────────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────────────── */
@media (min-width:640px){
  .screen{ max-width:560px; margin:0 auto; width:100%; }
  .chat-status-bar, .composer{ max-width:560px; margin:0 auto; width:100%; }
  .end-session-fab{ right:calc(50% - 280px + 12px); }
}
@media (min-width:900px){
  body{ display:flex; justify-content:center; }
  .app{ max-width:520px; left:50%; transform:translateX(-50%); border-left:1px solid var(--border-soft); border-right:1px solid var(--border-soft); box-shadow:0 0 80px rgba(0,0,0,0.5); }
  .end-session-fab{ right:12px; }
}

@media (prefers-reduced-motion: reduce){
  *{ animation-duration:0.001ms !important; transition-duration:0.001ms !important; }
}

/* =====================================================================
   Phase 2 — App Lock / No Identity / Security Dashboard / Verify / QR
   ===================================================================== */

.fullscreen-gate{
  position:fixed; inset:0; z-index:5000;
  background:var(--bg-0);
  display:flex; align-items:center; justify-content:center;
  padding:24px;
}
.fullscreen-gate .panel-center{ padding-top:0; }

.ring-verify{ background:linear-gradient(145deg, rgba(255,184,77,.18), rgba(255,120,90,.08)); color:#ffd9a0; }

.session-state-badge{
  display:inline-flex; align-items:center; padding:5px 14px; border-radius:14px;
  background:var(--glass-strong); border:1px solid var(--border);
  font-size:11.5px; font-weight:700; letter-spacing:.6px; text-transform:uppercase;
  color:var(--text-1); margin-bottom:6px;
}

.code-input-long{ letter-spacing:0.5px; font-size:13px; font-weight:500; text-transform:none; word-break:break-all; }

/* QR display / scan */
.qr-wrap{ margin:14px 0; padding:16px; background:#fff; border-radius:20px; display:flex; align-items:center; justify-content:center; }
.qr-wrap canvas, .qr-wrap img{ display:block; width:180px; height:180px; }
.scan-wrap{ width:100%; margin-top:14px; display:flex; flex-direction:column; align-items:center; gap:10px; }
.scan-wrap video{ width:100%; max-width:320px; border-radius:20px; border:1px solid var(--border); background:#000; aspect-ratio:1/1; object-fit:cover; }

/* Verify / safety number */
.safety-number{
  font-family:'SFMono-Regular', Menlo, Consolas, monospace;
  font-size:17px; font-weight:700; letter-spacing:2px; text-align:center;
  padding:16px; border-radius:var(--radius-md); background:var(--glass);
  border:1px solid var(--border); margin:14px 0; width:100%; line-height:1.6;
  color:#ffe3b0;
}
.fp-grid{ width:100%; display:flex; flex-direction:column; gap:8px; margin-bottom:8px; }
.fp-row{
  display:flex; justify-content:space-between; align-items:center; gap:10px;
  padding:9px 12px; border-radius:12px; background:var(--glass); border:1px solid var(--border-soft);
  font-size:12px;
}
.fp-row span{ color:var(--text-2); }
.fp-row strong{ font-family:monospace; font-size:11.5px; letter-spacing:.5px; }

/* Security dashboard */
.sec-section{
  padding:16px; border-radius:var(--radius-md); background:var(--glass);
  border:1px solid var(--border); margin-bottom:14px;
}
.sec-heading{ font-size:12px; text-transform:uppercase; letter-spacing:.8px; color:var(--text-2); margin:0 0 10px; font-weight:700; }
.sec-row{ display:flex; justify-content:space-between; align-items:center; padding:9px 0; border-bottom:1px solid var(--border-soft); font-size:13px; gap:10px; }
.sec-row:last-of-type{ border-bottom:none; }
.sec-row span{ color:var(--text-2); }
.sec-row strong{ font-weight:700; text-align:right; word-break:break-word; }
.sec-ok{ color:var(--success); }
.sec-warn{ color:var(--warn); }
.sec-off{ color:var(--danger); }
.sec-note{ font-size:12px; color:var(--text-1); line-height:1.5; margin:0 0 12px; }
.btn-danger-solid{
  width:100%; padding:14px; border-radius:var(--radius-md); margin-top:10px;
  background:rgba(255,90,122,0.14); border:1px solid rgba(255,90,122,0.35); color:var(--danger);
  font-size:14px; font-weight:700; display:flex; align-items:center; justify-content:center; gap:8px; cursor:pointer;
}
.btn-danger-solid:active{ transform:scale(0.97); }
.sheet-compact{ padding-bottom:calc(var(--safe-bottom) + 22px); }
#screen-security{ padding-bottom:calc(var(--safe-bottom) + 40px); }

/* =====================================================================
   Phase 3 — Invitation landing, Trusted Contacts, Trust prompt
   ===================================================================== */

.badge-row{ display:flex; flex-wrap:wrap; gap:8px; justify-content:center; margin:4px 0 2px; }
.badge-row .chip{ padding:6px 12px; font-size:11.5px; }

.badge-muted{
  position:absolute; top:14px; right:38px;
  background:var(--glass-strong); color:var(--text-1); font-size:11px; font-weight:700;
  min-width:20px; height:20px; border-radius:10px; display:flex; align-items:center; justify-content:center;
  padding:0 5px; border:1px solid var(--border-soft);
}

#screen-trusted .screen-sub{ text-align:left; margin:0 0 14px; }
#invite-landing-screen .panel-center{ padding-top:6vh; }
#screen-trust-prompt .panel-center{ padding-top:8vh; max-width:440px; }

/* =====================================================================
   Phase 4 — Onboarding, simplified home, global status chip,
   waiting pulse, teardown ritual, chat avatar
   ===================================================================== */

/* Onboarding */
.onboarding-gate{ flex-direction:column; padding:24px 24px calc(var(--safe-bottom) + 24px); }
.onboarding-track{ flex:1; display:flex; align-items:center; justify-content:center; width:100%; position:relative; }
.onboarding-slide{
  display:none; flex-direction:column; align-items:center; text-align:center; gap:14px; max-width:380px;
  animation:screenIn .35s cubic-bezier(.2,.8,.2,1);
}
.onboarding-slide.active{ display:flex; }
.onboarding-glyph{
  width:76px;height:76px;border-radius:26px;
  background:linear-gradient(145deg, rgba(90,120,255,.16), rgba(160,90,255,.10));
  border:1px solid var(--border);
  display:flex;align-items:center;justify-content:center; font-size:28px;
  color:#c9d0ff; margin-bottom:4px;
}
.onboarding-glyph-success{ background:linear-gradient(145deg, rgba(51,217,134,.20), rgba(51,180,217,.10)); color:var(--success); }
.onboarding-title{ font-size:26px; font-weight:800; margin:0; letter-spacing:.2px; }
.onboarding-text{ font-size:16px; line-height:1.55; color:var(--text-0); margin:0; font-weight:500; }
.onboarding-text-lg{ font-size:17px; }
.onboarding-identity{
  font-size:20px; font-weight:800; letter-spacing:.4px; margin-top:6px;
  background:var(--accent-grad); -webkit-background-clip:text; background-clip:text; color:transparent;
}
.onboarding-dots{ display:flex; gap:7px; justify-content:center; padding:18px 0 4px; flex-shrink:0; }
.dot-step{ width:6px;height:6px;border-radius:50%; background:var(--border); transition:background .2s ease, width .2s ease; }
.dot-step.active{ background:var(--accent-1); width:18px; border-radius:3px; }
.onboarding-continue{ flex-shrink:0; max-width:380px; margin:6px auto 0; }

/* Simplified home identity */
.home-welcome{ font-size:12.5px; color:var(--text-2); margin:0; font-weight:600; letter-spacing:.2px; }
.home-name{ font-size:22px; font-weight:800; margin:2px 0 0; letter-spacing:.2px; }

/* Global floating status chip */
.status-chip{
  display:inline-flex; align-items:center; gap:6px; padding:6px 11px; border-radius:14px;
  font-size:11.5px; font-weight:700; background:var(--glass-strong); border:1px solid var(--border-soft);
  color:var(--text-1);
}
.status-dot{ width:7px;height:7px;border-radius:50%; background:var(--text-2); flex-shrink:0; }
.status-secure{ color:var(--success); border-color:rgba(51,217,134,0.3); background:rgba(51,217,134,0.08); }
.status-secure .status-dot{ background:var(--success); box-shadow:0 0 6px var(--success); animation:dotPulse 2s ease-in-out infinite; }
.status-connecting{ color:var(--warn); border-color:rgba(255,184,77,0.3); background:rgba(255,184,77,0.08); }
.status-connecting .status-dot{ background:var(--warn); animation:dotPulse 1s ease-in-out infinite; }
.status-offline{ color:var(--danger); border-color:rgba(255,90,122,0.3); background:rgba(255,90,122,0.08); }
.status-offline .status-dot{ background:var(--danger); }

/* Waiting pulse */
.waiting-pulse{ display:flex; gap:6px; justify-content:center; margin-top:18px; }
.waiting-pulse span{
  width:8px;height:8px;border-radius:50%; background:var(--accent-1);
  animation:waitPulse 1.4s ease-in-out infinite;
}
.waiting-pulse span:nth-child(2){ animation-delay:.2s; }
.waiting-pulse span:nth-child(3){ animation-delay:.4s; }
@keyframes waitPulse{ 0%,100%{ transform:scale(0.6); opacity:.4; } 50%{ transform:scale(1); opacity:1; } }

/* Teardown ritual steps */
.teardown-steps{ list-style:none; padding:0; margin:22px 0 6px; width:100%; text-align:left; display:flex; flex-direction:column; gap:12px; max-width:340px; }
.teardown-steps li{
  font-size:13.5px; color:var(--text-2); opacity:0; transform:translateY(4px);
  transition:opacity .3s ease, transform .3s ease, color .3s ease;
}
.teardown-steps li.active{ opacity:1; transform:translateY(0); color:var(--text-0); }
.teardown-steps li.done{ opacity:1; transform:translateY(0); color:var(--success); }

/* Ended screen */
.ended-tagline{ font-size:12.5px; letter-spacing:.6px; text-transform:uppercase; color:var(--text-2); font-weight:700; margin:0 0 2px; }

/* Chat avatar */
.chat-peer-summary{ display:flex; align-items:center; justify-content:center; gap:6px; }
.chat-avatar{
  width:22px;height:22px;border-radius:8px; background:var(--accent-grad);
  display:inline-flex; align-items:center; justify-content:center;
  font-size:10.5px; font-weight:800; color:#fff; flex-shrink:0;
}

/* Trusted-contacts empty state */
.empty-state-title{ font-size:15px; font-weight:700; color:var(--text-0); margin:2px 0 0; }
.empty-state p{ line-height:1.5; }

/* Biometric setup */
.applock-forgot-btn{ margin-top:10px; }

/* ── Biometric Scan Screen ───────────────────────────────────────────────────
   Dedicated full-screen page that owns the biometric flow.
   z-index 9992 — above auth screen (9990) and app, below splash (9999).
   ─────────────────────────────────────────────────────────────────────────── */
.bio-scan-screen{
  flex-direction:column; justify-content:space-between; align-items:center;
  padding:calc(var(--safe-top) + 28px) 28px calc(var(--safe-bottom) + 48px);
  background:radial-gradient(ellipse 82% 58% at 50% 40%, #2a0870 0%, #150540 22%, #0a0220 50%, #040109 100%);
  z-index:9992; overflow:hidden;
}

/* Top area — small shield + wordmark */
.bio-scan-top{
  display:flex; flex-direction:column; align-items:center; gap:8px;
  position:relative; z-index:1;
}
.bio-scan-logo-wrap{
  width:min(22vw, 80px);
  aspect-ratio:1024/876; overflow:hidden;
  mix-blend-mode:screen;
  animation:logoBreathe 4.5s ease-in-out .5s infinite;
}
.bio-scan-shield{ width:100%; height:auto; display:block; }
.bio-scan-app-name{
  font-family:'Orbitron', sans-serif; font-weight:900;
  font-size:clamp(.85rem, 3.5vw, 1.05rem); letter-spacing:.10em;
  background:linear-gradient(160deg, #fff 0%, #ecdeff 40%, #b880ff 75%, #7833ee 100%);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
  margin:0;
}

/* Center — ring + fingerprint + labels */
.bio-scan-center{
  display:flex; flex-direction:column; align-items:center; gap:24px;
  flex:1; justify-content:center; position:relative; z-index:1;
}

/* ── Scan ring ── */
.bio-scan-ring{
  position:relative; width:200px; height:200px;
  display:flex; align-items:center; justify-content:center;
}

/* Static outer track */
.bio-scan-ring-track{
  position:absolute; inset:0; border-radius:50%;
  border:1.5px solid rgba(130,60,255,.30);
  transition:border-color .45s ease, box-shadow .45s ease;
}

/* Rotating sweep arc — visible only while scanning */
.bio-scan-ring-sweep{
  position:absolute; inset:-2px; border-radius:50%;
  border:3px solid transparent;
  border-top-color:rgba(185,110,255,.95);
  border-right-color:rgba(150,75,255,.55);
  animation:bioSweep 1.1s linear infinite;
  opacity:0; pointer-events:none;
  transition:opacity .25s ease;
}

/* Expanding pulse rings — idle state */
.bio-scan-ring-pulse{
  position:absolute; inset:0; border-radius:50%;
  border:1px solid rgba(140,70,255,.45);
  animation:bioPulseRing 2.8s ease-out infinite;
}

@keyframes bioSweep  { to{ transform:rotate(360deg); } }
@keyframes bioPulseRing{
  0%  { transform:scale(1);    opacity:.45; }
  70% { transform:scale(1.28); opacity:0;   }
  100%{ transform:scale(1.28); opacity:0;   }
}

/* State: scanning */
.bio-scan-ring.scanning .bio-scan-ring-sweep { opacity:1; }
.bio-scan-ring.scanning .bio-scan-ring-pulse  { animation:none; opacity:0; }

/* State: success */
.bio-scan-ring.success .bio-scan-ring-track{
  border-color:rgba(72,210,110,.70);
  box-shadow:0 0 32px rgba(72,210,110,.40), 0 0 80px rgba(72,210,110,.18);
}
.bio-scan-ring.success .bio-scan-ring-sweep { opacity:0; }
.bio-scan-ring.success .bio-scan-ring-pulse { animation:none; opacity:0; }

/* State: failed */
.bio-scan-ring.failed .bio-scan-ring-track{
  border-color:rgba(255,75,75,.65);
  box-shadow:0 0 24px rgba(255,75,75,.35);
}
.bio-scan-ring.failed .bio-scan-ring-sweep { opacity:0; }
.bio-scan-ring.failed .bio-scan-ring-pulse { animation:none; opacity:0; }

/* Icon inside the ring */
.bio-scan-icon-wrap{ position:relative; z-index:1; }
.bio-scan-icon{
  font-size:80px; line-height:1; display:block;
  background:linear-gradient(160deg, #fff 0%, #dbb8ff 40%, #9955ff 100%);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
  filter:drop-shadow(0 0 20px rgba(160,80,255,.55));
  animation:bioIconIdle 3.2s ease-in-out infinite;
  transition:filter .45s ease;
}
.bio-scan-ring.scanning .bio-scan-icon { animation:bioIconScan 0.9s ease-in-out infinite; }
.bio-scan-ring.success  .bio-scan-icon {
  background:linear-gradient(160deg, #c8ffe0 0%, #48d26e 100%);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
  filter:drop-shadow(0 0 22px rgba(72,210,110,.70)); animation:none;
}
.bio-scan-ring.failed .bio-scan-icon {
  background:linear-gradient(160deg, #ffc8c8 0%, #ff5050 100%);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
  filter:drop-shadow(0 0 18px rgba(255,75,75,.65)); animation:bioShake .42s ease both;
}

@keyframes bioIconIdle{ 0%,100%{transform:scale(1)} 50%{transform:scale(1.04)} }
@keyframes bioIconScan{ 0%,100%{transform:scale(1)} 50%{transform:scale(1.07)} }
@keyframes bioShake{
  0%,100%{transform:translateX(0)}
  20%{transform:translateX(-9px)}
  40%{transform:translateX(9px)}
  60%{transform:translateX(-6px)}
  80%{transform:translateX(6px)}
}

/* Status labels */
.bio-scan-label{
  font-size:16px; font-weight:600; color:rgba(255,255,255,.80);
  text-align:center; letter-spacing:.02em; margin:0;
  transition:color .35s ease;
  min-height:22px;
}
.bio-scan-ring.success ~ .bio-scan-label { color:rgba(140,240,175,.90); }
.bio-scan-ring.failed  ~ .bio-scan-label { color:rgba(255,140,140,.90); }

.bio-scan-sub{
  font-size:13px; color:rgba(255,255,255,.38);
  text-align:center; letter-spacing:.01em; margin:0;
  transition:opacity .35s ease;
  min-height:18px;
}

/* Footer — retry / PIN buttons */
.bio-scan-footer{
  display:flex; flex-direction:column; align-items:center; gap:12px;
  width:100%; position:relative; z-index:1;
}
.bio-scan-retry-btn{
  width:100%; max-width:320px;
  background:rgba(140,70,255,.16); border:1px solid rgba(140,70,255,.35);
  border-radius:16px; color:rgba(200,170,255,.88);
  font-size:15px; font-weight:600; padding:15px;
  cursor:pointer; font-family:inherit;
  transition:background .2s, border-color .2s;
  display:flex; align-items:center; justify-content:center; gap:8px;
}
.bio-scan-retry-btn:hover{ background:rgba(140,70,255,.28); border-color:rgba(140,70,255,.55); }
.bio-scan-pin-btn{
  background:none; border:none; cursor:pointer;
  color:rgba(255,255,255,.35); font-size:.82rem;
  padding:8px 16px; letter-spacing:.04em;
  transition:color .2s; font-family:inherit;
}
.bio-scan-pin-btn:hover{ color:rgba(255,255,255,.65); }

/* ── Auth Screen (PIN) — identical layout to bio scan screen ─────────────────
   Uses bio-scan-screen structure: same bg, same padding, same top/center/footer.
   z-index 9990 — above app, below bio-scan-screen (9992) and splash (9999).
   ─────────────────────────────────────────────────────────────────────────── */
.auth-screen{
  flex-direction:column; justify-content:space-between; align-items:center;
  padding:calc(var(--safe-top) + 28px) 28px calc(var(--safe-bottom) + 48px);
  background:radial-gradient(ellipse 82% 58% at 50% 40%, #2a0870 0%, #150540 22%, #0a0220 50%, #040109 100%);
  z-index:9990; overflow:hidden;
}

/* Floating particles */
.auth-particles{ position:absolute; inset:0; pointer-events:none; z-index:0; }
.auth-particles span{
  position:absolute; border-radius:50%; background:rgba(255,255,255,.55);
  animation:particleFloat 10s ease-in-out infinite alternate;
}
.auth-particles span:nth-child(1){ width:2px; height:2px; left:8%;  top:11%; animation-duration:10s; }
.auth-particles span:nth-child(2){ width:3px; height:3px; left:83%; top:9%;  animation-duration:13s; animation-delay:1.8s; }
.auth-particles span:nth-child(3){ width:2px; height:2px; left:47%; top:76%; animation-duration:8s;  animation-delay:0.7s; }
.auth-particles span:nth-child(4){ width:4px; height:4px; left:74%; top:54%; animation-duration:11s; animation-delay:2.3s; opacity:.55; }
.auth-particles span:nth-child(5){ width:2px; height:2px; left:21%; top:85%; animation-duration:14s; animation-delay:0.3s; }
.auth-particles span:nth-child(6){ width:3px; height:3px; left:92%; top:37%; animation-duration:7s;  animation-delay:1.5s; }
.auth-particles span:nth-child(7){ width:2px; height:2px; left:5%;  top:49%; animation-duration:9s;  animation-delay:3.1s; }
.auth-particles span:nth-child(8){ width:3px; height:3px; left:61%; top:21%; animation-duration:8.5s;animation-delay:0.9s; }

/* State exit animation */
.auth-state-exiting{ opacity:0; transform:translateY(-10px); pointer-events:none; transition:opacity .22s ease, transform .22s ease; }

/* ── PIN state ── */
.auth-pin-state{
  display:flex; flex-direction:column; align-items:center; gap:20px; width:100%;
  animation:authFadeUp .28s ease both;
}
.auth-pin-dots{
  display:flex; gap:20px; justify-content:center;
}
.auth-pin-dot{
  width:13px; height:13px; border-radius:50%;
  border:2px solid rgba(120,55,255,.42); background:transparent;
  transition:background .15s ease, border-color .15s ease, box-shadow .15s ease, transform .15s ease;
}
.auth-pin-dot.filled{
  background:rgba(150,75,255,.95); border-color:rgba(150,75,255,.95);
  box-shadow:0 0 10px rgba(150,75,255,.80), 0 0 22px rgba(120,55,255,.35);
  transform:scale(1.18);
}
.auth-pin-display.shake{ animation:pinShake .4s ease; }
.auth-pin-error{ color:#ff7070; font-size:.75rem; margin:-12px 0 -8px; min-height:1.1em; text-align:center; }
.auth-pin-keypad{
  display:grid; grid-template-columns:repeat(3,1fr);
  gap:14px; width:100%; max-width:300px; margin:0 auto;
}
.auth-pin-key{
  width:76px; height:76px; border-radius:50%; margin:0 auto;
  background:rgba(255,255,255,.04);
  border:1px solid rgba(120,55,255,.32);
  color:rgba(255,255,255,.90); font-size:1.5rem; font-weight:400; font-family:inherit;
  cursor:pointer;
  display:flex; align-items:center; justify-content:center;
  transition:background .12s ease, box-shadow .14s ease, border-color .12s ease, transform .09s ease;
  -webkit-tap-highlight-color:transparent;
}
.auth-pin-key:active{
  background:rgba(120,55,255,.22);
  border-color:rgba(150,80,255,.75);
  box-shadow:0 0 22px rgba(150,80,255,.45), 0 0 44px rgba(120,55,255,.20);
  transform:scale(.88);
}
.auth-pin-key-empty{ background:transparent !important; border:none !important; pointer-events:none; }
.auth-pin-key-del{ font-size:1.1rem; }

/* Forgot PIN — styled like bio-scan-pin-btn */
.auth-forgot-btn{
  background:none; border:none; cursor:pointer;
  color:rgba(255,255,255,.35); font-size:.82rem;
  padding:8px 16px; letter-spacing:.04em;
  transition:color .2s; font-family:inherit;
}
.auth-forgot-btn:hover{ color:rgba(255,255,255,.65); }

/* ── Success state ── */
.auth-success-state{
  display:flex; flex-direction:column; align-items:center; gap:10px;
  animation:authFadeUp .4s ease both;
}
.auth-success-ring{
  width:72px; height:72px; border-radius:50%;
  background:rgba(212,180,90,.10);
  border:2px solid rgba(212,180,90,.70);
  box-shadow:0 0 0 8px rgba(212,180,90,.07), 0 0 32px rgba(212,180,90,.38);
  display:flex; align-items:center; justify-content:center;
  animation:authCheckRing .48s cubic-bezier(.2,.8,.2,1) both;
}
.auth-success-check{
  font-size:28px; color:#D4B45A;
  animation:authCheckIn .38s cubic-bezier(.2,.8,.2,1) .14s both;
}
.auth-success-title{
  font-size:16px; font-weight:700; letter-spacing:.04em; color:#D4B45A; margin:0;
  text-shadow:0 0 18px rgba(212,180,90,.45);
  animation:authFadeUp .4s ease .2s both;
}

/* ── Bio state (edge-case) ── */
.auth-bio-state{
  display:flex; flex-direction:column; align-items:center; gap:12px; text-align:center;
  animation:authFadeUp .35s ease both;
}
.auth-bio-btn{ width:100%; max-width:300px; }
.auth-pin-link{
  background:none; border:none; cursor:pointer;
  color:rgba(255,255,255,.38); font-size:.78rem; padding:6px 0; letter-spacing:.03em;
  transition:color .2s; font-family:inherit;
}
.auth-pin-link:hover{ color:rgba(255,255,255,.68); }
.auth-status{ font-size:.75rem; color:rgba(255,100,100,.85); margin:0; min-height:16px; }

@keyframes authFadeUp{
  from{ opacity:0; transform:translateY(14px); }
  to{   opacity:1; transform:translateY(0); }
}
@keyframes authCheckRing{
  from{ transform:scale(.4); opacity:0; }
  to{   transform:scale(1);  opacity:1; }
}
@keyframes authCheckIn{
  from{ transform:scale(0) rotate(-20deg); opacity:0; }
  to{   transform:scale(1) rotate(0);      opacity:1; }
}
.bio-toggle-row{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:11px 0; border-bottom:1px solid var(--border-soft); font-size:13.5px; color:var(--text-0);
}
.bio-toggle-row:last-of-type{ border-bottom:none; }
.bio-toggle-row input[type="checkbox"]{
  width:40px; height:24px; border-radius:12px; appearance:none; -webkit-appearance:none;
  background:var(--glass-strong); border:1px solid var(--border); position:relative; cursor:pointer;
  transition:background .18s ease; flex-shrink:0;
}
.bio-toggle-row input[type="checkbox"]::before{
  content:''; position:absolute; top:2px; left:2px; width:18px; height:18px; border-radius:50%;
  background:var(--text-1); transition:transform .18s ease, background .18s ease;
}
.bio-toggle-row input[type="checkbox"]:checked{ background:rgba(90,120,255,0.35); border-color:var(--accent-1); }
.bio-toggle-row input[type="checkbox"]:checked::before{ background:var(--accent-1); transform:translateX(16px); }

/* =====================================================================
   Logo, session glyph, and component image styles
   ===================================================================== */

/* Glyph ring with logo image */
.glyph-ring-logo{
  background:none; border:none; overflow:hidden; padding:0;
}
.glyph-ring-logo-img{
  width:100%; height:100%; object-fit:cover; border-radius:26px;
}

/* Navigation bar logo button */
.nav-logo-img{
  width:26px; height:26px; object-fit:contain; border-radius:6px;
}

/* Empty state watermark */
.empty-state-watermark{
  width:52px; height:52px; object-fit:contain;
  opacity:.1; margin-bottom:4px;
}

/* Security screen logo */
.sec-logo-row{
  display:flex; justify-content:center; margin-bottom:20px;
}
.sec-logo-img{
  width:68px; height:68px; object-fit:contain; border-radius:20px;
  filter:drop-shadow(0 0 22px rgba(120,80,255,.35));
}

/* Ended screen logo */
.ended-logo-img{
  width:86px; height:86px; object-fit:contain; border-radius:24px;
  filter:drop-shadow(0 0 26px rgba(120,80,255,.3));
  margin-bottom:14px;
}

/* Session connecting glyph with ping animation */
.session-glyph-sequence{
  position:relative; width:76px; height:76px; margin-bottom:10px;
}
.session-glyph-img{
  width:76px; height:76px; border-radius:26px;
  object-fit:cover; border:1px solid var(--border);
  box-shadow:0 0 30px rgba(90,80,255,.2);
}
.session-glyph-ping{
  position:absolute; inset:-10px; border-radius:36px;
  border:2px solid rgba(90,120,255,.3);
  animation:pingRipple 2s ease-out infinite;
}
@keyframes pingRipple{
  0%  { transform:scale(1);    opacity:.8; }
  100%{ transform:scale(1.38); opacity:0; }
}

/* ─────────────────────────────────────────────────────────────────────
   INVITE AUTO-CONNECT SPINNER
   ───────────────────────────────────────────────────────────────────── */
.invite-auto-spinner{
  font-size:2.2rem;
  color:var(--accent-2,#a05aff);
  margin:20px 0 8px;
  opacity:.85;
}

/* ─────────────────────────────────────────────────────────────────────
   SESSION-END TRUST OFFER
   ───────────────────────────────────────────────────────────────────── */
.ended-divider{ border:none; border-top:1px solid rgba(255,255,255,.07); margin:24px 0 16px; }
.ended-trust-q{ font-size:.95rem; font-weight:600; margin:0 0 8px; color:var(--text-0); }
.ended-trust-hint{ font-size:.82rem; color:var(--text-2); margin:0 0 16px; line-height:1.5; }
.ended-trust-btns{ display:flex; gap:10px; justify-content:center; flex-wrap:wrap; }

/* ─────────────────────────────────────────────────────────────────────
   TOGGLE SWITCH (security screen)
   ───────────────────────────────────────────────────────────────────── */
.sec-toggle{
  position:relative; display:inline-block;
  width:44px; height:24px; flex-shrink:0;
}
.sec-toggle input{ position:absolute; opacity:0; width:0; height:0; }
.sec-toggle-track{
  position:absolute; inset:0;
  background:rgba(255,255,255,.14); border-radius:12px;
  cursor:pointer; transition:background .2s;
}
.sec-toggle-track::before{
  content:''; position:absolute;
  width:18px; height:18px; border-radius:50%;
  background:#fff; top:3px; left:3px;
  transition:transform .2s;
}
.sec-toggle input:checked+.sec-toggle-track{ background:var(--accent-2,#a05aff); }
.sec-toggle input:checked+.sec-toggle-track::before{ transform:translateX(20px); }

/* ─────────────────────────────────────────────────────────────────────
   INCOMING SESSION SHEET
   ───────────────────────────────────────────────────────────────────── */
.incoming-glyph{
  width:56px; height:56px; border-radius:50%;
  background:linear-gradient(135deg,rgba(90,120,255,.18),rgba(160,90,255,.18));
  border:1px solid rgba(140,80,255,.35);
  display:flex; align-items:center; justify-content:center;
  font-size:1.4rem; margin:0 auto 16px; color:var(--accent-2);
}

/* ─────────────────────────────────────────────────────────────────────
   PIN KEYPAD
   ───────────────────────────────────────────────────────────────────── */
.pin-sheet{ text-align:center; }
.pin-display{ display:flex; gap:14px; justify-content:center; margin:20px auto 8px; }
.pin-dot{
  width:13px; height:13px; border-radius:50%;
  border:2px solid rgba(150,100,255,.45); background:transparent;
  transition:background .12s,border-color .12s,transform .12s;
}
.pin-dot.filled{
  background:var(--accent-2,#a05aff); border-color:var(--accent-2,#a05aff); transform:scale(1.15);
}
.pin-error{ color:#ff6060; font-size:.82rem; margin:4px 0 8px; min-height:1.2em; }
@keyframes pinShake{
  0%,100%{ transform:translateX(0); }
  20%{ transform:translateX(-7px); }
  60%{ transform:translateX(7px); }
  80%{ transform:translateX(-4px); }
}
.pin-display.shake{ animation:pinShake .4s ease; }
.pin-keypad{
  display:grid; grid-template-columns:repeat(3,1fr);
  gap:8px; max-width:270px; margin:12px auto 16px;
}
.pin-key{
  height:60px; border-radius:14px;
  background:rgba(255,255,255,.07); border:1px solid rgba(255,255,255,.06);
  color:var(--text-0); font-size:1.35rem; font-weight:500;
  font-family:inherit; cursor:pointer;
  transition:background .1s,transform .08s;
  display:flex; align-items:center; justify-content:center;
}
.pin-key:active{ background:rgba(140,80,255,.3); transform:scale(.93); }
.pin-key-empty{ background:transparent !important; border:none !important; pointer-events:none; cursor:default; }
.pin-key-del{ font-size:1rem; }

/* ─────────────────────────────────────────────────────────────────────
   SPOTLIGHT WALKTHROUGH OVERLAY
   ───────────────────────────────────────────────────────────────────── */
/* ─── ONBOARDING TOUR — SPOTLIGHT ────────────────────────────────────────────
   Design goal: premium / banking-app feel.
   • Overlay is translucent (~48%) so the real interface stays readable.
   • The highlighted element gets a bright halo — it attracts the eye without
     blacking out the rest of the screen.
   • Tooltip card is a noticeably lighter purple so text pops cleanly.
   ─────────────────────────────────────────────────────────────────────────── */
.spotlight-overlay{
  position:fixed; inset:0; z-index:10000;
  /* 48% dark overlay — app interface clearly visible underneath */
  background:rgba(4,1,14,.48);
  display:flex; flex-direction:column;
  align-items:center; justify-content:flex-end;
  padding:0 20px calc(var(--safe-bottom) + 40px);
  transition:background .35s;
}
/* Welcome step: no spotlight, tooltip centred vertically */
.spotlight-overlay.tour-welcome{
  justify-content:center;
  padding:24px;
}
/* The cutout element that frames the highlighted UI card.
   Outer shadow dims the rest; the coloured ring is a subtle brand accent.
   The dominant spotlight effect comes from the ::before white glow below. */
.spotlight-spotlight{
  position:fixed;
  box-shadow:
    0 0 0 9999px rgba(0,0,0,.58),
    0 0 0 1.5px rgba(138,92,255,.40);
  border-radius:18px; pointer-events:none;
  transition:all .35s cubic-bezier(.2,.8,.2,1);
  overflow:visible;
}

/*
  WHITE SPOTLIGHT GLOW
  ─────────────────────
  A donut-shaped radial gradient that:
  • Is nearly transparent at the centre → the button keeps its original colours
  • Peaks (~24% white) at the element boundary → soft light rim around the card
  • Feathers to nothing ~90px beyond the card edge → no harsh cutoff
  The white has a very slight cool-blue tint for a premium feel.
  Opacity transitions handle the fade between tour steps.
*/
/* No ::before halo — thin border ring only */
/* Tutorial card */
.spotlight-tooltip{
  width:100%; max-width:420px;
  background:#1A1033;
  border:1px solid rgba(138,92,255,.55);
  border-radius:22px; padding:22px 22px 16px;
  box-shadow:
    0 12px 48px rgba(0,0,0,.55),
    0 0 50px rgba(138,92,255,.25),
    0 0 0 1px rgba(255,255,255,.04) inset;
  animation:tooltipUp .38s cubic-bezier(.2,.8,.2,1) both;
}
/* Step label — 70% white per spec */
.spotlight-step{
  font-size:.72rem; letter-spacing:.12em; text-transform:uppercase;
  color:rgba(255,255,255,.70); font-weight:700; margin:0 0 7px;
}
/* Title — pure white */
.spotlight-tooltip h3{
  margin:0 0 9px; font-size:1.05rem; font-weight:800;
  color:#ffffff; letter-spacing:.01em;
}
/* Body text */
.spotlight-tooltip p{
  margin:0; font-size:.875rem; color:rgba(255,255,255,.82);
  line-height:1.58; white-space:pre-line;
}
/* Status line */
.spotlight-status{ margin-top:12px; font-size:.875rem; font-weight:700; color:#33d986; }

/* Primary action button — spec gradient #5E7CFF → #A855F7 */
#spotlight-action-btn{
  margin-top:16px; width:100%;
  background:linear-gradient(135deg, #5E7CFF 0%, #8B4CF7 55%, #A855F7 100%);
  box-shadow:
    0 0 25px rgba(120,90,255,.45),
    0 0 50px rgba(110,55,220,.25),
    0 4px 12px rgba(0,0,0,.45);
  border:1px solid rgba(200,150,255,.25);
  color:#ffffff;
  font-weight:700; letter-spacing:.03em;
  transition:box-shadow .2s, transform .15s;
}
#spotlight-action-btn:hover{
  box-shadow:
    0 0 35px rgba(138,92,255,.70),
    0 0 65px rgba(120,60,230,.35),
    0 4px 14px rgba(0,0,0,.45);
  transform:translateY(-1px);
}

/* Elements previously using inline styles */
#ended-trust-section{ width:100%; margin-top:8px; }
#notif-permission-btn{ margin-top:8px; }
.sheet-desc-fine{ font-size:.8rem; opacity:.65; margin-top:-8px; }

/* Skip button — more visible */
.tour-skip-btn{
  display:block; width:100%; margin-top:10px;
  background:none; border:none; cursor:pointer;
  color:rgba(255,255,255,.55); font-size:.8rem; letter-spacing:.04em;
  padding:6px 0; text-align:center;
  transition:color .2s;
}
.tour-skip-btn:hover{ color:rgba(255,255,255,.82); }

@keyframes tooltipUp{
  from{ opacity:0; transform:translateY(18px); }
  to{ opacity:1; transform:translateY(0); }
}
