/* ═══════════════════════════════════════════════════════════════════
   QUBBLE CALL — "The Sealed Channel"
   Calls are bubbles: they form (sonar rings), entangle (thread fuses,
   particles burst), and end by popping. Secrecy is the aesthetic —
   veiled glass, whispered mono copy, a classified-stamp SAS chip.
   Uses the established theme tokens from style.css.
   ═══════════════════════════════════════════════════════════════════ */

/* ── header button ───────────────────────────────────────────────── */
.qcall-hbtn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    position: relative;
    color: var(--color-secondary, #00d4ff);
    overflow: visible;
}
.qcall-hbtn svg { display: block; }
.qcall-hbtn.qcall-ready::after {
    content: '';
    position: absolute;
    inset: -3px;
    border-radius: inherit;
    border: 1px solid rgba(0, 212, 255, .45);
    animation: qcall-breathe 2.6s ease-in-out infinite;
    pointer-events: none;
}
.qcall-hbtn.qcall-live {
    color: var(--color-success, #34d399);
    text-shadow: 0 0 8px rgba(52, 211, 153, .8);
}
@keyframes qcall-breathe {
    0%, 100% { opacity: .15; transform: scale(1); }
    50%      { opacity: .8;  transform: scale(1.08); }
}

/* ── full-screen veil + stage ────────────────────────────────────── */
#qbc-call-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: none;
    align-items: center;
    justify-content: center;
}
#qbc-call-overlay.qcall-show { display: flex; }
.qcall-veil {
    position: absolute;
    inset: 0;
    background:
        radial-gradient(ellipse 80% 60% at 50% 30%, rgba(123, 47, 247, .16), transparent 70%),
        radial-gradient(ellipse 60% 50% at 50% 80%, rgba(0, 212, 255, .08), transparent 70%),
        rgba(10, 10, 15, .82);
    backdrop-filter: blur(14px) saturate(1.2);
    -webkit-backdrop-filter: blur(14px) saturate(1.2);
}
/* faint scanline grain — the "classified feed" texture */
.qcall-veil::after {
    content: '';
    position: absolute;
    inset: 0;
    background: repeating-linear-gradient(0deg, transparent 0 2px, rgba(255, 255, 255, .012) 2px 3px);
    pointer-events: none;
}
.qcall-stage {
    position: relative;
    text-align: center;
    padding: 28px 22px;
    max-width: 420px;
    width: calc(100% - 32px);
    animation: qcall-rise .45s cubic-bezier(.2, .9, .25, 1.2);
}
@keyframes qcall-rise {
    from { opacity: 0; transform: translateY(26px) scale(.96); }
    to   { opacity: 1; transform: none; }
}

