:root {
    --bg: #F2F2F7;
    --panel: #FFFFFF;
    --accent: #007AFF;
    --text: #1C1C1E;
    --border: rgba(0,0,0,0.05);
    --success: #34C759;
    --warning: #FF9500;
    --danger: #FF3B30;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg);
    color: var(--text);
    font-family: 'Inter', -apple-system, sans-serif;
    overflow-x: hidden;
}

.sidebar-capsule {
    width: 72px;
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(20px);
    border-right: 1px solid var(--border);
    height: 96vh;
    margin: 2vh 0 2vh 12px;
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    box-shadow: 0 10px 30px rgba(0,0,0,0.03);
    z-index: 50;
    position: fixed;
    left: 0;
    top: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-arc {
    width: 72px;
    height: 96vh;
    margin: 2vh 0 2vh 12px;
    background: rgba(255,255,255,0.7);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 24px;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 0;
    gap: 16px;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 50;
}

.sidebar-arc .logo {
    width: 40px;
    height: 40px;
    background: #000;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-weight: 700;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.sidebar-arc .logo:hover {
    transform: scale(1.05);
}

.sidebar-arc .nav-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    width: 100%;
    padding: 0 16px;
}

.sidebar-arc .nav-section-title {
    font-size: 10px;
    font-weight: 600;
    color: #A1A1A6;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 4px;
    padding-left: 4px;
}

.sidebar-arc .nav-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: #f5f5f7;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #86868b;
    cursor: pointer;
    transition: all 0.2s;
}

.sidebar-arc .nav-icon:hover {
    background: #e8e8ed;
    color: #1d1d1f;
}

.sidebar-arc .nav-icon.active {
    background: rgba(0,122,255,0.1);
    color: #007AFF;
}

.sidebar-arc .avatar {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    overflow: hidden;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: auto;
}

.sidebar-arc .avatar:hover {
    transform: scale(1.05);
}

.sidebar-arc .avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.space-icon {
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: #fff;
    border: 1px solid var(--border);
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: #636366;
}

.space-icon:hover {
    transform: scale(1.05);
    border-color: #ddd;
    background: #fafafa;
}

.space-icon.active {
    border-color: var(--accent);
    box-shadow: 0 4px 12px rgba(0,122,255,0.2);
    color: var(--accent);
}

.main-stage {
    flex-grow: 1;
    height: 100vh;
    overflow-y: auto;
    padding: 40px 5% 180px calc(72px + 5%);
    scroll-behavior: smooth;
    margin-left: 0;
}

.island-wrapper {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 100;
}

.island {
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(30px);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 24px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1), 0 4px 12px rgba(0,0,0,0.05);
    overflow: hidden;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mode-switcher {
    display: flex;
    gap: 4px;
    padding: 6px;
    background: rgba(0,0,0,0.03);
    border-radius: 16px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 500;
    color: #636366;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: transparent;
}

.mode-btn:hover {
    background: rgba(0,0,0,0.05);
    color: #1C1C1E;
}

.mode-btn.active {
    background: #000;
    color: #fff;
}

.mode-btn svg {
    opacity: 0.7;
}

.mode-btn.active svg {
    opacity: 1;
}

.math-mode-bar {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 8px 16px;
    border-top: 1px solid rgba(0,0,0,0.05);
}

.math-intensity-selector {
    display: flex;
    align-items: center;
    gap: 8px;
    transition: all 0.2s;
}

.intensity-btn {
    padding: 6px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(0,0,0,0.1);
    background: transparent;
    color: #636366;
}

.intensity-btn:hover {
    border-color: rgba(0,122,255,0.3);
    color: #007AFF;
}

.content-block {
    background: var(--panel);
    border-radius: 24px;
    padding: 48px;
    margin-bottom: 24px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.02);
    max-width: 840px;
    margin-left: auto;
    margin-right: auto;
    position: relative;
    border: 1px solid transparent;
    transition: all 0.3s;
}

.content-block:hover {
    border-color: rgba(0,122,255,0.1);
}

.block-label {
    position: absolute;
    left: -100px;
    top: 52px;
    width: 80px;
    text-align: right;
    font-size: 11px;
    color: #A1A1A6;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.serif-title {
    font-family: 'Charter', serif;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 24px;
    letter-spacing: -0.01em;
}

