/* ══════════════════════════════════════════════════
   Microsoft Teams — Dark Theme (Authentic Clone)
   ══════════════════════════════════════════════════ */

:root {
    /* Teams dark palette */
    --t-bg:          #141414;
    --t-bg-1:        #1f1f1f;
    --t-bg-2:        #292929;
    --t-bg-3:        #323232;
    --t-bg-hover:    #3d3d3d;
    --t-border:      #3d3d3d;
    --t-border-sub:  rgba(255,255,255,0.04);

    /* Teams brand */
    --t-brand:       #5b5fc7;
    --t-brand-hover: #7579eb;
    --t-brand-fg:    #c8caf5;
    --t-speaking:    #5b5fc7;

    /* Text */
    --t-text:        #ffffff;
    --t-text-2:      #d6d6d6;
    --t-text-3:      #adadad;
    --t-text-4:      #8a8a8a;
    --t-text-dis:    #5c5c5c;
    --t-text-sec:    #adadad;

    /* Status */
    --t-danger:      #c4314b;
    --t-danger-h:    #d74158;
    --t-success:     #6bb700;
    --t-warning:     #f2c811;

    --t-font: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Helvetica Neue', sans-serif;
    --t-radius: 4px;
    --t-radius-md: 8px;
    --t-radius-lg: 12px;
}

.teams-logo-sm { flex-shrink: 0; }
.fca-logo, .fca-logo-sm {
    flex-shrink: 0;
    opacity: 0.85;
    vertical-align: middle;
}

