/* === Reset & Base === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #0b0d11;
    --bg-gradient: linear-gradient(135deg, #0b0d11 0%, #111827 50%, #0f172a 100%);
    --surface: rgba(17, 24, 39, 0.85);
    --surface-solid: #111827;
    --surface-2: rgba(30, 41, 59, 0.7);
    --surface-3: rgba(51, 65, 85, 0.5);
    --border: rgba(71, 85, 105, 0.4);
    --border-focus: rgba(99, 102, 241, 0.6);
    --text: #e2e8f0;
    --text-dim: #94a3b8;
    --text-muted: #64748b;
    --primary: #6366f1;
    --primary-hover: #818cf8;
    --primary-glow: rgba(99, 102, 241, 0.25);
    --primary-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --primary-gradient-hover: linear-gradient(135deg, #818cf8, #a78bfa);
    --primary-shadow: rgba(99, 102, 241, 0.3);
    --primary-shadow-hover: rgba(99, 102, 241, 0.4);
    --danger: #ef4444;
    --danger-hover: #f87171;
    --success: #10b981;
    --warning: #f59e0b;
    --msg-local: linear-gradient(135deg, #4338ca, #6366f1);
    --msg-remote: rgba(30, 41, 59, 0.9);
    --font: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
    --mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 20px;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.4);
    --glass-bg: rgba(17, 24, 39, 0.6);
    --glass-border: rgba(148, 163, 184, 0.1);
    --toggle-bg: rgba(71, 85, 105, 0.4);
    --toggle-hover: rgba(100, 116, 139, 0.5);
    --watermark-color: rgba(255, 255, 255, 0.025);
    --watermark-msg: rgba(255, 255, 255, 0.02);
    --input-bg: rgba(15, 23, 42, 0.5);
    --mnemonic-bg: rgba(15, 23, 42, 0.6);
    --msg-time-color: rgba(255, 255, 255, 0.5);
    --bg-anim-1: rgba(99, 102, 241, 0.08);
    --bg-anim-2: rgba(139, 92, 246, 0.06);
    --bg-anim-3: rgba(59, 130, 246, 0.05);
    --landing-title-from: #e2e8f0;
    --landing-title-to: #94a3b8;
}

/* === Light Theme === */
body.light-theme {
    --bg: #f8fafc;
    --bg-gradient: linear-gradient(135deg, #f8fafc 0%, #eef2ff 50%, #f1f5f9 100%);
    --surface: rgba(255, 255, 255, 0.9);
    --surface-solid: #ffffff;
    --surface-2: rgba(241, 245, 249, 0.9);
    --surface-3: rgba(226, 232, 240, 0.7);
    --border: rgba(203, 213, 225, 0.6);
    --border-focus: rgba(99, 102, 241, 0.5);
    --text: #1e293b;
    --text-dim: #475569;
    --text-muted: #94a3b8;
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --primary-glow: rgba(99, 102, 241, 0.15);
    --primary-gradient: linear-gradient(135deg, #6366f1, #8b5cf6);
    --primary-gradient-hover: linear-gradient(135deg, #818cf8, #a78bfa);
    --primary-shadow: rgba(99, 102, 241, 0.3);
    --primary-shadow-hover: rgba(99, 102, 241, 0.4);
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --success: #10b981;
    --warning: #d97706;
    --msg-local: linear-gradient(135deg, #6366f1, #8b5cf6);
    --msg-remote: #f1f5f9;
    --shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, 0.1);
    --glass-bg: rgba(255, 255, 255, 0.7);
    --glass-border: rgba(203, 213, 225, 0.4);
    --toggle-bg: rgba(203, 213, 225, 0.5);
    --toggle-hover: rgba(148, 163, 184, 0.4);
    --watermark-color: rgba(0, 0, 0, 0.03);
    --watermark-msg: rgba(0, 0, 0, 0.025);
    --input-bg: rgba(241, 245, 249, 0.8);
    --mnemonic-bg: rgba(241, 245, 249, 0.9);
    --msg-time-color: rgba(0, 0, 0, 0.35);
    --bg-anim-1: rgba(99, 102, 241, 0.05);
    --bg-anim-2: rgba(139, 92, 246, 0.04);
    --bg-anim-3: rgba(59, 130, 246, 0.03);
    --landing-title-from: #1e293b;
    --landing-title-to: #475569;
}

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    background-image: var(--bg-gradient);
    color: var(--text);
    overflow: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* === Animated Background === */
body::before {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background:
        radial-gradient(ellipse at 20% 50%, var(--bg-anim-1) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 20%, var(--bg-anim-2) 0%, transparent 50%),
        radial-gradient(ellipse at 40% 80%, var(--bg-anim-3) 0%, transparent 50%);
    animation: bgShift 20s ease-in-out infinite alternate;
    pointer-events: none;
    z-index: 0;
}

@keyframes bgShift {
    0% { transform: translate(0, 0) rotate(0deg); }
    100% { transform: translate(-5%, -3%) rotate(2deg); }
}

/* === Developer Tools Warning === */
.devtools-warning {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, #dc2626, #ef4444);
    color: #fff;
    text-align: center;
    padding: 8px 16px;
    font-size: 13px;
    font-weight: 600;
    z-index: 10000;
    letter-spacing: 0.5px;
    backdrop-filter: blur(8px);
}

/* === Screens === */
.screen {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    position: relative;
    z-index: 1;
}

/* === Landing === */
.landing-container {
    text-align: center;
    padding: 48px 40px;
    max-width: 480px;
    width: 90%;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.6s ease-out;
}

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

.landing-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 88px;
    height: 88px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary-glow), var(--primary-glow));
    border: 1px solid var(--primary-glow);
    margin-bottom: 24px;
    color: var(--primary);
    animation: iconPulse 3s ease-in-out infinite;
}