.omni-input {
    position: fixed;
    bottom: 40px;
    left: 50%;
    transform: translateX(-50%);
    width: 680px;
    background: rgba(255,255,255,0.9);
    backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 32px;
    padding: 12px 16px;
    box-shadow: 0 20px 50px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 100;
    transition: all 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.omni-input:focus-within {
    width: 800px;
    background: #fff;
    padding: 16px 20px;
}

.property-bar {
    position: fixed;
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
    display: flex;
    flex-direction: column;
    gap: 8px;
    z-index: 50;
}

.prop-tag {
    background: #fff;
    border: 1px solid var(--border);
    padding: 8px 16px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
    color: #636366;
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.prop-tag:hover {
    background: #fafafa;
    border-color: #ddd;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    background: var(--success);
    border-radius: 50%;
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 20px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    outline: none;
}

.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: #0066d6;
}

.btn-secondary {
    background: #f5f5f7;
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: #e8e8ed;
}

.btn-danger {
    background: var(--danger);
    color: white;
}

.btn-danger:hover {
    background: #d63029;
}

.input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    background: #fafafa;
    transition: all 0.2s;
    outline: none;
}

.input:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
}

.input-group {
    margin-bottom: 16px;
}

.input-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #636366;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-group {
    margin-bottom: 16px;
}

.form-label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: #636366;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 14px;
    background: #fafafa;
    transition: all 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(0,122,255,0.1);
}

.card {
    background: var(--panel);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.04);
    border: 1px solid var(--border);
    transition: all 0.2s;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.4);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--panel);
    border-radius: 24px;
    padding: 32px;
    max-width: 480px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.modal-overlay.active .modal {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.modal-title {
    font-size: 18px;
    font-weight: 600;
}

.modal-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #636366;
    transition: all 0.2s;
}

.modal-close:hover {
    background: #f5f5f7;
    color: var(--text);
}

.table {
    width: 100%;
    border-collapse: collapse;
}

.table th,
.table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border);
}

.table th {
    font-size: 11px;
    font-weight: 600;
    color: #636366;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: #fafafa;
}

.table tr:hover td {
    background: #fafafa;
}

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 500;
}

.badge-success {
    background: rgba(52, 199, 89, 0.1);
    color: var(--success);
}

.badge-warning {
    background: rgba(255, 149, 0, 0.1);
    color: var(--warning);
}

.badge-danger {
    background: rgba(255, 59, 48, 0.1);
    color: var(--danger);
}

.badge-info {
    background: rgba(0, 122, 255, 0.1);
    color: var(--accent);
}

.chat-container {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 180px);
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 0;
}

.message {
    max-width: 80%;
    margin-bottom: 16px;
    padding: 16px 20px;
    border-radius: 20px;
    line-height: 1.6;
}

.message-user {
    background: var(--accent);
    color: white;
    margin-left: auto;
    border-bottom-right-radius: 4px;
}

.message-assistant {
    background: #f5f5f7;
    color: var(--text);
    margin-right: auto;
    border-bottom-left-radius: 4px;
}

.chat-input-container {
    position: fixed;
    bottom: 0;
    left: calc(72px + 5%);
    right: 5%;
    padding: 20px;
    background: linear-gradient(transparent, var(--bg) 20%);
}

.chat-input-wrapper {
    background: var(--panel);
    border-radius: 24px;
    padding: 12px 16px;
    box-shadow: 0 4px 24px rgba(0,0,0,0.08);
    display: flex;
    align-items: flex-end;
    gap: 12px;
    max-width: 840px;
    margin: 0 auto;
}

.chat-textarea {
    flex: 1;
    border: none;
    outline: none;
    resize: none;
    font-size: 15px;
    line-height: 1.5;
    max-height: 200px;
    background: transparent;
    font-family: inherit;
}

.loading-dots {
    display: flex;
    gap: 4px;
    padding: 16px 20px;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: #c7c7cc;
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) { animation-delay: -0.32s; }
.loading-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0); }
    40% { transform: scale(1); }
}

.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.login-card {
    background: var(--panel);
    border-radius: 32px;
    padding: 48px;
    width: 100%;
    max-width: 420px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.1);
}

