:root {
    --primary-bg: #ffeef2;
    --card-bg: rgba(255, 255, 255, 0.9);
    --text-color: #d81b60;
    --accent-pink: #f06292;
    --accent-blue: #64b5f6;
    
    /* Glassmorphism Variables for Timeline */
    --glass-card-bg: rgba(255, 255, 255, 0.85);
    --glass-border: rgba(255, 182, 193, 0.3);
    --glass-card-json-bg: rgba(255, 240, 245, 0.5); 
    --accent-primary: #ec407a;
    --text-primary: #4a148c;
    --text-secondary: #880e4f;
    --btn-back-bg: rgba(255, 255, 255, 0.8);
    --btn-back-text: #d81b60;
    --user-role-bg: rgba(255, 255, 255, 0.5);
    --user-role-text: #888;
}

/* Dark/Night Theme */
[data-theme="dark"] {
    --primary-bg: #101010;
    --card-bg: rgba(30, 30, 40, 0.95);
    --text-color: #e0e0e0;
    --accent-pink: #ff80ab;
    --accent-blue: #82b1ff;
    
    --glass-card-bg: rgba(40, 40, 50, 0.9);
    --glass-border: rgba(100, 120, 140, 0.4);
    --glass-card-json-bg: rgba(30, 35, 45, 0.6);
    --accent-primary: #ff4081;
    --text-primary: #e8e8e8;
    --text-secondary: #b0b0b0;
    --btn-back-bg: rgba(50, 50, 60, 0.9);
    --btn-back-text: #e0e0e0;
    --user-role-bg: rgba(80, 80, 100, 0.6);
    --user-role-text: #c0c0c0;
}

body {
    margin: 0;
    padding: 0;
    background-color: var(--primary-bg);
    font-family: 'Segoe UI', "Microsoft JhengHei", sans-serif;
    overflow: hidden;
}

#canvas-container {
    width: 100%;
    height: 100vh;
    display: block;
}

/* 互動視窗樣式 */
#interaction-modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    background: var(--card-bg);
    width: 320px;
    padding: 25px;
    border-radius: 30px;
    box-shadow: 0 15px 50px rgba(216, 27, 96, 0.2);
    backdrop-filter: blur(15px);
    z-index: 100;
    display: none;
    flex-direction: column;
    align-items: center;
    border: 3px solid white;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    opacity: 0;
}

#interaction-modal.active {
    display: flex;
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
}

.agent-header {
    text-align: center;
    margin-bottom: 15px;
}

.agent-name {
    font-size: 24px;
    font-weight: bold;
    color: var(--text-color);
    margin: 0;
}

.agent-role {
    font-size: 14px;
    background: #fce4ec;
    padding: 4px 12px;
    border-radius: 15px;
    color: #ad1457;
    margin-top: 5px;
    display: inline-block;
}

.agent-bio {
    font-size: 14px;
    color: #666;
    text-align: center;
    line-height: 1.5;
    margin: 15px 0;
    max-height: 100px;
    overflow-y: auto;
}

.interaction-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    width: 100%;
}

.btn {
    background: var(--accent-pink);
    color: white;
    border: none;
    padding: 10px;
    border-radius: 15px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.2s;
    font-size: 14px;
}

.btn:hover {
    background: #e91e63;
    transform: translateY(-2px);
}

.btn-secondary {
    background: #f8bbd0;
    color: #ad1457;
}

.btn-close {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 20px;
    color: #ccc;
    cursor: pointer;
}

.ui-overlay {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--card-bg);
    padding: 15px 30px;
    border-radius: 50px;
    display: flex;
    gap: 15px;
    z-index: 10;
    border: 2px solid white;
}

.top-left-back {
    position: absolute;
    top: 20px;
    left: 20px;
    z-index: 20;
}
.btn-back {
     background: var(--btn-back-bg);
     padding: 10px 20px;
     border-radius: 20px;
     text-decoration: none;
     color: var(--btn-back-text);
     font-weight: bold;
     display: flex;
     align-items: center;
     gap: 5px;
     box-shadow: 0 4px 10px rgba(0,0,0,0.1);
}