/* Partnership separator (Teams × FCA) */
.logo-sep {
    font-size: 14px;
    color: var(--t-text-4);
    font-weight: 300;
    margin: 0 2px;
}
.logo-sep-sm {
    font-size: 11px;
    color: var(--t-text-4);
    font-weight: 300;
    margin: 0 1px;
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
    width: 100%; height: 100%;
    overflow: hidden;
    font-family: var(--t-font);
    background: var(--t-bg);
    color: var(--t-text);
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

::selection { background: rgba(91,95,199,0.35); color: #fff; }

/* Custom cursor for interactive elements */
button, .tray-btn, .panel-close, .prejoin-ctrl-btn, .tile-more, .topbar-btn {
    cursor: pointer;
}
.chat-input:disabled, .chat-send-btn:disabled {
    cursor: not-allowed;
}

/* Shake animation for locked chat input */
@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
    20%, 40%, 60%, 80% { transform: translateX(4px); }
}
.shake-animation {
    animation: shake 0.4s ease-in-out;
}

/* ══════════════════════════════════════════════════
   PIN ENTRY SCREEN
   ══════════════════════════════════════════════════ */
.pin-screen {
    width: 100%; height: 100%;
    display: flex; align-items: center; justify-content: center;
    background: radial-gradient(ellipse at 50% 30%, #1a1a2e 0%, var(--t-bg) 70%);
}

.pin-container {
    display: flex; flex-direction: column; align-items: center;
    width: 400px;
    max-width: calc(100% - 32px);
}

.pin-header {
    display: flex; align-items: center; gap: 10px;
    margin-bottom: 48px;
}

.pin-title {
    font-size: 16px; font-weight: 600;
    color: var(--t-text-2);
}

.pin-partner {
    font-size: 11px;
    color: var(--t-text-4);
    letter-spacing: 1.5px;
    text-transform: uppercase;
    margin-bottom: 32px;
    margin-top: -36px;
}

.pin-card {
    width: 100%;
    background: var(--t-bg-1);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-lg);
    padding: 40px 32px;
    display: flex; flex-direction: column; align-items: center;
    box-shadow: 0 8px 40px rgba(0,0,0,0.35);
}

.pin-lock-icon {
    width: 56px; height: 56px;
    border-radius: 50%;
    background: var(--t-bg-2);
    display: flex; align-items: center; justify-content: center;
    font-size: 22px; color: var(--t-brand);
    margin-bottom: 20px;
}

.pin-heading {
    font-size: 20px; font-weight: 600;
    color: var(--t-text);
    margin-bottom: 4px;
}

.pin-subtext {
    font-size: 13px; color: var(--t-text-3);
    margin-bottom: 6px;
}

.pin-organized-by {
    font-size: 12px; color: var(--t-text-4);
    margin-bottom: 28px;
}
.pin-organized-by strong { color: var(--t-text-3); font-weight: 600; }

.pin-input-group {
    display: flex; gap: 12px;
    margin-bottom: 16px;
}

.pin-digit {
    width: 52px; height: 52px;
    background: var(--t-bg-2);
    border: 2px solid var(--t-border);
    border-radius: var(--t-radius);
    text-align: center;
    font-size: 20px; font-weight: 600;
    color: var(--t-text);
    font-family: var(--t-font);
    outline: none;
    transition: border-color 0.15s;
}

.pin-digit:focus {
    border-color: var(--t-brand);
    background: var(--t-bg-3);
}

.pin-digit.error {
    border-color: var(--t-danger);
    animation: shake 0.3s;
}

.pin-error {
    display: flex; align-items: center; gap: 6px;
    color: var(--t-danger);
    font-size: 12px;
    margin-bottom: 16px;
}

.pin-error i { font-size: 14px; }

.pin-submit {
    width: 100%; padding: 10px;
    background: var(--t-brand);
    color: white;
    border: none; border-radius: var(--t-radius);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    font-family: var(--t-font);
    transition: background 0.15s;
}

.pin-submit:hover { background: var(--t-brand-hover); }
.pin-submit:focus-visible { outline: 2px solid var(--t-brand-fg); outline-offset: 2px; }
.pin-submit:active { transform: scale(0.98); }

.pin-submit:disabled {
    background: var(--t-bg-3);
    color: var(--t-text-dis);
    cursor: not-allowed;
}

/* ══════════════════════════════════════════════════
   PRE-JOIN SCREEN
   ══════════════════════════════════════════════════ */
.prejoin {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    background: radial-gradient(ellipse at 50% 40%, #1a1a2e 0%, var(--t-bg) 65%);
}

.prejoin-chrome {
    height: 48px;
    background: var(--t-bg-1);
    display: flex; align-items: center;
    padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    border-bottom: 1px solid var(--t-border-sub);
    -webkit-app-region: drag;
}

.prejoin-chrome-left {
    display: flex; align-items: center; gap: 10px;
}

.prejoin-chrome-title {
    font-size: 12px; font-weight: 600; color: var(--t-text-3);
}

.prejoin-body {
    flex: 1;
    display: flex; align-items: center; justify-content: center;
}

.prejoin-card {
    display: flex; flex-direction: column; align-items: center;
    width: 480px;
    max-width: 100%;
}

.prejoin-preview {
    width: 100%; height: 270px;
    background: var(--t-bg-2);
    border-radius: var(--t-radius-lg);
    overflow: hidden; position: relative;
}

.prejoin-preview video {
    width: 100%; height: 100%;
    object-fit: cover;
    transform: scaleX(-1);
}

.prejoin-preview::after {
    content: '';
    position: absolute; inset: 0;
    background: radial-gradient(ellipse at center, transparent 60%, rgba(0,0,0,0.25) 100%);
    pointer-events: none;
    border-radius: var(--t-radius-lg);
}

.prejoin-avatar {
    position: absolute; inset: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 36px; color: var(--t-text-4);
    background: var(--t-bg-2);
}

.prejoin-avatar.hidden { display: none; }

.prejoin-preview-controls {
    position: absolute; bottom: 12px;
    left: 50%; transform: translateX(-50%);
    display: flex; gap: 8px;
    background: rgba(0,0,0,0.55);
    padding: 6px 10px;
    border-radius: 20px;
    -webkit-backdrop-filter: blur(12px);
    backdrop-filter: blur(12px);
}

.prejoin-ctrl-btn {
    width: 36px; height: 36px;
    border-radius: 50%; border: none;
    background: rgba(255,255,255,0.1);
    color: white; font-size: 14px;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: background 0.15s;
}

.prejoin-ctrl-btn:hover { background: rgba(255,255,255,0.15); }
.prejoin-ctrl-btn.is-off { opacity: 0.5; }
.prejoin-ctrl-btn.is-active {
    background: var(--t-brand);
    color: #fff;
}

.prejoin-ctrl-btn.is-off:hover { background: var(--t-danger-h); }

.prejoin-info {
    margin-top: 24px; text-align: center;
    display: flex; flex-direction: column; align-items: center;
}

.prejoin-meeting-title {
    font-size: 20px; font-weight: 600; color: var(--t-text);
    margin-bottom: 4px;
}

.prejoin-meeting-sub {
    font-size: 12px; color: var(--t-text-4);
    margin-bottom: 16px;
}

.prejoin-e2e-badge {
    display: flex; align-items: center; gap: 6px;
    font-size: 11px; color: var(--t-success);
    margin-bottom: 12px;
}
.prejoin-e2e-badge i { font-size: 11px; }

.prejoin-mic-warning {
    display: flex; align-items: center; gap: 8px;
    background: rgba(196, 49, 75, 0.12);
    border: 1px solid rgba(196, 49, 75, 0.25);
    border-radius: var(--t-radius);
    padding: 8px 14px;
    margin-bottom: 20px;
    font-size: 12px; color: var(--t-danger);
}

.prejoin-mic-warning i { font-size: 14px; }

.prejoin-join-btn {
    width: 200px; padding: 10px 0;
    background: var(--t-brand); color: white;
    border: none; border-radius: var(--t-radius);
    font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: var(--t-font);
    transition: background 0.15s, transform 0.1s;
}
.prejoin-join-btn:active:not(:disabled) { transform: scale(0.97); }
.prejoin-join-btn:focus-visible { outline: 2px solid var(--t-brand-fg); outline-offset: 2px; }

.prejoin-join-btn:hover:not(:disabled) { background: var(--t-brand-hover); }

.prejoin-join-btn:disabled {
    background: var(--t-bg-3);
    color: var(--t-text-dis);
    cursor: not-allowed;
}

.prejoin-other-opts {
    margin-top: 12px;
    display: flex; gap: 6px;
    font-size: 12px; color: var(--t-text-4);
}

.prejoin-opt-link {
    color: var(--t-brand-fg); cursor: pointer;
}
.prejoin-opt-link:hover { text-decoration: underline; }
.prejoin-opt-sep { color: var(--t-text-dis); }

/* ══════════════════════════════════════════════════
   MEETING ROOM
   ══════════════════════════════════════════════════ */
.meeting {
    width: 100%; height: 100%;
    display: flex; flex-direction: column;
    background: var(--t-bg);
}

/* ── TOP BAR ── */
.meeting-topbar {
    height: 48px;
    background: var(--t-bg-1);
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    flex-shrink: 0;
    border-bottom: 1px solid var(--t-border-sub);
}

.topbar-left {
    display: flex; align-items: center; gap: 10px;
    min-width: 0;
    overflow: hidden;
}

.topbar-title {
    font-size: 13px; font-weight: 600;
    color: var(--t-text-2);
}

.topbar-center {
    display: flex; align-items: center;
}

.topbar-security {
    display: flex; align-items: center; gap: 5px;
    font-size: 11px; color: var(--t-success);
    padding: 4px 8px;
    border-radius: 20px;
    border: 1px solid transparent;
    transition: background 0.15s, border-color 0.15s;
}

.topbar-security:hover {
    background: rgba(107, 183, 0, 0.12);
    border-color: rgba(107, 183, 0, 0.3);
}

.topbar-security i { font-size: 11px; }

.topbar-confidential {
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 1.2px;
    color: var(--t-warning);
    background: rgba(242, 200, 17, 0.1);
    border: 1px solid rgba(242, 200, 17, 0.2);
    padding: 2px 8px;
    border-radius: 3px;
    margin-left: 10px;
}

.topbar-right {
    display: flex; align-items: center; gap: 12px;
}

.topbar-timer {
    font-size: 12px; font-weight: 600;
    color: var(--t-text-3);
    font-variant-numeric: tabular-nums;
}

.topbar-btn {
    width: 32px; height: 32px;
    border-radius: var(--t-radius);
    border: none; background: transparent;
    color: var(--t-text-3); font-size: 14px;
    cursor: pointer; display: flex;
    align-items: center; justify-content: center;
    transition: background 0.12s;
}

.topbar-btn:hover { background: var(--t-bg-hover); }

/* ── VIDEO STAGE ── */
.meeting-stage {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    min-height: 0;
    background: var(--t-bg);
    position: relative;
}

/* ── REALISM OVERLAYS ── */
.recording-badge {
    position: absolute;
    top: 16px;
    left: 16px;
    background: rgba(196, 49, 75, 0.9);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    padding: 6px 12px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 600;
    color: white;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    animation: recFadeIn 1.5s ease forwards;
}

@keyframes recFadeIn {
    0% { opacity: 0; transform: translateY(-8px); }
    100% { opacity: 1; transform: translateY(0); }
}

.rec-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: white;
    animation: recPulse 1.6s ease-in-out infinite;
}

@keyframes recPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: .4; transform: scale(1.3); }
}