.login-logo {
    text-align: center;
    margin-bottom: 32px;
}

.login-logo h1 {
    font-family: 'Charter', serif;
    font-size: 28px;
    font-weight: 700;
    margin-bottom: 8px;
}

.login-logo p {
    color: #636366;
    font-size: 14px;
}

.admin-sidebar {
    width: 240px;
    background: var(--panel);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: fixed;
    left: 72px;
    top: 0;
    padding: 24px 16px;
    overflow-y: auto;
}

.admin-sidebar-title {
    font-size: 11px;
    font-weight: 600;
    color: #A1A1A6;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 12px;
    padding: 0 12px;
}

.admin-nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    color: #636366;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 4px;
    text-decoration: none;
}

.admin-nav-item:hover {
    background: #f5f5f7;
    color: var(--text);
}

.admin-nav-item.active {
    background: rgba(0, 122, 255, 0.1);
    color: var(--accent);
}

.admin-content {
    margin-left: calc(72px + 240px);
    padding: 32px;
    min-height: 100vh;
}

.stat-card {
    background: var(--panel);
    border-radius: 16px;
    padding: 24px;
    border: 1px solid var(--border);
}

.stat-value {
    font-size: 32px;
    font-weight: 600;
    margin-bottom: 4px;
}

.stat-label {
    font-size: 13px;
    color: #636366;
}

::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #c7c7cc;
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a1a1a6;
}

.fade-in {
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.slide-in {
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(-10px); }
    to { opacity: 1; transform: translateX(0); }
}

.chat-layout {
    display: flex;
    flex-direction: column;
    height: 100vh;
    padding-bottom: 120px;
}

.chat-container-unified {
    flex: 1;
    display: flex;
    flex-direction: column;
    max-width: 900px;
    margin: 0 auto;
    width: 100%;
    padding: 40px 20px;
}

.welcome-header {
    text-align: center;
    padding: 80px 20px;
    animation: fadeIn 0.5s ease-out;
}

.welcome-header h1 {
    font-family: 'Charter', serif;
    font-size: 48px;
    font-weight: 700;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}

.omni-input-unified {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 200px);
    max-width: 800px;
    background: rgba(255,255,255,0.95);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 24px;
    padding: 16px 20px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.12);
    display: flex;
    align-items: flex-end;
    gap: 12px;
    z-index: 100;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.omni-input-unified:focus-within {
    box-shadow: 0 25px 80px rgba(0,0,0,0.18);
    border-color: rgba(0,122,255,0.3);
}

.modal-large {
    max-width: 600px;
    max-height: 80vh;
}

.modal-history {
    max-width: 500px;
    max-height: 70vh;
}

.model-grid-modal {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    padding: 0 16px 16px;
    max-height: 400px;
    overflow-y: auto;
}

.model-card-modal {
    padding: 16px;
    background: #f8f8fa;
    border-radius: 16px;
    cursor: pointer;
    transition: all 0.2s;
    border: 2px solid transparent;
}

.model-card-modal:hover {
    background: #f0f0f5;
    transform: translateY(-2px);
}

.model-card-modal.selected {
    background: rgba(0, 122, 255, 0.1);
    border-color: var(--accent);
}

.model-card-modal .model-name {
    font-weight: 600;
    font-size: 14px;
    color: var(--text);
}

.model-card-modal .model-meta {
    font-size: 12px;
    color: #8e8e93;
    margin-top: 4px;
}

.history-list {
    padding: 0 16px 16px;
    max-height: 400px;
    overflow-y: auto;
}

.history-item {
    padding: 14px 16px;
    background: #f8f8fa;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.2s;
    margin-bottom: 8px;
}

.history-item:hover {
    background: #f0f0f5;
    transform: translateX(4px);
}

.history-item .history-title {
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
}

.history-item .history-meta {
    font-size: 12px;
    color: #8e8e93;
    margin-top: 4px;
}