.instructions {
    position: absolute;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    color: #ad1457;
    background: rgba(255, 255, 255, 0.5);
    padding: 8px 20px;
    border-radius: 20px;
    font-size: 14px;
    text-align: center;
    z-index: 5;
    pointer-events: none;
}

/* Chat History Sidebar */
#chat-history-container {
    position: absolute;
    right: 20px;
    top: 80px;
    width: 260px;
    max-height: 70vh;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    z-index: 100;
    overflow-y: auto;
    padding-right: 5px;
}

#chat-history-container::-webkit-scrollbar { width: 4px; }
#chat-history-container::-webkit-scrollbar-thumb {
    background: rgba(216, 27, 96, 0.2);
    border-radius: 10px;
}

.chat-entry {
    background: rgba(255, 255, 255, 0.6);
    backdrop-filter: blur(8px);
    padding: 10px 15px;
    border-radius: 15px;
    border-left: 5px solid var(--accent-pink);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    animation: slideIn 0.3s ease-out;
    pointer-events: auto;
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(30px); }
    to { opacity: 1; transform: translateX(0); }
}

.chat-entry-name {
    font-size: 11px;
    font-weight: bold;
    color: var(--accent-pink);
    margin-bottom: 2px;
    display: flex;
    justify-content: space-between;
}

.chat-entry-model {
    font-size: 9px;
    color: #888;
    font-weight: normal;
}

.chat-entry-text {
    font-size: 13px;
    color: var(--text-primary);
    line-height: 1.4;
}

.chat-entry-time {
    font-size: 9px;
    color: #888;
    font-weight: normal;
    margin-left: 6px;
}

/* User Profile Card */
#user-profile-card {
    position: absolute;
    top: 70px;
    left: 20px;
    background: var(--glass-card-bg);
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(10px);
    padding: 10px 15px;
    border-radius: 15px;
    display: flex;
    align-items: center;
    gap: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    z-index: 20;
    transition: transform 0.2s;
}

#user-profile-card:hover {
    transform: translateY(2px);
}

.user-avatar-icon {
    width: 40px;
    height: 40px;
    background: var(--accent-pink);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 18px;
    border: 2px solid white;
}