.network-indicator {
    position: absolute;
    top: 16px;
    right: 16px;
    background: rgba(41, 41, 41, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    padding: 8px 14px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: var(--t-warning);
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
    animation: slideInRight 0.3s ease-out;
}

@keyframes slideInRight {
    from { transform: translateX(100px); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

.network-indicator i {
    font-size: 14px;
    animation: wifi-pulse 1s ease-in-out infinite;
}

@keyframes wifi-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.3; }
}

.watermark-overlay {
    position: absolute;
    bottom: 80px;
    right: 20px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.15);
    font-weight: 600;
    letter-spacing: 0.5px;
    pointer-events: none;
    z-index: 5;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.video-grid {
    width: 100%; height: 100%;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    grid-template-rows: repeat(2, 1fr);
    gap: 4px;
}

/* Row 1: 3 equal tiles spanning 2/6 cols each */
.video-tile:nth-child(1) { grid-column: 1 / 3; }
.video-tile:nth-child(2) { grid-column: 3 / 5; }
.video-tile:nth-child(3) { grid-column: 5 / 7; }

/* Row 2: 2 tiles centered — gaps of 1 col each side */
.video-tile:nth-child(4) { grid-column: 2 / 4; }
.video-tile:nth-child(5) { grid-column: 4 / 6; }

.video-tile {
    background: var(--t-bg-2);
    border-radius: var(--t-radius-md);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: box-shadow 0.2s;
}
.video-tile:hover {
    box-shadow: 0 0 0 1px rgba(255,255,255,0.08);
}

.video-tile:hover .tile-more { opacity: 1; }

.tile-video {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}

/* Dual speak/silent looping videos — overlapping, event-switched by JS */
.tile-loop-video {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.tile-speak-video {
    z-index: 2;
    opacity: 0;
    transition: opacity 0.35s ease;
    pointer-events: none;
}
.tile-speak-video.is-speaking {
    opacity: 1;
}

.is-self .tile-video { transform: scaleX(-1); }

/* Micro-shake for realism */
.video-tile.micro-shake {
    animation: micro-shake 0.1s ease-in-out;
}

@keyframes micro-shake {
    0%, 100% { transform: translate(0, 0); }
    25% { transform: translate(0.5px, -0.3px); }
    50% { transform: translate(-0.4px, 0.5px); }
    75% { transform: translate(0.3px, 0.4px); }
}

/* Freeze frame effect */
.tile-video.frozen {
    filter: brightness(0.98) contrast(1.02);
}

/* Glitch effect — brief visual distortion at chunk transitions */
@keyframes video-glitch-anim {
    0%   { clip-path: inset(0 0 100% 0);   transform: translate(0,0);     filter: none; }
    15%  { clip-path: inset(15% 0 70% 0);  transform: translate(-4px,0);  filter: hue-rotate(80deg) saturate(3); }
    30%  { clip-path: inset(60% 0 20% 0);  transform: translate(4px,0);   filter: brightness(1.8); }
    50%  { clip-path: inset(30% 0 50% 0);  transform: translate(-2px,1px); filter: hue-rotate(180deg); }
    70%  { clip-path: inset(0 0 0 0);      transform: translate(2px,0);   filter: none; }
    100% { clip-path: inset(0 0 0 0);      transform: translate(0,0);     filter: none; }
}
.video-glitch {
    animation: video-glitch-anim 0.1s steps(2) forwards;
}

/* Avatar circle */
.tile-avatar {
    width: 80px; height: 80px;
    border-radius: 50%;
    background: var(--t-brand);
    display: flex; align-items: center; justify-content: center;
    font-size: 28px; font-weight: 600; color: white;
    position: absolute;
}

/* Individual avatar colours per character */
.av-ceo     { background: #7B2D8E !important; }
.av-ignacio { background: #2E7D32 !important; }
.av-fca     { background: #1565C0 !important; }
.av-david   { background: #D84315 !important; }

.tile-avatar.hidden { display: none; }

/* Bottom nameplate overlay */
.tile-bottom {
    position: absolute; bottom: 0; left: 0; right: 0;
    padding: 6px 8px;
    background: linear-gradient(transparent, rgba(0,0,0,0.7));
    display: flex; align-items: flex-end;
}

.tile-nameplate {
    display: flex; align-items: center; gap: 6px;
}

.tile-mic {
    width: 20px; height: 20px;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; color: var(--t-text);
}

.tile-mic.is-muted { color: var(--t-danger); }

.tile-name {
    font-size: 12px; font-weight: 400;
    color: var(--t-text);
    text-shadow: 0 1px 3px rgba(0,0,0,0.6);
    max-width: 180px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* Kebab more button */
.tile-more {
    position: absolute; top: 6px; right: 6px;
    width: 28px; height: 28px;
    border-radius: var(--t-radius);
    border: none;
    background: rgba(0,0,0,0.5);
    color: white; font-size: 12px;
    cursor: pointer; opacity: 0;
    display: flex; align-items: center; justify-content: center;
    transition: opacity 0.15s;
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
}

.tile-more:hover { background: rgba(0,0,0,0.7); }

/* ── SPEAKING RING ── */
.speaking-ring {
    position: absolute; inset: 0;
    border: 3px solid transparent;
    border-radius: var(--t-radius-md);
    pointer-events: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    z-index: 2;
}

.speaking-ring.active {
    border-color: var(--t-speaking);
    box-shadow: 0 0 0 1px var(--t-speaking);
}

/* ══════════════════════════════════════════════════
   CONTROL TRAY (Bottom bar)
   ══════════════════════════════════════════════════ */
.meeting-tray {
    height: 68px;
    background: var(--t-bg-1);
    display: flex; align-items: center;
    justify-content: space-between;
    padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left));
    padding-bottom: env(safe-area-inset-bottom, 0);
    flex-shrink: 0;
    border-top: 1px solid var(--t-border-sub);
}

.tray-left, .tray-right {
    width: 120px;
    display: flex; align-items: center;
}

.tray-right { justify-content: flex-end; }

.tray-clock {
    font-size: 12px; color: var(--t-text-4);
    font-variant-numeric: tabular-nums;
}

.tray-center {
    display: flex; align-items: center; gap: 4px;
}

.tray-btn {
    width: 46px; height: 46px;
    border-radius: var(--t-radius);
    border: none;
    background: transparent;
    color: var(--t-text);
    font-size: 18px;
    cursor: pointer;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 2px;
    transition: background 0.12s;
    font-family: var(--t-font);
    position: relative;
}

.tray-btn:hover { background: var(--t-bg-hover); }
.tray-btn:active { transform: scale(0.94); }
.tray-btn:focus-visible { outline: 2px solid var(--t-brand); outline-offset: 1px; }

.tray-btn.is-off {
    background: var(--t-danger);
    color: #fff;
}

.tray-btn.is-off:hover { background: var(--t-danger-h); }

@keyframes shake-deny {
    0%, 100% { transform: translateX(0); }
    15% { transform: translateX(-4px); }
    30% { transform: translateX(4px); }
    45% { transform: translateX(-3px); }
    60% { transform: translateX(3px); }
    75% { transform: translateX(-2px); }
    90% { transform: translateX(2px); }
}
.tray-btn.shake-deny {
    animation: shake-deny 0.45s ease-in-out;
}

.tray-label {
    font-size: 10px; font-weight: 400;
    color: var(--t-text-3);
    line-height: 1;
}

.tray-btn.is-off .tray-label { color: rgba(255,255,255,0.8); }

.tray-badge {
    position: absolute;
    top: 2px; right: 2px;
    min-width: 16px; height: 16px;
    border-radius: 8px;
    background: #c4314b;
    color: #fff;
    font-size: 10px; font-weight: 700;
    display: flex; align-items: center; justify-content: center;
    padding: 0 4px;
    line-height: 1;
    pointer-events: none;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.tray-badge.hidden { display: none; }
.tray-badge.pulse {
    animation: badge-pulse 0.35s ease;
}
@keyframes badge-pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.3); }
    100% { transform: scale(1); }
}

.tray-sep {
    width: 1px; height: 24px;
    background: var(--t-border);
    margin: 0 6px;
}

.tray-leave {
    background: var(--t-danger) !important;
    border-radius: var(--t-radius) !important;
    min-width: 60px;
    transition: background 0.12s, transform 0.1s;
}
.tray-leave:active { transform: scale(0.94); }

.tray-leave:hover { background: var(--t-danger-h) !important; }

.tray-leave i { font-size: 16px; }

/* ══════════════════════════════════════════════════
   SIDE PANEL (People)
   ══════════════════════════════════════════════════ */
.side-panel {
    position: fixed;
    top: 48px; right: 0;
    width: 320px;
    height: calc(100% - 48px - 68px);
    background: var(--t-bg-1);
    border-left: 1px solid var(--t-border);
    z-index: 100;
    display: flex; flex-direction: column;
    box-shadow: -2px 0 12px rgba(0,0,0,0.3);
    animation: panelSlideIn 0.2s ease-out;
}
@keyframes panelSlideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

.panel-header {
    padding: 16px 16px 12px;
    display: flex; align-items: center;
    justify-content: space-between;
}

.panel-header h3 {
    font-size: 16px; font-weight: 600;
}

.panel-count { font-weight: 400; color: var(--t-text-3); }

.panel-close {
    width: 28px; height: 28px;
    border-radius: var(--t-radius);
    border: none; background: transparent;
    color: var(--t-text-3); cursor: pointer;
    font-size: 14px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.12s;
}

.panel-close:hover { background: var(--t-bg-hover); }

.panel-search {
    padding: 0 16px 12px;
    display: flex; align-items: center; gap: 8px;
    color: var(--t-text-4);
    position: relative;
}

.panel-search input {
    flex: 1; background: var(--t-bg-2);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius);
    padding: 6px 10px;
    font-size: 12px; color: var(--t-text);
    font-family: var(--t-font);
    outline: none;
}

.panel-search input:focus { border-color: var(--t-brand); }
.panel-search i { font-size: 12px; position: absolute; margin-left: 10px; }

.panel-body {
    flex: 1; overflow-y: auto; padding: 0 16px;
}

.panel-section { margin-bottom: 4px; }

.panel-section h4 {
    font-size: 12px; font-weight: 600;
    color: var(--t-text-3);
    margin-bottom: 4px; margin-top: 8px;
}

.panel-person {
    display: flex; align-items: center; gap: 10px;
    padding: 6px 4px;
    border-radius: var(--t-radius);
    transition: background 0.1s;
}

.panel-person:hover { background: var(--t-bg-3); }

.panel-avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 600; color: white;
    flex-shrink: 0;
}

.panel-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column;
}