/* ── the two orbs + entanglement thread ──────────────────────────── */
.qcall-orbs {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    margin-bottom: 26px;
    min-height: 96px;
}
.qcall-orb {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: 1.6rem;
    color: #fff;
    position: relative;
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .35), transparent 42%),
        radial-gradient(circle at 50% 50%, rgba(123, 47, 247, .55), rgba(18, 18, 31, .9) 75%);
    border: 1px solid rgba(123, 47, 247, .55);
    box-shadow: 0 0 24px rgba(123, 47, 247, .35), inset 0 0 18px rgba(0, 212, 255, .12);
    animation: qcall-orbfloat 3.4s ease-in-out infinite;
    transition: transform .8s cubic-bezier(.4, 0, .2, 1), box-shadow .8s;
}
.qcall-orb-peer {
    border-color: rgba(0, 212, 255, .55);
    background:
        radial-gradient(circle at 32% 28%, rgba(255, 255, 255, .35), transparent 42%),
        radial-gradient(circle at 50% 50%, rgba(0, 212, 255, .4), rgba(18, 18, 31, .9) 75%);
    box-shadow: 0 0 24px rgba(0, 212, 255, .3), inset 0 0 18px rgba(123, 47, 247, .12);
    animation-delay: -1.7s;
}
@keyframes qcall-orbfloat {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-7px); }
}
.qcall-thread {
    display: flex;
    gap: 7px;
    align-items: center;
}
.qcall-thread i {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--color-secondary, #00d4ff);
    opacity: .25;
}
[data-mode="connecting"] .qcall-thread i,
[data-mode="out"] .qcall-thread i {
    animation: qcall-threadflow 1.1s ease-in-out infinite;
}
.qcall-thread i:nth-child(2) { animation-delay: .12s; }
.qcall-thread i:nth-child(3) { animation-delay: .24s; }
.qcall-thread i:nth-child(4) { animation-delay: .36s; }
.qcall-thread i:nth-child(5) { animation-delay: .48s; }
@keyframes qcall-threadflow {
    0%, 100% { opacity: .2; transform: scale(1); box-shadow: none; }
    50%      { opacity: 1; transform: scale(1.5); box-shadow: 0 0 10px var(--color-secondary, #00d4ff); }
}
/* the seal: orbs slam together, thread goes solid green */
[data-mode="sealed"] .qcall-orb-me   { transform: translateX(34px) scale(1.05); }
[data-mode="sealed"] .qcall-orb-peer { transform: translateX(-34px) scale(1.05); }
[data-mode="sealed"] .qcall-orb {
    border-color: rgba(52, 211, 153, .8);
    box-shadow: 0 0 36px rgba(52, 211, 153, .5);
    animation: none;
}
[data-mode="sealed"] .qcall-thread i {
    background: var(--color-success, #34d399);
    opacity: 1;
    animation: none;
    box-shadow: 0 0 8px rgba(52, 211, 153, .9);
}

/* ── sonar rings (incoming ring) ─────────────────────────────────── */
.qcall-rings {
    position: absolute;
    top: 38px;
    left: 50%;
    width: 0;
    height: 0;
    pointer-events: none;
}
.qcall-rings b {
    position: absolute;
    left: -60px;
    top: -22px;
    width: 120px;
    height: 120px;
    border-radius: 50%;
    border: 1px solid rgba(0, 212, 255, .5);
    opacity: 0;
}
[data-mode="in"] .qcall-rings b,
[data-mode="out"] .qcall-rings b { animation: qcall-sonar 2.2s ease-out infinite; }
.qcall-rings b:nth-child(2) { animation-delay: .7s; }
.qcall-rings b:nth-child(3) { animation-delay: 1.4s; }
@keyframes qcall-sonar {
    0%   { transform: scale(.4); opacity: .7; }
    100% { transform: scale(2.4); opacity: 0; }
}

/* ── copy ────────────────────────────────────────────────────────── */
.qcall-peer-name {
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: 1.35rem;
    letter-spacing: .14em;
    color: var(--color-text, #e8e8f0);
    text-transform: uppercase;
    margin-bottom: 8px;
    text-shadow: 0 0 18px rgba(123, 47, 247, .55);
}
.qcall-whisper {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: .72rem;
    letter-spacing: .06em;
    color: rgba(232, 232, 240, .55);
    min-height: 2.2em;
    margin-bottom: 22px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: center;
}

/* ── action buttons ──────────────────────────────────────────────── */
.qcall-actions { display: flex; gap: 14px; justify-content: center; }
.qcall-btn {
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: .78rem;
    letter-spacing: .12em;
    padding: 13px 26px;
    border-radius: 999px;
    border: 1px solid transparent;
    cursor: pointer;
    background: rgba(18, 18, 31, .8);
    color: var(--color-text, #e8e8f0);
    transition: transform .15s, box-shadow .15s;
    min-height: 44px; /* touch target */
}
.qcall-btn:active { transform: scale(.95); }
.qcall-accept {
    border-color: rgba(52, 211, 153, .7);
    color: var(--color-success, #34d399);
    box-shadow: 0 0 18px rgba(52, 211, 153, .25);
    animation: qcall-breathe 1.8s ease-in-out infinite;
}
.qcall-decline, .qcall-cancel {
    border-color: rgba(244, 114, 182, .6);
    color: var(--color-accent-hot, #f472b6);
}
.qcall-pick {
    border-color: rgba(0, 212, 255, .5);
    color: var(--color-secondary, #00d4ff);
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    text-transform: none;
    letter-spacing: .02em;
}
/* mode-gating — ID-prefixed on BOTH sides so the show rules out-specify the
   hide rule (an ID beats any number of classes; without the ID prefix the
   hide rule wins and the ANSWER/CANCEL buttons never appear). */
#qbc-call-overlay .qcall-accept,
#qbc-call-overlay .qcall-decline,
#qbc-call-overlay .qcall-cancel { display: none; }
#qbc-call-overlay[data-mode="in"]  .qcall-accept,
#qbc-call-overlay[data-mode="in"]  .qcall-decline { display: inline-block; }
#qbc-call-overlay[data-mode="out"] .qcall-cancel,
#qbc-call-overlay[data-mode="connecting"] .qcall-cancel { display: inline-block; }
#qbc-call-overlay[data-mode="pick"] .qcall-orbs,
#qbc-call-overlay[data-mode="pick"] .qcall-rings { display: none; }

/* ── in-call bar ─────────────────────────────────────────────────── */
#qbc-call-bar {
    position: fixed;
    z-index: 8900;
    display: none;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    background:
        linear-gradient(180deg, rgba(18, 18, 31, .96), rgba(10, 10, 15, .96));
    border: 1px solid rgba(52, 211, 153, .35);
    box-shadow: 0 6px 28px rgba(0, 0, 0, .55), 0 0 22px rgba(52, 211, 153, .12);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    /* mobile-first: docked bottom, safe-area aware */
    left: 8px;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    border-radius: 16px;
    flex-wrap: wrap;
    justify-content: center;
}
#qbc-call-bar.qcall-show { display: flex; animation: qcall-rise .35s ease; }
@media (min-width: 760px) {
    #qbc-call-bar {
        left: auto;
        bottom: auto;
        top: 64px;
        right: 14px;
        max-width: 560px;
        flex-wrap: nowrap;
    }
}
.qcall-bar-state {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: .62rem;
    letter-spacing: .14em;
    color: var(--color-success, #34d399);
}
.qcall-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--color-success, #34d399);
    box-shadow: 0 0 8px currentColor;
}
.qcall-dot-sealed { background: var(--color-success, #34d399); animation: qcall-breathe 2s infinite; }
.qcall-dot-warn   { background: #fbbf24; color: #fbbf24; }
.qcall-dot-bad    { background: var(--color-accent-hot, #f472b6); color: #f472b6; }
.qcall-bar-peer {
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: .8rem;
    letter-spacing: .1em;
    color: var(--color-text, #e8e8f0);
    text-transform: uppercase;
}
.qcall-mono, .qcall-bar-dur {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: .76rem;
    color: rgba(232, 232, 240, .8);
    font-variant-numeric: tabular-nums;
}
/* live voice — your words rippling through the sealed channel */
.qcall-wave {
    display: flex;
    gap: 2.5px;
    align-items: center;
    height: 22px;
}
.qcall-wave i {
    width: 3px;
    height: 100%;
    border-radius: 2px;
    background: linear-gradient(180deg, var(--color-secondary, #00d4ff), var(--color-primary, #7b2ff7));
    transform: scaleY(.15);
    transform-origin: center;
    transition: transform .08s linear;
}
/* SAS chip — the classified stamp */
.qcall-sas {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 9px;
    border: 1px dashed rgba(0, 212, 255, .45);
    border-radius: 8px;
    position: relative;
    overflow: hidden;
    cursor: help;
}
.qcall-sas::after {              /* hologram shimmer sweep */
    content: '';
    position: absolute;
    top: 0; bottom: 0;
    width: 36%;
    left: -40%;
    background: linear-gradient(105deg, transparent, rgba(0, 212, 255, .16), transparent);
    animation: qcall-shimmer 3.8s ease-in-out infinite;
}
@keyframes qcall-shimmer {
    0%, 60% { left: -40%; }
    100%    { left: 130%; }
}
.qcall-sas-label {
    font-family: var(--font-mono, 'JetBrains Mono', monospace);
    font-size: .6rem;
    letter-spacing: .08em;
    color: rgba(0, 212, 255, .75);
    text-transform: uppercase;
}
.qcall-sas-emoji { font-size: .95rem; letter-spacing: .12em; white-space: nowrap; }
/* bar buttons */
.qcall-mute, .qcall-pop {
    font-family: var(--font-display, 'Orbitron', sans-serif);
    font-size: .64rem;
    letter-spacing: .1em;
    padding: 8px 13px;
    border-radius: 999px;
    cursor: pointer;
    background: transparent;
    min-height: 36px;
    transition: transform .12s;
}
.qcall-mute { border: 1px solid rgba(0, 212, 255, .5); color: var(--color-secondary, #00d4ff); }
.qcall-mute.qcall-muted { border-color: #fbbf24; color: #fbbf24; }
.qcall-pop {
    border: 1px solid rgba(244, 114, 182, .65);
    color: var(--color-accent-hot, #f472b6);
    box-shadow: 0 0 12px rgba(244, 114, 182, .2);
}
.qcall-mute:active, .qcall-pop:active { transform: scale(.92); }

/* reduced motion: secrecy without seasickness */
@media (prefers-reduced-motion: reduce) {
    .qcall-orb, .qcall-rings b, .qcall-thread i,
    .qcall-hbtn.qcall-ready::after, .qcall-sas::after,
    .qcall-dot-sealed, .qcall-accept { animation: none !important; }
    .qcall-stage, #qbc-call-bar.qcall-show { animation: none !important; }
}

/* ───────────────────────── sealed video (jun11) ───────────────────────── */
.qcall-cam { border: 1px solid rgba(52, 211, 153, .55); color: #34d399; }
.qcall-cam.qcall-cam-on { border-color: #34d399; color: #052e1c; background: #34d399; box-shadow: 0 0 12px rgba(52,211,153,.35); }
.qcall-cam:active { transform: scale(.92); }

#qbc-video-tiles {
    position: fixed;
    right: 16px;
    bottom: 84px;                 /* sits just above the in-call bar */
    z-index: 9998;
    width: min(340px, 64vw);
    border-radius: 16px;
    overflow: hidden;
    background: #05060b;
    border: 1px solid rgba(52, 211, 153, .35);
    box-shadow: 0 10px 40px rgba(0,0,0,.6), 0 0 24px rgba(52,211,153,.12);
}
#qbc-video-tiles[hidden] { display: none; }
.qcall-remote-tile {
    display: block;
    width: 100%;
    height: auto;
    aspect-ratio: 4 / 3;
    background: #05060b;
    object-fit: cover;
}
.qcall-remote-wait {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    letter-spacing: .04em;
    color: rgba(180, 200, 220, .65);
    pointer-events: none;
}
.qcall-remote-wait[hidden] { display: none; }
.qcall-local-pip {
    position: absolute;
    right: 10px;
    bottom: 10px;
    width: 33%;
    max-width: 110px;
    aspect-ratio: 4 / 3;
    object-fit: cover;
    border-radius: 9px;
    border: 1px solid rgba(52, 211, 153, .6);
    background: #000;
    transform: scaleX(-1);        /* mirror self-view, like every camera UI */
    box-shadow: 0 2px 12px rgba(0,0,0,.5);
}
.qcall-local-pip[hidden] { display: none; }
@media (max-width: 560px) {
    #qbc-video-tiles { right: 8px; left: 8px; width: auto; bottom: 76px; }
}