@keyframes iconPulse {
    0%, 100% { box-shadow: 0 0 0 0 var(--primary-glow); }
    50% { box-shadow: 0 0 0 12px transparent; }
}

.landing-title {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 8px;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, var(--landing-title-from), var(--landing-title-to));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-subtitle {
    color: var(--text-dim);
    margin-bottom: 20px;
    font-size: 0.9rem;
    line-height: 1.5;
}

.landing-features {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 32px;
}

.feature-tag {
    padding: 4px 12px;
    background: var(--primary-glow);
    border: 1px solid var(--primary-glow);
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--primary-hover);
    font-weight: 500;
    letter-spacing: 0.3px;
}

.landing-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

/* === Buttons === */
.btn {
    padding: 12px 28px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font);
    position: relative;
    overflow: hidden;
}

.btn:hover {
    transform: translateY(-1px);
}

.btn:active {
    transform: translateY(0);
    scale: 0.98;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    box-shadow: 0 2px 12px var(--primary-shadow);
}

.btn-primary:hover {
    background: var(--primary-gradient-hover);
    box-shadow: 0 4px 20px var(--primary-shadow-hover);
}

.btn-secondary {
    background: var(--surface-2);
    color: var(--text);
    border: 1px solid var(--border);
    backdrop-filter: blur(8px);
}

.btn-secondary:hover {
    background: var(--surface-3);
    border-color: var(--text-muted);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.15);
    color: #f87171;
    border: 1px solid rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
    background: rgba(239, 68, 68, 0.25);
    border-color: rgba(239, 68, 68, 0.5);
}

.btn-text {
    background: none;
    color: var(--text-dim);
    padding: 8px 16px;
    font-size: 0.85rem;
}

.btn-text:hover {
    color: var(--text);
    background: none;
    transform: none;
}

.btn-small {
    padding: 6px 14px;
    font-size: 0.8rem;
}

/* === Screen Icons === */
.screen-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--primary-glow);
    border: 1px solid var(--primary-glow);
    margin-bottom: 20px;
    color: var(--primary);
}

/* === Create Screen === */
.create-container, .join-container {
    max-width: 520px;
    width: 90%;
    text-align: center;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 40px 36px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease-out;
    position: relative;
}

.create-container h2, .join-container h2 {
    margin-bottom: 16px;
    font-size: 1.4rem;
    font-weight: 700;
}

.room-id-display {
    margin-bottom: 16px;
    font-family: var(--mono);
    font-size: 1rem;
    color: var(--primary-hover);
    background: var(--primary-glow);
    padding: 8px 16px;
    border-radius: var(--radius-sm);
    display: inline-block;
}

#created-join-code {
    font-family: var(--mono);
    letter-spacing: 4px;
    font-size: 1.3em;
}

