/*
 * MetisChat - Premium UI v7.2
 * Gold Crystal & Deep Navy Glassmorphism
 */

:root {
    --bg-dark: #050A0F;
    --navy-deep: #0B141B;
    --navy-glass: rgba(11, 20, 27, 0.75);
    --gold: #D9A13E;
    --gold-bright: #F5C77D;
    --gold-glass: rgba(217, 161, 62, 0.12);
    --text-main: #E1E9EF;
    --text-dim: #8FA1AC;
    --border: rgba(217, 161, 62, 0.2);
    --border-light: rgba(255, 255, 255, 0.05);
    --glass-blur: blur(25px);
    --shadow-premium: 0 40px 100px rgba(0, 0, 0, 0.8), 0 0 40px rgba(217, 161, 62, 0.05);
    --success: #22C55E;
    --danger: #EF4444;
    --info: #3B82F6;
    --aura-glow: 0 0 20px rgba(217, 161, 62, 0.3);
}

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

body {
    font-family: 'Outfit', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-main);
    height: 100vh;
    overflow: hidden;
    background-image: 
        radial-gradient(circle at 0% 0%, rgba(217, 161, 62, 0.05) 0%, transparent 40%),
        radial-gradient(circle at 100% 100%, rgba(217, 161, 62, 0.05) 0%, transparent 40%);
}

button { cursor: pointer; transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); border: none; outline: none; background: none; }
button:active { transform: scale(0.95); }

/* === Global Scrollbar === */
html {
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--gold); }

/* === LOGIN SCREEN === */
.login-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #050A0F 0%, #0B141B 100%);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000; padding: 20px;
}

.login-wrapper {
    display: flex; flex-direction: column; align-items: center;
    width: 100%; max-width: 380px;
    animation: fadeIn 0.8s ease-out;
}

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

.login-logo { margin-bottom: 20px; text-align: center; }
.login-logo img { width: 80px; filter: drop-shadow(0 0 15px rgba(217,161,62,0.3)); }
.login-logo h1 { 
            background: linear-gradient(135deg, var(--gold-bright), var(--gold));
            -webkit-background-clip: text; 
            background-clip: text;
            -webkit-text-fill-color: transparent;
            font-weight: 900; letter-spacing: 2px; text-transform: uppercase;
}

.login-card {
    background: var(--navy-glass); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
    padding: 30px; border-radius: 32px; border: 1px solid var(--border); box-shadow: var(--shadow-premium);
    width: 100%;
}

.login-field { margin-bottom: 25px; }
.login-field label { display: block; font-size: 11px; text-transform: uppercase; color: var(--gold); font-weight: 900; margin-bottom: 8px; letter-spacing: 1px; }
.login-field input {
    width: 100%; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.1);
    padding: 16px; border-radius: 16px; color: #fff; font-size: 1rem;
}
.login-field input:focus { border-color: var(--gold); background: rgba(217,161,62,0.05); }

.login-btn {
    width: 100%; padding: 18px; background: var(--gold); border: none; border-radius: 16px;
    color: #000; font-weight: 800; font-size: 1.1rem; text-transform: uppercase; letter-spacing: 2px;
}
.login-btn:hover { background: var(--gold-bright); transform: scale(1.02); }

.login-error { color: var(--danger); text-align: center; margin-top: 15px; font-weight: 600; display: none; }

/* === MAIN APP === */
.app-container { 
    display: flex; 
    width: 100vw;
    height: 100vh; 
    opacity: 0; 
    transition: opacity 0.5s; 
    overflow: hidden; 
}
#app.flex { display: flex; opacity: 1; }

.sidebar {
    width: 75px; background: var(--navy-deep); border-right: 1px solid var(--border);
    display: flex; flex-direction: column; align-items: center; padding: 25px 0;
    z-index: 1000; transition: all 0.4s ease;
}
.sidebar-logo { margin-bottom: 20px; }
.sidebar-logo img { width: 44px; filter: drop-shadow(0 0 15px rgba(217,161,62,0.3)); }