.markdown-content {
    line-height: 1.8;
    color: var(--text);
    font-size: 15px;
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4,
.markdown-content h5,
.markdown-content h6 {
    font-family: 'Charter', serif;
    font-weight: 700;
    margin-top: 32px;
    margin-bottom: 16px;
    line-height: 1.4;
    color: #1a1a1e;
}

.markdown-content h1 {
    font-size: 32px;
    letter-spacing: -0.02em;
    border-bottom: 2px solid rgba(0,0,0,0.08);
    padding-bottom: 12px;
}

.markdown-content h2 {
    font-size: 26px;
    letter-spacing: -0.01em;
}

.markdown-content h3 {
    font-size: 22px;
}

.markdown-content h4 {
    font-size: 18px;
}

.markdown-content h5 {
    font-size: 16px;
}

.markdown-content h6 {
    font-size: 14px;
    color: #636366;
}

.markdown-content p {
    margin-bottom: 16px;
}

.markdown-content p:last-child {
    margin-bottom: 0;
}

.markdown-content strong {
    font-weight: 600;
    color: #1a1a1e;
}

.markdown-content em {
    font-style: italic;
    color: #4a4a4f;
}

.markdown-content strong em,
.markdown-content em strong {
    font-style: italic;
    font-weight: 600;
}

.markdown-content del {
    text-decoration: line-through;
    color: #a1a1a6;
    opacity: 0.7;
}

.markdown-content sub {
    font-size: 0.75em;
    vertical-align: sub;
    color: #636366;
}

.markdown-content sup {
    font-size: 0.75em;
    vertical-align: super;
    color: var(--accent);
    font-weight: 500;
}

.markdown-content ul,
.markdown-content ol {
    margin-bottom: 16px;
    padding-left: 24px;
}

.markdown-content ul {
    list-style-type: disc;
}

.markdown-content ol {
    list-style-type: decimal;
}

.markdown-content li {
    margin-bottom: 8px;
    line-height: 1.7;
}

.markdown-content ul ul,
.markdown-content ol ol,
.markdown-content ul ol,
.markdown-content ol ul {
    margin-top: 8px;
    margin-bottom: 8px;
}

.markdown-content ul li::marker {
    color: var(--accent);
}

.markdown-content input[type="checkbox"] {
    margin-right: 8px;
    accent-color: var(--accent);
    cursor: pointer;
}

.markdown-content input[type="checkbox"]:checked + span {
    text-decoration: line-through;
    color: #a1a1a6;
}

.markdown-content a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: all 0.2s;
}

.markdown-content a:hover {
    border-bottom-color: var(--accent);
}

.markdown-content img {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    margin: 16px 0;
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}

.markdown-content code {
    font-family: 'SF Mono', 'Fira Code', 'Consolas', monospace;
    font-size: 0.9em;
    background: rgba(0,0,0,0.06);
    padding: 2px 6px;
    border-radius: 4px;
    color: #e83e8c;
}

.markdown-content pre {
    background: #1e1e1e;
    border-radius: 12px;
    padding: 20px;
    margin: 20px 0;
    overflow-x: auto;
    box-shadow: 0 4px 16px rgba(0,0,0,0.12);
}

.markdown-content pre code {
    background: transparent;
    padding: 0;
    color: #f8f8f2;
    font-size: 14px;
    line-height: 1.6;
}

.markdown-content pre code::before {
    content: attr(data-language);
    display: block;
    font-size: 11px;
    color: #636366;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 12px;
    font-family: 'Inter', sans-serif;
}

.markdown-content blockquote {
    border-left: 3px solid var(--accent);
    padding-left: 20px;
    margin: 20px 0;
    color: #636366;
    font-style: italic;
    background: rgba(0,122,255,0.03);
    padding: 16px 20px;
    border-radius: 0 12px 12px 0;
}

.markdown-content blockquote blockquote {
    border-left-color: #636366;
    margin-left: 20px;
}

.markdown-content blockquote blockquote blockquote {
    border-left-color: #a1a1a6;
    margin-left: 40px;
}

.markdown-content hr {
    border: none;
    height: 1px;
    background: linear-gradient(to right, transparent, rgba(0,0,0,0.1), transparent);
    margin: 32px 0;
}

.markdown-content hr::before {
    content: '•';
    display: block;
    text-align: center;
    color: #a1a1a6;
    font-size: 20px;
    line-height: 0;
    margin-top: -10px;
}

.markdown-content table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.markdown-content thead {
    background: rgba(0,0,0,0.03);
}

.markdown-content th {
    padding: 12px 16px;
    text-align: left;
    font-weight: 600;
    font-size: 13px;
    color: #636366;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-bottom: 2px solid rgba(0,0,0,0.08);
}