.user-info {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.user-name {
    font-weight: bold;
    color: var(--text-color);
    font-size: 14px;
}

.user-role {
    font-size: 11px;
    color: var(--user-role-text);
    background: var(--user-role-bg);
    padding: 2px 8px;
    border-radius: 10px;
    display: inline-block;
    margin-top: 2px;
    align-self: flex-start;
}

.user-stats {
    display: flex;
    gap: 5px;
    margin-top: 4px;
}

.stat-badge {
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    gap: 3px;
    font-weight: bold;
    color: white;
}

.stat-badge.level { background: #7e57c2; }
.stat-badge.sc { background: #ffa726; }
.stat-badge.bc { background: #42a5f5; }

/* Lobby Modals */
.lobby-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.6);
    display: flex; /* Flex to center */
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.lobby-modal-content {
    width: 400px;
    max-width: 90%;
    padding: 20px;
    border-radius: 15px;
    color: var(--text-color);
}

.glass-panel {
    background: var(--glass-card-bg); /* Use existing glass var */
    border: 1px solid var(--glass-border);
    backdrop-filter: blur(15px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    padding-bottom: 10px;
}

.modal-header h3 {
    margin: 0;
    font-size: 1.2rem;
    color: var(--accent-blue);
}

.close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 1.5rem;
    cursor: pointer;
}
.close-btn:hover { color: red; }

.interactive-list {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 300px;
    overflow-y: auto;
}

.interactive-list li {
    padding: 10px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.interactive-list li a {
    color: var(--text-color);
    text-decoration: none;
    display: block;
    transition: color 0.2s;
}

.interactive-list li a:hover {
    color: var(--accent-pink);
    background: rgba(255,255,255,0.05);
}

.trend-up { color: #ff5252 !important; }
.trend-down { color: #69f0ae !important; }
.trend-neutral { color: #e0e0e0; }

/* Enhanced Interactive List */
.interactive-item-enhanced {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.05);
    transition: background 0.2s;
}
.interactive-item-enhanced:hover {
    background: rgba(255,255,255,0.05);
}

.item-info {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.item-title {
    font-weight: bold;
    color: var(--text-color);
    font-size: 0.95rem;
}

.item-sub {
    font-size: 0.8rem;
    color: #aaa;
}

.btn-action {
    background: var(--accent-blue); /* Default Blue */
    color: white;
    text-decoration: none;
    padding: 6px 12px;
    border-radius: 6px;
    font-size: 0.85rem;
    transition: transform 0.1s, background 0.2s;
    border: none;
    cursor: pointer;
    white-space: nowrap;
}
.btn-action:hover {
    background: #42a5f5; /* Lighter Blue */
    transform: scale(1.05);
    color: white;
}
.btn-action:active {
    transform: scale(0.95);
}

/* Specific Stock Colors */
.stock-up { color: #ff5252; }
.stock-down { color: #69f0ae; }
/* User Provided Modal Styles */
/* 彈窗樣式 (Agent, 公司, 新聞) */
/* User Provided Modal Styles (Optimized) */
.modal {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    /* Improved Gradient Background */
    background: linear-gradient(145deg, rgba(30, 30, 30, 0.95), rgba(20, 20, 25, 0.98));
    width: 360px; /* Slightly wider */
    padding: 35px;
    border-radius: 25px;
    /* Richer Shadow */
    box-shadow: 0 25px 50px rgba(0,0,0,0.6), 0 0 0 1px rgba(255,255,255,0.1) inset;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    z-index: 200;
    display: none;
    flex-direction: column;
    align-items: center;
    /* Subtle Border Glow */
    border: 1px solid rgba(255, 255, 255, 0.08);
    transition: all 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
    opacity: 0;
    color: #f0f0f0;
}

.modal.active { display: flex; transform: translate(-50%, -50%) scale(1); opacity: 1; }
.modal-header { text-align: center; margin-bottom: 20px; width: 100%; position: relative; }
.modal-title { font-size: 24px; font-weight: 700; color: #fff; margin: 0; letter-spacing: 0.5px; text-shadow: 0 2px 4px rgba(0,0,0,0.3); }
.modal-subtitle { 
    font-size: 13px; 
    background: rgba(100, 181, 246, 0.15); 
    padding: 6px 14px; 
    border-radius: 20px; 
    color: var(--accent-blue); 
    margin-top: 10px; 
    display: inline-block;
    border: 1px solid rgba(100, 181, 246, 0.2);
}
.modal-body { 
    font-size: 15px; 
    color: #ccc; 
    text-align: center; 
    line-height: 1.7; 
    margin: 25px 0; 
    font-weight: 400;
}
.interaction-btns { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; width: 100%; }

.btn { 
    background: linear-gradient(135deg, #333, #2a2a2a); 
    color: #ddd; 
    border: 1px solid rgba(255,255,255,0.1); 
    padding: 14px; 
    border-radius: 12px; 
    cursor: pointer; 
    font-weight: 600; 
    transition: all 0.25s ease; 
    font-size: 14px; 
    text-decoration: none; 
    text-align: center; 
    box-shadow: 0 4px 6px rgba(0,0,0,0.2);
}
.btn:hover { 
    background: linear-gradient(135deg, #444, #3a3a3a); 
    transform: translateY(-2px); 
    color: #fff;
    box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}
.btn-primary { 
    background: linear-gradient(135deg, var(--accent-blue), #1e88e5); 
    color: white; 
    border: none;
    box-shadow: 0 4px 10px rgba(33, 150, 243, 0.3);
}
.btn-primary:hover { 
    background: linear-gradient(135deg, #42a5f5, #2196f3); 
    box-shadow: 0 6px 15px rgba(33, 150, 243, 0.4);
}
.btn-full { grid-column: span 2; }

.btn-close { 
    position: absolute; 
    top: 20px; 
    right: 20px; 
    background: rgba(255,255,255,0.1); /* Circle background */
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none; 
    font-size: 18px; 
    line-height: 32px;
    color: #aaa; 
    cursor: pointer; 
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
} 
.btn-close:hover { 
    background: rgba(255,60,60,0.2); 
    color: #ff5252; 
    transform: rotate(90deg);
}

.modal .btn-close { top: 20px; right: 20px; }

/* End User Styles */