.panel-name {
    font-size: 13px; font-weight: 600;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.panel-tag {
    font-weight: 400; font-size: 11px;
    color: var(--t-text-4);
    margin-left: 4px;
}

.panel-role {
    font-size: 11px; color: var(--t-text-4);
}

.panel-mic-icon {
    font-size: 12px; color: var(--t-text-3);
    flex-shrink: 0;
}

.panel-mic-icon.is-muted { color: var(--t-danger); }

/* Mic pulse when participant is speaking */
.panel-mic-icon.is-speaking {
    color: var(--t-success);
    animation: mic-pulse 0.8s ease-in-out infinite;
}

@keyframes mic-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(1.15); }
}

/* ══════════════════════════════════════════════════
   PREJOIN — PARTICIPANTS PREVIEW
   ══════════════════════════════════════════════════ */
.prejoin-participants {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
    padding: 10px 14px;
    background: rgba(255,255,255,0.04);
    border: 1px solid var(--t-border-sub);
    border-radius: var(--t-radius);
}

.prejoin-part-avatars {
    display: flex;
}

.prejoin-part-av {
    width: 28px; height: 28px;
    border-radius: 50%;
    border: 2px solid var(--t-bg-1);
    display: flex; align-items: center; justify-content: center;
    font-size: 9px; font-weight: 700; color: white;
    margin-left: -6px;
    flex-shrink: 0;
}

