/* ==================== RESET & BASE ==================== */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --sidebar-width: 260px;
    --bg-primary: #0d0d0d;
    --bg-secondary: #111111;
    --bg-tertiary: #1a1a1a;
    --bg-hover: #222222;
    --bg-active: #252525;
    --text-primary: #f5f5f5;
    --text-secondary: #a3a3a3;
    --text-muted: #6b6b6b;
    --accent: #7c3aed;
    --accent-hover: #6d28d9;
    --accent-glow: rgba(124, 58, 237, 0.25);
    --border-color: rgba(255, 255, 255, 0.07);
    --input-bg: #1a1a1a;
    --scrollbar-thumb: #333;
    --scrollbar-track: transparent;
    --shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
    --radius-sm: 10px;
    --radius-md: 14px;
    --radius-lg: 18px;
    --radius-xl: 24px;
    --transition: 0.2s ease;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    height: 100vh;
    height: 100dvh;
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #444; }

/* ==================== SIDEBAR (removed) ==================== */

/* ==================== SIMPLE MENU ==================== */
.menu-toggle-btn {
    position: absolute;
    left: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}

.menu-toggle-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.simple-menu {
    position: absolute;
    top: 52px;
    left: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    padding: 6px;
    min-width: 220px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
    z-index: 200;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-8px);
    transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s ease;
}

.simple-menu.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.simple-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    background: transparent;
    border: none;
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-family: inherit;
    cursor: pointer;
    transition: background var(--transition), color var(--transition);
    text-align: left;
}

.simple-menu-item:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.simple-menu-item i {
    font-size: 1rem;
    width: 20px;
    text-align: center;
    opacity: 0.7;
}

/* ==================== MAIN CONTENT ==================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-width: 0;
    position: relative;
    background: var(--bg-primary);
}

/* Top Bar */
.top-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 16px;
    min-height: 52px;
    border-bottom: 1px solid var(--border-color);
    background: var(--bg-primary);
    z-index: 10;
    position: relative;
}

.top-bar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.top-bar-logo {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.top-bar-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

/* ==================== CHAT AREA ==================== */
.chat-area {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(ellipse at 20% 0%, rgba(124, 58, 237, 0.04) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 100%, rgba(59, 130, 246, 0.03) 0%, transparent 50%),
        var(--bg-primary);
}

/* Welcome Screen */
.welcome-screen {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 24px;
    max-width: 720px;
    margin: 0 auto;
    width: 100%;
    gap: 20px;
}

.welcome-screen.hidden {
    display: none;
}

.welcome-logo {
    width: 72px;
    height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.3), 0 0 60px rgba(124, 58, 237, 0.1);
    animation: logoFloat 4s ease-in-out infinite;
}

@keyframes logoFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-6px); }
}

.welcome-screen h1 {
    font-size: 1.75rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: center;
    letter-spacing: -0.02em;
}

.welcome-subtitle {
    font-size: 0.9375rem;
    color: var(--text-muted);
    text-align: center;
    max-width: 480px;
    line-height: 1.6;
}

.suggestion-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-top: 12px;
}

.suggestion-pill {
    padding: 10px 24px;
    background: transparent;
    border: 1px solid rgba(124, 58, 237, 0.3);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.25s ease;
    font-family: inherit;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.suggestion-pill:hover {
    background: rgba(124, 58, 237, 0.12);
    border-color: rgba(124, 58, 237, 0.5);
    color: var(--text-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.15);
}

/* ==================== MESSAGES ==================== */
.messages-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 768px;
    margin: 0 auto;
    width: 100%;
    padding: 24px 24px;
    gap: 20px;
}

.messages-container.hidden {
    display: none;
}

.message {
    display: flex;
    gap: 12px;
    animation: fadeInUp 0.35s ease;
    max-width: 90%;
}

/* User message: right-aligned with avatar on right */
.message.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

/* Assistant message: left-aligned with avatar on left */
.message.assistant {
    align-self: flex-start;
}

@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.message-avatar {
    width: 34px;
    height: 34px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 700;
    flex-shrink: 0;
    margin-top: 2px;
}

