* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Microsoft YaHei', 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    min-height: 100vh;
    padding: 20px;
    color: #333;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    background: white;
    border-radius: 20px;
    box-shadow: 0 25px 50px rgba(0,0,0,0.15);
    overflow: hidden;
}

.header {
    background: linear-gradient(135deg, #2c3e50 0%, #3498db 100%);
    color: white;
    padding: 20px 30px;
}

.header h1 {
    font-size: 2.2em;
    margin-bottom: 5px;
    font-weight: 300;
}

.header p {
    opacity: 0.9;
    margin-bottom: 15px;
}

.controls {
    display: flex;
    gap: 15px;
    align-items: center;
    flex-wrap: wrap;
}

.controls button {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

#start-simulation {
    background: #27ae60;
    color: white;
}

#start-simulation:hover {
    background: #219653;
}

#pause-simulation {
    background: #f39c12;
    color: white;
}

#pause-simulation:hover {
    background: #e67e22;
}

#reset-simulation {
    background: #e74c3c;
    color: white;
}

#reset-simulation:hover {
    background: #c0392b;
}

.speed-control {
    display: flex;
    align-items: center;
    gap: 10px;
    color: white;
}

.speed-control select {
    padding: 8px;
    border-radius: 5px;
    border: none;
}

.api-key-section {
    display: flex;
    gap: 10px;
    align-items: center;
}

.api-key-section input {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    width: 200px;
}

.api-key-section button {
    background: #9b59b6;
    color: white;
    padding: 8px 15px;
}

.main-content {
    display: grid;
    grid-template-columns: 1fr 350px;
    height: 70vh;
}

/* 地图样式 */
.map-container {
    position: relative;
    background: #ecf0f1;
    border-right: 3px solid #bdc3c7;
    overflow: hidden;
}

.town-map {
    width: 100%;
    height: 100%;
    position: relative;
    background: 
        radial-gradient(circle at 20% 80%, #87CEEB 0%, #98FB98 100%),
        linear-gradient(145deg, #87CEEB, #98FB98);
    background-blend-mode: overlay;
}

.location {
    position: absolute;
    border: 2px solid #34495e;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.95);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: #2c3e50;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    transition: all 0.3s ease;
    text-align: center;
    padding: 10px;
}

.location:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 16px rgba(0,0,0,0.2);
}

.location-name {
    font-size: 14px;
    font-weight: bold;
}

/* 具体位置定位 */
#town-square {
    top: 15%;
    left: 40%;
    width: 180px;
    height: 100px;
    background: rgba(241, 196, 15, 0.9);
}

#cafe {
    top: 35%;
    left: 65%;
    width: 160px;
    height: 90px;
    background: rgba(230, 126, 34, 0.9);
}

#library {
    top: 55%;
    left: 20%;
    width: 150px;
    height: 130px;
    background: rgba(52, 152, 219, 0.9);
}

#park {
    top: 60%;
    left: 60%;
    width: 200px;
    height: 140px;
    background: rgba(46, 204, 113, 0.9);
}

#market {
    top: 20%;
    left: 10%;
    width: 170px;
    height: 100px;
    background: rgba(155, 89, 182, 0.9);
}

#homes {
    top: 70%;
    left: 80%;
    width: 140px;
    height: 120px;
    background: rgba(149, 165, 166, 0.9);
}

.character-avatar {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    border: 3px solid white;
    box-shadow: 0 3px 8px rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    color: white;
    cursor: pointer;
    transition: all 0.5s ease;
    z-index: 10;
    font-size: 20px;
}

.character-avatar:hover {
    transform: scale(1.3);
    z-index: 100;
    box-shadow: 0 5px 15px rgba(0,0,0,0.5);
}

.character-tooltip {
    position: absolute;
    background: rgba(0,0,0,0.85);
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    font-size: 12px;
    white-space: nowrap;
    z-index: 1000;
    pointer-events: none;
}