.prejoin-part-av:first-child { margin-left: 0; }

/* Green live-pulse dot on last avatar */
.prejoin-part-av:last-child::after {
    content: '';
    position: absolute;
    bottom: 0; right: 0;
    width: 8px; height: 8px;
    background: var(--t-success);
    border-radius: 50%;
    border: 1.5px solid var(--t-bg-1);
    animation: live-pulse 2s ease-in-out infinite;
}

.prejoin-part-av { position: relative; }

@keyframes live-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.6; transform: scale(1.2); }
}

.prejoin-part-text {
    font-size: 12px;
    color: var(--t-text-3);
    white-space: nowrap;
}

.prejoin-auto-join-info {
    font-size: 11px;
    color: var(--t-text-4);
    text-align: center;
    margin-top: -8px;
    margin-bottom: 4px;
    min-height: 16px;
}

/* ══════════════════════════════════════════════════
   TOPBAR REAL-TIME CLOCK
   ══════════════════════════════════════════════════ */
.topbar-realtime {
    font-size: 12px;
    color: var(--t-text-4);
    font-variant-numeric: tabular-nums;
    margin-right: 12px;
}

/* ══════════════════════════════════════════════════
   CHAT PANEL
   ══════════════════════════════════════════════════ */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-msg {
    display: flex;
    gap: 10px;
    animation: msg-appear 0.25s ease-out;
}