/* Show avatar for user messages */
.message.user .message-avatar {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    color: white;
    font-size: 0.9rem;
}

.message.assistant .message-avatar {
    background: linear-gradient(135deg, #7c3aed, #a855f7);
    border: none;
    color: white;
    font-size: 0.85rem;
}

.message-content {
    min-width: 0;
}

.message-bubble {
    padding: 14px 20px;
    border-radius: 20px;
    font-size: 1rem;
    line-height: 1.7;
    word-wrap: break-word;
}

/* User bubble: solid purple, rounded with flat bottom-right */
.message.user .message-bubble {
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    border-bottom-right-radius: 6px;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.2);
}

/* Assistant bubble: dark with border, flat bottom-left */
.message.assistant .message-bubble {
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    color: var(--text-primary);
    border-bottom-left-radius: 6px;
}

/* Hide role label — not needed with bubble layout */
.message-role {
    display: none;
}

.message-text {
    font-size: 1rem;
    line-height: 1.75;
    word-wrap: break-word;
}

.message-text p {
    margin-bottom: 10px;
}

.message-text p:last-child {
    margin-bottom: 0;
}

.message-text code {
    background: rgba(124, 58, 237, 0.12);
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 0.85em;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #c4b5fd;
}

.message-text pre {
    background: #111;
    border-radius: var(--radius-sm);
    padding: 14px;
    overflow-x: auto;
    margin: 10px 0;
    border: 1px solid var(--border-color);
}

.message-text pre code {
    background: none;
    padding: 0;
    font-size: 0.8125rem;
    line-height: 1.6;
    color: #e2e8f0;
}

/* Clean formatted message elements */
.message-text .msg-img-wrap {
    margin: 12px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-color);
}

.message-text .msg-img-wrap img {
    width: 100%;
    display: block;
    border-radius: 10px;
}

.message-text .msg-link-btn {
    display: inline-block;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    padding: 10px 24px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    margin: 6px 0;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.message-text .msg-link-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(124, 58, 237, 0.4);
}

.message-text .msg-list {
    margin: 8px 0;
    padding-left: 20px;
}

.message-text .msg-list li {
    margin-bottom: 4px;
    line-height: 1.6;
}

.message-text strong {
    color: #fff;
    font-weight: 600;
}

.message-text em {
    color: var(--text-secondary);
    font-style: italic;
}

/* ==================== RICH CONTENT (Inline-styled HTML like haxgpt) ==================== */
.rich-content {
    font-size: 1rem !important;
    line-height: 1.8 !important;
    color: var(--text-primary);
    word-wrap: break-word;
}

.rich-content p {
    margin: 10px 0 !important;
    font-size: 1rem !important;
    line-height: 1.8 !important;
}

.rich-content p:first-child {
    margin-top: 0 !important;
}

.rich-content p:last-child {
    margin-bottom: 0 !important;
}

.rich-content br {
    display: block;
    content: '';
    margin: 6px 0;
}

.rich-content h3 {
    margin: 16px 0 8px;
    font-size: 1.1rem;
}

.rich-content h3:first-child {
    margin-top: 0;
}

.rich-content img {
    max-width: 100%;
    height: auto;
    display: block;
    margin: 12px 0;
}

.rich-content a {
    transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
    font-size: 0.9rem !important;
    padding: 12px 28px !important;
}

.rich-content div {
    margin: 14px 0 !important;
}

.rich-content a:hover {
    transform: translateY(-2px);
    opacity: 0.9;
}

.rich-content br {
    display: block;
    content: "";
    margin: 4px 0;
}

/* Message Actions */
.message-actions {
    display: flex;
    gap: 2px;
    margin-top: 6px;
    padding-left: 4px;
    opacity: 0;
    transition: opacity var(--transition);
}

.message:hover .message-actions {
    opacity: 1;
}

.action-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: background var(--transition), color var(--transition);
}

.action-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

/* Typing Indicator */
.typing-indicator {
    display: flex;
    gap: 4px;
    padding: 4px 0;
}

.typing-indicator span {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #7c3aed;
    animation: typing 1.4s infinite ease-in-out;
}

.typing-indicator span:nth-child(1) { animation-delay: 0s; }
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }

