.pub-chat-panel {
    position: fixed;
    bottom: 90px;
    right: 28px;
    width: 380px;
    height: 520px;
    background: linear-gradient(180deg, #0e0e16 0%, #07070b 100%);
    border: 1px solid rgba(255, 215, 0, 0.32);
    border-radius: 4px;
    clip-path: polygon(14px 0, 100% 0, 100% calc(100% - 14px), calc(100% - 14px) 100%, 0 100%, 0 14px);
    display: flex;
    flex-direction: column;
    z-index: 9998;
    transform: translateY(20px);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
    box-shadow: 0 20px 60px rgba(0,0,0,0.8), 0 0 40px rgba(255,215,0,0.12), inset 0 1px 0 rgba(255,255,255,0.04);
    background-image:
        linear-gradient(180deg, #0e0e16 0%, #07070b 100%),
        repeating-linear-gradient(0deg, transparent 0 2px, rgba(255,215,0,0.025) 2px 3px);
    background-blend-mode: normal, overlay;
}
.pub-chat-panel.open {
    transform: translateY(0);
    opacity: 1;
    pointer-events: all;
}
.pub-chat-header {
    padding: 16px 20px;
    border-bottom: 1px solid rgba(255,215,0,0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pub-chat-header-title {
    font-family: 'Orbitron', sans-serif;
    font-size: 0.85rem;
    font-weight: 700;
    color: #FFD700;
    letter-spacing: 0.1em;
}
.pub-chat-header-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}
.pub-chat-clear-btn {
    background: transparent;
    border: none;
    color: #555;
    cursor: pointer;
    font-size: 0.7rem;
    font-family: 'Rajdhani', sans-serif;
    letter-spacing: 0.05em;
    padding: 2px 6px;
    transition: color 0.2s;
}
.pub-chat-clear-btn:hover {
    color: #FFD700;
}
.pub-chat-header-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.75rem;
    color: #666;
}
.pub-chat-status-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: #FFD700;
    animation: statusPulse 2s infinite;
}
@keyframes statusPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}
/* ── Trio cockpit display frame ───────────────────────────────── */
.pub-cockpit-frame {
    position: relative;
    flex: 1;
    margin: 10px 12px 6px;
    background: linear-gradient(180deg, #1c1d22 0%, #0f1014 100%);
    border: 1px solid #2a2c33;
    border-radius: 6px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04), 0 4px 14px rgba(0,0,0,0.5);
    display: flex;
    flex-direction: column;
    min-height: 0;
}
.pub-cockpit-rail {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 10px 6px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    flex-shrink: 0;
}
.pub-cockpit-title {
    font-size: 9.5px; letter-spacing: 0.22em; text-transform: uppercase;
    color: rgba(212,161,58,0.85);
    font-family: 'Courier New', monospace;
}
.pub-cockpit-screw {
    width: 8px; height: 8px; border-radius: 50%;
    background: radial-gradient(circle at 30% 30%, #6a6c72, #1a1b1f 70%);
    box-shadow: inset 0 0 1px #000, 0 1px 0 rgba(255,255,255,0.05);
    flex-shrink: 0;
}
.pub-cockpit-phase {
    position: absolute; left: 0; right: 0; top: 24px;
    height: 2px; pointer-events: none;
    background: linear-gradient(90deg, transparent 0%, rgba(212,161,58,0.6) 50%, transparent 100%);
    transform: translateX(-100%);
    opacity: 0;
}
.pub-cockpit-frame.pub-cockpit-active .pub-cockpit-phase {
    opacity: 1;
    animation: pub-cockpit-phase 1.6s ease-in-out infinite;
}
@keyframes pub-cockpit-phase {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}
.pub-chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    scrollbar-width: thin;
    scrollbar-color: #2a2c33 transparent;
    min-height: 0;
}
.pub-chat-messages::-webkit-scrollbar { width: 4px; }
.pub-chat-messages::-webkit-scrollbar-track { background: transparent; }
.pub-chat-messages::-webkit-scrollbar-thumb { background: #2a2c33; border-radius: 2px; }
.pub-msg {
    position: relative;
    max-width: 88%;
    padding: 8px 12px 10px;
    border-radius: 4px;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    letter-spacing: 0.02em;
}
.pub-msg-assistant {
    background: linear-gradient(180deg, rgba(20,20,28,0.92) 0%, rgba(10,10,14,0.92) 100%);
    border: 1px solid rgba(212,161,58,0.35);
    border-left: 2px solid var(--cx-gold, #FFD700);
    color: #e6e6ec;
    align-self: flex-start;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 0 12px rgba(255,215,0,0.05);
}
.pub-msg-assistant::before {
    content: 'PUB · TRIO';
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 8.5px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(212,161,58,0.85);
    margin-bottom: 5px;
}
.pub-msg-signal {
    border-left-color: var(--cx-signal, #5ab0ff);
    border-color: rgba(90,176,255,0.32);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 0 12px rgba(90,176,255,0.08);
}
.pub-msg-signal::before { content: 'SIGNAL'; color: #5ab0ff; }
.pub-msg-architect {
    border-left-color: var(--cx-architect, #ffb547);
    border-color: rgba(255,181,71,0.32);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 0 12px rgba(255,181,71,0.08);
}
.pub-msg-architect::before { content: 'ARCHITECT'; color: #ffb547; }
.pub-msg-continuum {
    border-left-color: var(--cx-continuum, #c88cff);
    border-color: rgba(200,140,255,0.32);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03), 0 0 12px rgba(200,140,255,0.08);
}
.pub-msg-continuum::before { content: 'CONTINUUM'; color: #c88cff; }
.pub-msg-user {
    background: linear-gradient(180deg, rgba(255,215,0,0.14) 0%, rgba(255,215,0,0.06) 100%);
    border: 1px solid rgba(255,215,0,0.35);
    border-right: 2px solid #FFD700;
    color: #FFD700;
    align-self: flex-end;
    border-radius: 4px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.05), 0 0 12px rgba(255,215,0,0.08);
}
.pub-msg-user::before {
    content: 'PRODUCER';
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 8.5px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255,215,0,0.75);
    margin-bottom: 4px;
    text-align: right;
}
.pub-msg-typing {
    display: flex;
    gap: 4px;
    align-items: center;
    padding: 8px 12px 10px;
}
.pub-msg-typing::before { content: 'PUB · TRIO'; display: none; }
.pub-msg-typing span {
    width: 6px;
    height: 6px;
    background: #FFD700;
    border-radius: 50%;
    animation: typingDot 1.2s infinite;
    opacity: 0.4;
    box-shadow: 0 0 6px rgba(255,215,0,0.6);
}
.pub-msg-typing span:nth-child(2) { animation-delay: 0.2s; }
.pub-msg-typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingDot {
    0%, 100% { opacity: 0.4; transform: translateY(0); }
    50% { opacity: 1; transform: translateY(-3px); }
}
.pub-chat-limit-bar {
    padding: 8px 16px;
    border-top: 1px solid rgba(255,215,0,0.08);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.pub-chat-limit-text {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.75rem;
    color: #555;
    letter-spacing: 0.05em;
}
.pub-chat-limit-text.warning { color: #EF9F27; }
.pub-chat-limit-text.critical { color: #E24B4A; }
.pub-chat-limit-bar-track {
    width: 80px;
    height: 2px;
    background: #222;
    border-radius: 1px;
    overflow: hidden;
}
.pub-chat-limit-bar-fill {
    height: 100%;
    background: #FFD700;
    border-radius: 1px;
    transition: width 0.3s ease;
}
.pub-chat-limit-bar-fill.warning { background: #EF9F27; }
.pub-chat-limit-bar-fill.critical { background: #E24B4A; }
.pub-chat-input-area {
    padding: 10px 14px 14px;
    border-top: 1px solid rgba(255,215,0,0.18);
    background: linear-gradient(180deg, rgba(20,20,28,0.6) 0%, rgba(7,7,11,0.95) 100%);
    background-image:
        linear-gradient(180deg, rgba(20,20,28,0.6) 0%, rgba(7,7,11,0.95) 100%),
        repeating-linear-gradient(0deg, transparent 0 2px, rgba(255,215,0,0.025) 2px 3px);
    display: flex;
    gap: 10px;
    align-items: flex-end;
}
.pub-chat-input {
    flex: 1;
    background: linear-gradient(180deg, #0a0b0e 0%, #15171c 100%);
    border: 1px solid rgba(255,215,0,0.25);
    border-radius: 0;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    padding: 10px 12px;
    color: #f4f4ff;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.95rem;
    resize: none;
    max-height: 100px;
    min-height: 44px;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: inset 0 0 8px rgba(0,0,0,0.6);
}
.pub-chat-input:focus {
    border-color: rgba(255,215,0,0.55);
    box-shadow: inset 0 0 8px rgba(0,0,0,0.6), 0 0 12px rgba(255,215,0,0.15);
}
.pub-chat-input::placeholder {
    color: rgba(244,244,255,0.32);
    font-family: 'Courier New', monospace;
    font-size: 0.82rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.pub-chat-send-btn {
    width: 44px;
    height: 44px;
    background: linear-gradient(180deg, #FFD700 0%, #b89400 100%);
    border: 1px solid rgba(255,215,0,0.6);
    border-radius: 0;
    clip-path: polygon(8px 0, 100% 0, 100% calc(100% - 8px), calc(100% - 8px) 100%, 0 100%, 0 8px);
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: 'Orbitron', sans-serif;
    font-size: 1.2rem;
    font-weight: 700;
    transition: all 0.2s;
    flex-shrink: 0;
    box-shadow: 0 0 12px rgba(255,215,0,0.35), inset 0 1px 0 rgba(255,255,255,0.4);
}
.pub-chat-send-btn:hover { background: linear-gradient(180deg, #fff 0%, #FFD700 100%); box-shadow: 0 0 18px rgba(255,215,0,0.55); }
.pub-chat-send-btn:disabled {
    background: linear-gradient(180deg, #222 0%, #111 100%);
    color: #444;
    border-color: #2a2c33;
    box-shadow: none;
    cursor: not-allowed;
}

/* ── Cockpit throw switch cluster (replaces mic + speaker buttons) ── */
.pub-cockpit-switches {
    display: flex;
    gap: 8px;
    align-items: flex-end;
    flex-shrink: 0;
}
.pub-cockpit-switch {
    display: flex; flex-direction: column; align-items: center;
    background: linear-gradient(180deg, #14151a 0%, #08090c 100%);
    border: 1px solid #2a2c33;
    border-radius: 4px;
    padding: 4px 6px 6px;
    min-width: 46px;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.pub-cockpit-switch-label {
    font-size: 8px;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.55);
    margin-bottom: 4px;
    font-family: 'Courier New', monospace;
}
.pub-cockpit-throw {
    position: relative;
    width: 22px;
    height: 44px;
    background: linear-gradient(180deg, #0a0b0e 0%, #15171c 50%, #0a0b0e 100%);
    border: 1px solid #2a2c33;
    border-radius: 3px;
    cursor: pointer;
    box-shadow: inset 0 0 6px rgba(0,0,0,0.6);
    color: transparent;
    padding: 0;
}
.pub-cockpit-throw svg { display: none; }
.pub-cockpit-throw::after {
    content: '';
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    width: 14px;
    height: 16px;
    background: linear-gradient(180deg, #d8d8db 0%, #8c8c92 50%, #5a5a60 100%);
    border: 1px solid #2a2c33;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.6), inset 0 1px 0 rgba(255,255,255,0.4);
    transition: top 180ms cubic-bezier(0.5, 1.6, 0.4, 1);
    top: 24px;
    pointer-events: none;
}
.pub-cockpit-throw.pub-throw-on::after,
.pub-mic-btn.pub-mic-recording::after,
.pub-speaker-btn.pub-speaker-active::after {
    top: 4px;
}
.pub-cockpit-led {
    width: 6px; height: 6px; border-radius: 50%;
    margin-top: 5px;
    background: #1a1b1f;
    box-shadow: inset 0 0 2px #000;
    transition: background 180ms, box-shadow 180ms;
}
.pub-cockpit-switch.pub-throw-mic .pub-cockpit-led { background: #1a1b1f; }
.pub-cockpit-switch.pub-throw-mic.pub-throw-active .pub-cockpit-led {
    background: #c95757;
    box-shadow: 0 0 6px #c95757, inset 0 0 1px rgba(255,255,255,0.6);
}
.pub-cockpit-switch.pub-throw-speaker.pub-throw-active .pub-cockpit-led {
    background: #5ee0a8;
    box-shadow: 0 0 6px #5ee0a8, inset 0 0 1px rgba(255,255,255,0.6);
}
.pub-cockpit-readout {
    font-size: 7.5px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: rgba(255,255,255,0.5);
    margin-top: 3px;
    font-family: 'Courier New', monospace;
    min-height: 9px;
}
.pub-cockpit-switch.pub-throw-active .pub-cockpit-readout {
    color: rgba(255,255,255,0.9);
}
.pub-mic-btn.pub-mic-busy { opacity: 0.55; cursor: wait; }
@keyframes pub-mic-pulse {
    0% { transform: scale(1); opacity: 0.7; }
    50% { transform: scale(1.18); opacity: 0; }
    100% { transform: scale(1); opacity: 0; }
}
.pub-voice-strip {
    margin: 0 16px 8px;
    padding: 6px 10px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.06), rgba(255, 165, 0, 0.03));
    border: 1px solid rgba(255, 215, 0, 0.28);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.pub-voice-wave {
    width: 100%;
    height: 32px;
    display: block;
    border-radius: 5px;
    background: rgba(0, 0, 0, 0.3);
}
.pub-voice-meta {
    display: flex; align-items: center; gap: 8px;
    color: #FFD700; font-size: 0.72rem; letter-spacing: 0.4px;
}
.pub-voice-dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: #ff5050;
    box-shadow: 0 0 8px rgba(255, 80, 80, 0.7);
    animation: pub-rec-blink 1s ease-in-out infinite;
}
@keyframes pub-rec-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.35; }
}
.pub-voice-label { flex: 1; }
.pub-voice-timer { color: #aaa; font-variant-numeric: tabular-nums; }
.pub-chat-quick-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 16px 12px;
}
.pub-chip {
    background: transparent;
    border: 1px solid rgba(255,215,0,0.2);
    color: #888;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.8rem;
    padding: 5px 10px;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.03em;
}
.pub-chip:hover {
    border-color: rgba(255,215,0,0.5);
    color: #FFD700;
    background: rgba(255,215,0,0.05);
}
.pub-chat-limit-reached {
    padding: 16px;
    text-align: center;
    border-top: 1px solid rgba(255,215,0,0.1);
}
.pub-chat-limit-reached p {
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.85rem;
    color: #666;
    margin-bottom: 10px;
    letter-spacing: 0.02em;
}
.pub-limit-action-btn {
    display: block;
    width: 100%;
    padding: 8px;
    margin-bottom: 6px;
    background: transparent;
    border: 1px solid rgba(255,215,0,0.2);
    color: #FFD700;
    font-family: 'Rajdhani', sans-serif;
    font-size: 0.85rem;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}
.pub-limit-action-btn:hover {
    background: rgba(255,215,0,0.08);
    border-color: rgba(255,215,0,0.4);
}
@media (max-width: 768px) {
    .pub-chat-panel {
        right: 12px;
        left: 12px;
        width: auto;
        bottom: 80px;
        height: 460px;
    }
}
.pub-msg-beta-welcome {
    font-size: 0.88rem;
    line-height: 1.55;
    padding: 14px 16px;
}
.pub-beta-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 8px 0;
}
.pub-beta-chips .pub-chip {
    font-size: 0.78rem;
}