@keyframes msg-appear {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: translateY(0); }
}

.chat-msg-avatar {
    width: 28px; height: 28px;
    border-radius: 50%;
    flex-shrink: 0;
    display: flex; align-items: center; justify-content: center;
    font-size: 10px; font-weight: 700; color: white;
    margin-top: 2px;
}

.chat-msg-body {
    flex: 1; min-width: 0;
}

.chat-msg-meta {
    display: flex; align-items: baseline; gap: 6px;
    margin-bottom: 3px;
}

.chat-msg-name {
    font-size: 12px; font-weight: 600;
    color: var(--t-text);
}

.chat-msg-time {
    font-size: 10px; color: var(--t-text-4);
}

.chat-msg-bubble {
    font-size: 13px;
    color: var(--t-text-2);
    line-height: 1.45;
    word-break: break-word;
}

.chat-typing {
    padding: 6px 16px 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 11px;
    color: var(--t-text-4);
}

.typing-dots {
    display: flex; gap: 3px;
    align-items: center;
}

.typing-dots span {
    width: 5px; height: 5px;
    border-radius: 50%;
    background: var(--t-text-4);
    animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing-bounce {
    0%, 60%, 100% { transform: translateY(0); }
    30% { transform: translateY(-4px); }
}

.chat-input-area {
    padding: 10px 16px 12px;
    border-top: 1px solid var(--t-border-sub);
}

.chat-input-row {
    display: flex; gap: 8px;
    margin-bottom: 6px;
}

.chat-input {
    flex: 1;
    background: var(--t-bg-2);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius);
    padding: 8px 12px;
    font-size: 13px;
    color: var(--t-text-dis);
    font-family: var(--t-font);
    outline: none;
    cursor: not-allowed;
}

.chat-send-btn {
    width: 34px; height: 34px;
    border-radius: var(--t-radius);
    border: 1px solid var(--t-border);
    background: var(--t-bg-2);
    color: var(--t-text-dis);
    cursor: not-allowed;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px;
}

.chat-input-hint {
    font-size: 11px; color: var(--t-text-4);
    text-align: center;
}

/* ══════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════ */
.toast-container {
    position: fixed;
    top: 60px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    pointer-events: none;
}

.toast {
    background: var(--t-bg-2);
    border: 1px solid var(--t-border);
    border-radius: var(--t-radius-md);
    padding: 12px 16px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    min-width: 280px;
    max-width: 340px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.4);
    animation: toast-in 0.25s ease-out;
    pointer-events: auto;
}

.toast:hover {
    box-shadow: 0 6px 20px rgba(0,0,0,0.5);
    transform: translateY(-1px);
}

.toast.toast-out {
    animation: toast-out 0.3s ease-in forwards;
}

@keyframes toast-in {
    from { transform: translateX(120px); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0); opacity: 1; }
    to   { transform: translateX(120px); opacity: 0; }
}

.toast-icon {
    font-size: 15px;
    margin-top: 1px;
    flex-shrink: 0;
}

.toast-icon.info    { color: var(--t-brand); }
.toast-icon.warning { color: var(--t-warning); }
.toast-icon.success { color: var(--t-success); }
.toast-icon.danger  { color: var(--t-danger); }

.toast-body { flex: 1; min-width: 0; }

.toast-title {
    font-size: 13px; font-weight: 600;
    color: var(--t-text);
    margin-bottom: 2px;
}

.toast-sub {
    font-size: 11px; color: var(--t-text-4);
}

/* ══════════════════════════════════════════════════
   EMOJI REACTIONS (float-up animation)
   ══════════════════════════════════════════════════ */
.tile-reaction {
    position: absolute;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 28px;
    z-index: 20;
    pointer-events: none;
    animation: reaction-float 2.5s ease-out forwards;
}

@keyframes reaction-float {
    0%   { opacity: 1; transform: translateX(-50%) translateY(0) scale(1); }
    60%  { opacity: 1; transform: translateX(-50%) translateY(-60px) scale(1.2); }
    100% { opacity: 0; transform: translateX(-50%) translateY(-100px) scale(0.8); }
}

/* ══════════════════════════════════════════════════
   RAISED HAND BADGE on tiles
   ══════════════════════════════════════════════════ */
.tile-hand-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(242, 200, 17, 0.95);
    border-radius: 50%;
    width: 30px; height: 30px;
    display: flex; align-items: center; justify-content: center;
    font-size: 15px;
    z-index: 15;
    pointer-events: none;
    opacity: 0;
    transform: scale(0.5);
    transition: opacity 0.2s, transform 0.2s;
}

.tile-hand-badge.visible {
    opacity: 1;
    transform: scale(1);
}

/* ══════════════════════════════════════════════════
   LOADING OVERLAY
   ══════════════════════════════════════════════════ */