@keyframes typing {
    0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
    30% { transform: translateY(-6px); opacity: 1; }
}

/* ==================== INPUT AREA ==================== */
.input-area {
    padding: 0 24px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: transparent;
}

.input-wrapper {
    width: 100%;
    max-width: 768px;
    position: relative;
}

.autocomplete-suggestions {
    display: none;
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    margin-bottom: 6px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-md);
    overflow: hidden;
    z-index: 20;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.4);
}

.autocomplete-suggestions.active {
    display: block;
}

.autocomplete-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    cursor: pointer;
    transition: background 0.15s ease;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: inherit;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.autocomplete-item:hover {
    background: var(--bg-hover);
}

.autocomplete-item .ac-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
}

.autocomplete-item .ac-text {
    color: var(--text-secondary);
}

.autocomplete-item .ac-match {
    color: var(--text-primary);
    font-weight: 600;
}

.input-container {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    padding: 14px 18px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    transition: border-color var(--transition), box-shadow var(--transition);
}

.input-container:focus-within {
    border-color: rgba(124, 58, 237, 0.35);
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
}

.input-container textarea {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    outline: none;
    max-height: 200px;
    font-family: inherit;
    padding: 6px 0;
}

.input-container textarea::placeholder {
    color: var(--text-muted);
    line-height: 1.5;
}

.input-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.send-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    border: none;
    color: white;
    cursor: pointer;
    border-radius: 12px;
    transition: all var(--transition);
    box-shadow: 0 2px 8px rgba(124, 58, 237, 0.25);
}

.send-btn:hover:not(:disabled) {
    transform: scale(1.05);
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.35);
}

.send-btn:disabled {
    background: #222;
    cursor: not-allowed;
    opacity: 0.3;
    box-shadow: none;
}

.disclaimer {
    margin-top: 8px;
    font-size: 0.72rem;
    color: var(--text-muted);
    text-align: center;
}

/* ==================== PARTICLES ==================== */
#particlesCanvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

.main-content {
    z-index: 1;
    position: relative;
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
    .suggestion-pills {
        flex-wrap: wrap;
        justify-content: center;
    }

    .welcome-screen h1 {
        font-size: 1.375rem;
    }

    .messages-container {
        padding: 12px 16px;
    }

    .input-area { padding: 0 12px 14px; }

    .message {
        gap: 10px;
        padding: 0;
        max-width: 95%;
    }

    .message-bubble {
        padding: 14px 16px;
    }
}

@media (max-width: 480px) {
    .input-container {
        padding: 10px 12px;
        border-radius: var(--radius-md);
    }

    .message {
        max-width: 100%;
    }

    .message-text {
        font-size: 0.9375rem;
        line-height: 1.75;
    }

    .message-bubble {
        padding: 14px 14px;
        border-radius: 16px;
    }

    .rich-content p {
        font-size: 0.9375rem !important;
        line-height: 1.8 !important;
        margin: 8px 0 !important;
    }

    .rich-content a {
        padding: 12px 24px !important;
        font-size: 0.85rem !important;
        display: block !important;
        text-align: center;
    }
}

/* ==================== STOP BUTTON ==================== */
.stop-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-xl);
    color: var(--text-primary);
    font-size: 0.8125rem;
    font-weight: 500;
    cursor: pointer;
    transition: background var(--transition);
    font-family: inherit;
    margin-bottom: 8px;
}

.stop-btn:hover {
    background: var(--bg-hover);
}

.stop-btn svg {
    flex-shrink: 0;
}

/* ==================== INSTALLATION MODAL ==================== */
.install-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.install-modal-overlay.active {
    display: flex;
    animation: overlayIn 0.3s ease;
}

@keyframes overlayIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.install-modal {
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 24px;
    width: 100%;
    max-width: 460px;
    max-height: 92vh;
    overflow-y: auto;
    box-shadow:
        0 32px 80px rgba(0, 0, 0, 0.8),
        0 0 0 1px rgba(255, 255, 255, 0.04);
    animation: modalIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(40px) scale(0.92); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

/* scrollbar for modal */
.install-modal::-webkit-scrollbar { width: 4px; }
.install-modal::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 4px; }