.markdown-content td {
    padding: 12px 16px;
    border-bottom: 1px solid rgba(0,0,0,0.05);
}

.markdown-content tbody tr:hover {
    background: rgba(0,122,255,0.03);
}

.markdown-content tbody tr:last-child td {
    border-bottom: none;
}

.markdown-content table[align="center"] {
    margin-left: auto;
    margin-right: auto;
}

.markdown-content table[align="right"] {
    margin-left: auto;
}

.markdown-content .footnote-ref {
    font-size: 0.75em;
    vertical-align: super;
    color: var(--accent);
    cursor: pointer;
}

.markdown-content .footnote {
    font-size: 13px;
    color: #636366;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid rgba(0,0,0,0.08);
}

.markdown-content .footnote li {
    margin-bottom: 8px;
}

.markdown-content dl {
    margin: 16px 0;
}

.markdown-content dt {
    font-weight: 600;
    color: #1a1a1e;
    margin-top: 12px;
    margin-bottom: 4px;
}

.markdown-content dd {
    margin-left: 20px;
    margin-bottom: 12px;
    color: #636366;
}

.markdown-content .emoji {
    font-size: 1.2em;
    vertical-align: middle;
}

.markdown-content .highlight {
    background: linear-gradient(120deg, rgba(255,235,59,0.3) 0%, rgba(255,235,59,0) 100%);
    padding: 0 2px;
}

.markdown-content .mark {
    background: rgba(255,235,59,0.2);
    padding: 2px 4px;
    border-radius: 3px;
}

.markdown-content details {
    margin: 16px 0;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    overflow: hidden;
}

.markdown-content summary {
    padding: 12px 16px;
    background: rgba(0,0,0,0.02);
    cursor: pointer;
    font-weight: 500;
    transition: background 0.2s;
}

.markdown-content summary:hover {
    background: rgba(0,0,0,0.04);
}

.markdown-content details[open] summary {
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.markdown-content details > *:not(summary) {
    padding: 16px;
}

.markdown-content kbd {
    background: #fafafa;
    border: 1px solid rgba(0,0,0,0.1);
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.85em;
    font-family: 'SF Mono', 'Fira Code', monospace;
    box-shadow: 0 2px 0 rgba(0,0,0,0.05);
}

.markdown-content abbr {
    text-decoration: underline dotted;
    cursor: help;
}

.markdown-content mark {
    background: rgba(255,235,59,0.3);
    padding: 2px 4px;
    border-radius: 3px;
}

.markdown-content .highlight-mark {
    background: linear-gradient(120deg, rgba(255,235,59,0.4) 0%, rgba(255,235,59,0.2) 100%);
    padding: 2px 4px;
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(255,235,59,0.2);
}

.markdown-content .emoji-shortcode {
    font-size: 1.2em;
    vertical-align: middle;
    display: inline-block;
    margin: 0 2px;
}

.markdown-content .auto-link {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px dashed var(--accent);
    transition: all 0.2s;
}

.markdown-content .auto-link:hover {
    border-bottom-style: solid;
}

.code-file-card {
    background: rgba(255,255,255,0.8);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0,0,0,0.05);
    border-radius: 16px;
    padding: 16px;
    margin: 16px 0;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.04);
}

.code-file-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0,122,255,0.12);
    border-color: rgba(0,122,255,0.3);
    background: rgba(255,255,255,0.95);
}

