
        :root {
            --primary: #4f46e5;
            --primary-hover: #4338ca;
            --danger: #ef4444;
            --success: #10b981;
            --warning: #f59e0b;
            --bg: #f5f7fb;
            --surface: #ffffff;
            --text: #0f172a;
            --muted: #64748b;
            --border: #e5e7eb;
            --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
            --bg-grad-1: radial-gradient(1200px 600px at 10% -10%, #eef2ff 0%, transparent 60%);
            --bg-grad-2: radial-gradient(1200px 600px at 90% -10%, #ecfeff 0%, transparent 60%);
        }
        [data-theme="dark"] {
            --primary: #8b9bff;
            --primary-hover: #6e7bff;
            --danger: #f87171;
            --success: #34d399;
            --warning: #fbbf24;
            --bg: #0b1120;
            --surface: #111827;
            --text: #e5e7eb;
            --muted: #9aa7bf;
            --border: #1f2a44;
            --shadow: 0 16px 40px rgba(2, 6, 23, 0.55);
            --bg-grad-1: radial-gradient(1200px 600px at 10% -10%, rgba(99, 102, 241, 0.16) 0%, transparent 60%);
            --bg-grad-2: radial-gradient(1200px 600px at 90% -10%, rgba(56, 189, 248, 0.16) 0%, transparent 60%);
        }
        * { box-sizing: border-box; }
        body {
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
            padding: 2rem 1.25rem 3rem;
            max-width: 980px;
            margin: 0 auto;
            background: var(--bg-grad-1), var(--bg-grad-2), var(--bg);
            color: var(--text);
            line-height: 1.6;
        }
        header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
        header .title { font-size: 1.6rem; font-weight: 700; letter-spacing: 0.2px; }
        header .subtitle { color: var(--muted); font-size: 0.95rem; }
        .header-actions { display: flex; align-items: center; gap: 0.75rem; }
        .nav-link { display: inline-flex; align-items: center; padding: 0.5rem 0.9rem; border-radius: 8px; border: 1px solid var(--border); color: var(--text); font-size: 0.88rem; font-weight: 600; text-decoration: none; transition: all 0.2s; }
        .nav-link:hover { border-color: var(--primary); color: var(--primary); background: rgba(79, 70, 229, 0.08); }
        [data-theme="dark"] .nav-link:hover { background: rgba(129, 140, 248, 0.16); }
        .theme-toggle { background: transparent; color: var(--text); border: 1px solid var(--border); box-shadow: none; padding: 0.5rem 1rem; border-radius: 8px; cursor: pointer; transition: background 0.2s;}
        .theme-toggle:hover { background: rgba(79, 70, 229, 0.08); }
        [data-theme="dark"] .theme-toggle:hover { background: rgba(129, 140, 248, 0.16); }
        
        .card { background: var(--surface); padding: 2rem; border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 1.5rem; border: 1px solid var(--border); transition: transform 0.2s ease, box-shadow 0.2s ease; }
        .card:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(15, 23, 42, 0.1); }
        h2 { margin-top: 0; border-bottom: 1px solid var(--border); padding-bottom: 10px; color: var(--text); }
        h3 { margin-top: 1.5rem; margin-bottom: 1rem; color: #334155; }
        [data-theme="dark"] h3 { color: #cbd5f5; }

        button { padding: 0.65rem 1.25rem; font-size: 0.95rem; font-weight: 600; cursor: pointer; background: var(--primary); color: white; border: none; border-radius: 8px; transition: all 0.2s; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
        button:hover { background: var(--primary-hover); transform: translateY(-1px); }
        [data-theme="dark"] button { box-shadow: 0 1px 2px rgba(0,0,0,0.35); }
        button:active { transform: translateY(0); }
        button.primary { width: 100%; padding: 1rem; font-size: 1.1rem; margin-top: 1rem; }

        .hidden { display: none !important; }
        [data-theme="dark"] .card { border-color: #1f2a44; }
        img.avatar { width: 64px; height: 64px; border-radius: 50%; border: 3px solid var(--bg); box-shadow: 0 2px 6px rgba(0,0,0,0.12); object-fit: cover;}

        .user-profile-card { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
        .user-info { display: flex; align-items: center; gap: 1rem; }
        .username-row { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
        .username-row h3 { margin: 0; }
        
        .btn-logout-small { padding: 4px 10px; font-size: 0.75rem; background: #fee2e2; color: #ef4444; border-radius: 6px; border: 1px solid #fca5a5; font-weight: bold; box-shadow: none; }
        .btn-logout-small:hover { background: #fecaca; transform: translateY(0); }
        [data-theme="dark"] .btn-logout-small { background: rgba(239, 68, 68, 0.15); color: #fca5a5; border-color: rgba(239, 68, 68, 0.3); }
        [data-theme="dark"] .btn-logout-small:hover { background: rgba(239, 68, 68, 0.25); }

        .user-id { font-size: 0.85rem; color: var(--muted); font-family: monospace; }
        .user-assets { text-align: right; }
        .asset-label { font-size: 0.9rem; color: #475569; margin-bottom: 5px; }
        [data-theme="dark"] .asset-label { color: #9aa7bf; }
        
        .asset-value { font-size: 1.5rem; font-weight: bold; color: var(--warning); cursor: pointer; display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; transition: background 0.2s; margin-right: -8px;}
        .asset-value:hover { background: #fef3c7; }
        [data-theme="dark"] .asset-value:hover { background: rgba(245, 158, 11, 0.15); }
        .refresh-icon { font-size: 1.1rem; opacity: 0.7; }

        @media (max-width: 600px) {
            .user-profile-card { flex-direction: column; align-items: flex-start; }
            .user-assets { text-align: left; margin-top: 0.5rem; }
            .asset-value { margin-left: -8px; }
        }

        .form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
        .form-group { display: flex; flex-direction: column; }
        .form-group label { font-size: 0.875rem; font-weight: 600; color: #475569; margin-bottom: 0.5rem; }
        .form-group input, .form-group select { padding: 0.65rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; font-size: 0.95rem; outline: none; transition: all 0.2s; background: #fff; color: var(--text); }
        .form-group input::placeholder { color: #94a3b8; }
        .form-group input:focus, .form-group select:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.14); }
        [data-theme="dark"] .form-group input, [data-theme="dark"] .form-group select { background: #0b1220; border-color: #23304a; color: #e2e8f0; box-shadow: inset 0 0 0 1px rgba(148, 163, 184, 0.06); }
        [data-theme="dark"] .form-group input::placeholder { color: #6b7a97; }
        [data-theme="dark"] .form-group input:focus, [data-theme="dark"] .form-group select:focus { border-color: #8b9bff; box-shadow: 0 0 0 3px rgba(139, 155, 255, 0.28); }

        #toast-container { position: fixed; top: 20px; right: 20px; z-index: 9999; display: flex; flex-direction: column; gap: 10px; }
        .toast { padding: 12px 20px; border-radius: 8px; color: white; font-size: 0.9rem; font-weight: 600; box-shadow: 0 4px 12px rgba(0,0,0,0.15); opacity: 0; transform: translateX(100%); transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55); display: flex; align-items: center; gap: 8px; }
        .toast.show { opacity: 1; transform: translateX(0); }
        .toast.info { background: #3b82f6; }
        .toast.success { background: var(--success); }
        .toast.error { background: var(--danger); }
        .toast.warning { background: var(--warning); }

        #imagePreviewContainer { margin-top: 10px; border: 2px dashed var(--border); border-radius: 10px; padding: 12px; text-align: center; color: #94a3b8; font-size: 0.85rem; background: #f8fafc; }
        #imagePreview { max-width: 100%; max-height: 160px; border-radius: 6px; display: none; margin: 0 auto; }
        [data-theme="dark"] #imagePreviewContainer { background: #0b1220; color: #9aa7bf; border-color: #23304a; }

        #externalPreviewContainer { margin-top: 10px; border: 2px dashed var(--border); border-radius: 10px; padding: 12px; text-align: center; color: #94a3b8; font-size: 0.85rem; background: #f8fafc; }
        #externalImagePreview { max-width: 100%; max-height: 200px; border-radius: 6px; display: none; margin: 0 auto; }
        #externalAudioPreview { width: 100%; margin-top: 8px; display: none; }
        [data-theme="dark"] #externalPreviewContainer { background: #0b1220; color: #9aa7bf; border-color: #23304a; }

        .history-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.5rem; cursor: pointer; padding: 0.5rem; margin-left: -0.5rem; margin-right: -0.5rem; border-radius: 8px; transition: background 0.2s; user-select: none; }
        .history-header:hover { background: rgba(0,0,0,0.03); }
        [data-theme="dark"] .history-header:hover { background: rgba(255,255,255,0.03); }
        .history-title-area { display: flex; align-items: center; gap: 8px; }
        .history-header h3 { margin: 0; }
        #historyToggleIcon { font-size: 0.8rem; transition: transform 0.3s; color: var(--muted); display: inline-block; }
        
        .btn-clear { background: transparent; color: var(--muted); border: 1px solid var(--border); padding: 4px 10px; font-size: 0.8rem; border-radius: 6px; box-shadow: none; }
        .btn-clear:hover { background: #f1f5f9; color: var(--danger); }
        [data-theme="dark"] .btn-clear:hover { background: rgba(239, 68, 68, 0.1); color: #fca5a5; }
        
        .history-list { display: flex; flex-direction: column; gap: 1rem; margin-top: 10px; }
        .history-item { padding: 1rem; border: 1px solid var(--border); border-radius: 8px; background: #f8fafc; font-size: 0.9rem; transition: background 0.2s;}
        [data-theme="dark"] .history-item { background: #0f172a; }
        .history-item-top { display: flex; justify-content: space-between; margin-bottom: 0.75rem; align-items: center; flex-wrap: wrap; gap: 0.5rem;}
        .badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 4px; background: #eef2ff; color: #4338ca; font-size: 0.8rem; font-weight: 600; margin-right: 6px;}
        [data-theme="dark"] .badge { background: rgba(99, 102, 241, 0.2); color: #c7d2fe; }
        .history-item-body { display: grid; grid-template-columns: 1fr; gap: 0.4rem; color: #475569; }
        [data-theme="dark"] .history-item-body { color: #94a3b8; }
        .history-item-id { font-family: monospace; font-size: 0.8rem; color: var(--muted); margin-top: 0.5rem; border-top: 1px dashed var(--border); padding-top: 0.5rem; word-break: break-all;}
        .history-link { color: var(--primary); text-decoration: none; font-weight: 600; font-size: 0.85rem;}
        .history-link:hover { text-decoration: underline; }

        .history-id-link { font-family: inherit; font-size: 0.8rem; color: var(--primary); background: transparent; border: none; padding: 0; cursor: pointer; font-weight: 600; }
        .history-id-link:hover { text-decoration: underline; }

        .modal-root { position: fixed; inset: 0; z-index: 2000; display: flex; align-items: center; justify-content: center; }
        .modal-backdrop { position: absolute; inset: 0; background: rgba(15, 23, 42, 0.45); backdrop-filter: blur(4px); }
        .modal-card { position: relative; width: min(780px, 92vw); max-height: 88vh; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow); border: 1px solid var(--border); display: flex; flex-direction: column; overflow: hidden; }
        .modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1.25rem 1.5rem 0.75rem; border-bottom: 1px solid var(--border); }
        .modal-title { font-size: 1.1rem; font-weight: 700; color: var(--text); }
        .modal-subtitle { font-size: 0.8rem; color: var(--muted); margin-top: 4px; word-break: break-all; }
        .modal-body { padding: 1rem 1.5rem; overflow: auto; }
        .modal-summary { display: flex; flex-wrap: wrap; gap: 0.75rem 1rem; align-items: center; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.75rem; }
        .modal-summary strong { color: var(--text); font-weight: 700; }
        .modal-footer { padding: 0.9rem 1.5rem 1.25rem; border-top: 1px solid var(--border); display: flex; justify-content: flex-end; gap: 0.75rem; }
        .btn-close { background: transparent; border: 1px solid var(--border); color: var(--muted); border-radius: 999px; width: 34px; height: 34px; font-size: 1.2rem; line-height: 1; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
        .btn-close:hover { color: var(--text); border-color: var(--primary); }
        .receive-list { display: grid; gap: 0.75rem; }
        .receive-item { display: flex; gap: 0.9rem; align-items: center; padding: 0.75rem 0.85rem; border: 1px solid var(--border); border-radius: 10px; background: #f8fafc; }
        [data-theme="dark"] .receive-item { background: #0f172a; }
        .receive-avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; border: 2px solid var(--bg); }
        .receive-info { flex: 1; min-width: 0; }
        .receive-name { font-weight: 700; color: var(--text); display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
        .receive-id { font-size: 0.75rem; color: var(--muted); word-break: break-all; }
        .receive-meta { font-size: 0.8rem; color: var(--muted); }
        .receive-carrot { font-weight: 700; color: var(--warning); }
        .receive-empty { text-align: center; color: var(--muted); padding: 1.5rem 0; }
        .load-more { background: transparent; color: var(--primary); border: 1px solid var(--border); padding: 0.45rem 0.85rem; font-size: 0.85rem; border-radius: 999px; cursor: pointer; }
        .load-more:hover { border-color: var(--primary); }
    