/* Banner */
.modal-banner {
    width: 100%;
    height: 120px;
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    border-radius: 18px 18px 0 0;
    position: relative;
}

.modal-banner::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50px;
    background: linear-gradient(transparent, #141414);
}

/* Header */
.install-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 22px 24px 14px;
}

.modal-game-info {
    display: flex;
    align-items: center;
    gap: 14px;
}

.modal-game-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
    background: #1e1e1e;
    border: 1px solid rgba(255, 255, 255, 0.08);
}

.modal-game-meta { min-width: 0; }

.modal-game-title {
    font-size: 1rem;
    font-weight: 700;
    color: #f5f5f5;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.modal-game-sub {
    font-size: 0.72rem;
    color: #666;
    margin-top: 3px;
    font-family: 'Consolas', 'Monaco', monospace;
    letter-spacing: 0.3px;
}

.modal-close-btn {
    width: 30px;
    height: 30px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 8px;
    color: #666;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close-btn:hover {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.25);
    color: #ef4444;
}

/* Step Dots */
.modal-step-dots {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 24px 12px;
}

.modal-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-dot.active {
    background: #7c3aed;
    box-shadow: 0 0 12px rgba(124, 58, 237, 0.5);
    transform: scale(1.2);
}

.modal-dot.done {
    background: #22c55e;
    opacity: 0.7;
}

.modal-dot-line {
    width: 20px;
    height: 2px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 2px;
    transition: background 0.4s;
}

.modal-dot-line.done {
    background: rgba(34, 197, 94, 0.35);
}

/* Progress Bar */
.modal-progress-bar {
    height: 2px;
    background: rgba(255, 255, 255, 0.04);
    margin: 0 24px;
    border-radius: 4px;
    overflow: hidden;
}

.modal-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a855f7, #7c3aed);
    background-size: 200% 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    width: 0%;
    animation: progressShimmer 2s linear infinite;
}

@keyframes progressShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* Step Content */
.modal-step-content {
    padding: 24px;
    min-height: 240px;
}

.modal-step-enter {
    animation: stepFadeIn 0.4s ease;
}

@keyframes stepFadeIn {
    from { opacity: 0; transform: translateX(16px); }
    to { opacity: 1; transform: translateX(0); }
}

.modal-step-label {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    color: #a855f7;
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 14px;
    padding: 5px 12px;
    background: rgba(124, 58, 237, 0.08);
    border: 1px solid rgba(124, 58, 237, 0.15);
    border-radius: 6px;
}

.modal-step-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: #f5f5f5;
    margin-bottom: 8px;
    letter-spacing: -0.01em;
}

.modal-step-desc {
    font-size: 0.85rem;
    color: #999;
    line-height: 1.7;
    margin-bottom: 20px;
}

/* Connect step card */
.modal-connect-card {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 16px;
    padding: 24px;
    text-align: center;
}

.modal-connect-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(124, 58, 237, 0.08);
    border: 2px solid rgba(124, 58, 237, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 1.6rem;
    animation: connectPulse 2s ease-in-out infinite;
}

@keyframes connectPulse {
    0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(124, 58, 237, 0.2); }
    50% { transform: scale(1.05); box-shadow: 0 0 20px 4px rgba(124, 58, 237, 0.12); }
}

.modal-connect-server {
    font-size: 0.75rem;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #888;
    margin-top: 10px;
    padding: 6px 14px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 6px;
    display: inline-block;
}

.modal-connect-info {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin-top: 16px;
}

.modal-connect-stat {
    text-align: center;
}

.modal-connect-stat-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: #f5f5f5;
}

.modal-connect-stat-label {
    font-size: 0.65rem;
    color: #666;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

/* Status items */
.modal-status-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 4px;
}

.modal-status-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 13px 16px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 12px;
    font-size: 0.82rem;
    color: #555;
    transition: all 0.5s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(0);
}

.modal-status-item.active {
    border-color: rgba(124, 58, 237, 0.25);
    background: rgba(124, 58, 237, 0.04);
    color: #ddd;
    transform: translateX(4px);
}