.sidebar-top { 
    margin-bottom: 30px; 
    border-bottom: 1px solid var(--border);
    padding-bottom: 20px;
}
.aura-icon-btn { 
    font-size: 32px; filter: drop-shadow(0 0 10px var(--gold));
    transition: 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.aura-icon-btn:hover { transform: scale(1.2) rotate(10deg); filter: drop-shadow(0 0 20px var(--gold-bright)); }

.sidebar-nav { display: flex; flex-direction: column; align-items: center; width: 100%; height: 100%; }
.sidebar-nav button { font-size: 26px; padding: 12px; border-radius: 16px; margin-bottom: 12px; color: var(--text-dim); transition: 0.3s; position: relative; }
.sidebar-nav .nav-label { position: absolute; left: 85px; background: #000; color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 11px; font-weight: 700; white-space: nowrap; opacity: 0; pointer-events: none; transform: translateX(-10px); transition: 0.2s; }
.sidebar-nav button:hover .nav-label { opacity: 1; transform: translateX(0); }
.sidebar-nav button.active-tab { color: var(--gold); background: var(--gold-glass); box-shadow: inset 0 0 8px rgba(217,161,62,0.1); }
.sidebar-badge {
    position: absolute;
    top: 4px;
    right: 2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 900;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Chat Panel */
.view-main { 
    flex: 1; 
    display: none; 
    background: transparent; 
    min-width: 0; 
    min-height: 0; 
    overflow: hidden; 
}
/* View-Specific Layouts */
#view-chat.active {
    display: grid;
    grid-template-columns: auto 1fr;
    width: 100%;
    height: 100%;
}

.contacts-sidebar { width: clamp(260px, 28vw, 320px); min-width: 260px; background: rgba(11, 20, 27, 0.5); border-right: 1px solid var(--border); padding: 15px; display: flex; flex-direction: column; }
.contacts-header { 
    display: flex; 
    align-items: center; 
    justify-content: space-between; 
    margin-bottom: 20px; 
    padding: 0 5px;
    position: relative; 
    z-index: 100;
    gap: 15px;
}
.contacts-tabs { display: flex; gap: 8px; flex: 1; }
.contact-tab-btn {
    display: flex; align-items: center; justify-content: center;
    width: 40px; height: 40px; padding: 0; border-radius: 50%;
    font-size: 1.1rem; font-weight: 800; flex-shrink: 0;
    color: var(--text-dim); background: rgba(255,255,255,0.05); transition: 0.2s;
    position: relative;
}
.contact-tab-btn.active {
    background: var(--gold); color: #000; box-shadow: 0 0 15px rgba(217,161,62,0.3);
}
.mini-tab-badge {
    position: absolute; top: -2px; right: -4px;
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 999px; background: var(--danger); color: #fff;
    font-size: 9px; font-weight: 900; box-shadow: 0 2px 4px rgba(0,0,0,0.5);
    margin-left: 0;
}
/* Custom Tooltip using data-tooltip */
.has-tooltip { position: relative; }
.has-tooltip::after {
    content: attr(data-tooltip); position: absolute; bottom: -36px; left: 50%;
    transform: translateX(-50%) translateY(-5px); background: rgba(0, 0, 0, 0.9);
    color: #fff; padding: 6px 12px; border-radius: 8px; font-size: 12px; font-weight: 600;
    white-space: nowrap; opacity: 0; visibility: hidden; transition: all 0.2s ease;
    pointer-events: none; z-index: 1000; border: 1px solid rgba(255,255,255,0.1);
}
.has-tooltip:hover::after { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(0); }
.contacts-actions { display: flex; gap: 10px; align-items: center; flex-shrink: 0; }
.contact-filter-btn {
    padding: 8px 12px;
    border-radius: 16px;
    background: rgba(255,255,255,0.05);
    color: var(--text-main);
    border: 1px solid rgba(255,255,255,0.08);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.contact-filter-btn.active { background: var(--gold); color: #000; border-color: var(--gold); }
.contacts-subfilters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.add-friend-main { 
    width: 40px; height: 40px; border-radius: 50%;
    background: var(--gold); color: #000;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.3rem; font-weight: bold;
    box-shadow: 0 4px 15px rgba(217, 161, 62, 0.4);
    pointer-events: auto !important;
    flex-shrink: 0;
}
.add-friend-main:hover { background: var(--gold-bright); transform: scale(1.1); box-shadow: 0 6px 20px rgba(217, 161, 62, 0.6); }
.contacts-list { flex: 1; overflow-y: auto; }
.roster-section { margin-bottom: 18px; }
.roster-section:last-child { margin-bottom: 0; }
.roster-section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 10px 10px;
    color: var(--gold);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 1.4px;
    text-transform: uppercase;
    opacity: 0.9;
}
.roster-section-title::after {
    content: "";
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}
.intentional-request-card {
    margin: 0 8px 10px;
    padding: 14px;
    border-radius: 18px;
    background: rgba(217,161,62,0.08);
    border: 1px solid rgba(217,161,62,0.18);
}
.intentional-request-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.intentional-request-message { color: var(--text-main); line-height: 1.5; margin-bottom: 12px; white-space: pre-wrap; }
.intentional-request-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.intentional-request-actions button { padding: 10px 14px; border-radius: 12px; font-weight: 800; }
.intentional-request-actions .accept-request-btn { background: var(--gold); color: #000; }
.intentional-request-actions .secondary { background: rgba(255,255,255,0.08); color: #fff; }
.intentional-request-actions .reject-request-btn { background: rgba(239,68,68,0.15); color: #fff; border: 1px solid rgba(239,68,68,0.35); }
.intentional-history-list { display: flex; flex-direction: column; gap: 12px; }
.intentional-history-filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.intentional-history-item {
    padding: 14px;
    border-radius: 16px;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}
.intentional-history-item strong { color: #fff; display: block; margin-bottom: 6px; }
.intentional-history-item small { color: var(--text-dim); display: block; margin-top: 6px; }
.intentional-history-item.accepted { border-color: rgba(34,197,94,0.25); }
.intentional-history-item.rejected { border-color: rgba(239,68,68,0.25); }
.intentional-history-item.archived { border-color: rgba(217,161,62,0.25); }
.intentional-history-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.intentional-history-actions button { padding: 8px 12px; border-radius: 12px; font-weight: 800; }

.contact-item { 
    display: flex; align-items: center; gap: 15px; padding: 15px; border-radius: 18px; cursor: pointer; margin-bottom: 8px;
    transition: all 0.2s; border: 1px solid transparent;
}
.contact-item:hover { background: rgba(255,255,255,0.03); }
.contact-item.active { background: var(--gold-glass); border-color: var(--border); }

.contact-avatar { width: 45px; height: 45px; border-radius: 50%; background: var(--gold); color: #000; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 1.2rem; overflow: hidden; flex-shrink: 0; }
.contact-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }

.delete-contact-btn {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.25);
    cursor: pointer;
    font-size: 14px;
    padding: 4px;
    line-height: 1;
    border-radius: 4px;
    transition: color 0.2s, background 0.2s;
    flex-shrink: 0;
}
.delete-contact-btn:hover {
    color: #ff4444;
    background: rgba(255,68,68,0.15);
}
.contact-info { flex: 1; min-width: 0; }
.contact-name { font-weight: 700; color: #fff; display: flex; align-items: center; gap: 8px; }
.contact-status { font-size: 12px; color: var(--text-dim); }
.relationship-icon {
    width: 20px;
    height: 20px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
    flex-shrink: 0;
}
.relationship-icon.friend { background: rgba(34,197,94,0.18); color: #BBF7D0; }
.relationship-icon.pending { background: rgba(217,161,62,0.18); color: var(--gold-bright); }
.relationship-icon.free { background: rgba(255,255,255,0.1); color: #fff; }
.pending-reminder-btn { background: rgba(217,161,62,0.14); color: var(--gold-bright); border: 1px solid rgba(217,161,62,0.25); }

.status-dot { width: 10px; height: 10px; border-radius: 50%; }
.status-online { background: var(--success); box-shadow: 0 0 10px var(--success); }
.status-offline { background: #444; }

.unread-badge {
    background: var(--danger);
    color: #fff;
    font-size: 11px; font-weight: 800;
    padding: 2px 8px; border-radius: 10px;
    margin-left: auto; margin-right: 10px;
    box-shadow: 0 0 10px rgba(239, 68, 68, 0.5);
    animation: popBadge 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
@keyframes popBadge { 0% { transform: scale(0); } 100% { transform: scale(1); } }

/* Chat Area */
.chat-main { flex: 1; display: flex; flex-direction: column; background: rgba(5, 10, 15, 0.4); overflow: hidden; height: 100%; min-width: 0; }
.chat-header { padding: 20px 30px; border-bottom: 1px solid var(--border); backdrop-filter: blur(10px); display: flex; justify-content: space-between; align-items: center; flex-shrink: 0; gap: 16px; }
.chat-mobile-back { display: none; min-width: 42px; height: 42px; border-radius: 14px; background: rgba(255,255,255,0.05); color: #fff; border: 1px solid rgba(255,255,255,0.06); font-size: 1.1rem; }
.chat-header-info { min-width: 0; flex: 1; }
.chat-header h1 { font-size: clamp(1.1rem, 1.4vw, 1.4rem); color: #fff; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header span { font-size: 11px; color: var(--gold); opacity: 0.8; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.chat-header-actions button { min-width: 44px; height: 44px; border-radius: 14px; background: rgba(255,255,255,0.05); color: var(--text-main); border: 1px solid rgba(255,255,255,0.06); }
.chat-header-actions button:hover { background: rgba(217,161,62,0.12); border-color: var(--border); }

/* Aura Dashboard (The Intelligence Hub) */
.aura-dashboard {
    flex: 1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-gap: 20px;
    padding: 30px;
    width: min(100%, 1100px);
    max-width: 1100px;
    margin: 0 auto;
    overflow-y: auto;
    max-height: calc(100vh - 120px);
    scrollbar-width: thin;
    scrollbar-color: var(--gold) transparent;
    animation: auraDashFadeIn 0.8s cubic-bezier(0.165, 0.84, 0.44, 1);
}

@keyframes auraDashFadeIn {
    from { opacity: 0; transform: translateY(30px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.dash-tile {
    background: var(--navy-glass);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--border);
    border-radius: 28px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    position: relative;
    overflow: hidden;
    min-width: 0;
}

.dash-tile:hover {
    transform: translateY(-8px);
    border-color: var(--gold);
    box-shadow: 0 20px 40px rgba(0,0,0,0.4), 0 0 20px rgba(217,161,62,0.2);
}

.tile-welcome {
    grid-column: span 2;
    background: linear-gradient(135deg, rgba(217, 161, 62, 0.08), rgba(11, 20, 27, 0.8));
    border: 2px solid var(--border);
}

.welcome-top { display: flex; align-items: center; gap: 20px; margin-bottom: 25px; min-width: 0; }
.welcome-logo { width: 60px; filter: drop-shadow(0 0 15px var(--gold)); animation: pulseAura 3s infinite; }
@keyframes pulseAura { 0%, 100% { transform: scale(1); filter: drop-shadow(0 0 15px var(--gold)); } 50% { transform: scale(1.05); filter: drop-shadow(0 0 25px var(--gold-bright)); } }

.welcome-text { min-width: 0; flex: 1; }
.welcome-text h1 { font-size: clamp(1.5rem, 3vw, 2.2rem); font-weight: 800; color: #fff; margin: 0; line-height: 1.1; overflow-wrap: anywhere; }
.welcome-text p { color: var(--gold); font-weight: 700; font-size: clamp(0.95rem, 1.6vw, 1.1rem); margin-top: 5px; overflow-wrap: anywhere; }

.welcome-system-info { display: flex; gap: 24px; border-top: 1px solid var(--border); padding-top: 20px; flex-wrap: wrap; }
.sys-item { display: flex; flex-direction: column; min-width: 120px; }
.sys-label { font-size: 10px; font-weight: 900; color: var(--text-dim); letter-spacing: 1.5px; margin-bottom: 5px; }
.sys-value { font-size: clamp(1rem, 1.8vw, 1.2rem); font-weight: 800; color: #fff; overflow-wrap: anywhere; }
.status-neon { color: var(--success); text-shadow: 0 0 10px var(--success); }

/* Tile Specifics */
.tile-header { display: flex; align-items: center; gap: 12px; margin-bottom: 15px; }
.tile-icon { font-size: 1.5rem; }
.tile-header h3 { font-size: 1.1rem; font-weight: 800; color: var(--gold); margin: 0; overflow-wrap: anywhere; }
.tile-body { flex: 1; color: var(--text-dim); font-size: 0.9rem; line-height: 1.5; min-width: 0; overflow-wrap: anywhere; }
.tile-action { font-size: 10px; font-weight: 900; color: var(--gold); margin-top: 15px; letter-spacing: 1px; opacity: 0.7; overflow-wrap: anywhere; }

.peek-msg { font-style: italic; border-left: 2px solid var(--gold); padding-left: 10px; }
.arcade-stars { font-size: 1.2rem; margin-top: 10px; }

.aura-progress-bar { width: 100%; height: 6px; background: rgba(255,255,255,0.05); border-radius: 10px; margin-top: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--gold); box-shadow: 0 0 10px var(--gold); border-radius: 10px; }

/* Responsive Dash */
@media (max-width: 1280px), (max-height: 820px) {
    .aura-dashboard { padding: 20px; gap: 16px; max-height: calc(100vh - 100px); }
    .dash-tile { padding: 20px; border-radius: 24px; }
    .welcome-top { gap: 16px; margin-bottom: 20px; }
    .welcome-logo { width: 52px; }
    .contacts-sidebar { width: 280px; min-width: 240px; }
}

@media (max-width: 800px) {
    .aura-dashboard { grid-template-columns: 1fr; padding: 15px; margin-top: 20px; }
    .tile-welcome { grid-column: span 1; }
    .welcome-top { align-items: flex-start; }
    .welcome-system-info { flex-direction: column; gap: 14px; }
    .chat-header { padding: 16px 18px; }
    .chat-header h1, .chat-header span { white-space: normal; }
    .reminder-presets { grid-template-columns: 1fr; }
}

@media (max-width: 1100px) {
    .contacts-sidebar { width: 250px; min-width: 220px; }
    .feed-container, .settings-container { padding: 24px; }
    .profile-grid-layout { grid-template-columns: 1fr; }
    .profile-settings-grid { grid-template-columns: 1fr; }
    .profile-signal-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.messages-area { flex: 1; padding: 30px; overflow-y: auto; display: flex; flex-direction: column; gap: 15px; }
.msg-row { display: flex; width: 100%; }
.msg-row.sent { justify-content: flex-end; }
.msg-bubble { max-width: 75%; padding: 16px 20px; border-radius: 24px; position: relative; font-size: 0.95rem; line-height: 1.5; padding-bottom: 25px; word-wrap: break-word; overflow-wrap: break-word; overflow: hidden; }
.msg-bubble.sent { background: var(--gold); color: #000; border-bottom-right-radius: 4px; box-shadow: 0 10px 30px rgba(217,161,62,0.2); }
.msg-bubble.received { background: var(--navy-deep); color: #fff; border-bottom-left-radius: 4px; border: 1px solid var(--border); }
.msg-tick { font-size: 0.8rem; position: absolute; bottom: 6px; right: 20px; letter-spacing: -3px; font-weight: 800; opacity: 0.6; }
.msg-tick.delivered { color: #000; opacity: 0.8; }
.msg-title.received .msg-tick { display: none; }
.msg-tick.read { color: #007BFF; opacity: 1; }
.msg-tick.queued { color: rgba(0,0,0,0.75); letter-spacing: 0; }
.msg-tick.failed { color: #EF4444; letter-spacing: 0; }
.msg-tick.sent { color: rgba(0,0,0,0.9); }
.msg-system-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 18px;
    padding: 14px;
    min-width: 260px;
}
.msg-system-card h4 { color: var(--gold-bright); margin-bottom: 8px; }
.msg-system-card p { color: var(--text-main); line-height: 1.5; margin-bottom: 8px; white-space: pre-wrap; }
.msg-system-card small { color: var(--text-dim); display: block; margin-bottom: 10px; }
.msg-system-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.msg-system-actions button { padding: 10px 14px; border-radius: 12px; background: var(--gold); color: #000; font-weight: 800; }
.msg-system-actions button.secondary { background: rgba(255,255,255,0.08); color: #fff; }

/* Redesign Contextual Shell: Hide chat chrome when dashboard is active */
.aura-dashboard:not(.is-hidden) ~ .chat-header,
.aura-dashboard:not(.is-hidden) ~ .messages-area,
.aura-dashboard:not(.is-hidden) ~ .chat-input-area {
    display: none !important;
}

.chat-input-area { padding: 25px 30px; border-top: 1px solid var(--border); }
.chat-input-bar { display: flex; align-items: center; gap: 15px; background: var(--navy-glass); padding: 10px 20px; border-radius: 20px; border: 1px solid var(--border); }
.chat-input-bar input { flex: 1; background: transparent; color: #fff; font-size: 1rem; border: none; outline: none; }

.send-btn { font-size: 20px; color: var(--gold); cursor: pointer; }
.attach-btn { font-size: 20px; color: var(--text-dim); cursor: pointer; }

/* Dashboard Isolation: Hide floating sidebar icons when dashboard is active (Modern CSS) */
body:has(.aura-dashboard:not(.is-hidden)) .contacts-actions {
    display: none !important;
}

/* Global Avatar Scaling Fix - Designer standard */
.my-avatar-img, .dash-avatar-img, .call-avatar img, .post-avatar img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block;
    transition: transform 0.4s ease;
}

.profile-avatar-big {
    width: 140px;
    height: 140px;
    border-radius: 42px;
    overflow: hidden !important;
    border: 3px solid rgba(217, 161, 62, 0.4);
    background: var(--navy-glass);
    position: relative;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

/* === GLOBAL SEARCH & DISCOVERY === */
.contacts-header .search-toggle { font-size: 18px; color: var(--gold); }
.tab-discovery-view { display: flex; flex-direction: column; height: 100%; }

/* --- CONTACT ACTIONS --- */
.contact-actions { display: flex; gap: 10px; align-items: center; margin-left: auto; }
.profile-btn, .add-friend-btn { 
    width: 32px; height: 32px; border-radius: 10px; display: flex; align-items: center; 
    justify-content: center; font-size: 16px; background: var(--gold-glass); 
    border: 1px solid var(--border); color: var(--gold); transition: 0.3s;
}
.profile-btn:hover, .add-friend-btn:hover { background: var(--gold); color: #000; transform: translateY(-2px); }
.add-friend-btn { background: rgba(34, 197, 94, 0.1); border-color: rgba(34, 197, 94, 0.2); color: #22C55E; }
.add-friend-btn:hover { background: #22C55E; color: #fff; }

/* === SOCIAL FEED === */
.feed-container { flex: 1; overflow-y: auto; padding: 40px; display: flex; flex-direction: column; align-items: center; gap: 30px; background: radial-gradient(circle at 50% 0%, rgba(217, 161, 62, 0.03) 0%, transparent 70%); }
.feed-composer { width: 100%; max-width: 600px; background: var(--navy-glass); backdrop-filter: var(--glass-blur); border: 1px solid var(--border); border-radius: 24px; padding: 20px; box-shadow: var(--shadow-premium); }
.feed-composer textarea { width: 100%; background: transparent; border: none; color: #fff; font-family: inherit; font-size: 1.1rem; resize: none; min-height: 80px; outline: none; }
.feed-composer-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 15px; padding-top: 15px; border-top: 1px solid var(--border-light); }
.feed-post { width: 100%; max-width: 600px; background: var(--navy-glass); backdrop-filter: var(--glass-blur); border: 1px solid var(--border-light); border-radius: 24px; padding: 25px; animation: slideUp 0.5s ease-out; }
@keyframes slideUp { from { opacity: 0; transform: translateY(30px); } to { opacity: 1; transform: translateY(0); } }
.post-header { display: flex; align-items: center; gap: 15px; margin-bottom: 20px; }
.post-avatar { width: 50px; height: 50px; border-radius: 50%; border: 2px solid var(--gold); object-fit: cover; }
.post-user-info { flex: 1; }
.post-user-name { font-weight: 800; color: #fff; font-size: 1.1rem; }
.post-time { font-size: 12px; color: var(--text-dim); }
.post-content { font-size: 1.05rem; line-height: 1.6; color: var(--text-main); margin-bottom: 20px; white-space: pre-wrap; }
.post-media { width: 100%; border-radius: 16px; margin-bottom: 20px; max-height: 400px; object-fit: cover; border: 1px solid var(--border-light); }
.post-actions { display: flex; gap: 20px; border-top: 1px solid var(--border-light); padding-top: 15px; }
.post-action { display: flex; align-items: center; gap: 8px; color: var(--text-dim); font-weight: 600; font-size: 0.9rem; cursor: pointer; transition: 0.2s; }
.post-action:hover { color: var(--gold); transform: scale(1.1); }
.post-action.liked { color: #ff4757; text-shadow: 0 0 10px rgba(255,71,87,0.4); }
.post-action.liked .heart-icon { animation: heartBeat 0.4s ease-out; }
@keyframes heartBeat { 
    0% { transform: scale(1); }
    50% { transform: scale(1.4); } 
    100% { transform: scale(1); }
}

/* === CALL OVERLAY AURA === */
.call-overlay { 
    background: radial-gradient(circle at center, rgba(11, 20, 27, 0.95) 0%, #050A0F 100%); 
}
.call-card { 
    width: 380px; padding: 50px; background: rgba(255,255,255,0.03); border: 1px solid var(--border); 
    border-radius: 40px; backdrop-filter: blur(30px); box-shadow: var(--aura-glow);
    animation: pulseGlow 3s infinite alternate;
}
@keyframes pulseGlow { from { box-shadow: 0 0 20px rgba(217, 161, 62, 0.1); } to { box-shadow: 0 0 50px rgba(217, 161, 62, 0.3); } }
.call-avatar { width: 120px; height: 120px; margin: 0 auto 30px; border-radius: 50%; border: 4px solid var(--gold); display: flex; align-items: center; justify-content: center; font-size: 40px; background: var(--navy-deep); overflow: hidden; }
.call-avatar img { width: 100%; height: 100%; object-fit: cover; }
.call-video-container { margin-top: 30px; position: relative; border-radius: 20px; overflow: hidden; border: 2px solid var(--border); height: 240px; background: #000; }
#remote-video { width: 100%; height: 100%; object-fit: cover; }
#local-video { position: absolute; bottom: 15px; right: 15px; width: 80px; height: 110px; border-radius: 12px; border: 2px solid var(--gold); object-fit: cover; z-index: 10; }
.call-actions { display: flex; justify-content: center; gap: 40px; margin-top: 40px; }

/* === PROFILE VIEW === */
.profile-workspace { flex: 1; overflow-y: auto; padding: 34px; display: flex; flex-direction: column; gap: 28px; background: radial-gradient(circle at top left, rgba(217, 161, 62, 0.09), transparent 35%), linear-gradient(180deg, rgba(5, 10, 15, 0.95), rgba(5, 10, 15, 0.75)); }
.profile-hero-card, .profile-panel { width: min(100%, 1180px); margin: 0 auto; background: linear-gradient(160deg, rgba(11, 20, 27, 0.92), rgba(9, 16, 23, 0.76)); border: 1px solid var(--border); border-radius: 30px; box-shadow: var(--shadow-premium); backdrop-filter: var(--glass-blur); }
.profile-hero-card { padding: 34px; position: relative; overflow: hidden; }
.profile-hero-card::before { content: ""; position: absolute; inset: -80px auto auto -60px; width: 240px; height: 240px; background: radial-gradient(circle, rgba(217, 161, 62, 0.18), transparent 70%); pointer-events: none; }
.profile-hero-main { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 28px; align-items: center; position: relative; z-index: 1; }
.profile-avatar-big { 
    width: 160px; 
    height: 160px; 
    margin: 0; 
    border-radius: 36px; 
    border: 3px solid var(--gold); 
    position: relative; 
    cursor: pointer; 
    overflow: hidden; 
    background: linear-gradient(135deg, rgba(217, 161, 62, 0.12), rgba(11, 20, 27, 0.9)); 
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.45); 
    transition: all 0.3s ease;
}

.my-avatar-img, .dash-avatar-img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}
.profile-avatar-big:hover {
    transform: translateY(-5px);
    box-shadow: 0 30px 60px rgba(217, 161, 62, 0.2);
    border-color: var(--gold-bright);
}
/* Avatar Interactivity */
.avatar-edit-trigger {
    cursor: pointer;
    position: relative;
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.avatar-edit-trigger:hover {
    transform: scale(1.05);
}

.avatar-edit-trigger:hover .profile-avatar-edit {
    opacity: 1;
    transform: translateY(0);
}

.profile-avatar-edit { 
    position: absolute; 
    inset: 0; 
    background: rgba(5, 10, 15, 0.8); 
    display: flex; 
    flex-direction: column;
    align-items: center; 
    justify-content: center; 
    opacity: 0; 
    transform: translateY(10px);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); 
    font-weight: 800; 
    letter-spacing: 1px;
    font-size: 11px;
    text-transform: uppercase;
    color: var(--gold-bright);
    gap: 8px;
    backdrop-filter: blur(5px);
    z-index: 5;
}

.profile-avatar-edit::before {
    content: "📷";
    font-size: 1.8rem;
}

.profile-avatar-big.uploading::after {
    content: "";
    position: absolute;
    inset: -6px;
    border-radius: inherit;
    border: 3px solid var(--gold);
    border-top-color: transparent;
    animation: aura-spin 0.8s linear infinite;
    z-index: 10;
}

@keyframes aura-spin {
    to { transform: rotate(360deg); }
}
.profile-avatar-big.uploading img {
    filter: blur(4px) grayscale(0.5);
    opacity: 0.5;
}
.profile-identity-block { min-width: 0; }
.profile-kicker, .profile-panel-kicker { display: inline-block; color: var(--gold); font-size: 11px; font-weight: 900; text-transform: uppercase; letter-spacing: 1.6px; margin-bottom: 12px; }
.profile-name-edit { background: transparent; border: none; border-bottom: 2px solid var(--border); color: #fff; font-size: clamp(2rem, 3vw, 3rem); font-weight: 900; text-align: left; margin-bottom: 12px; width: 100%; outline: none; }
.profile-jid-line { color: var(--gold); margin-bottom: 18px; font-size: 0.98rem; word-break: break-word; }
.profile-headline-input, .profile-select, .profile-bio-edit { width: 100%; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 18px; color: var(--text-main); padding: 15px 16px; outline: none; }
.profile-headline-input { font-size: 1rem; margin-bottom: 14px; }
.profile-select { appearance: none; font-size: 0.98rem; }
.profile-bio-edit { min-height: 170px; resize: vertical; margin-bottom: 20px; font-size: 1rem; line-height: 1.6; }
.profile-hero-note { color: var(--text-dim); max-width: 720px; line-height: 1.6; }
.profile-signal-strip { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 26px; position: relative; z-index: 1; }
.profile-signal-card { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.05); border-radius: 20px; padding: 16px 18px; }
.profile-insight-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; margin-top: 14px; }
.profile-insight-card { background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.05); border-radius: 20px; padding: 16px 18px; }
.profile-signal-label { display: block; color: var(--text-dim); font-size: 0.76rem; text-transform: uppercase; letter-spacing: 1.2px; margin-bottom: 8px; }
.profile-signal-card strong { font-size: 1.05rem; color: #fff; }
.profile-insight-card strong { font-size: 1rem; color: #fff; line-height: 1.4; display: block; }
.profile-actions-inline { display: flex; gap: 14px; align-items: center; margin-top: 22px; position: relative; z-index: 1; flex-wrap: wrap; }
.profile-save-status { color: var(--text-dim); font-size: 0.9rem; min-height: 22px; }
.profile-save-status.is-dirty { color: var(--gold-bright); }
.profile-save-status.is-saving { color: #8DDCFF; }
.profile-save-status.is-saved { color: #86EFAC; }
.profile-save-status.is-error { color: #FCA5A5; }
.profile-danger-btn { background: rgba(239, 68, 68, 0.14); color: #fff; border: 1px solid rgba(239, 68, 68, 0.35); padding: 15px 24px; border-radius: 16px; font-weight: 800; }
.profile-danger-btn:hover { background: rgba(239, 68, 68, 0.22); transform: translateY(-2px); }
.contact-flow-modal { max-width: 560px; }
.contact-flow-header { text-align: left; align-items: flex-start; }
.contact-flow-header h2 { color: #fff; }
.contact-flow-body { text-align: left; }
.contact-flow-copy { color: var(--text-dim); line-height: 1.6; margin-bottom: 16px; }
.contact-context-textarea { min-height: 150px; margin-bottom: 0; }
.reminder-presets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.reminder-preset-btn { width: 100%; text-align: center; }
.profile-grid-layout { width: min(100%, 1180px); margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr); gap: 24px; }
.profile-panel { padding: 30px; }
.profile-panel-header h2 { font-size: 1.7rem; color: #fff; margin-bottom: 10px; }
.profile-panel-header p { color: var(--text-dim); line-height: 1.6; margin-bottom: 22px; }
.profile-field-label { display: block; margin-bottom: 10px; color: #fff; font-weight: 700; }
.profile-two-col-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 18px; }
.profile-preview-card { border-radius: 24px; padding: 24px; background: linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)); border: 1px solid rgba(255,255,255,0.08); }
.profile-preview-top { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.profile-preview-top img { width: 72px; height: 72px; border-radius: 22px; object-fit: cover; border: 2px solid rgba(217, 161, 62, 0.45); }
.profile-preview-name { font-size: 1.3rem; font-weight: 900; color: #fff; margin-bottom: 4px; }
.profile-preview-headline { color: var(--gold-bright); line-height: 1.5; }
.profile-preview-chips { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 18px; }
.profile-preview-chip { padding: 8px 12px; border-radius: 999px; background: rgba(217, 161, 62, 0.09); border: 1px solid rgba(217, 161, 62, 0.2); color: var(--gold-bright); font-size: 0.84rem; font-weight: 700; }
.profile-preview-bio { color: var(--text-main); line-height: 1.7; margin-bottom: 18px; white-space: pre-wrap; }
.profile-preview-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.profile-preview-meta div { background: rgba(255,255,255,0.03); border-radius: 18px; padding: 14px; border: 1px solid rgba(255,255,255,0.05); }
.profile-preview-meta span { display: block; color: var(--text-dim); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 6px; }
.profile-preview-meta strong { color: #fff; overflow-wrap: anywhere; }
.profile-principles-card { margin-top: 18px; border-radius: 24px; padding: 22px; background: rgba(255,255,255,0.025); border: 1px solid rgba(255,255,255,0.05); }
.profile-principles-card h3 { color: #fff; margin-bottom: 12px; }
.profile-principles-card ul { padding-left: 18px; color: var(--text-dim); display: grid; gap: 8px; line-height: 1.5; }
.profile-settings-header { width: min(100%, 1180px); margin: 0 auto; text-align: left; }
.profile-settings-grid { width: min(100%, 1180px); margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.user-modal-headline { color: var(--gold-bright); line-height: 1.5; margin-bottom: 14px; }
.user-modal-chips { margin-bottom: 16px; }
.user-modal-meta { margin-top: 20px; }
.metis-btn-gold { 
    background: var(--gold); color: #000; padding: 15px 40px; border-radius: 16px; font-weight: 800; 
    text-transform: uppercase; letter-spacing: 1px; box-shadow: 0 10px 20px rgba(217, 161, 62, 0.2);
}
.metis-btn-gold:hover { background: var(--gold-bright); transform: translateY(-3px); }

.is-hidden { display: none !important; }

/* === SETTINGS AREA === */
.settings-container { flex: 1; overflow-y: auto; padding: 40px; display: flex; flex-direction: column; align-items: center; }
.settings-header { text-align: center; margin-bottom: 40px; }
.settings-header h1 { font-size: 2.2rem; color: var(--gold); font-weight: 800; }
.settings-header p { color: var(--text-dim); }

.settings-section { width: 100%; max-width: 600px; background: var(--navy-glass); padding: 30px; border-radius: 20px; border: 1px solid var(--border); margin-bottom: 30px; }
.settings-section h2 { color: #fff; font-size: 1.3rem; margin-bottom: 20px; padding-bottom: 10px; border-bottom: 1px solid rgba(255,255,255,0.05); }

.theme-options { display: flex; gap: 15px; flex-wrap: wrap; }
.theme-circle { width: 45px; height: 45px; border-radius: 50%; cursor: pointer; border: 3px solid transparent; transition: 0.3s; box-shadow: 0 4px 15px rgba(0,0,0,0.5); }
.theme-circle:hover { transform: scale(1.1); }
.theme-circle.active { border-color: #fff; transform: scale(1.1); }

.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 15px 0; color: #fff; font-size: 1.1rem; }
.audio-tools-copy { color: var(--text-dim); line-height: 1.5; margin-bottom: 16px; }
.audio-tools-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 16px; }
.audio-tool-btn { padding: 12px 18px; }
.mic-test-panel { padding: 16px; border-radius: 16px; background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06); }
.mic-test-label-row { display: flex; justify-content: space-between; gap: 12px; color: #fff; margin-bottom: 12px; }
.mic-test-meter { height: 12px; border-radius: 999px; overflow: hidden; background: rgba(255,255,255,0.08); }
#mic-test-fill { width: 0%; height: 100%; background: linear-gradient(90deg, #22C55E, var(--gold)); transition: width 0.12s linear; }
.mic-test-playback { width: 100%; margin-top: 14px; }

/* Toggle Switch */
.toggle-switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; background-color: #444; transition: .4s; border-radius: 34px; box-shadow: inset 0 2px 5px rgba(0,0,0,0.5); }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.5); }
input:checked + .slider { background-color: var(--gold); }
input:checked + .slider:before { transform: translateX(24px); }

/* ============================
   ARCADE IN-APP STYLES
============================ */
.arcade-view {
    flex-direction: column;
    overflow-y: auto;
    overflow-x: hidden;
    min-width: 0;
    min-height: 0;
    overscroll-behavior-x: none;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-y;
}
.view-main.active.arcade-view {
    overflow-y: auto;
    overflow-x: hidden;
}
.arcade-page-header {
    padding: 15px 20px 0 20px;
    flex-shrink: 0;
    position: relative;
    overflow-x: clip;
}
.arcade-site-link {
    position: absolute;
    right: 20px;
    top: 15px;
    font-size: 1.5rem;
    text-decoration: none;
    color: var(--gold);
    filter: drop-shadow(0 0 5px rgba(217,161,62,0.4));
    transition: 0.3s;
    z-index: 10;
}
.arcade-page-title {
    font-size: 1.5rem;
    color: var(--gold);
    margin: 0 0 5px 0;
    font-weight: 800;
}
.arcade-page-subtitle {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin: 0 0 10px 0;
}
.arcade-auth-gate {
    padding: 8px 16px 0;
}
.arcade-auth-card {
    width: min(100%, 820px);
    margin: 0 auto 18px;
    padding: 24px;
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(11,20,27,0.98), rgba(9,16,23,0.92));
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 24px 60px rgba(0,0,0,0.38);
}
.arcade-auth-kicker {
    display: inline-block;
    margin-bottom: 10px;
    color: var(--gold-bright);
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}
.arcade-auth-copy h2 {
    color: #fff;
    font-size: clamp(1.3rem, 2vw, 2rem);
    margin-bottom: 10px;
}
.arcade-auth-copy p {
    color: var(--text-dim);
    line-height: 1.65;
}
.arcade-auth-tabs {
    display: inline-flex;
    gap: 8px;
    padding: 6px;
    margin-top: 20px;
    border-radius: 18px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
}
.arcade-auth-feedback {
    min-height: 24px;
    margin-top: 16px;
    color: var(--text-dim);
    font-size: 0.92rem;
}
.arcade-auth-feedback.is-error { color: #FCA5A5; }
.arcade-auth-feedback.is-success { color: #86EFAC; }
.arcade-auth-form {
    display: grid;
    gap: 10px;
    margin-top: 10px;
}
.arcade-auth-input {
    width: 100%;
}
.arcade-auth-submit {
    margin-top: 10px;
    justify-self: start;
}
.arcade-view.is-locked .arcade-layout {
    opacity: 0.35;
    pointer-events: none;
    filter: blur(2px);
}
.arcade-search-input {
    margin-bottom: 5px;
    padding: 10px;
    font-size: 0.9rem;
}
.arcade-rows-container {
    overflow-y: visible;
    overflow-x: hidden;
    padding: 10px 0 20px;
    width: 100%;
    min-width: 0;
    overscroll-behavior-x: none;
}
.arcade-layout {
    display: block;
    gap: 16px;
    padding: 10px 16px 20px;
}
.arcade-library-panel,
.arcade-stage-panel {
    min-width: 0;
    background: rgba(0,0,0,0.22);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 20px;
    overflow: visible;
}
.arcade-stage-panel {
    margin-top: 16px;
}
.metis-arcade-intro {
    padding: 14px 14px 4px;
    color: var(--text-dim);
    line-height: 1.55;
    font-size: 0.92rem;
}
.metis-arcade-intro p { margin: 0; }
.arcade-stage-panel {
    display: flex;
    flex-direction: column;
    padding: 16px;
    gap: 12px;
}
.arcade-empty-state,
.arcade-player-shell {
    width: 100%;
}
.arcade-stage-copy {
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.arcade-preview-image-wrapper {
    width: 100%;
    max-width: 420px;
    aspect-ratio: 16 / 9;
    border-radius: 16px;
    overflow: hidden;
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.06);
}
.arcade-preview-image-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.arcade-launch-btn { align-self: flex-start; }
.arcade-stage-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.arcade-secondary-btn { padding: 12px 16px; background: rgba(255,255,255,0.06); border-color: rgba(255,255,255,0.12); }
.arcade-preview-meta { display: flex; flex-wrap: wrap; gap: 8px; }
.arcade-preview-meta span { padding: 7px 11px; border-radius: 999px; font-size: 0.82rem; font-weight: 700; color: var(--gold-bright); background: rgba(217,161,62,0.08); border: 1px solid rgba(217,161,62,0.18); }
.arcade-player-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding: 14px 16px;
    background: linear-gradient(180deg, rgba(0,0,0,0.7) 0%, transparent 100%);
    border-radius: 18px 18px 0 0;
}
.arcade-player-header h3 {
    color: #fff;
    margin: 0;
    font-size: 1.1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    text-shadow: 0 0 10px rgba(0,0,0,0.8);
}
.arcade-close-btn {
    padding: 10px 18px;
    border-radius: 999px;
    background: rgba(239,68,68,0.75);
    border: 1px solid rgba(239,68,68,0.4);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
    backdrop-filter: blur(8px);
    box-shadow: 0 4px 12px rgba(239,68,68,0.2);
}
.arcade-close-btn:hover {
    background: rgba(239,68,68,0.95);
    box-shadow: 0 6px 18px rgba(239,68,68,0.4);
    transform: translateY(-1px);
}
.arcade-inline-iframe {
    width: 100%;
    height: 100%;
    min-height: 420px;
    border: 4px solid #1a1a2e;
    border-radius: 18px;
    background: #0a0a14;
    box-shadow:
        inset 0 0 60px rgba(0,0,0,0.8),
        0 0 0 1px rgba(0,234,255,0.08),
        0 0 40px rgba(0,0,0,0.5);
}
.arcade-core-title {
    font-size: 1rem; margin: 12px 0 8px 14px;
    color: var(--gold); font-weight: 800; letter-spacing: 1px;
    text-transform: uppercase; text-shadow: 0 0 10px rgba(217, 161, 62, 0.3);
}
.arcade-horizontal-scroll {
    display: flex; overflow-x: auto; overflow-y: hidden; padding: 0 14px 16px 14px; gap: 12px;
    scroll-snap-type: x mandatory; scrollbar-width: none;
    width: 100%;
    max-width: 100%;
    touch-action: pan-x pinch-zoom;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
    user-select: none;
    cursor: grab;
    padding-bottom: 6px;
}
.arcade-horizontal-scroll::-webkit-scrollbar { display: none; }
.arcade-horizontal-scroll.is-dragging { cursor: grabbing; }

/* ============================
   AURA MEDIA ENGINE 
============================ */
/* --- Audio Recording Bar --- */
.media-record-wrapper { position: relative; display: flex; align-items: center; justify-content: center; }
.record-mode-btn { background: transparent; border: none; font-size: 1.5rem; cursor: pointer; transition: 0.2s; color: var(--text-dim); }
.record-mode-btn.recording { color: var(--danger); animation: neon-pulse-red 1s infinite alternate; }

.record-ui {
    position: absolute; right: 0; bottom: 50px; background: rgba(0,0,0,0.8);
    backdrop-filter: blur(10px); padding: 10px 20px; border-radius: 20px;
    display: flex; align-items: center; gap: 15px; border: 1px solid var(--danger);
    box-shadow: 0 5px 20px rgba(239, 68, 68, 0.4); z-index: 10;
}
.record-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); }
.record-timer { color: #fff; font-weight: bold; font-family: monospace; font-size: 1.1rem; }
.record-slide-tip { font-size: 0.8rem; color: #888; animation: slideUpHint 1.5s infinite; }

@keyframes neon-pulse-red { 0% { text-shadow: 0 0 5px var(--danger); } 100% { text-shadow: 0 0 20px var(--danger), 0 0 40px var(--danger); transform: scale(1.1); } }
@keyframes slideUpHint { 0% { transform: translateY(0); opacity: 0.5; } 50% { transform: translateY(-5px); opacity: 1; } 100% { transform: translateY(0); opacity: 0.5; } }

/* --- Fullscreen Call UI (Frosted Glass) --- */
.call-overlay-immersiv {
    position: fixed; inset: 0; z-index: 999999; display: flex; flex-direction: column;
    justify-content: space-between; overflow: hidden; background: #000;
}
.call-bg-blur {
    position: absolute; inset: -20px; background-size: cover; background-position: center;
    filter: blur(30px) brightness(0.4); z-index: 1; transition: 0.5s;
}
.call-header-info { position: relative; z-index: 10; padding: 40px 20px; text-align: center; }
.call-header-info h2 { font-size: 2rem; color: #fff; text-shadow: 0 2px 10px rgba(0,0,0,0.8); margin: 0; }
.call-header-info p { color: var(--gold); font-weight: bold; font-size: 1.1rem; letter-spacing: 1px; }
.call-diagnostics-strip { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 14px; }
.call-diagnostic-pill { padding: 7px 12px; border-radius: 999px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,255,255,0.12); color: #fff; font-size: 0.82rem; position: relative; padding-left: 28px; }
.call-diagnostic-pill::before { content: ""; position: absolute; left: 10px; top: 50%; width: 10px; height: 10px; border-radius: 50%; transform: translateY(-50%); background: rgba(255,255,255,0.5); box-shadow: 0 0 0 3px rgba(255,255,255,0.08); }
.call-diagnostic-pill.status-ok::before { background: #22C55E; box-shadow: 0 0 0 3px rgba(34,197,94,0.18); }
.call-diagnostic-pill.status-warn::before { background: #EF4444; box-shadow: 0 0 0 3px rgba(239,68,68,0.18); }
.call-diagnostic-pill.status-neutral::before { background: var(--gold); box-shadow: 0 0 0 3px rgba(217,161,62,0.18); }
.call-help-text { margin-top: 10px; color: rgba(255,255,255,0.85); font-size: 0.92rem; max-width: 680px; margin-left: auto; margin-right: auto; line-height: 1.45; }

.call-center-stage { position: relative; z-index: 10; flex: 1; display: flex; align-items: center; justify-content: center; }
.call-avatar-glow {
    width: 150px; height: 150px; border-radius: 50%; font-size: 4rem; color: #fff;
    display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--gold), #8B6508);
    box-shadow: 0 0 50px rgba(217, 161, 62, 0.3), inset 0 0 20px rgba(0,0,0,0.5);
    animation: avatar-breathe 2s infinite alternate ease-in-out; border: 3px solid rgba(255,255,255,0.2);
}

.call-actions-hud {
    position: relative; z-index: 10; padding: 30px 20px; display: flex; justify-content: center; gap: 30px;
    background: linear-gradient(0deg, rgba(0,0,0,0.9), transparent);
}
.hud-btn {
    width: 60px; height: 60px; border-radius: 50%; border: none; font-size: 1.5rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; background: rgba(255,255,255,0.1); color: #fff;
    backdrop-filter: blur(10px); transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255,255,255,0.1);
}
.hud-btn:hover { transform: scale(1.15); background: rgba(255,255,255,0.2); }
.hud-btn.accept { background: var(--success); box-shadow: 0 0 20px rgba(34, 197, 94, 0.4); }
.hud-btn.hangup { background: var(--danger); box-shadow: 0 0 20px rgba(239, 68, 68, 0.4); }

/* --- Video PiP & Fullscreen --- */
.call-video-container { position: absolute; inset: 0; z-index: 5; }
#remote-video { width: 100%; height: 100%; object-fit: cover; }
.pip-local-video {
    position: absolute; right: 20px; top: 120px; width: 140px; height: 190px;
    border-radius: 16px; overflow: hidden; border: none;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6); z-index: 20;
    resize: both;
    min-width: 100px; min-height: 140px;
    max-width: 320px; max-height: 480px;
}
#local-video { width: 100%; height: 100%; object-fit: cover; transform: scaleX(-1); }

@keyframes avatar-breathe { 0% { transform: scale(1); box-shadow: 0 0 40px rgba(217,161,62,0.2); } 100% { transform: scale(1.05); box-shadow: 0 0 80px rgba(217,161,62,0.6); } }
.pulse-text { animation: pulseOpacity 1s infinite alternate; }
@keyframes pulseOpacity { from { opacity: 0.5; } to { opacity: 1; } }

/* --- Custom Audio Message Player --- */
.aura-audio-player {
    display: flex; align-items: center; gap: 12px; padding: 10px 15px;
    background: rgba(255,255,255,0.05); border-radius: 20px; border: 1px solid rgba(255,255,255,0.1);
    min-width: 200px; margin-top: 5px;
}
.audio-play-btn {
    width: 35px; height: 35px; border-radius: 50%; background: var(--gold);
    border: none; color: #000; font-size: 0.8rem; cursor: pointer;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.audio-waveform {
    flex: 1; height: 20px; display: flex; align-items: center; gap: 2px;
}
.audio-waveform i {
    flex: 1; height: 40%; background: rgba(255,255,255,0.2); border-radius: 2px;
}
.audio-waveform i.active { background: var(--gold); }
.audio-duration { font-size: 0.75rem; color: var(--text-dim); font-family: monospace; }
.audio-dl-btn {
    background: none; border: none; color: var(--text-dim); font-size: 0.85rem;
    cursor: pointer; padding: 2px 6px; border-radius: 6px; transition: 0.2s;
}
.audio-dl-btn:hover { background: rgba(255,255,255,0.1); color: var(--gold); }

.hidden-while-ringing { display: none !important; }
.call-overlay-immersiv:not(.is-hidden).connected .hidden-while-ringing { display: flex !important; }
.call-overlay-immersiv:not(.is-hidden).connected .accept { display: none !important; }

/* Arcade categories refinement */
.arcade-card {
    flex: 0 0 calc((100% - 24px) / 2.5); width: calc((100% - 24px) / 2.5); max-width: 180px; background: transparent;
    border: 0; border-radius: 16px;
    overflow: visible; scroll-snap-align: start; cursor: pointer;
    transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex; flex-direction: column; gap: 8px; box-shadow: none;
    backdrop-filter: none;
    padding: 0;
}
.arcade-card:hover {
    transform: translateY(-4px) scale(1.02);
}
.arcade-card.selected {
    transform: translateY(-4px);
}
.arcade-card-thumb {
    width: 100%;
    aspect-ratio: 1 / 1;
    border-radius: 12px;
    overflow: hidden;
    border: 3px solid transparent;
    background: linear-gradient(90deg, #00eaff, #37ff8b, #f751ff, #00eaff) border-box;
    box-shadow: 0 10px 24px rgba(0,0,0,0.35);
}
.arcade-card.selected .arcade-card-thumb {
    box-shadow: 0 0 0 2px rgba(255,255,255,0.18), 0 0 18px rgba(0, 234, 255, 0.22);
}
.arcade-card-thumb img {
    width: 100%; height: 100%; object-fit: contain; display: block;
    background: rgba(0,0,0,0.45);
}
.arcade-card-title {
    padding: 0 4px; font-size: 0.8rem; color: #fff; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 700;
}

@media (min-width: 961px) {
    .arcade-page-header {
        padding: 20px 24px 0;
    }

    .metis-arcade-intro {
        padding: 18px 18px 10px;
    }

    .arcade-layout {
        display: block;
        padding: 10px 16px 20px;
    }

    .arcade-stage-panel {
        display: none;
    }

    .arcade-layout.arcade-playing .arcade-library-panel {
        display: none;
    }

    .arcade-layout.arcade-playing .arcade-player-shell {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: 0;
        z-index: 200;
        background: #070c12;
        height: 100%;
        width: 100%;
    }

    .arcade-layout.arcade-playing .arcade-inline-iframe {
        flex: 1;
        min-height: 0;
        border-radius: 0;
    }

    .arcade-library-panel {
        padding-bottom: 8px;
    }

    .arcade-layout.arcade-playing .arcade-player-header {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        z-index: 10;
        background: linear-gradient(180deg, rgba(0,0,0,0.9) 0%, transparent 100%);
        border-bottom: none;
        padding: 18px 20px 28px;
        display: flex;
        flex-direction: row;
        align-items: center;
        gap: 14px;
    }

    .arcade-layout.arcade-playing .arcade-player-header h3 {
        color: #fff;
        font-size: 1.1rem;
        flex: 1;
        text-shadow: 0 2px 8px rgba(0,0,0,0.8);
    }

    .arcade-layout.arcade-playing .arcade-player-header .arcade-close-btn {
        width: auto;
        min-width: auto;
        min-height: 44px;
        padding: 10px 18px;
        border-radius: 999px;
        font-size: 0.88rem;
        font-weight: 700;
        background: rgba(239,68,68,0.85);
        border: 1px solid rgba(239,68,68,0.4);
        color: #fff;
        backdrop-filter: blur(10px);
        box-shadow: 0 4px 16px rgba(239,68,68,0.3);
    }

    .arcade-layout.arcade-playing .arcade-inline-iframe {
        border-top: none;
        border-radius: 0;
    }

    .arcade-core-title {
        margin: 18px 18px 12px;
        font-size: 1.05rem;
    }

    .arcade-horizontal-scroll {
        display: grid;
        grid-template-columns: repeat(4, minmax(0, 1fr));
        gap: 14px;
        overflow: visible;
        padding: 0 18px 18px;
        scroll-snap-type: none;
        cursor: default;
        user-select: auto;
    }

    .arcade-horizontal-scroll.is-dragging {
        cursor: default;
    }

    .arcade-card {
        width: 100%;
        max-width: 210px;
        justify-self: center;
        gap: 10px;
    }

    .arcade-card-thumb {
        aspect-ratio: 2 / 3;
        border-radius: 14px;
    }

    .arcade-card-thumb img {
        object-fit: cover;
    }

    .arcade-card-title {
        white-space: normal;
        line-height: 1.25;
        min-height: 2.4em;
    }
}

@media (min-width: 1180px) {
    .arcade-horizontal-scroll {
        grid-template-columns: repeat(5, minmax(0, 1fr));
    }
}

@media (min-width: 1480px) {
    .arcade-horizontal-scroll {
        grid-template-columns: repeat(6, minmax(0, 1fr));
    }
}

@media (max-width: 700px) {
    .arcade-auth-gate {
        padding: 12px 14px 0;
    }

    .arcade-auth-card {
        padding: 18px;
        margin-bottom: 14px;
        border-radius: 22px;
    }

    .arcade-auth-tabs {
        display: flex;
        width: 100%;
    }

    .arcade-auth-tabs .contact-tab-btn {
        flex: 1;
    }

    .arcade-auth-submit {
        width: 100%;
        justify-self: stretch;
    }

    .arcade-page-header { padding: 14px 14px 0 14px; }
    .arcade-site-link { right: 14px; }
    .arcade-layout { padding: 10px 14px 18px; }
    .arcade-horizontal-scroll { padding: 0 14px 18px 14px; gap: 12px; }
    .arcade-card { width: calc((100% - 24px) / 2.35); }
    .profile-save-status { text-align: center; width: 100%; }

    .arcade-stage-panel {
        display: none;
    }

    .arcade-library-panel {
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 8px;
    }

    .arcade-rows-container {
        overflow: visible;
        height: auto;
    }

    .arcade-layout.arcade-playing .arcade-library-panel {
        display: none;
    }

    .arcade-layout.arcade-playing .arcade-player-shell {
        display: flex;
        flex-direction: column;
        position: fixed;
        inset: 0;
        z-index: 200;
        background: #070c12;
        height: 100%;
        width: 100%;
    }

    .arcade-layout.arcade-playing .arcade-player-header {
        flex-shrink: 0;
        padding: 10px 14px;
    }

    .arcade-layout.arcade-playing .arcade-player-header h3 {
        font-size: 1rem;
    }

    .arcade-layout.arcade-playing .arcade-close-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
    }

    .arcade-layout.arcade-playing .arcade-inline-iframe {
        flex: 1;
        min-height: 0;
        border-radius: 0;
        border: none;
    }

    .arcade-player-header {
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        padding: 12px 14px;
        background: rgba(0,0,0,0.88);
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .arcade-player-header h3 {
        font-size: 1rem;
        flex: 1;
        text-align: left;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .arcade-layout.arcade-playing .arcade-player-header {
        flex-shrink: 0;
    }

    .arcade-layout.arcade-playing .arcade-inline-iframe {
        flex: 1;
        min-height: 0;
        border-radius: 0;
        border: none;
    }

    .arcade-inline-iframe {
        min-height: 0;
        border-radius: 0;
    }
}

.arcade-modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 999999;
    background: rgba(3, 8, 13, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.arcade-modal {
    width: min(1080px, 96vw);
    max-height: 92vh;
    overflow: hidden;
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,0.08);
    background: linear-gradient(180deg, rgba(10,17,24,0.98), rgba(8,14,20,0.96));
    box-shadow: 0 30px 80px rgba(0,0,0,0.55);
    display: grid;
    grid-template-columns: minmax(320px, 0.9fr) minmax(320px, 1.1fr);
}

.arcade-modal-media {
    position: relative;
    min-height: 420px;
    background: #070c12;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.arcade-modal-media img,
.arcade-modal-media video {
    width: 100%;
    height: 100%;
    max-height: 70vh;
    object-fit: cover;
    border-radius: 20px;
}

.arcade-modal-body {
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow-y: auto;
}

.arcade-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 44px;
    height: 44px;
    border-radius: 999px;
    background: rgba(0,0,0,0.5);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.1);
    font-size: 1.4rem;
    z-index: 2;
}

.arcade-modal-title {
    font-size: clamp(1.5rem, 2vw, 2.2rem);
    color: #fff;
    font-weight: 900;
}

.arcade-modal-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.arcade-modal-meta span {
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(217,161,62,0.1);
    border: 1px solid rgba(217,161,62,0.2);
    color: var(--gold-bright);
    font-size: 0.82rem;
    font-weight: 700;
}

.arcade-modal-description {
    color: var(--text-main);
    line-height: 1.7;
    font-size: 0.98rem;
    overflow-y: auto;
}

.arcade-modal-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: auto;
}

@media (max-width: 900px) {
    .arcade-modal {
        grid-template-columns: 1fr;
        width: min(96vw, 720px);
    }

    .arcade-modal-media {
        min-height: 260px;
    }

    .arcade-modal-body {
        max-height: 46vh;
    }
}

/* --- User Profile Modal (Glassmorphism 2.0) --- */
.modal-overlay {
    position: fixed; inset: 0; z-index: 9999999;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(15px);
    display: flex; align-items: center; justify-content: center;
    animation: fadeInModal 0.3s ease;
}

@keyframes fadeInModal { from { opacity: 0; } to { opacity: 1; } }

.user-modal-glass {
    position: relative;
    background: var(--navy-glass);
    border: 1px solid var(--border);
    border-radius: 32px; padding: 40px;
    width: 90%; max-width: 450px;
    text-align: center; color: #fff;
    box-shadow: 0 40px 100px rgba(0,0,0,0.5), 0 0 30px rgba(217,161,62,0.1);
    transform-origin: center; animation: popModal 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popModal { from { transform: scale(0.85); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal-close-btn { position: absolute; top: 20px; right: 25px; background: none; border: none; font-size: 2rem; color: var(--text-dim); cursor: pointer; transition: 0.3s; }
.modal-close-btn:hover { color: var(--danger); transform: rotate(90deg); }

.modal-avatar-glow { width: 120px; height: 120px; margin: 0 auto 20px auto; border-radius: 50%; padding: 5px; background: linear-gradient(45deg, var(--gold), transparent); box-shadow: 0 0 20px var(--gold-bright); }
.modal-avatar-glow img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; border: 3px solid #0b141b; }

.status-indicator { font-size: 0.8rem; color: var(--success); text-transform: uppercase; letter-spacing: 2px; font-weight: 800; display: block; margin-top: 5px; }

.modal-action-btn { width: 100%; padding: 15px; border-radius: 12px; font-weight: 800; cursor: pointer; border: none; margin-top: 20px; transition: 0.3s; }
.modal-action-btn.primary { background: var(--gold); color: #000; box-shadow: 0 10px 20px rgba(217,161,62,0.3); }
.modal-action-btn.primary:hover { transform: scale(1.02); box-shadow: 0 15px 30px rgba(217,161,62,0.5); }

/* --- Sidebar Navigation Updates --- */
.sidebar-nav button.active-tab {
    background: rgba(217, 161, 62, 0.15);
    border-radius: 12px;
    color: var(--gold-bright);
    box-shadow: 0 0 15px rgba(217, 161, 62, 0.2);
    text-shadow: 0 0 15px var(--gold-bright); 
    transform: scale(1.1);
}

/* --- Metis UI Refresh --- */
:root {
    --panel-strong: rgba(10, 17, 24, 0.9);
    --panel-soft: rgba(14, 23, 31, 0.72);
    --panel-elevated: rgba(20, 31, 41, 0.78);
    --accent-soft: rgba(217, 161, 62, 0.16);
    --accent-line: rgba(217, 161, 62, 0.24);
    --shadow-soft: 0 18px 60px rgba(0, 0, 0, 0.34);
}

body {
    background-image:
        radial-gradient(circle at 12% 14%, rgba(217, 161, 62, 0.14), transparent 24%),
        radial-gradient(circle at 82% 18%, rgba(58, 122, 255, 0.12), transparent 28%),
        radial-gradient(circle at 50% 100%, rgba(217, 161, 62, 0.08), transparent 30%),
        linear-gradient(180deg, #071018 0%, #09131b 48%, #04080d 100%);
}

.app-container {
    gap: 16px;
    padding: 16px;
    /* Opacity is handled by the base definition */
}

.sidebar {
    width: 88px;
    padding: 18px 12px;
    border: 1px solid var(--border-light);
    border-radius: 28px;
    background: linear-gradient(180deg, rgba(13, 21, 29, 0.96), rgba(9, 16, 23, 0.78));
    box-shadow: var(--shadow-soft);
}

.sidebar-logo img {
    width: 48px;
}

.sidebar-top {
    margin-bottom: 24px;
    padding-bottom: 18px;
    width: 100%;
    display: flex;
    justify-content: center;
}

.aura-icon-btn,
.sidebar-nav button {
    width: 100%;
    min-height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.nav-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 1.35rem;
    line-height: 1;
}

.nav-label {
    display: none;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.view-main.active {
    /* Main layout is handled by the primary grid definition at line 165 */
    border: 1px solid var(--border-light);
    border-radius: 32px;
    overflow: hidden;
    background: linear-gradient(180deg, rgba(8, 14, 20, 0.88), rgba(7, 12, 18, 0.72));
    box-shadow: var(--shadow-soft);
}

.contacts-sidebar {
    width: clamp(300px, 30vw, 360px);
    min-width: 300px;
    padding: 18px;
    gap: 14px;
    background: linear-gradient(180deg, rgba(14, 22, 30, 0.96), rgba(9, 16, 23, 0.88));
    border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.contacts-header {
    margin-bottom: 0;
    padding: 0;
    gap: 12px;
    align-items: flex-start;
}

.contacts-tabs {
    flex: 1;
    gap: 8px;
    padding: 6px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.contact-tab-btn {
    min-height: 46px;
    height: 46px;
    width: 46px;
    padding: 0;
    border-radius: 50%;
    font-size: 1.3rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
    flex-shrink: 0;
}

.tab-icon {
    font-size: 0.95rem;
    opacity: 0.9;
}

.contact-tab-btn.active {
    background: linear-gradient(135deg, var(--gold-bright), var(--gold));
    box-shadow: 0 10px 24px rgba(217, 161, 62, 0.24);
}

.contacts-actions {
    gap: 8px;
}

.contacts-search {
    position: relative;
}

.contacts-search::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    width: 10px;
    height: 10px;
    border: 2px solid rgba(255, 255, 255, 0.34);
    border-radius: 50%;
    transform: translateY(-58%);
}

.contacts-search::after {
    content: "";
    position: absolute;
    left: 24px;
    top: calc(50% + 5px);
    width: 7px;
    height: 2px;
    background: rgba(255, 255, 255, 0.34);
    transform: rotate(45deg);
    border-radius: 999px;
}

.contacts-search input {
    width: 100%;
    min-height: 48px;
    padding: 0 16px 0 42px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    outline: none;
}

.contacts-search input:focus {
    border-color: var(--accent-line);
    background: rgba(217, 161, 62, 0.06);
}

.contacts-subfilters {
    gap: 10px;
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-bottom: 0;
    padding-bottom: 4px;
    scrollbar-width: none;
    scroll-snap-type: x proximity;
}

.contacts-subfilters::-webkit-scrollbar {
    display: none;
}

.contact-filter-btn {
    min-height: 40px;
    padding: 9px 14px;
    border-radius: 999px;
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    text-transform: none;
    white-space: nowrap;
    scroll-snap-align: start;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.06);
}

.contact-filter-btn.active {
    background: var(--accent-soft);
    color: var(--gold-bright);
    border-color: var(--accent-line);
}

.add-friend-main {
    width: 44px;
    height: 44px;
    box-shadow: 0 12px 24px rgba(217, 161, 62, 0.28);
}

.contacts-list {
    padding-right: 4px;
}

.roster-section-title {
    padding: 0 6px 10px;
    font-size: 10px;
    letter-spacing: 1.2px;
}

.contact-item {
    gap: 12px;
    padding: 14px;
    margin-bottom: 10px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.025);
    border: 1px solid rgba(255, 255, 255, 0.04);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.02);
}

.contact-item:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.08);
    transform: translateY(-1px);
}

.contact-item.active {
    background: linear-gradient(135deg, rgba(217, 161, 62, 0.12), rgba(255, 255, 255, 0.04));
    border-color: var(--accent-line);
}

.contact-avatar {
    width: 48px;
    height: 48px;
    background: linear-gradient(135deg, #46c6f0, #b58f2d);
    box-shadow: 0 12px 24px rgba(70, 198, 240, 0.16);
    overflow: hidden;
}
.contact-avatar img { width: 100%; height: 100%; object-fit: cover; }

.contact-name {
    font-size: 0.96rem;
    font-weight: 700;
}

.contact-status {
    margin-top: 4px;
    font-size: 0.78rem;
}

.chat-main {
    background: linear-gradient(180deg, rgba(8, 14, 20, 0.66), rgba(6, 10, 15, 0.42));
}

.chat-header {
    padding: 22px 26px 18px;
    background: linear-gradient(180deg, rgba(14, 22, 30, 0.82), rgba(14, 22, 30, 0.58));
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.chat-header h1 {
    font-size: clamp(1.12rem, 1.5vw, 1.48rem);
}

.chat-header span {
    margin-top: 5px;
    font-size: 0.76rem;
    color: rgba(255, 255, 255, 0.62);
}

.chat-header-actions {
    gap: 8px;
}

.chat-header-actions button {
    min-width: 46px;
    height: 46px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.045);
}

.aura-dashboard,
.messages-area,
.feed-container,
.settings-container,
.profile-workspace {
    scrollbar-gutter: stable;
}

.messages-area {
    padding: 28px;
    gap: 12px;
    background:
        radial-gradient(circle at top right, rgba(217, 161, 62, 0.05), transparent 22%),
        linear-gradient(180deg, rgba(4, 8, 12, 0.18), rgba(4, 8, 12, 0.02));
}

.msg-bubble {
    border-radius: 24px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.16);
}

.chat-input-area {
    padding: 18px 22px 22px;
    background: linear-gradient(180deg, rgba(8, 14, 20, 0), rgba(8, 14, 20, 0.88) 30%);
}

.chat-input-bar {
    min-height: 64px;
    padding: 10px 12px;
    border-radius: 24px;
    background: rgba(14, 22, 30, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.06);
    box-shadow: 0 18px 34px rgba(0, 0, 0, 0.2);
}

#message-input {
    min-width: 0;
}

.call-header-info {
    padding: 34px 20px 18px;
    position: relative;
    z-index: 1000;
}

.call-diagnostics-strip {
    gap: 10px;
}

/* Logic to hide avatar when video starts */
.call-video-container:not(.is-hidden) + .call-center-stage {
    display: none !important;
}

.call-center-stage {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 5;
}

.call-avatar-glow {
    width: 140px;
    height: 140px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--gold), #7d4411);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3.5rem;
    color: #fff;
    box-shadow: 0 0 60px rgba(217, 161, 62, 0.4);
    border: 3px solid rgba(255,255,255,0.1);
    animation: pulseAvatar 2s infinite;
}

@keyframes pulseAvatar {
    0% { transform: scale(1); box-shadow: 0 0 40px rgba(217, 161, 62, 0.4); }
    50% { transform: scale(1.05); box-shadow: 0 0 80px rgba(217, 161, 62, 0.6); }
    100% { transform: scale(1); box-shadow: 0 0 40px rgba(217, 161, 62, 0.4); }
}

.call-video-container {
    margin-top: 0;
    position: absolute;
    inset: 0;
    height: auto;
    border: none;
    border-radius: 0;
    background: #000;
}

#remote-video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    transition: object-fit 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
}

.call-video-container.is-screen-share #remote-video {
    object-fit: contain;
    background: #000;
}

.pip-local-video {
    position: absolute;
    top: auto;
    right: 28px;
    bottom: 124px;
    width: clamp(120px, 15vw, 220px);
    aspect-ratio: 9/16;
    border-radius: 24px;
    border: 1px solid rgba(217, 161, 62, 0.4);
    background: #000;
    backdrop-filter: blur(50px);
    z-index: 800; 
    box-shadow: 
        0 40px 100px rgba(0,0,0,0.9),
        0 0 20px rgba(217, 161, 62, 0.15),
        0 0 0 1px rgba(255, 255, 255, 0.05);
    overflow: hidden;
    cursor: move;
    touch-action: none;
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), border-color 0.3s, box-shadow 0.3s;
}

.pip-local-video.swapped {
    top: 0; left: 0; right: 0; bottom: 0;
    width: 100%; height: 100%;
    border-radius: 0;
    z-index: 10;
}

.pip-local-video:hover { 
    transform: translateY(-5px); 
    border-color: rgba(217, 161, 62, 0.8);
    box-shadow: 0 50px 120px rgba(0,0,0,1), 0 0 30px rgba(217, 161, 62, 0.25);
}

.pip-local-video video { 
    width: 100%; 
    height: 100%; 
    object-fit: cover; 
    border-radius: inherit;
    pointer-events: none;
    background: #000;
}

/* --- PiP Controls Overlay --- */
.pip-overlay-controls {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    gap: 12px;
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    z-index: 10;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.8));
}

.pip-local-video:hover .pip-overlay-controls {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1.1);
}

.pip-mini-btn {
    width: 38px;
    height: 38px;
    border-radius: 50%;
    border: 1px solid rgba(255,255,255,0.2);
    background: rgba(10, 15, 20, 0.7);
    backdrop-filter: blur(10px);
    color: #fff;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}

.pip-mini-btn:hover {
    background: var(--gold);
    color: #000;
    border-color: var(--gold-bright);
    transform: scale(1.1);
}

/* --- PiP Status Bar --- */
.pip-status-bar {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 12px 15px;
    background: linear-gradient(0deg, rgba(0,0,0,0.6) 0%, transparent 100%);
    display: flex;
    align-items: center;
    justify-content: space-between;
    pointer-events: none;
    z-index: 5;
}

.pip-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: rgba(255,255,255,0.9);
}

.pip-audio-visualizer {
    width: 24px;
    height: 12px;
    display: flex;
    align-items: flex-end;
    gap: 2px;
}

.pip-audio-bar {
    width: 3px;
    height: 4px;
    background: var(--gold);
    border-radius: 2px;
    animation: pipAudioPulse 1.2s infinite ease-in-out;
}

@keyframes pipAudioPulse {
    0%, 100% { height: 4px; opacity: 0.5; }
    50% { height: 10px; opacity: 1; }
}

/* --- Resize Handle --- */
.pip-resize-handle {
    position: absolute;
    top: 0;
    left: 0;
    width: 20px;
    height: 20px;
    cursor: nw-resize;
    z-index: 20;
    background: linear-gradient(135deg, rgba(217,161,62,0.4) 0%, transparent 50%);
}


/* Mobile adjustments for the 'quadratino' */
@media (max-width: 768px) {
    .pip-local-video {
        right: 18px;
        bottom: 140px; /* Alza per non coprire i tasti HUD */
        width: 100px;
        height: 140px;
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(0,0,0,0.7);
    }
}

.call-actions-hud {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 24px 20px 35px;
    gap: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
    background: linear-gradient(0deg, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.2) 60%, transparent 100%);
    z-index: 500;
    flex-wrap: wrap;
}

.hud-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    background: rgba(255,255,255,0.08);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255,255,255,0.1);
    color: #fff;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: 0.3s;
}
.hud-btn:hover { background: var(--gold); color: #000; transform: translateY(-5px); box-shadow: 0 10px 20px rgba(217, 161, 62, 0.4); border-color: var(--gold-bright); }
.hud-btn.accept { background: var(--success); color: #fff; border: none; }
.hud-btn.hangup { background: var(--danger); color: #fff; border: none; }
.hud-btn.active { background: var(--gold); color: #000; border-color: var(--gold-bright); }

/* MetisVideo Shared Notes Panel */
.notes-panel {
    position: absolute;
    top: 40px;
    right: 20px;
    bottom: 120px;
    width: min(90%, 380px);
    background: var(--navy-glass);
    backdrop-filter: var(--glass-blur);
    border: 1px solid var(--gold);
    border-radius: 30px;
    z-index: 600;
    display: flex;
    flex-direction: column;
    box-shadow: 0 40px 100px rgba(0,0,0,0.8);
    animation: notesIn 0.5s cubic-bezier(0.165, 0.84, 0.44, 1);
    overflow: hidden;
}
@keyframes notesIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.notes-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(217, 161, 62, 0.2);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(217, 161, 62, 0.05);
}
.notes-header h3 {
    font-size: 1.1rem;
    color: var(--gold-bright);
    margin: 0; font-weight: 800;
}
.close-notes-btn {
    background: rgba(255,255,255,0.05);
    color: #fff;
    width: 36px;
    height: 36px;
    border-radius: 12px;
    font-size: 1.4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}
/* Whiteboard Canvas & Controls */
.whiteboard-controls {
    padding: 15px 24px;
    display: flex;
    align-items: center;
    gap: 15px;
    background: rgba(0, 0, 0, 0.15);
    border-bottom: 1px solid rgba(217, 161, 62, 0.1);
}
.whiteboard-controls button {
    background: rgba(255, 255, 255, 0.05);
    padding: 8px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.2s;
    font-size: 1.2rem;
    display: flex; align-items: center; justify-content: center;
}
.whiteboard-controls button:hover { background: rgba(239, 68, 68, 0.2); transform: scale(1.1); }

#whiteboard-color {
    width: 38px;
    height: 38px;
    padding: 0;
    border: 2px solid rgba(255,255,255,0.1);
    border-radius: 50%;
    overflow: hidden;
    cursor: pointer;
    background: none;
}
#whiteboard-size {
    flex: 1;
    accent-color: var(--gold);
}

.whiteboard-container {
    flex: 1;
    position: relative;
    background: #0d1117;
    cursor: crosshair;
    overflow: hidden;
}
#metis-whiteboard {
    width: 100%;
    height: 100%;
    touch-action: none;
    display: block;
}
.notes-footer {
    padding: 12px 24px;
    background: rgba(0,0,0,0.2);
    font-size: 0.75rem;
    color: var(--text-dim);
    text-align: center;
    letter-spacing: 0.5px;
}

@media (max-width: 1100px) {
    .app-container {
        padding: 12px;
        gap: 12px;
    }

    .sidebar {
        width: 80px;
        padding: 16px 10px;
    }

    .contacts-sidebar {
        width: 280px;
        min-width: 280px;
    }
}

@media (max-width: 760px) {
    body {
        height: 100svh;
        overflow: hidden;
    }

    .app-container {
        min-height: 100svh;
        height: 100svh;
        padding: 0;
        gap: 0;
        display: flex;
        flex-direction: column;
    }

    .view-main.active {
        flex: 1;
        display: flex;
        flex-direction: column;
        overflow: hidden;
        border: none;
        border-radius: 0;
        box-shadow: none;
        padding-bottom: 0;
    }

    .view-main.active .profile-workspace {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior: contain;
        padding-bottom: calc(96px + 12px);
    }

    .sidebar {
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: max(12px, env(safe-area-inset-bottom));
        z-index: 999;
        width: auto;
        height: 76px;
        padding: 8px;
        display: flex;
        align-items: stretch;
        justify-content: flex-start;
        gap: 8px;
        border-radius: 28px;
        background: rgba(10, 17, 24, 0.94);
        backdrop-filter: blur(24px);
        border: 1px solid rgba(255, 255, 255, 0.08);
        overflow: visible;
    }

    .sidebar-logo {
        display: none;
    }

    .sidebar-top {
        display: none;
    }

    .sidebar-nav {
        flex: 1;
        display: grid;
        grid-template-columns: repeat(7, minmax(0, 1fr));
        gap: 4px;
        width: 100%;
    }

    .aura-icon-btn,
    .sidebar-nav button {
        min-height: 52px;
        border-radius: 14px;
        flex-direction: column;
        gap: 3px;
        padding: 4px 2px;
        margin: 0;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .nav-label {
        display: block;
        font-size: 0.62rem;
    }

    .nav-emoji {
        font-size: 1.18rem;
    }

    .sidebar-badge {
        top: 6px;
        right: 8px;
    }

    #view-chat.active {
        display: block;
        min-height: 100svh;
        height: calc(100svh - 96px);
        overflow: hidden;
    }

    .contacts-sidebar {
        width: 100%;
        min-width: 0;
        max-height: none;
        height: calc(100svh - 96px);
        padding: 14px 14px 12px;
        border-right: none;
        border-bottom: none;
        border-radius: 0;
        background: linear-gradient(180deg, rgba(12, 20, 28, 0.98), rgba(8, 14, 20, 0.94));
    }

    .contacts-header {
        flex-direction: column;
        align-items: stretch;
    }

    .contacts-tabs,
    .contacts-subfilters {
        overflow-x: auto;
        overflow-y: hidden;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
    }

    .contacts-actions {
        justify-content: space-between;
    }

    .contact-tab-btn,
    .contact-filter-btn {
        flex: 0 0 auto;
    }

    .contacts-list {
        padding-right: 0;
    }

    .contact-item {
        border-radius: 18px;
        padding: 12px;
    }

    .chat-main {
        min-height: 0;
        flex: 1;
        height: calc(100svh - 96px);
        display: none;
        background: linear-gradient(180deg, rgba(8, 14, 20, 0.98), rgba(5, 10, 15, 0.98));
    }

    .app-container.mobile-chat-open #view-chat.active .contacts-sidebar {
        display: none;
    }

    .app-container.mobile-chat-open #view-chat.active .chat-main {
        display: flex;
    }

    .contacts-sidebar {
        width: 320px !important; /* Telegram Standard */
        min-width: 320px !important;
        border-right: 1px solid var(--border);
    }
    
    .chat-main {
        flex: 1;
        min-width: 0;
    }
} /* Global Mobile Block CLOSED */

/* Restore view-chat as a full layout container */
#view-chat.active {
    display: flex !important;
    flex-direction: row !important;
    width: 100% !important;
}

#view-chat.active .contacts-sidebar {
    display: flex !important;
}

#view-chat.active .chat-main {
    display: flex !important;
    flex: 1;
}
/* ==========================================================================
   METIS UNIFIED STRUCTURAL ARCHITECTURE (Telegram Standard)
   ========================================================================== */

/* 1. Global View Visibility: Absolute Isolation */
.view-main {
    display: none;
    opacity: 0;
}

.is-hidden {
    display: none !important;
}

.view-main.active {
    display: flex !important;
    flex: 1 !important;
    min-width: 0;
    position: relative;
    opacity: 1;
}

/* 2. Chat View Layout (Telegram Standard 2-Pane) */
#view-chat.active {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    flex-direction: row;
    overflow: hidden;
}

/* Sidebars & Hidden State */
.contacts-sidebar {
    width: 320px;
    min-width: 320px;
    transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
    opacity: 1;
    visibility: visible;
}

.contacts-hidden .contacts-sidebar {
    width: 0 !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    opacity: 0;
    visibility: hidden;
    border-right: none !important;
}

.chat-main {
    flex: 1;
    min-width: 0;
    height: 100%;
}

/* 3. Full-Width Views (Social, Search, Profile) */
#view-social.active,
#view-search.active,
#view-profile.active,
#view-arcade.active {
    display: flex !important;
    width: 100% !important;
    height: 100% !important;
    flex-direction: column;
}

#search-view-iframe {
    width: 100%;
    height: 100%;
    border: none;
    flex: 1;
}

/* 4. Orientation & Sidebar Logic (Automatic Scaling) */
@media (orientation: landscape) {
    .view-main.active:not(#view-chat) {
        margin-left: 0 !important;
        width: 100% !important;
    }
}

/* 5. Header/Footer Isolation in Chat */
#view-chat.active .chat-header.is-hidden,
#view-chat.active .messages-area.is-hidden,
#view-chat.active .chat-input-area.is-hidden {
    display: none !important;
}

/* ---- AURA DASHBOARD: THE ULTIMATE HUB (Bento 4.1) ---- */
#view-home.active {
    display: grid !important;
    width: 100% !important;
    height: 100% !important;
    flex: 1 !important;
    overflow-y: auto;
}

.aura-dashboard {
    height: 100%;
    width: 100%;
    padding: 24px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: auto auto;
    grid-template-areas: 
        "welcome welcome stats"
        "social identity arcade";
    gap: 24px;
    box-sizing: border-box;
    background: radial-gradient(circle at top right, rgba(217, 161, 62, 0.08), transparent 40%),
                radial-gradient(circle at bottom left, rgba(141, 220, 255, 0.05), transparent 40%);
}

.dash-hero-welcome { grid-area: welcome; }
.dash-sys-stats { grid-area: stats; }
.tile-social { grid-area: social; }
.tile-system { grid-area: identity; }
.tile-arcade { grid-area: arcade; }

.dash-tile {
    min-height: 200px;
    background: var(--navy-glass);
    backdrop-filter: var(--glass-blur);
    border-radius: 24px;
    border: 1px solid var(--border);
    padding: 24px;
    transition: 0.3s cubic-bezier(0.19, 1, 0.22, 1);
}
.dash-tile:hover { transform: translateY(-5px); border-color: rgba(217,161,62,0.4); box-shadow: 0 10px 30px rgba(0,0,0,0.5); }

.dash-hero-welcome { grid-area: welcome; }
.dash-sys-stats { grid-area: stats; }
.tile-social { grid-area: social; }
.tile-system { grid-area: identity; }
.tile-arcade { grid-area: arcade; }

.dash-tile {
    background: rgba(11, 20, 27, 0.6);
    border: 1px solid rgba(217, 161, 62, 0.1);
    border-radius: 42px;
    backdrop-filter: blur(40px);
    box-shadow: 0 40px 100px rgba(0, 0, 0, 0.4);
    transition: all 0.6s cubic-bezier(0.19, 1, 0.22, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 40px;
    height: 100%;
    width: 100%;
    box-sizing: border-box;
}

/* Hero Section (2 Columns) */
.dash-hero-welcome {
    background: linear-gradient(135deg, rgba(10, 18, 25, 0.95), rgba(5, 10, 15, 0.98));
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    min-height: 280px;
}

.dash-welcome-aura {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at 70% 30%, rgba(217, 161, 62, 0.1) 0%, transparent 70%);
}

.welcome-profile-area {
    display: flex;
    align-items: center;
    gap: 40px;
    z-index: 10;
}

#dash-greeting {
    font-size: clamp(2rem, 3.5vw, 4rem);
    line-height: 1.1;
    margin-bottom: 8px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

#dash-username {
    font-size: 1.25rem;
    color: var(--gold);
    letter-spacing: 1px;
    font-weight: 500;
}

/* Stats Tile (1 Column) */
.dash-sys-stats {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 30px;
}

.sys-grid {
    display: grid;
    grid-template-rows: 1fr 1fr;
    gap: 15px;
    width: 100%;
    height: 100%;
}

.sys-item {
    text-align: center;
    padding: 20px;
    background: rgba(0,0,0,0.25);
    border-radius: 28px;
    border: 1px solid rgba(255,255,255,0.02);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.sys-label { font-size: 10px; font-weight: 900; letter-spacing: 2px; color: var(--gold); opacity: 0.6; margin-bottom: 4px; }
.sys-value { font-size: 2.2rem; font-weight: 800; color: #fff; line-height: 1; }
.status-neon { color: var(--gold); text-shadow: 0 0 20px rgba(217, 161, 62, 0.4); }

.dash-tile:hover {
    transform: translateY(-8px) scale(1.005);
    border-color: var(--gold);
    box-shadow: 0 50px 120px rgba(0, 0, 0, 0.6);
}

.tile-header { display: flex; align-items: center; gap: 20px; margin-bottom: 30px; }
.tile-icon { font-size: 32px; filter: grayscale(0.2); }
.tile-header h3 { font-size: 1.25rem; font-weight: 800; }
.tile-body { flex: 1; color: var(--text-dim); line-height: 1.7; font-size: 1.05rem; }
.tile-action { color: var(--gold); font-weight: 900; font-size: 11px; letter-spacing: 2px; margin-top: 30px; cursor: pointer; text-transform: uppercase; }
.jid-text { color: var(--text-main); font-family: monospace; font-size: 0.95rem; margin-bottom: 12px; word-break: break-all; opacity: 0.8; }
.tile-header h3 {
    font-size: 1.1rem;
    font-weight: 800;
    color: #fff;
    margin: 0;
}

.tile-body {
    flex: 1;
    color: var(--text-dim);
    line-height: 1.6;
}

.peek-msg {
    font-style: italic;
    font-size: 1.05rem;
    color: var(--text-main);
}

.tile-action {
    margin-top: 24px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    color: var(--gold);
    opacity: 0.8;
}

/* Fix Avatar on dashboard context */
.dash-avatar-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 28px;
}

/* Responsiveness */
@media (max-width: 1024px) {
    .tile-welcome {
        flex-direction: column;
        text-align: center;
        padding: 40px;
    }
    .welcome-top {
        flex-direction: column;
    }
    .welcome-system-info {
        text-align: center;
        gap: 30px;
    }
    .sys-item { text-align: center; }
}

@media (max-width: 480px) {
    .aura-dashboard { padding: 15px; }
    .dash-grid-flow { grid-template-columns: 1fr; }
}

.profile-input-with-action {
    display: flex;
    gap: 10px;
    align-items: center;
}

.profile-input-with-action input {
    flex: 1;
}

.profile-input-with-action button {
    flex-shrink: 0;
    padding: 10px 15px;
    border-radius: 12px;
    font-size: 0.85rem;
}

/* ---- SALA GIOCHI (ARCADE) FIX ---- */
.arcade-view, #view-arcade {
    display: flex;
    flex-direction: column;
    height: 100%;
    margin-left: 0 !important;
    width: 100% !important;
}
.arcade-view.active {
    display: flex !important;
}

.arcade-layout {
    display: contents;
}

    .arcade-library-panel {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        border: none;
        background: transparent;
        border-radius: 0;
    }

    .arcade-page-header {
        flex-shrink: 0;
        padding: 10px 14px 6px;
        display: flex;
        align-items: center;
        gap: 10px;
        background: rgba(10, 17, 24, 0.96);
        border-bottom: 1px solid rgba(255,255,255,0.06);
        position: sticky;
        top: 0;
        z-index: 15;
    }

    .arcade-site-link {
        flex-shrink: 0;
        font-size: 1.2rem;
    }

    .arcade-page-title {
        font-size: 1rem;
        font-weight: 800;
        white-space: nowrap;
    }

    .arcade-search-input {
        flex: 1;
        border-radius: 14px;
        padding: 8px 12px;
        font-size: 0.85rem;
        margin: 0;
    }

    .arcade-auth-gate {
        flex-shrink: 0;
        padding: 8px 14px;
        background: rgba(8, 14, 20, 0.98);
        border-bottom: 1px solid rgba(255,255,255,0.06);
        position: relative;
        z-index: 1000;
    }

    .arcade-auth-card {
        background: transparent;
        border: none;
        box-shadow: none;
        padding: 0;
    }

    .arcade-auth-copy h2 {
        font-size: 0.95rem;
        margin-bottom: 4px;
    }

    .arcade-auth-copy p {
        font-size: 0.78rem;
        margin-bottom: 8px;
    }

    .arcade-auth-tabs {
        display: flex;
        width: 100%;
        margin-bottom: 8px;
    }

    .arcade-auth-tabs .contact-tab-btn {
        flex: 1;
        border-radius: 14px;
        padding: 8px;
        font-size: 0.82rem;
    }

    .arcade-auth-form {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
    }

    .arcade-auth-form .arcade-auth-submit {
        grid-column: span 2;
        width: 100%;
        padding: 12px;
        font-size: 0.85rem;
    }

    .arcade-auth-input {
        padding: 10px 12px;
        border-radius: 12px;
        font-size: 0.85rem;
    }

    .arcade-rows-container {
        flex: 1;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        padding: 10px 0 8px;
        min-height: 0;
        box-sizing: border-box;
    }

    .arcade-core-title {
        font-size: 0.72rem;
        color: var(--text-dim);
        text-transform: uppercase;
        letter-spacing: 1px;
        font-weight: 700;
        padding: 8px 14px 4px;
    }

    .arcade-horizontal-scroll {
        display: flex;
        gap: 8px;
        padding: 0 14px 12px;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .arcade-horizontal-scroll::-webkit-scrollbar { display: none; }

    .arcade-card {
        flex-shrink: 0;
        width: 110px;
        background: rgba(255,255,255,0.04);
        border: 1px solid rgba(255,255,255,0.08);
        border-radius: 16px;
        overflow: hidden;
        padding: 0;
        cursor: pointer;
        transition: transform 0.2s, border-color 0.2s;
    }

    .arcade-card:hover,
    .arcade-card.selected {
        transform: translateY(-2px);
        border-color: var(--gold);
    }

    .arcade-card-thumb {
        width: 100%;
        height: 72px;
        background: rgba(0,0,0,0.4);
    }

    .arcade-card-thumb img {
        width: 100%;
        height: 100%;
        object-fit: cover;
    }

    .arcade-card-title {
        padding: 6px 8px;
        font-size: 0.72rem;
        color: #fff;
        font-weight: 600;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* ---- PLAYER SHELL ---- */
    .arcade-player-shell {
        position: fixed;
        inset: 0;
        z-index: 200;
        background: #070c12;
        display: flex;
        flex-direction: column;
    }

    .arcade-player-header {
        flex-shrink: 0;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 12px 14px;
        background: rgba(10,17,24,0.98);
        border-bottom: 1px solid rgba(255,255,255,0.08);
    }

    .arcade-player-header h3 {
        font-size: 0.95rem;
        color: #fff;
    }

    .arcade-close-btn {
        padding: 8px 16px;
        font-size: 0.8rem;
        border-radius: 12px;
        background: rgba(255,255,255,0.08);
        color: #fff;
        border: 1px solid rgba(255,255,255,0.12);
        font-weight: 700;
    }

    .arcade-inline-iframe {
        flex: 1;
        border: none;
    }

    .call-header-info {
        padding: 20px 16px 12px;
    }

    .call-header-info h2 {
        font-size: 1.7rem;
    }

    .call-diagnostics-strip {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        scrollbar-width: none;
    }

    .call-diagnostics-strip::-webkit-scrollbar {
        display: none;
    }

    .call-diagnostic-pill {
        flex: 0 0 auto;
        font-size: 0.74rem;
    }

    .call-help-text {
        font-size: 0.84rem;
        text-align: left;
    }

    .pip-local-video {
        right: 14px;
        bottom: 104px;
        width: 88px;
        height: 126px;
        border-radius: 18px;
    }

    .call-actions-hud {
        gap: 10px;
        padding: 18px 12px calc(22px + env(safe-area-inset-bottom));
    }

    .hud-btn {
        width: 56px;
        height: 56px;
        font-size: 1.25rem;
    }

    .profile-grid-layout { grid-template-columns: 1fr; }
    .profile-settings-grid { grid-template-columns: 1fr; }
    .profile-signal-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .profile-two-col-grid { grid-template-columns: 1fr; }
    .profile-preview-meta { grid-template-columns: 1fr; }
    .profile-workspace { padding: 12px; gap: 14px; }
    .profile-hero-card { padding: 20px; border-radius: 24px; }
    .profile-hero-main { grid-template-columns: auto 1fr; gap: 16px; }
    .profile-avatar-big { width: 88px; height: 88px; border-radius: 22px; }
    .profile-name-edit { font-size: 1.6rem; }
    .profile-actions-inline { flex-direction: column; align-items: stretch; gap: 10px; }
    .profile-panel { padding: 18px; border-radius: 22px; }
    .profile-panel-header h2 { font-size: 1.2rem; }
    .settings-section { padding: 18px; border-radius: 18px; }

    /* ==============================
       METIS GAME MODAL - come giochi_mobile.php
       ============================== */
    @keyframes metisModalFadeIn {
        from { opacity: 0; }
        to { opacity: 1; }
    }

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

    #metis-game-modal-overlay {
        position: fixed;
        inset: 0;
        width: 100vw;
        height: 100svh;
        background: rgba(12, 18, 38, 0.94);
        z-index: 10000;
        display: flex;
        justify-content: center;
        align-items: center;
        padding: 0;
        animation: metisModalFadeIn 0.15s ease;
    }

    .metis-game-modal {
        width: 100vw;
        height: 100svh;
        max-height: 100svh;
        border: 3px solid;
        border-image: linear-gradient(90deg, #00eaff, #37ff8b, #f751ff, #00eaff) 1;
        background: #111328;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: stretch;
        padding: 0;
        margin: 0;
        position: relative;
        overflow: hidden;
        animation: metisSheetUp 0.22s cubic-bezier(.33, 1.2, .58, 1);
        border-radius: 0;
    }

    .metis-game-modal-close {
        position: absolute;
        top: 14px;
        right: 16px;
        background: none;
        color: #fff;
        font-size: 2.1em;
        border: none;
        z-index: 100;
        cursor: pointer;
        line-height: 1;
        padding: 0;
        transition: color 0.18s;
    }

    .metis-game-modal-close:hover {
        color: #37ff8b;
    }

    .metis-game-modal-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        z-index: 50;
        background: rgba(255,255,255,0.1);
        color: #fff;
        border: none;
        font-size: 1.8em;
        width: 44px;
        height: 60px;
        display: flex;
        align-items: center;
        justify-content: center;
        cursor: pointer;
        border-radius: 10px;
        transition: background 0.15s;
        padding: 0;
        line-height: 1;
    }

    .metis-game-modal-nav:active {
        background: rgba(255,255,255,0.2);
    }

    .metis-game-modal-nav.prev { left: 6px; }
    .metis-game-modal-nav.next { right: 6px; }

    .metis-game-modal-content {
        width: 100vw;
        height: 100svh;
        min-height: 0;
        box-sizing: border-box;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: space-between;
        padding: 7.5vh 0 0 0;
        padding-bottom: clamp(16px, 4vh, 32px);
        gap: 0.7em;
        overflow: hidden;
    }

    .metis-game-modal-title {
        color: #00eaff;
        font-size: 1.35em;
        font-weight: bold;
        margin: 1.4vh 0 0.15em 0;
        text-align: center;
        line-height: 1.2;
        max-width: 94vw;
        overflow: hidden;
        text-overflow: ellipsis;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        line-clamp: 2;
        -webkit-box-orient: vertical;
        white-space: normal;
        letter-spacing: 0.01em;
        padding-top: 0.5vh;
        padding-left: clamp(36px, 6vw, 48px);
        padding-right: clamp(36px, 6vw, 48px);
        min-height: calc(1.2em * 2);
        max-height: calc(1.2em * 2);
        text-shadow: 0 0 8px rgba(0, 234, 255, 0.4);
    }

    .metis-modal-card {
        width: 94vw;
        max-width: 370px;
        max-height: 370px;
        min-width: 150px;
        min-height: 150px;
        aspect-ratio: 1/1;
        display: flex;
        justify-content: center;
        align-items: center;
        margin: 0 auto 0.7em auto;
        background: none;
        box-shadow: none;
        border: none;
        padding: 0;
        flex-shrink: 0;
        position: relative;
        overflow: hidden;
        margin-bottom: clamp(12px, 2vh, 20px);
    }

    .metis-modal-card img,
    .metis-modal-card video {
        width: 100%;
        height: 100%;
        object-fit: contain;
        border-radius: 17px;
        background: #10102c;
        display: block;
    }

    .metis-game-description {
        color: #e0e0e0;
        font-size: 1.04em;
        line-height: 1.22;
        margin: 0 0 0.7em 0;
        text-align: center;
        font-weight: normal;
        height: calc(1.22em * 9);
        overflow-y: auto;
        overflow-x: hidden;
        padding: 0 1em;
        box-sizing: border-box;
        scrollbar-width: none;
    }

    .metis-game-description::-webkit-scrollbar { display: none; }

    .metis-game-modal-actions {
        display: flex;
        gap: clamp(8px, 2vw, 12px);
        align-items: center;
        justify-content: center;
        flex-wrap: wrap;
        row-gap: 10px;
        margin-top: auto;
        padding-top: clamp(6px, 1.4vh, 12px);
        padding-bottom: clamp(16px, 3vh, 28px);
    }

    .metis-round-green-btn {
        width: clamp(62px, 15vw, 74px);
        height: clamp(62px, 15vw, 74px);
        border-radius: 50%;
        background: radial-gradient(circle at 30% 30%, #4cffb5, #00a45a);
        box-shadow:
            inset -4px -4px 10px rgba(255, 255, 255, 0.25),
            inset 4px 4px 10px rgba(0, 0, 0, 0.35),
            0 6px 12px rgba(0, 0, 0, 0.5);
        border: 2px solid rgba(255, 255, 255, 0.2);
        cursor: pointer;
        display: grid;
        place-items: center;
        transition: transform 0.12s ease;
        color: #041b12;
        font-weight: 700;
        font-size: 0.85rem;
        letter-spacing: 0.06em;
    }

    .metis-round-green-btn:active {
        transform: translateY(2px);
    }

    .metis-round-green-btn span {
        font-family: 'Rajdhani', 'Segoe UI', sans-serif;
        font-weight: 700;
        display: block;
        width: 90%;
        text-align: center;
        line-height: 1.13;
        pointer-events: none;
    }

    /* ---- LANDSCAPE ---- */
    @media screen and (orientation: landscape) {
        #metis-game-modal-overlay,
        .metis-game-modal {
            width: 100vw;
            height: 100vh;
            overflow: hidden;
        }

        .metis-game-modal-content {
            display: flex;
            flex-direction: row;
            width: 100vw;
            height: 100vh;
            padding: 0;
            gap: 0;
            overflow: hidden;
            align-items: stretch;
        }

        .metis-game-modal-left {
            width: 54vw;
            max-width: 58vw;
            min-width: 0;
            display: flex;
            flex-direction: column;
            align-items: flex-start;
            justify-content: flex-start;
            padding: 3vh 1vw 3vh 2vw;
            box-sizing: border-box;
            gap: 0.3em;
        }

        .metis-game-modal-left .metis-game-modal-title {
            margin: 0 0 0.2em 0;
            font-size: 2em;
            text-align: left;
            width: 100%;
            max-width: 95%;
            line-height: 1.18;
            white-space: normal;
            padding-top: 0;
            padding-left: 0;
            padding-right: 0;
        }

        .metis-game-modal-left .metis-modal-card {
            width: 100%;
            max-width: 100%;
            min-width: 0;
            flex: 1 1 auto;
            margin: 0;
            aspect-ratio: 16/9;
        }

        .metis-game-modal-right {
            width: 46vw;
            min-width: 0;
            height: 100%;
            display: flex;
            flex-direction: column;
            justify-content: flex-start;
            align-items: flex-start;
            padding: 3vh 2vw 3vh 1vw;
            box-sizing: border-box;
            gap: 0.7em;
            overflow-y: auto;
        }

        .metis-game-modal-right .metis-game-description {
            margin: 0.1em 0 2em 0;
            line-height: 1.32;
            text-align: left;
            font-size: 1.09em;
            height: auto;
            max-height: none;
            padding: 0 0.8em;
        }

        .metis-game-modal-right .metis-game-modal-actions {
            margin-top: auto;
            justify-content: flex-start;
        }

        .metis-game-modal-nav { top: 50%; }
    }

    /* ---- SMALL PHONES ---- */
    @media (max-width: 480px) {
        .metis-modal-card {
            max-width: 210px;
            max-height: 210px;
            min-width: 100px;
            min-height: 100px;
        }

        .metis-round-green-btn {
            width: 65px;
            height: 65px;
            font-size: 1em;
        }

        .metis-game-modal-title {
            font-size: 1.20em;
        }
    }
#tab-home { font-size: 1.2rem; }

/* ===================== MUC / GROUP CHAT ===================== */
.muc-room-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-left: 1px solid var(--border);
}

.muc-messages-area {
    flex: 1;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.muc-msg {
    max-width: 80%;
    padding: 8px 12px;
    border-radius: 12px;
    font-size: 13px;
    line-height: 1.4;
}
.muc-msg-mine {
    align-self: flex-end;
    background: var(--gold);
    color: #000;
    border-bottom-right-radius: 4px;
}
.muc-msg-other {
    align-self: flex-start;
    background: rgba(255,255,255,0.08);
    color: #fff;
    border-bottom-left-radius: 4px;
}
.muc-msg-nick {
    display: block;
    font-size: 10px;
    font-weight: 700;
    opacity: 0.7;
    margin-bottom: 2px;
    text-transform: uppercase;
}
.muc-msg-text { word-break: break-word; }
.muc-msg-time {
    display: block;
    font-size: 9px;
    opacity: 0.5;
    margin-top: 2px;
    text-align: right;
}
.muc-empty { text-align: center; color: var(--text-dim); padding: 40px 20px; }
.muc-room-item .contact-avatar { background: linear-gradient(135deg, #9b59b6, #e67e22); }

/* ==========================================================================
   MOBILE & TABLET RE-ARCHITECTURE (Telegram Responsive Standard)
   ========================================================================== */
@media (max-width: 760px) {
    .app-container { flex-direction: column-reverse !important; width: 100vw; height: 100vh; }
    
    #view-home.active { 
        display: block !important; 
        width: 100vw !important; 
        height: calc(100vh - 60px) !important; 
        padding: 0 !important; 
        overflow-y: auto !important; 
    }
    
    .aura-dashboard { 
        display: flex !important; 
        flex-direction: column !important; 
        gap: 15px !important; 
        padding: 15px !important; 
        height: auto !important; 
    }
    
    .dash-hero-welcome, .dash-sys-stats, .tile-social, .tile-system, .tile-arcade {
        width: 100% !important;
        min-height: 180px !important;
        grid-area: auto !important;
    }
    
    .sidebar {
        width: 100% !important;
        height: 60px !important;
        border-right: none;
        border-top: 1px solid var(--border);
        flex-direction: row !important;
        padding: 0 10px !important;
        justify-content: space-around;
        background: #080808;
    }
    
    .sidebar-logo, .sidebar-top, .sidebar .nav-label { display: none !important; }
    .sidebar-nav { flex-direction: row !important; height: 60px !important; align-items: center !important; }
    .sidebar-nav button { margin-bottom: 0 !important; font-size: 22px !important; padding: 10px !important; }
    
    /* Mobile Chat Isolation */
    #view-chat.active { flex-direction: column !important; }
    .contacts-sidebar { width: 100% !important; min-width: 0 !important; position: absolute; inset: 0; z-index: 50; }
    .chat-main { width: 100% !important; position: absolute; inset: 0; z-index: 60; background: var(--bg); transform: translateX(100%); transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1); }
    .mobile-chat-open .chat-main { transform: translateX(0); }
    .mobile-chat-open .contacts-sidebar { opacity: 0.5; pointer-events: none; }
}

@media (min-width: 761px) and (max-width: 1100px) {
    .aura-dashboard { 
        grid-template-columns: 1fr 1fr !important; 
        grid-template-areas: "welcome welcome" "stats social" "identity arcade" !important; 
    }
}

/* ==========================================================================
   ARCADE CHAT SIDEBAR BANNER (Salagiochi Integration)
   ========================================================================== */
.arcade-chat-banner {
    padding: 15px;
    background: rgba(217, 161, 62, 0.05);
    border: 1px solid rgba(217, 161, 62, 0.1);
    border-radius: 12px;
    margin: 10px 15px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
    transition: all 0.3s cubic-bezier(0.19, 1, 0.22, 1);
    border-left: 3px solid var(--gold);
}

.arcade-chat-banner:hover {
    border-color: rgba(217, 161, 62, 0.4);
    background: rgba(217, 161, 62, 0.08);
    transform: translateY(-2px);
}

.arcade-banner-mini-form .banner-title {
    display: block;
    color: var(--gold);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
    text-transform: uppercase;
}

.arcade-banner-mini-form .banner-text {
    font-size: 11px;
    color: var(--text-dim);
    margin-bottom: 12px;
    line-height: 1.3;
}

#btn-chat-arcade-jump {
    text-shadow: 0 0 5px rgba(0,0,0,0.5);
    font-weight: 800;
}

/* ==========================================================================
   ADMIN VISUAL EDITOR (Premium HUD)
   ========================================================================== */
.admin-pod {
    position: fixed;
    top: 20px;
    right: 20px;
    width: 320px;
    background: rgba(10, 10, 10, 0.85);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
    z-index: 10000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: transform 0.3s cubic-bezier(0.19, 1, 0.22, 1), opacity 0.3s ease;
}

.admin-pod.active {
    display: flex !important;
}

.admin-pod.is-hidden {
    display: none !important;
}

.admin-pod.is-minimized {
    height: 50px;
}

.admin-pod-header {
    padding: 12px 16px;
    background: rgba(255, 255, 255, 0.05);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: move;
}

.admin-pod-header .header-main {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-pod-header .pod-title {
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold);
}

.admin-pod-body {
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-height: 80vh;
    overflow-y: auto;
}

.admin-target-details {
    margin-top: 10px;
    padding: 8px;
    background: rgba(0,0,0,0.3);
    border-radius: 6px;
    font-size: 11px;
}

.admin-target-details code {
    color: var(--gold-bright);
    font-family: monospace;
}

.admin-props-scroll {
    display: flex;
    flex-direction: column;
    gap: 15px;
}

.prop-group h4 {
    font-size: 11px;
    text-transform: uppercase;
    color: var(--text-dim);
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    padding-bottom: 5px;
}

.prop-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 8px;
}

.prop-row label {
    font-size: 12px;
    color: #ccc;
    flex: 1;
}

.prop-row input[type="range"] {
    flex: 2;
    height: 4px;
    accent-color: var(--gold);
}

.prop-row span {
    font-size: 11px;
    color: var(--gold);
    width: 50px;
    text-align: right;
}

.admin-footer textarea {
    width: 100%;
    height: 80px;
    background: rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: 8px;
    color: #cfc;
    font-family: 'Consolas', monospace;
    font-size: 11px;
    padding: 8px;
    resize: none;
    margin-top: 10px;
}

/* Selector Mode */
.admin-selector-mode * {
    cursor: crosshair !important;
}

.admin-hover-target {
    outline: 2px dashed var(--gold) !important;
    outline-offset: 2px !important;
    position: relative;
    z-index: 9999;
}

/* Pod Buttons */
.pod-min-btn:hover, .pod-close-btn:hover {
    color: var(--text);
}

/* =========================================
   METIS TOAST SYSTEM (Premium Notifications)
   ========================================= */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10001; /* Above Admin Panel */
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.metis-toast {
    min-width: 280px;
    max-width: 400px;
    padding: 16px 20px;
    background: rgba(15, 15, 15, 0.8);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    color: #fff;
    font-size: 13px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
    pointer-events: auto;
    display: flex;
    align-items: center;
    gap: 12px;
    animation: toast-in 0.4s cubic-bezier(0.19, 1, 0.22, 1) forwards;
    cursor: pointer;
}

.metis-toast.success { border-left: 4px solid #22c55e; }
.metis-toast.error { border-left: 4px solid #ef4444; }
.metis-toast.info { border-left: 4px solid var(--gold); }

.metis-toast.hiding {
    animation: toast-out 0.4s cubic-bezier(0.19, 1, 0.22, 1) forwards;
}

@keyframes toast-in {
    from { transform: translateX(100%) scale(0.9); opacity: 0; }
    to { transform: translateX(0) scale(1); opacity: 1; }
}

@keyframes toast-out {
    from { transform: translateX(0) scale(1); opacity: 1; }
    to { transform: translateX(50%) scale(0.9); opacity: 0; }
}