.loading-overlay {
    position: fixed;
    inset: 0;
    z-index: 9000;
    background: rgba(10, 10, 10, 0.95);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 0;
}
.loading-overlay::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--t-brand), #7579eb, var(--t-brand));
    background-size: 200% 100%;
    animation: loadingBar 1.5s ease-in-out infinite;
}
@keyframes loadingBar {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

.loading-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-ring {
    width: 48px;
    height: 48px;
    border: 3px solid rgba(98, 100, 167, 0.25);
    border-top-color: var(--t-brand);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    will-change: transform;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.loading-text {
    font-size: 16px;
    font-weight: 600;
    color: var(--t-text);
}

.loading-sub {
    font-size: 12px;
    color: var(--t-text-4);
}

.loading-fca {
    font-size: 10px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--t-text-dis);
    margin-top: 8px;
}

/* ══════════════════════════════════════════════════
   SCROLLBAR
   ══════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ══════════════════════════════════════════════════
   RESPONSIVE — SMALL TABLET / LARGE MOBILE (≤ 900px)
   ══════════════════════════════════════════════════ */
@media (max-width: 900px) {
    /* Video grid: 2+2+1 layout */
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
    .video-tile:nth-child(1) { grid-column: 1 / 2; }
    .video-tile:nth-child(2) { grid-column: 2 / 3; }
    .video-tile:nth-child(3) { grid-column: 1 / 2; }
    .video-tile:nth-child(4) { grid-column: 2 / 3; }
    .video-tile:nth-child(5) { grid-column: 1 / 3; }

    /* Tray */
    .tray-label { display: none; }
    .tray-btn { width: 44px; height: 44px; font-size: 17px; }
    .tray-left, .tray-right { width: 60px; }

    /* Side panels */
    .side-panel { width: 280px; }

    /* Pre-join */
    .prejoin-card {
        flex-direction: column;
        max-width: 460px;
        align-items: center;
    }
    .prejoin-preview { width: 100%; max-width: 400px; height: 220px; }
    .prejoin-info { width: 100%; text-align: center; }
    .prejoin-mic-warning { justify-content: center; }
}

/* ══════════════════════════════════════════════════
   RESPONSIVE — MOBILE (≤ 768px)
   ══════════════════════════════════════════════════ */
@media (max-width: 768px) {
    /* ── PIN screen ── */
    .pin-container { width: calc(100% - 32px); max-width: 360px; }
    .pin-card { padding: 28px 20px; }
    .pin-digit { width: 56px; height: 56px; font-size: 22px; }

    /* ── Pre-join ── */
    .prejoin-body { padding: 16px; align-items: flex-start; overflow-y: auto; }
    .prejoin-card {
        flex-direction: column;
        padding: 16px;
        width: 100%;
        gap: 16px;
    }
    .prejoin-preview { width: 100%; height: 200px; border-radius: 8px; }
    .prejoin-info { text-align: center; }
    .prejoin-meeting-title { font-size: 16px; }
    .prejoin-participants { justify-content: center; }
    .prejoin-join-btn { width: 100%; }
    .prejoin-auto-join-info { text-align: center; }
    .prejoin-other-opts { justify-content: center; }

    /* ── Meeting topbar ── */
    .meeting-topbar { padding: 0 10px; }
    .topbar-title { font-size: 12px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .topbar-confidential { display: none; }
    .topbar-security span { display: none; }
    .topbar-realtime { display: none; }

    /* ── Video grid: 2+2+1 ── */
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
        gap: 3px;
    }
    .video-tile:nth-child(1) { grid-column: 1 / 2; }
    .video-tile:nth-child(2) { grid-column: 2 / 3; }
    .video-tile:nth-child(3) { grid-column: 1 / 2; }
    .video-tile:nth-child(4) { grid-column: 2 / 3; }
    .video-tile:nth-child(5) { grid-column: 1 / 3; }

    /* ── Tile details ── */
    .tile-name { font-size: 10px; }
    .tile-avatar { width: 56px; height: 56px; font-size: 20px; }
    .tile-more { display: none; }

    /* ── Control tray ── */
    .meeting-tray { height: 60px; padding: 0 6px; }
    .tray-btn { width: 44px; height: 44px; font-size: 16px; border-radius: 6px; }
    .tray-label { display: none; }
    .tray-sep { margin: 0 3px; }
    .tray-left { display: none; }
    .tray-right { display: none; }
    .tray-center { gap: 2px; }

    /* ── Recording + network badges ── */
    .recording-badge { top: 8px; left: 8px; padding: 4px 8px; font-size: 11px; }
    .network-indicator { top: 8px; right: 8px; padding: 6px 10px; font-size: 11px; }
    .watermark-overlay { display: none; }

    /* ── Side panels: full-width overlay on mobile ── */
    .side-panel {
        width: 100%;
        top: 48px;
        height: calc(100% - 48px - 60px);
    }

    /* ── Toast: smaller ── */
    .toast { min-width: 220px; max-width: calc(100vw - 24px); }
    .toast-container { right: 8px; top: 56px; }

    /* ── Leave dialog: fit small screens ── */
    .leave-dialog-card { min-width: 0; width: calc(100% - 32px); max-width: 400px; padding: 20px 16px; }
}

/* ══════════════════════════════════════════════════
   PREJOIN NAME INPUT
   ══════════════════════════════════════════════════ */
.prejoin-name-input {
    display: flex; flex-direction: column; gap: 5px;
    margin-bottom: 12px; width: 100%;
}
.prejoin-name-input label {
    font-size: 12px; color: var(--t-text-sec);
    font-weight: 500;
}
.prejoin-name-field {
    width: 100%; padding: 9px 12px;
    background: var(--t-bg-2); border: 1px solid var(--t-border);
    border-radius: var(--t-radius); color: var(--t-text);
    font-size: 14px; font-family: var(--t-font);
    outline: none; transition: border-color 0.15s;
    box-sizing: border-box;
}
.prejoin-name-field:focus {
    border-color: var(--t-brand);
    background: var(--t-bg-3);
}
.prejoin-name-field::placeholder { color: var(--t-text-dis); }
.prejoin-name-field:not(:placeholder-shown):valid {
    border-color: rgba(107, 183, 0, 0.4);
}

/* ══════════════════════════════════════════════════
   TRAY BADGES (chat unread / people count)
   — main definition is above (.tray-badge block ~line 782)
   ══════════════════════════════════════════════════ */
#people-badge { background: var(--t-brand); }

/* ══════════════════════════════════════════════════
   LEAVE CONFIRM DIALOG
   ══════════════════════════════════════════════════ */
.leave-dialog {
    position: fixed; inset: 0; z-index: 9000;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,.55);
    -webkit-backdrop-filter: blur(4px);
    backdrop-filter: blur(4px);
    animation: dialogFadeIn 0.15s ease-out;
}
@keyframes dialogFadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
.leave-dialog.hidden { display: none; }
.leave-dialog-card {
    background: var(--t-bg-2); border-radius: 8px;
    padding: 24px 28px; min-width: 320px; max-width: 400px;
    box-shadow: 0 8px 32px rgba(0,0,0,.4);
    text-align: center;
    animation: dialogScaleIn 0.2s ease-out;
}
@keyframes dialogScaleIn {
    from { transform: scale(0.92); opacity: 0; }
    to   { transform: scale(1); opacity: 1; }
}
.leave-dialog-card h3 {
    margin: 0 0 8px; font-size: 17px; font-weight: 600;
    color: var(--t-text);
}
.leave-dialog-card p {
    margin: 0 0 20px; font-size: 13px; color: var(--t-text-sec);
}
.leave-dialog-actions {
    display: flex; gap: 10px; justify-content: center;
}
.leave-dialog-btn {
    padding: 8px 24px; border: none; border-radius: var(--t-radius);
    font-size: 13px; font-weight: 600; cursor: pointer;
    font-family: var(--t-font); transition: background 0.15s;
}
.leave-dialog-btn.cancel {
    background: var(--t-bg-3); color: var(--t-text);
}
.leave-dialog-btn.cancel:hover { background: var(--t-bg); }
.leave-dialog-btn.confirm {
    background: #c4314b; color: #fff;
}
.leave-dialog-btn.confirm:hover { background: #a82a40; }

/* tray button active state when panel is open */
.tray-btn.is-active {
    background: var(--t-bg-3);
    color: var(--t-brand-fg);
}
.tray-btn.is-active .tray-label { color: var(--t-brand-fg); }

/* focus-visible on dialog and panel buttons */
.leave-dialog-btn:focus-visible,
.panel-close:focus-visible,
.prejoin-ctrl-btn:focus-visible {
    outline: 2px solid var(--t-brand-fg);
    outline-offset: 2px;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE — SMALL MOBILE (≤ 480px)
   ══════════════════════════════════════════════════ */
@media (max-width: 480px) {
    /* PIN */
    .pin-digit { width: 52px; height: 52px; }
    .pin-heading { font-size: 17px; }

    /* Video grid: 2-col compact on very small screens */
    .video-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-template-rows: repeat(3, 1fr);
    }
    .tile-avatar { width: 44px; height: 44px; font-size: 16px; }
    .tile-nameplate { padding: 3px 6px 4px; gap: 4px; }

    /* Tray: hide less important buttons */
    #btn-reactions, #btn-raise { display: none; }
    #btn-share { display: none; }

    /* Topbar */
    .topbar-center { display: none; }
    .meeting-topbar { justify-content: space-between; }

    /* Hide logos on very small screens */
    .fca-logo-sm, .logo-sep-sm { display: none; }
    .fca-logo, .logo-sep { display: none; }
    .topbar-title { display: none; }
    .pin-container { width: calc(100% - 24px); }
    .pin-title { font-size: 14px; }
}

/* ══════════════════════════════════════════════════
   RESPONSIVE — LANDSCAPE MOBILE (short height)
   ══════════════════════════════════════════════════ */
@media (max-height: 500px) {
    .meeting-stage { padding: 4px; }
    .meeting-topbar { height: 36px; }
    .meeting-tray { height: 48px; }
    .tray-btn { width: 38px; height: 38px; font-size: 15px; }
    .tray-label { display: none; }
    .side-panel { top: 36px; height: calc(100% - 36px - 48px); }
    .recording-badge { top: 4px; left: 4px; padding: 3px 8px; font-size: 10px; }
    .tile-avatar { width: 40px; height: 40px; font-size: 16px; }
    .prejoin-preview { height: 140px; }
    .prejoin-body { overflow-y: auto; align-items: flex-start; padding: 8px; }
}