.modal-status-item.done {
    border-color: rgba(34, 197, 94, 0.15);
    background: rgba(34, 197, 94, 0.03);
    color: #22c55e;
}

.modal-status-icon {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 0.7rem;
    background: rgba(255, 255, 255, 0.04);
    color: #555;
    transition: all 0.4s;
}

.modal-status-item.active .modal-status-icon {
    background: rgba(124, 58, 237, 0.12);
    color: #a855f7;
}

.modal-status-item.done .modal-status-icon {
    background: rgba(34, 197, 94, 0.15);
    color: #22c55e;
}

.modal-status-text {
    flex: 1;
    min-width: 0;
}

.modal-status-detail {
    font-size: 0.68rem;
    color: #444;
    margin-top: 2px;
    font-family: 'Consolas', 'Monaco', monospace;
    transition: color 0.4s;
}

.modal-status-item.active .modal-status-detail {
    color: #777;
}

.modal-status-item.done .modal-status-detail {
    color: rgba(34, 197, 94, 0.45);
}

/* Spinner */
.modal-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(124, 58, 237, 0.15);
    border-top-color: #a855f7;
    border-radius: 50%;
    animation: modalSpin 0.7s linear infinite;
}

@keyframes modalSpin {
    to { transform: rotate(360deg); }
}

/* Checkmark animation */
.modal-check-svg {
    width: 16px;
    height: 16px;
}

.modal-check-svg path {
    stroke-dasharray: 20;
    stroke-dashoffset: 20;
    animation: checkDraw 0.4s ease forwards;
}

@keyframes checkDraw {
    to { stroke-dashoffset: 0; }
}

/* Download section */
.modal-dl-section {
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.06);
    border-radius: 14px;
    padding: 20px;
}

.modal-dl-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}

.modal-dl-filename {
    font-size: 0.8rem;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #ccc;
}

.modal-dl-speed {
    font-size: 0.72rem;
    font-family: 'Consolas', 'Monaco', monospace;
    color: #22c55e;
}

.modal-dl-bar {
    height: 8px;
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    overflow: hidden;
    position: relative;
}

.modal-dl-fill {
    height: 100%;
    background: linear-gradient(90deg, #7c3aed, #a855f7);
    border-radius: 8px;
    width: 0%;
    transition: width 0.25s ease;
    position: relative;
}

.modal-dl-fill::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 40px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3));
    border-radius: 0 8px 8px 0;
}

.modal-dl-info {
    display: flex;
    justify-content: space-between;
    margin-top: 10px;
    font-size: 0.72rem;
    color: #777;
    font-family: 'Consolas', 'Monaco', monospace;
}

.modal-dl-percent {
    color: #ccc;
    font-weight: 600;
}

/* Captcha box */
.modal-captcha-box {
    background: transparent;
    border: none;
    border-radius: 16px;
    padding: 32px 24px;
    text-align: center;
    animation: captchaAppear 0.5s ease;
}

@keyframes captchaAppear {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

.modal-captcha-shield {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.08);
    border: 2px solid rgba(34, 197, 94, 0.25);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 24px;
    animation: shieldPulse 2s ease-in-out infinite;
}

@keyframes shieldPulse {
    0%, 100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.15); }
    50% { box-shadow: 0 0 20px 6px rgba(34, 197, 94, 0.1); }
}

.modal-captcha-title {
    font-size: 1.3rem;
    font-weight: 700;
    color: #f5f5f5;
    margin-bottom: 10px;
}

.modal-captcha-desc {
    font-size: 0.85rem;
    color: #999;
    line-height: 1.6;
    margin-bottom: 28px;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
}

.modal-captcha-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: #22c55e;
    color: #fff;
    padding: 16px 60px;
    border: none;
    border-radius: 12px;
    font-size: 0.95rem;
    font-weight: 800;
    letter-spacing: 1px;
    cursor: pointer;
    text-decoration: none;
    text-transform: uppercase;
    transition: all 0.2s ease;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.3);
    font-family: inherit;
    width: 100%;
    max-width: 320px;
}

.modal-captcha-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 30px rgba(34, 197, 94, 0.45);
    background: #16a34a;
}

/* Footer */
.modal-footer {
    padding: 0 24px 22px;
}