.security-warning {
    background: rgba(245, 158, 11, 0.08);
    border: 1px solid rgba(245, 158, 11, 0.2);
    border-radius: var(--radius-sm);
    padding: 12px 16px;
    margin-bottom: 20px;
    font-size: 0.85rem;
    color: var(--warning);
    line-height: 1.5;
}

.mnemonic-display {
    background: var(--mnemonic-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
    font-family: var(--mono);
    font-size: 0.85rem;
    line-height: 2;
    word-spacing: 4px;
    user-select: text;
    position: relative;
    overflow: hidden;
    text-align: left;
}

.mnemonic-display::after {
    content: 'CONFIDENTIAL';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-25deg);
    font-size: 3rem;
    color: var(--watermark-color);
    font-weight: 800;
    pointer-events: none;
    white-space: nowrap;
    letter-spacing: 8px;
}

.mnemonic-timer {
    color: var(--text-muted);
    font-size: 0.8rem;
    margin-bottom: 20px;
}

.create-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: center;
}

/* === Join Screen === */
.input-group {
    margin-bottom: 16px;
    text-align: left;
}

.input-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.8rem;
    color: var(--text-dim);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.input-group input,
.input-group textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-family: var(--mono);
    font-size: 0.9rem;
    outline: none;
    transition: all 0.2s ease;
}

.input-group input:focus,
.input-group textarea:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
}

.join-container .btn-primary {
    width: 100%;
    margin-top: 8px;
    margin-bottom: 8px;
}

/* === Connecting Screen === */
.connecting-container {
    text-align: center;
    background: var(--glass-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    animation: fadeInUp 0.5s ease-out;
}

.connecting-title {
    font-size: 1.1rem;
    font-weight: 600;
    margin-bottom: 8px;
}

.spinner {
    width: 44px;
    height: 44px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 24px;
}

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

.connection-status {
    color: var(--text-dim);
    font-size: 0.85rem;
}

/* === Chat Screen === */
#chat-screen {
    flex-direction: column;
    align-items: stretch;
    justify-content: stretch;
    background: var(--bg);
}

.chat-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 24px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--glass-border);
    z-index: 10;
}

.chat-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.chat-lock-icon {
    color: var(--success);
    flex-shrink: 0;
}

.chat-title {
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.3px;
}

.messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    position: relative;
}

.message {
    max-width: 72%;
    padding: 12px 16px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.55;
    position: relative;
    overflow: hidden;
    word-break: break-word;
    animation: msgFadeIn 0.3s ease-out;
}

@keyframes msgFadeIn {
    from {
        opacity: 0;
        transform: translateY(8px) scale(0.97);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message::after {
    content: 'CONFIDENTIAL';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) rotate(-20deg);
    font-size: 0.85rem;
    color: var(--watermark-msg);
    font-weight: 800;
    pointer-events: none;
    white-space: nowrap;
    letter-spacing: 4px;
}

.message.local {
    align-self: flex-end;
    background: var(--msg-local);
    color: #fff;
    border-bottom-right-radius: 4px;
    box-shadow: 0 2px 8px var(--primary-shadow);
}

.message.remote {
    align-self: flex-start;
    background: var(--msg-remote);
    border: 1px solid var(--border);
    border-bottom-left-radius: 4px;
}

.message .msg-text {
    user-select: text;
}

.message .msg-time {
    font-size: 0.65rem;
    color: var(--msg-time-color);
    text-align: right;
}

.message.remote .msg-time {
    color: var(--text-muted);
}

.message .msg-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 6px;
}

.message .msg-countdown {
    font-size: 0.6rem;
    font-family: var(--mono);
    color: var(--text-muted);
    opacity: 0.7;
    min-width: 28px;
    text-align: right;
}

.message .msg-countdown.countdown-urgent {
    color: var(--danger);
    opacity: 1;
    animation: countdownPulse 1s ease-in-out infinite;
}

@keyframes countdownPulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.4; }
}

.message.msg-burn {
    animation: burnAway 0.4s ease-in forwards;
}

@keyframes burnAway {
    0% { opacity: 1; transform: scale(1); filter: brightness(1); }
    40% { opacity: 0.8; transform: scale(1.02); filter: brightness(1.8); }
    100% { opacity: 0; transform: scale(0.8); filter: brightness(3) blur(4px); }
}

/* === Particle System === */
.particle {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    z-index: 50;
    will-change: transform, opacity;
}

@keyframes particleBurst {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 1;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(0);
        opacity: 0;
    }
}