.code-file-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.code-file-icon.html { 
    background: linear-gradient(135deg, #FF6B35 0%, #F7931E 100%);
    color: white;
}
.code-file-icon.css { 
    background: linear-gradient(135deg, #007AFF 0%, #5AC8FA 100%);
    color: white;
}
.code-file-icon.js { 
    background: linear-gradient(135deg, #FFCC00 0%, #FF9500 100%);
    color: #1C1C1E;
}
.code-file-icon.python { 
    background: linear-gradient(135deg, #34C759 0%, #30D158 100%);
    color: white;
}
.code-file-icon.json { 
    background: linear-gradient(135deg, #8E8E93 0%, #636366 100%);
    color: white;
}
.code-file-icon.default { 
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    color: white;
}

.code-file-info {
    flex: 1;
    min-width: 0;
}

.code-file-name {
    font-weight: 600;
    font-size: 14px;
    color: #1C1C1E;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.code-file-meta {
    font-size: 12px;
    color: #8E8E93;
    display: flex;
    align-items: center;
    gap: 6px;
}

.code-file-meta::before {
    content: '';
    width: 6px;
    height: 6px;
    background: #34C759;
    border-radius: 50%;
}

.code-file-actions {
    display: flex;
    gap: 8px;
}

.code-file-btn {
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
}

.code-file-btn-primary {
    background: #007AFF;
    color: white;
}

.code-file-btn-primary:hover {
    background: #0066d6;
    transform: scale(1.02);
}

.code-file-btn-secondary {
    background: rgba(0,122,255,0.1);
    color: #007AFF;
}

.code-file-btn-secondary:hover {
    background: rgba(0,122,255,0.15);
}

.code-preview-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.code-preview-modal.active {
    opacity: 1;
    visibility: visible;
}

.code-preview-container {
    background: #fff;
    border-radius: 20px;
    width: 100%;
    max-width: 900px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s;
}

.code-preview-modal.active .code-preview-container {
    transform: scale(1);
}

.code-preview-header {
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.code-preview-title {
    font-size: 18px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 12px;
}

.code-preview-close {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #86868b;
    transition: all 0.2s;
}

.code-preview-close:hover {
    background: #f5f5f7;
    color: #1d1d1f;
}

.code-preview-body {
    flex: 1;
    overflow: auto;
    padding: 24px;
}

.code-preview-code {
    background: #1e1e1e;
    border-radius: 12px;
    padding: 20px;
    overflow-x: auto;
}

.code-preview-code pre {
    margin: 0;
    background: transparent;
    padding: 0;
    box-shadow: none;
}

.code-preview-code code {
    color: #f8f8f2;
    font-size: 14px;
    line-height: 1.6;
}

.code-preview-tabs {
    display: flex;
    gap: 8px;
    padding: 0 24px;
    border-bottom: 1px solid rgba(0,0,0,0.08);
}

.code-preview-tab {
    padding: 12px 20px;
    font-size: 14px;
    font-weight: 500;
    color: #86868b;
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.2s;
}

.code-preview-tab:hover {
    color: #1d1d1f;
}

.code-preview-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.code-preview-render {
    background: #fff;
    border: 1px solid rgba(0,0,0,0.08);
    border-radius: 12px;
    min-height: 300px;
}

.code-runner {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 20px;
    margin-top: 16px;
}

.code-runner-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.code-runner-title {
    font-size: 14px;
    font-weight: 600;
    color: #1d1d1f;
}

.code-runner-output {
    background: #1e1e1e;
    border-radius: 8px;
    padding: 16px;
    min-height: 100px;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 13px;
    color: #f8f8f2;
    white-space: pre-wrap;
    word-break: break-all;
}

.code-runner-output.error {
    color: #ff6b6b;
}

.code-runner-output.success {
    color: #51cf66;
}

.data-analyzing {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px 20px;
    background: rgba(0,122,255,0.08);
    backdrop-filter: blur(20px);
    border: 1px solid rgba(0,122,255,0.15);
    border-radius: 14px;
    margin: 16px 0;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

.data-analyzing-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.data-analyzing-icon::before {
    content: '';
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.data-analyzing-content {
    flex: 1;
}

.data-analyzing-title {
    font-size: 14px;
    font-weight: 600;
    color: #1C1C1E;
    margin-bottom: 2px;
}

.data-analyzing-subtitle {
    font-size: 12px;
    color: #8E8E93;
}

.data-analyzing-dots {
    display: inline-flex;
    gap: 3px;
    margin-left: 4px;
}

.data-analyzing-dots span {
    width: 4px;
    height: 4px;
    background: #007AFF;
    border-radius: 50%;
    animation: bounce 1.4s ease-in-out infinite both;
}

.data-analyzing-dots span:nth-child(1) { animation-delay: -0.32s; }
.data-analyzing-dots span:nth-child(2) { animation-delay: -0.16s; }
.data-analyzing-dots span:nth-child(3) { animation-delay: 0s; }

@keyframes bounce {
    0%, 80%, 100% { transform: scale(0.6); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

.data-analyzing-pulse {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: 10px;
    background: linear-gradient(135deg, #007AFF 0%, #5856D6 100%);
    animation: pulse-ring 1.5s ease-out infinite;
}

@keyframes pulse-ring {
    0% { transform: scale(1); opacity: 0.5; }
    100% { transform: scale(1.4); opacity: 0; }
}

.user-query {
    font-size: 24px; font-weight: 500; letter-spacing: -0.01em; margin-bottom: 40px; color: #111827;
    animation: fadeIn 0.4s ease-out;
}

.research-active-block {
    border: 1px solid #E5E7EB; border-radius: 16px; padding: 24px;
    background: #FFFFFF; box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03);
    margin-bottom: 40px; animation: slideDown 0.4s ease-out;
}

.status-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }

.status-badge {
    display: inline-flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 500; color: #111827;
}

.research-spinner {
    width: 14px; height: 14px; border: 2px solid #F3F4F6; border-top-color: #2563EB;
    border-radius: 50%; animation: spin 0.8s linear infinite;
}

.time-est { font-variant-numeric: tabular-nums; font-size: 12px; color: #6B7280; }

.source-stream { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }

.source-tag {
    display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
    background: #F9FAFB; border: 1px solid #F3F4F6; border-radius: 6px;
    font-size: 11px; color: #6B7280; opacity: 0; transform: translateY(4px);
    animation: fadeUpIn 0.3s ease forwards;
}

.source-tag img { width: 12px; height: 12px; border-radius: 2px; filter: grayscale(100%); opacity: 0.6; }

.report-block {
    background: #FFFFFF; animation: fadeIn 0.6s ease-out;
    border-bottom: 1px solid #F3F4F6; padding-bottom: 60px; margin-bottom: 40px;
}

.report-meta {
    display: flex; gap: 16px; font-size: 11px; color: #6B7280; font-weight: 500;
    text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: 24px;
}

.report-title {
    font-family: 'Newsreader', 'Georgia', serif; font-size: 32px; font-weight: 500; line-height: 1.2;
    letter-spacing: -0.01em; margin-bottom: 32px; color: #111827;
}

.report-summary {
    background: #F9FAFB; border-left: 2px solid #111827; padding: 16px 20px;
    font-size: 14px; line-height: 1.6; color: #111827; margin-bottom: 40px; border-radius: 0 8px 8px 0;
}

.report-body { font-size: 15px; line-height: 1.8; color: #374151; }
.report-body h3 { font-size: 16px; font-weight: 600; color: #111827; margin: 32px 0 12px 0; }
.report-body p { margin-bottom: 20px; }

.citation {
    display: inline-flex; justify-content: center; align-items: center;
    width: 14px; height: 14px; background: #F3F4F6; color: #6B7280;
    border-radius: 4px; font-size: 9px; font-weight: 600; cursor: pointer;
    vertical-align: super; margin: 0 2px; transition: all 0.15s ease; position: relative;
}

.citation:hover { background: #E5E7EB; color: #111827; }

.citation-tooltip {
    position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(-8px);
    width: 280px; background: #FFFFFF; border: 1px solid #E5E7EB;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08), 0 2px 6px rgba(0,0,0,0.04); border-radius: 12px; padding: 16px;
    opacity: 0; visibility: hidden; transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    z-index: 100; text-align: left; font-weight: normal; font-size: 13px; line-height: 1.5;
    color: #111827;
}

.citation:hover .citation-tooltip { opacity: 1; visibility: visible; transform: translateX(-50%) translateY(-4px); }

.tooltip-source { display: flex; align-items: center; gap: 6px; font-size: 11px; color: #6B7280; margin-bottom: 8px; font-weight: 500; }
.tooltip-source img { width: 12px; height: 12px; border-radius: 2px; }

.report-actions { margin-top: 32px; display: flex; gap: 12px; }

.report-btn {
    padding: 6px 12px; border: 1px solid #E5E7EB; border-radius: 6px;
    font-size: 12px; font-weight: 500; color: #6B7280; background: transparent;
    cursor: pointer; transition: all 0.2s;
}

.report-btn:hover { background: #F9FAFB; color: #111827; }

@keyframes slideDown { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeUpIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Mobile Adaptations */
@media (max-width: 768px) {
    /* Mobile Header */
    .mobile-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        height: 60px;
        padding: 0 16px;
        background: rgba(255, 255, 255, 0.9);
        backdrop-filter: blur(20px);
        border-bottom: 1px solid rgba(0,0,0,0.05);
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        z-index: 100;
    }

    .mobile-header-title {
        font-weight: 600;
        font-size: 17px;
    }

    /* Sidebar Drawer */
    .sidebar-arc {
        display: flex !important; /* Override display: none */
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        height: 100vh;
        margin: 0;
        border-radius: 0 24px 24px 0;
        background: #fff;
        z-index: 1001;
        box-shadow: 4px 0 24px rgba(0,0,0,0.1);
    }

    .sidebar-arc.active {
        transform: translateX(0);
    }

    .sidebar-overlay {
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.4);
        backdrop-filter: blur(4px);
        z-index: 1000;
        opacity: 0;
        visibility: hidden;
        transition: all 0.3s;
    }

    .sidebar-overlay.active {
        opacity: 1;
        visibility: visible;
    }

    /* Main Stage Adjustment */
    .main-stage {
        padding-top: 80px; /* Space for header */
        padding-bottom: 100px; /* Space for input */
        padding-left: 20px;
        padding-right: 20px;
        margin-left: 0;
    }

    /* Island / Input Docking */
    .island-wrapper {
        bottom: 0 !important;
        width: 100% !important;
        left: 0 !important;
        transform: none !important;
        padding: 10px;
        background: white;
        border-top: 1px solid rgba(0,0,0,0.1);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .island {
        border: none;
        box-shadow: none;
        background: transparent;
        padding: 0;
        border-radius: 0;
    }

    .omni-input-unified {
        width: 100%;
        max-width: none;
        left: 0;
        transform: none;
        bottom: 0;
        border-radius: 0;
        border: none;
        border-top: 1px solid rgba(0,0,0,0.1);
    }
    
    .right-panel {
        display: none;
    }

    /* Chat layout adjustments */
    .message {
        max-width: 90%;
    }

    .modal {
        width: 100%;
        height: 100%;
        max-width: none;
        max-height: none;
        border-radius: 0;
    }

    .omni-input {
        width: 100%;
        border-radius: 12px;
        box-shadow: none;
        border: 1px solid var(--border);
        background: #f5f5f7;
    }

    .mode-switcher {
        width: 100%;
        overflow-x: auto;
        justify-content: flex-start;
        padding-bottom: 8px;
    }
    
    .math-mode-bar {
        display: none; /* Hide complex math controls on mobile for simplicity, or adapt them */
    }

    /* Admin Mobile Adaptations */
    .admin-sidebar {
        position: fixed;
        top: 60px; /* Below mobile header */
        left: 0;
        width: 100%;
        height: 50px;
        display: flex;
        flex-direction: row;
        overflow-x: auto;
        white-space: nowrap;
        background: #fff;
        z-index: 90;
        border-bottom: 1px solid rgba(0,0,0,0.05);
        padding: 0 10px;
        align-items: center;
        border-right: none;
    }
    
    .admin-nav-item {
        margin-bottom: 0;
        margin-right: 10px;
        padding: 6px 12px;
        font-size: 13px;
        flex-shrink: 0;
    }
    
    .admin-sidebar-title {
        display: none;
    }

    .admin-content {
        margin-left: 0;
        padding: 20px;
        padding-top: 120px; /* Header + Admin Nav */
    }
}

/* Desktop default */
.mobile-header, .sidebar-overlay {
    display: none;
}

@media (max-width: 768px) {
    .mobile-warning-banner {
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        background: #FFF7E6;
        color: #92400E;
        border-bottom: 1px solid rgba(0,0,0,0.06);
        padding: 10px 12px;
        z-index: 1200;
    }
    .mobile-warning-banner.hide {
        display: none;
    }
    .mobile-warning-content {
        max-width: 1024px;
        margin: 0 auto;
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 12px;
    }
    .mobile-warning-btn {
        padding: 6px 12px;
        background: #F59E0B;
        color: #fff;
        border: none;
        border-radius: 8px;
        font-size: 13px;
        cursor: pointer;
    }
}