.modal-footer.hidden { display: none; }

.modal-action-btn {
    width: 100%;
    padding: 15px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    border: none;
    border-radius: 14px;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    letter-spacing: 0.3px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 24px rgba(124, 58, 237, 0.25);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}

.modal-action-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s;
}

.modal-action-btn:hover::before {
    left: 100%;
}

.modal-action-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 32px rgba(124, 58, 237, 0.4);
}

.modal-action-btn:disabled {
    background: #1e1e1e;
    color: #444;
    cursor: not-allowed;
    box-shadow: none;
    transform: none;
}

.modal-action-btn:disabled::before { display: none; }

/* ==================== CONFIRM DIALOG ==================== */
.confirm-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    z-index: 10001;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}

.confirm-overlay.active {
    display: flex;
}

.confirm-dialog {
    background: #1a1f2e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 28px 24px 20px;
    max-width: 320px;
    width: 90%;
    text-align: center;
    animation: captchaAppear 0.25s ease;
}

.confirm-icon {
    font-size: 1.6rem;
    color: #facc15;
    margin-bottom: 16px;
}

.confirm-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #f5f5f5;
    margin-bottom: 10px;
}

.confirm-desc {
    font-size: 0.82rem;
    color: #94a3b8;
    line-height: 1.6;
    margin-bottom: 24px;
}

.confirm-buttons {
    display: flex;
    gap: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    margin: 0 -24px -20px;
}

.confirm-btn {
    flex: 1;
    padding: 14px;
    border: none;
    background: transparent;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s ease;
}

.confirm-cancel {
    color: #94a3b8;
    border-radius: 0 0 0 16px;
    border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.confirm-cancel:hover {
    background: rgba(255, 255, 255, 0.05);
}

.confirm-inject {
    color: #60a5fa;
    border-radius: 0 0 16px 0;
}

.confirm-inject:hover {
    background: rgba(96, 165, 250, 0.1);
}

/* Responsive */
@media (max-width: 480px) {
    .install-modal {
        max-width: 100%;
        border-radius: 18px;
        max-height: 95vh;
    }

    .modal-step-content { padding: 20px 18px; }
    .install-modal-header { padding: 16px 18px 10px; }
    .modal-footer { padding: 0 18px 18px; }
    .modal-step-dots { padding: 6px 18px 10px; }
}

/* ==================== SETTINGS MODAL ==================== */
.settings-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 1100;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.settings-overlay.active {
    display: flex;
    animation: overlayIn 0.25s ease;
}

.settings-modal {
    background: #141414;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    width: 100%;
    max-width: 420px;
    animation: modalIn 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 12px;
}

.settings-header h3 {
    font-size: 1.05rem;
    font-weight: 700;
    color: #f5f5f5;
}

.settings-body {
    padding: 8px 24px 20px;
}

.settings-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 8px;
}

.settings-input-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.settings-input {
    width: 100%;
    padding: 12px 16px;
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    color: #f5f5f5;
    font-size: 0.875rem;
    font-family: 'Consolas', 'Monaco', monospace;
    outline: none;
    transition: border-color 0.2s;
}

.settings-input:focus {
    border-color: rgba(124, 58, 237, 0.4);
}

select.settings-input {
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23999' viewBox='0 0 24 24'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

select.settings-input option {
    background: #1a1a1a;
    color: #f5f5f5;
}

.settings-eye-btn {
    position: absolute;
    right: 10px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    transition: color 0.2s;
}

.settings-eye-btn:hover {
    color: #aaa;
}

.settings-hint {
    font-size: 0.72rem;
    color: #555;
    margin-top: 8px;
    line-height: 1.5;
}

.settings-footer {
    padding: 0 24px 20px;
}

.settings-save-btn {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #7c3aed, #6d28d9);
    color: #fff;
    border: none;
    border-radius: 12px;
    font-size: 0.88rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    box-shadow: 0 4px 16px rgba(124, 58, 237, 0.2);
}

.settings-save-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 24px rgba(124, 58, 237, 0.35);
}

@media (max-width: 480px) {
    .settings-modal {
        max-width: 100%;
        border-radius: 16px;
    }
}