.message.system {
    align-self: center;
    background: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-style: italic;
    max-width: 90%;
    padding: 8px 0;
    text-align: center;
}

.message.system::after {
    display: none;
}

.message.msg-blocked {
    border: 1px dashed var(--danger) !important;
    background: rgba(239, 68, 68, 0.08) !important;
    color: var(--danger) !important;
}

.message.msg-blocked .msg-text {
    font-style: italic;
    opacity: 0.85;
}

.message.msg-blocked .msg-time {
    color: var(--danger) !important;
    opacity: 0.5;
}

.message.msg-blocked .msg-countdown {
    color: var(--danger) !important;
}

/* === Input Area === */
.input-area {
    display: flex;
    padding: 16px 24px;
    gap: 12px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--glass-border);
    align-items: center;
}

.input-area input {
    flex: 1;
    padding: 12px 18px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 0.9rem;
    outline: none;
    font-family: var(--font);
    transition: all 0.2s ease;
}

.input-area input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 3px var(--primary-glow);
}

.input-area input::placeholder {
    color: var(--text-muted);
}

.btn-send {
    width: 46px;
    height: 46px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
    box-shadow: 0 2px 12px var(--primary-shadow);
}

.btn-send:hover {
    background: var(--primary-gradient-hover);
    box-shadow: 0 4px 20px var(--primary-shadow-hover);
    transform: scale(1.05);
}

.btn-send:active {
    transform: scale(0.95);
}

/* === Scrollbar === */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* === Responsive === */
@media (max-width: 600px) {
    .landing-container,
    .create-container,
    .join-container,
    .connecting-container {
        padding: 32px 24px;
        border-radius: var(--radius);
    }

    .landing-title {
        font-size: 1.6rem;
    }

    .landing-buttons {
        flex-direction: column;
    }

    .landing-features {
        gap: 6px;
    }

    .feature-tag {
        font-size: 0.7rem;
        padding: 3px 10px;
    }

    .message {
        max-width: 88%;
    }

    .messages {
        padding: 16px;
    }

    .input-area {
        padding: 12px 16px;
    }

    .chat-header {
        padding: 12px 16px;
    }

    .create-actions {
        flex-direction: column;
    }

    .create-actions .btn {
        width: 100%;
    }
}

/* === Selection === */
::selection {
    background: var(--primary-glow);
    color: #fff;
}

/* === About Button === */
.btn-about {
    position: absolute;
    bottom: 20px;
    right: 20px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 10;
}

.btn-about:hover {
    background: var(--surface-3);
    color: var(--text);
    transform: scale(1.05);
}

/* === Modal === */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    animation: modalFadeIn 0.25s ease-out;
}

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

.modal-content {
    background: var(--surface-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 520px;
    max-height: 80vh;
    overflow-y: auto;
    box-shadow: var(--shadow-lg);
    animation: modalSlideUp 0.3s ease-out;
}

@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(0.96); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-header h3 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: none;
    color: var(--text-muted);
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
}

.modal-close:hover {
    background: var(--surface-3);
    color: var(--text);
}

.modal-body {
    padding: 16px 24px 24px;
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-dim);
}

.modal-body h4 {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    margin: 16px 0 8px;
}

.modal-body h4:first-child {
    margin-top: 0;
}

.modal-body ul,
.modal-body ol {
    padding-left: 20px;
    margin: 0;
}

.modal-body li {
    margin-bottom: 6px;
}

.modal-body li strong {
    color: var(--text);
}

.modal-body .risk-section li {
    color: var(--warning);
}

.modal-body .risk-section li strong {
    color: var(--danger);
}

/* === Threat Modals === */
.modal-threat {
    max-width: 440px;
    border-color: rgba(239, 68, 68, 0.4);
}

.modal-threat .threat-title {
    color: var(--danger);
    font-size: 1.15rem;
}

.modal-threat .threat-msg {
    font-size: 0.88rem;
    line-height: 1.7;
    color: var(--text-dim);
    margin: 0;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    padding: 0 24px 24px;
}

.modal-actions .btn {
    flex: 1;
    max-width: 180px;
}

/* === Theme Toggle === */
.theme-toggle {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 100;
}