.time-display {
    position: absolute;
    top: 15px;
    left: 15px;
    background: rgba(255,255,255,0.95);
    padding: 12px 18px;
    border-radius: 10px;
    box-shadow: 0 3px 10px rgba(0,0,0,0.25);
    border: 2px solid #3498db;
}

#current-time {
    font-size: 1.3em;
    font-weight: bold;
    color: #2c3e50;
}

#weather {
    font-size: 1em;
    color: #7f8c8d;
    margin-top: 5px;
}

/* 侧边栏样式 */
.sidebar {
    background: #f8f9fa;
    padding: 20px;
    overflow-y: auto;
    border-left: 3px solid #bdc3c7;
}

.character-panel h3,
.interaction-panel h3 {
    color: #2c3e50;
    margin-bottom: 15px;
    padding-bottom: 8px;
    border-bottom: 3px solid #3498db;
    font-size: 1.2em;
}

.status-grid {
    display: grid;
    gap: 12px;
}

.character-status-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    border-left: 5px solid #3498db;
    box-shadow: 0 3px 6px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: all 0.3s ease;
}

.character-status-item:hover {
    transform: translateX(8px);
    box-shadow: 0 5px 12px rgba(0,0,0,0.15);
}

.status-name {
    font-weight: bold;
    color: #2c3e50;
    margin-bottom: 8px;
    font-size: 1.1em;
}

.status-details {
    font-size: 0.9em;
    color: #7f8c8d;
    display: flex;
    justify-content: space-between;
}

.status-mood {
    font-style: italic;
    color: #e74c3c;
}

.interaction-log {
    max-height: 300px;
    overflow-y: auto;
    background: white;
    border-radius: 8px;
    padding: 10px;
    border: 1px solid #e9ecef;
}

.interaction-item {
    background: #f8f9fa;
    padding: 12px;
    margin-bottom: 10px;
    border-radius: 8px;
    border-left: 4px solid #e74c3c;
    font-size: 0.9em;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    transition: all 0.2s ease;
}

.interaction-item:hover {
    background: #e9ecef;
    transform: translateX(3px);
}

.interaction-time {
    font-size: 0.8em;
    color: #95a5a6;
    margin-bottom: 5px;
    font-weight: bold;
}

.interaction-content {
    color: #2c3e50;
    line-height: 1.4;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.6);
}

.modal-content {
    background-color: white;
    margin: 3% auto;
    padding: 30px;
    border-radius: 15px;
    width: 85%;
    max-width: 700px;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 15px 40px rgba(0,0,0,0.4);
    border: 3px solid #3498db;
}

.close {
    color: #aaa;
    float: right;
    font-size: 32px;
    font-weight: bold;
    cursor: pointer;
    transition: color 0.3s ease;
}

.close:hover {
    color: #e74c3c;
}

#modal-character-info {
    margin: 25px 0;
}

.character-detail-item {
    margin: 12px 0;
    padding: 10px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #3498db;
}

.memory-item {
    background: #fff3cd;
    margin: 10px 0;
    padding: 12px;
    border-radius: 6px;
    border-left: 4px solid #ffc107;
    font-size: 0.9em;
    line-height: 1.4;
}

/* 动画效果 */
@keyframes float {
    0%, 100% { transform: translateY(0px); }
    50% { transform: translateY(-5px); }
}

.character-avatar {
    animation: float 3s ease-in-out infinite;
}

.character-avatar:nth-child(2n) {
    animation-delay: 0.5s;
}

.character-avatar:nth-child(3n) {
    animation-delay: 1s;
}

/* 响应式设计 */
@media (max-width: 1200px) {
    .main-content {
        grid-template-columns: 1fr;
        height: auto;
    }
    
    .sidebar {
        border-left: none;
        border-top: 3px solid #bdc3c7;
    }
    
    .map-container {
        height: 500px;
    }
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 3px solid #f3f3f3;
    border-top: 3px solid #3498db;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}