.theme-toggle:hover {
    background: var(--surface-3);
    color: var(--text);
    transform: scale(1.05);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
    width: 20px;
    height: 20px;
    position: absolute;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.theme-toggle .icon-sun {
    opacity: 0;
    transform: rotate(-90deg) scale(0.5);
}

.theme-toggle .icon-moon {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

body.light-theme .theme-toggle .icon-sun {
    opacity: 1;
    transform: rotate(0deg) scale(1);
}

body.light-theme .theme-toggle .icon-moon {
    opacity: 0;
    transform: rotate(90deg) scale(0.5);
}

.chat-header .theme-toggle {
    position: relative;
    top: auto;
    right: auto;
    width: 34px;
    height: 34px;
}

.chat-header-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* === Color Theme Button === */
.color-theme-btn {
    position: absolute;
    top: 16px;
    right: 64px;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 100;
}

.color-theme-btn:hover {
    background: var(--surface-3);
    color: var(--text);
    transform: scale(1.05);
}

.color-theme-btn .color-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: var(--primary);
    border: 2px solid var(--surface-solid);
    box-shadow: 0 0 0 1px var(--border);
}

.chat-header .color-theme-btn {
    position: relative;
    top: auto;
    right: auto;
    width: 34px;
    height: 34px;
}

/* === Color Theme: Emerald === */
body.theme-emerald {
    --bg: #0a0f0d;
    --bg-gradient: linear-gradient(135deg, #0a0f0d 0%, #0f1a17 50%, #0d1512 100%);
    --surface: rgba(13, 21, 18, 0.85);
    --surface-solid: #0f1a17;
    --surface-2: rgba(15, 26, 23, 0.7);
    --surface-3: rgba(30, 50, 44, 0.5);
    --border: rgba(52, 211, 153, 0.12);
    --border-focus: rgba(16, 185, 129, 0.5);
    --text: #ecfdf5;
    --text-dim: #6ee7b7;
    --text-muted: #34d399;
    --primary: #10b981;
    --primary-hover: #34d399;
    --primary-glow: rgba(16, 185, 129, 0.2);
    --primary-gradient: linear-gradient(135deg, #059669, #10b981);
    --primary-gradient-hover: linear-gradient(135deg, #34d399, #6ee7b7);
    --primary-shadow: rgba(16, 185, 129, 0.3);
    --primary-shadow-hover: rgba(16, 185, 129, 0.4);
    --danger: #f43f5e;
    --danger-hover: #fb7185;
    --success: #22c55e;
    --warning: #f59e0b;
    --msg-local: linear-gradient(135deg, #047857, #10b981);
    --msg-remote: rgba(15, 26, 23, 0.9);
    --glass-bg: rgba(13, 21, 18, 0.6);
    --glass-border: rgba(52, 211, 153, 0.08);
    --toggle-bg: rgba(52, 211, 153, 0.1);
    --toggle-hover: rgba(52, 211, 153, 0.15);
    --input-bg: rgba(10, 15, 13, 0.5);
    --mnemonic-bg: rgba(10, 15, 13, 0.6);
    --bg-anim-1: rgba(16, 185, 129, 0.06);
    --bg-anim-2: rgba(52, 211, 153, 0.04);
    --bg-anim-3: rgba(6, 182, 212, 0.04);
    --landing-title-from: #ecfdf5;
    --landing-title-to: #6ee7b7;
}

body.theme-emerald.light-theme {
    --bg: #f0fdf4;
    --bg-gradient: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 50%, #ecfdf5 100%);
    --surface: rgba(255, 255, 255, 0.9);
    --surface-solid: #ffffff;
    --surface-2: rgba(220, 252, 231, 0.9);
    --surface-3: rgba(187, 247, 208, 0.7);
    --border: rgba(16, 185, 129, 0.2);
    --border-focus: rgba(16, 185, 129, 0.5);
    --text: #14532d;
    --text-dim: #15803d;
    --text-muted: #4ade80;
    --primary: #059669;
    --primary-hover: #047857;
    --primary-glow: rgba(16, 185, 129, 0.15);
    --primary-gradient: linear-gradient(135deg, #059669, #34d399);
    --primary-gradient-hover: linear-gradient(135deg, #34d399, #6ee7b7);
    --primary-shadow: rgba(16, 185, 129, 0.3);
    --primary-shadow-hover: rgba(16, 185, 129, 0.4);
    --danger: #e11d48;
    --danger-hover: #be123c;
    --success: #16a34a;
    --warning: #d97706;
    --msg-local: linear-gradient(135deg, #059669, #34d399);
    --msg-remote: #dcfce7;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(16, 185, 129, 0.15);
    --toggle-bg: rgba(16, 185, 129, 0.1);
    --toggle-hover: rgba(16, 185, 129, 0.15);
    --input-bg: rgba(240, 253, 244, 0.8);
    --mnemonic-bg: rgba(240, 253, 244, 0.9);
    --bg-anim-1: rgba(16, 185, 129, 0.04);
    --bg-anim-2: rgba(52, 211, 153, 0.03);
    --bg-anim-3: rgba(6, 182, 212, 0.02);
    --landing-title-from: #14532d;
    --landing-title-to: #166534;
}

/* === Color Theme: Slate === */
body.theme-slate {
    --bg: #0c0c0f;
    --bg-gradient: linear-gradient(135deg, #0c0c0f 0%, #12121a 50%, #0f0f15 100%);
    --surface: rgba(18, 18, 26, 0.85);
    --surface-solid: #12121a;
    --surface-2: rgba(30, 30, 42, 0.7);
    --surface-3: rgba(51, 51, 65, 0.5);
    --border: rgba(100, 116, 139, 0.15);
    --border-focus: rgba(148, 163, 184, 0.4);
    --text: #f1f5f9;
    --text-dim: #94a3b8;
    --text-muted: #64748b;
    --primary: #64748b;
    --primary-hover: #94a3b8;
    --primary-glow: rgba(100, 116, 139, 0.2);
    --primary-gradient: linear-gradient(135deg, #475569, #64748b);
    --primary-gradient-hover: linear-gradient(135deg, #64748b, #94a3b8);
    --primary-shadow: rgba(100, 116, 139, 0.25);
    --primary-shadow-hover: rgba(100, 116, 139, 0.35);
    --danger: #f43f5e;
    --danger-hover: #fb7185;
    --success: #22c55e;
    --warning: #f59e0b;
    --msg-local: linear-gradient(135deg, #334155, #475569);
    --msg-remote: rgba(18, 18, 26, 0.9);
    --glass-bg: rgba(18, 18, 26, 0.6);
    --glass-border: rgba(148, 163, 184, 0.06);
    --toggle-bg: rgba(100, 116, 139, 0.15);
    --toggle-hover: rgba(100, 116, 139, 0.25);
    --input-bg: rgba(12, 12, 15, 0.5);
    --mnemonic-bg: rgba(12, 12, 15, 0.6);
    --bg-anim-1: rgba(100, 116, 139, 0.05);
    --bg-anim-2: rgba(148, 163, 184, 0.04);
    --bg-anim-3: rgba(71, 85, 105, 0.04);
    --landing-title-from: #f1f5f9;
    --landing-title-to: #94a3b8;
}

body.theme-slate.light-theme {
    --bg: #f8f9fa;
    --bg-gradient: linear-gradient(135deg, #f8f9fa 0%, #f1f3f5 50%, #e9ecef 100%);
    --surface: rgba(255, 255, 255, 0.9);
    --surface-solid: #ffffff;
    --surface-2: rgba(233, 236, 239, 0.9);
    --surface-3: rgba(222, 226, 230, 0.7);
    --border: rgba(203, 213, 225, 0.5);
    --border-focus: rgba(108, 117, 125, 0.5);
    --text: #212529;
    --text-dim: #495057;
    --text-muted: #adb5bd;
    --primary: #495057;
    --primary-hover: #343a40;
    --primary-glow: rgba(108, 117, 125, 0.15);
    --primary-gradient: linear-gradient(135deg, #495057, #6c757d);
    --primary-gradient-hover: linear-gradient(135deg, #6c757d, #adb5bd);
    --primary-shadow: rgba(108, 117, 125, 0.25);
    --primary-shadow-hover: rgba(108, 117, 125, 0.35);
    --danger: #dc3545;
    --danger-hover: #bb2d3b;
    --success: #198754;
    --warning: #d97706;
    --msg-local: linear-gradient(135deg, #495057, #6c757d);
    --msg-remote: #e9ecef;
    --glass-bg: rgba(255, 255, 255, 0.8);
    --glass-border: rgba(203, 213, 225, 0.4);
    --toggle-bg: rgba(203, 213, 225, 0.5);
    --toggle-hover: rgba(148, 163, 184, 0.4);
    --input-bg: rgba(248, 249, 250, 0.8);
    --mnemonic-bg: rgba(248, 249, 250, 0.9);
    --bg-anim-1: rgba(108, 117, 125, 0.04);
    --bg-anim-2: rgba(100, 116, 139, 0.03);
    --bg-anim-3: rgba(71, 85, 105, 0.03);
    --landing-title-from: #212529;
    --landing-title-to: #6c757d;
}

/* === Color Theme: Amber === */
body.theme-amber {
    --bg: #0f0d0a;
    --bg-gradient: linear-gradient(135deg, #0f0d0a 0%, #1a1612 50%, #14110d 100%);
    --surface: rgba(26, 22, 18, 0.85);
    --surface-solid: #1a1612;
    --surface-2: rgba(42, 36, 28, 0.7);
    --surface-3: rgba(65, 55, 42, 0.5);
    --border: rgba(251, 191, 36, 0.12);
    --border-focus: rgba(245, 158, 11, 0.5);
    --text: #fef3c7;
    --text-dim: #d97706;
    --text-muted: #92400e;
    --primary: #f59e0b;
    --primary-hover: #fbbf24;
    --primary-glow: rgba(245, 158, 11, 0.2);
    --primary-gradient: linear-gradient(135deg, #d97706, #f59e0b);
    --primary-gradient-hover: linear-gradient(135deg, #fbbf24, #fcd34d);
    --primary-shadow: rgba(245, 158, 11, 0.3);
    --primary-shadow-hover: rgba(245, 158, 11, 0.4);
    --danger: #ef4444;
    --danger-hover: #f87171;
    --success: #22c55e;
    --warning: #f59e0b;
    --msg-local: linear-gradient(135deg, #b45309, #d97706);
    --msg-remote: rgba(26, 22, 18, 0.9);
    --glass-bg: rgba(26, 22, 18, 0.6);
    --glass-border: rgba(251, 191, 36, 0.08);
    --toggle-bg: rgba(251, 191, 36, 0.1);
    --toggle-hover: rgba(251, 191, 36, 0.15);
    --input-bg: rgba(15, 13, 10, 0.5);
    --mnemonic-bg: rgba(15, 13, 10, 0.6);
    --bg-anim-1: rgba(245, 158, 11, 0.06);
    --bg-anim-2: rgba(251, 191, 36, 0.04);
    --bg-anim-3: rgba(217, 119, 6, 0.04);
    --landing-title-from: #fef3c7;
    --landing-title-to: #fbbf24;
}

body.theme-amber.light-theme {
    --bg: #fffbeb;
    --bg-gradient: linear-gradient(135deg, #fffbeb 0%, #fef3c7 50%, #fff8e1 100%);
    --surface: rgba(255, 255, 255, 0.9);
    --surface-solid: #ffffff;
    --surface-2: rgba(254, 243, 199, 0.9);
    --surface-3: rgba(253, 230, 138, 0.7);
    --border: rgba(245, 158, 11, 0.15);
    --border-focus: rgba(245, 158, 11, 0.5);
    --text: #78350f;
    --text-dim: #b45309;
    --text-muted: #d97706;
    --primary: #d97706;
    --primary-hover: #b45309;
    --primary-glow: rgba(245, 158, 11, 0.15);
    --primary-gradient: linear-gradient(135deg, #d97706, #fbbf24);
    --primary-gradient-hover: linear-gradient(135deg, #fbbf24, #fcd34d);
    --primary-shadow: rgba(245, 158, 11, 0.3);
    --primary-shadow-hover: rgba(245, 158, 11, 0.4);
    --danger: #dc2626;
    --danger-hover: #b91c1c;
    --success: #16a34a;
    --warning: #d97706;
    --msg-local: linear-gradient(135deg, #d97706, #fbbf24);
    --msg-remote: #fef3c7;
    --glass-bg: rgba(255, 255, 255, 0.75);
    --glass-border: rgba(245, 158, 11, 0.12);
    --toggle-bg: rgba(245, 158, 11, 0.1);
    --toggle-hover: rgba(245, 158, 11, 0.15);
    --input-bg: rgba(255, 251, 235, 0.8);
    --mnemonic-bg: rgba(255, 251, 235, 0.9);
    --bg-anim-1: rgba(245, 158, 11, 0.04);
    --bg-anim-2: rgba(251, 191, 36, 0.03);
    --bg-anim-3: rgba(217, 119, 6, 0.02);
    --landing-title-from: #78350f;
    --landing-title-to: #92400e;
}
