/* 全局样式 - Apple Design风格 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Microsoft YaHei', 'Segoe UI', Tahoma, sans-serif;
    background-color: #f5f5f7;
    color: #1d1d1f;
    line-height: 1.47059;
    font-weight: 400;
    letter-spacing: -0.022em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* 开始界面样式 - Apple Design风格 */
.start-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #f5f5f7;
    background-image: linear-gradient(to bottom, #f5f5f7, #e5e5e7);
}

.start-card {
    max-width: 480px;
    width: 100%;
    padding: 2.5rem;
    border-radius: 20px;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.08);
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(209, 213, 219, 0.3);
    transition: transform 0.3s cubic-bezier(0.42, 0, 0.58, 1), box-shadow 0.3s cubic-bezier(0.42, 0, 0.58, 1);
}

.start-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.12);
}

.start-title {
    text-align: center;
    margin-bottom: 2.5rem;
    color: #1d1d1f;
    font-weight: 500;
    letter-spacing: -0.022em;
}

.start-title h1 {
    font-size: 2.5rem;
    margin-bottom: 0.75rem;
    background: linear-gradient(135deg, #0071e3, #42a1ec);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.start-title p {
    font-size: 1.1rem;
    color: #6e6e73;
    max-width: 80%;
    margin: 0 auto;
}

.form-group {
    margin-bottom: 1.75rem;
    text-align: left;
}

.form-control {
    border-radius: 12px;
    padding: 0.75rem 1rem;
    border: 1px solid rgba(0, 0, 0, 0.1);
    background-color: rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
    font-size: 1rem;
}

.form-control:focus {
    border-color: #0071e3;
    box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.2);
    background-color: white;
}

.form-label {
    font-weight: 500;
    margin-bottom: 0.5rem;
    color: #1d1d1f;
    font-size: 0.95rem;
    display: block;
    text-align: center;
}

/* 模拟界面样式 - Apple Design风格 */
.simulation-screen {
    padding: 2rem 0;
    min-height: 100vh;
    background-color: #f5f5f7;
    background-image: linear-gradient(135deg, #f5f5f7 0%, #e8e8ed 100%);
}

.simulation-header {
    margin-bottom: 2.5rem;
    text-align: center;
    padding: 0 1rem;
}

.simulation-header h1 {
    color: #1d1d1f;
    font-weight: 500;
    letter-spacing: -0.022em;
    font-size: 2.2rem;
    margin-bottom: 0.5rem;
}

.simulation-header p {
    color: #6e6e73;
    font-size: 1.1rem;
    max-width: 600px;
    margin: 0 auto;
}

.simulation-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

/* 事件日志样式 - Apple Design风格 */
.event-log {
    max-height: 450px;
    overflow-y: auto;
    padding: 0.75rem;
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.event-log::-webkit-scrollbar {
    width: 6px;
}

.event-log::-webkit-scrollbar-track {
    background: transparent;
}

.event-log::-webkit-scrollbar-thumb {
    background-color: rgba(0, 0, 0, 0.2);
    border-radius: 6px;
}

.event-item {
    padding: 0.85rem 1.1rem;
    border-radius: 14px;
    margin-bottom: 0.85rem;
    background-color: rgba(255, 255, 255, 0.8);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.04);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(209, 213, 219, 0.3);
}

.event-item:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    transform: translateY(-2px);
    background-color: rgba(255, 255, 255, 0.95);
}

.event-item.important {
    border-left: 3px solid #0071e3;
    background-color: rgba(0, 113, 227, 0.05);
}

.event-item p {
    margin-bottom: 0;
    color: #1d1d1f;
    font-size: 0.95rem;
    line-height: 1.4;
}

/* 选择界面 */
.choice-container {
    background-color: rgba(255, 255, 255, 0.9);
    border-radius: 10px;
    padding: 20px;
    margin: 20px 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.choice-prompt {
    font-size: 18px;
    margin-bottom: 15px;
}

.choice-options {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
}

/* 自动选择倒计时 */
.auto-choice-timer {
    margin: 15px 0;
}

.timer-text {
    font-size: 16px;
    color: #ff6b00;
    margin-bottom: 5px;
    text-align: center;
    font-weight: bold;
}

.progress {
    height: 10px;
    border-radius: 5px;
    background-color: #f0f0f0;
    margin-bottom: 15px;
}

.progress-bar {
    transition: width 1s linear;
}

/* 游戏结束样式 - Apple Design风格 */
.game-over-summary {
    padding: 1.75rem;
    background-color: rgba(255, 255, 255, 0.8);
    border-radius: 16px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(209, 213, 219, 0.3);
    line-height: 1.5;
}

.game-over-summary h3 {
    font-weight: 500;
    color: #1d1d1f;
    margin-bottom: 1.5rem;
    letter-spacing: -0.022em;
}

.game-over-summary p {
    margin-bottom: 0.75rem;
    color: #424245;
}

/* 事件弹窗样式 - Apple Design风格 */
.event-modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1050;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1), visibility 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.event-modal-backdrop.show {
    opacity: 1;
    visibility: visible;
}

.event-modal {
    background-color: rgba(255, 255, 255, 0.95);
    border-radius: 16px;
    width: 90%;
    max-width: 480px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.12);
    transform: scale(0.95);
    opacity: 0;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(209, 213, 219, 0.3);
}

.event-modal.show {
    transform: scale(1);
    opacity: 1;
}

.event-modal-header {
    padding: 1.1rem 1.5rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #0071e3, #42a1ec);
    color: white;
    border-top-left-radius: 16px;
    border-top-right-radius: 16px;
}

.close-modal-btn {
    background: none;
    border: none;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.8;
    transition: opacity 0.2s ease;
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.close-modal-btn:hover {
    opacity: 1;
    background-color: rgba(255, 255, 255, 0.1);
}

.event-modal-body {
    padding: 1.75rem;
    font-size: 1rem;
    line-height: 1.5;
    color: #1d1d1f;
}

.event-modal-footer {
    padding: 1.1rem 1.5rem;
    border-top: 1px solid rgba(0, 0, 0, 0.05);
    display: flex;
    justify-content: flex-end;
    background-color: rgba(0, 0, 0, 0.02);
}

/* 人物详情弹窗样式 */
.person-detail-modal {
    max-width: 600px;
}

.person-stats {
    background-color: #f8f9fa;
    border-radius: 10px;
    padding: 15px;
    margin-bottom: 20px;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}

.stat-label {
    font-weight: 500;
    color: #666;
}

.stat-value {
    font-weight: 600;
    color: #333;
}

.person-events {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid #eee;
    border-radius: 10px;
    padding: 10px;
}

.person-event-item {
    display: flex;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
}

.event-age {
    min-width: 50px;
    font-weight: 600;
    color: #007bff;
}

.event-content {
    flex: 1;
}

/* 排行榜项目样式 */
.leaderboard-item .name {
    cursor: pointer;
    transition: color 0.2s;
}

.leaderboard-item .name:hover {
    color: #0056b3 !important;
    text-decoration: underline;
}

/* 卡片样式增强 - Apple Design风格 */
.card {
    border-radius: 12px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.05);
    transition: all 0.3s cubic-bezier(0.42, 0, 0.58, 1);
    border: none;
    overflow: hidden;
    margin-bottom: 1.5rem;
    background-color: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
}

.card-header {
    border-top-left-radius: 12px !important;
    border-top-right-radius: 12px !important;
    padding: 1rem 1.25rem;
    font-weight: 500;
    border-bottom: none;
    background: linear-gradient(135deg, #0071e3, #42a1ec);
}

/* 按钮样式 - Apple Design风格 */
.btn {
    border-radius: 980px; /* Apple的圆角按钮 */
    font-weight: 500;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0.6rem 1.2rem;
    box-shadow: none;
    letter-spacing: -0.01em;
    font-size: 0.95rem;
    border: none;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.1);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.btn:hover::before {
    opacity: 1;
}

.btn:active {
    transform: scale(0.97);
}

.btn-primary {
    background-color: #0071e3; /* Apple蓝 */
    color: white;
}

.btn-primary:hover {
    background-color: #0077ed;
}

.btn-success {
    background-color: #34c759; /* Apple绿 */
    color: white;
}

.btn-success:hover {
    background-color: #30d158;
}

.btn-danger {
    background-color: #ff3b30; /* Apple红 */
    color: white;
}

.btn-danger:hover {
    background-color: #ff453a;
}

.btn-secondary {
    background-color: #6e6e73; /* Apple灰 */
    color: white;
}

.btn-secondary:hover {
    background-color: #86868b;
}

.btn-outline-primary {
    background-color: transparent;
    border: 1px solid #0071e3;
    color: #0071e3;
}

.btn-outline-primary:hover {
    background-color: rgba(0, 113, 227, 0.1);
}

.btn-lg {
    padding: 0.8rem 1.5rem;
    font-size: 1rem;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 排行榜样式 */
.leaderboard {
    background-color: rgba(255, 255, 255, 0.85);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.08);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(209, 213, 219, 0.3);
    max-height: 300px;
    overflow-y: auto;
}

.leaderboard h4 {
    color: #1d1d1f;
    font-weight: 500;
    margin-bottom: 1rem;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    padding: 0.75rem 1rem;
    border-radius: 10px;
    margin-bottom: 0.5rem;
    background-color: rgba(255, 255, 255, 0.7);
    transition: all 0.2s ease;
}

.leaderboard-item:hover {
    background-color: rgba(255, 255, 255, 0.9);
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.05);
}

.leaderboard-item .rank {
    font-weight: bold;
    font-size: 1.2rem;
    color: #0071e3;
    width: 30px;
}

.leaderboard-item .info {
    flex: 1;
}

.leaderboard-item .name {
    font-weight: 500;
    color: #1d1d1f;
}

.leaderboard-item .details {
    font-size: 0.85rem;
    color: #6e6e73;
}

.leaderboard-item .score {
    font-weight: bold;
    color: #0071e3;
    font-size: 1.1rem;
}

/* 时间轴样式 */
.timeline-container {
    position: relative;
    padding-left: 60px; /* 增加左侧padding，为时间轴年龄标签留出空间 */
}

.timeline-container::before {
    content: '';
    position: absolute;
    top: 0;
    bottom: 0;
    left: 48px; /* 调整时间轴位置 */
    width: 2px;
    background-color: rgba(0, 113, 227, 0.3);
    border-radius: 1px;
}

.event-item {
    position: relative;
    padding-left: 25px;
    margin-bottom: 15px; /* 增加事件项之间的间距 */
}

.timeline-dot {
    position: absolute;
    left: -12px;
    top: 15px;
    width: 12px;
    height: 12px;
    background-color: #0071e3;
    border-radius: 50%;
    z-index: 1;
}

.timeline-age {
    position: absolute;
    left: -45px; /* 调整年龄标签位置 */
    top: 12px;
    font-size: 0.8rem;
    font-weight: 500;
    color: #0071e3;
    background-color: rgba(255, 255, 255, 0.9);
    padding: 2px 6px;
    border-radius: 10px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    z-index: 2; /* 确保年龄标签在最上层 */
}

/* 特殊事件样式 */
.event-item.important p {
    color: #0071e3;
    font-weight: 500;
}

.event-item.special-event p {
    color: #ff9500;
    font-weight: 500;
}

.event-item.magical-event p {
    color: #af52de;
    font-weight: 500;
}

.event-item.important .timeline-dot {
    background-color: #0071e3;
    width: 14px;
    height: 14px;
    border: 2px solid white;
}

.event-item.special-event .timeline-dot {
    background-color: #ff9500;
    width: 14px;
    height: 14px;
    border: 2px solid white;
}

.event-item.magical-event .timeline-dot {
    background-color: #af52de;
    width: 14px;
    height: 14px;
    border: 2px solid white;
}

/* 响应式调整 - Apple Design风格 */
@media (max-width: 991.98px) {
    .container {
        padding: 1.25rem;
    }
    
    .card {
        margin-bottom: 1.25rem;
    }
    
    .card-body {
        padding: 1.25rem;
    }
}

@media (max-width: 767.98px) {
    .container {
        padding: 1rem;
    }
    
    .card {
        margin-bottom: 1rem;
        border-radius: 12px;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .event-log {
        max-height: 200px;
    }
    
    .btn {
        padding: 0.4rem 0.75rem;
        font-size: 0.85rem;
    }
    
    h1 {
        font-size: 1.5rem;
    }
    
    h2, h3 {
        font-size: 1.3rem;
    }
    
    .event-item {
        padding: 0.6rem 0.8rem 0.6rem 20px;
        border-radius: 10px;
        margin-bottom: 0.6rem;
        font-size: 0.9rem;
    }
    
    .event-modal {
        width: 95%;
    }
    
    /* 移动端优化 - 卡片式布局 */
    .mobile-panel {
        max-height: none;
        overflow-y: visible;
    }
    
    .mobile-events {
        max-height: none;
    }
    
    .mobile-buttons .btn {
        padding: 0.4rem 0.5rem;
        font-size: 0.8rem;
        white-space: nowrap;
    }
    
    .mobile-info-row {
        margin-top: 0;
    }
    
    .simulation-container {
        padding: 0 0.5rem;
    }
    
    /* 紧凑型卡片布局 */
    .card {
        margin-bottom: 0.75rem;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .card-header {
        padding: 0.6rem 0.75rem;
    }
    
    .progress {
        height: 6px !important;
        margin-bottom: 0.5rem;
    }
    
    .col-12.mb-3 {
        margin-bottom: 0.5rem !important;
    }
}

@media (max-width: 575.98px) {
    .container {
        padding: 0.5rem;
    }
    
    h1 {
        font-size: 1.3rem;
    }
    
    h2, h3 {
        font-size: 1.1rem;
    }
    
    .card-header {
        padding: 0.5rem 0.75rem;
    }
    
    .event-log {
        max-height: 200px;
        padding: 0.5rem;
    }
    
    .timeline-container::before {
        left: 6px;
    }
    
    .timeline-dot {
        left: -10px;
        width: 8px;
        height: 8px;
    }
    
    .timeline-age {
        left: -40px;
        font-size: 0.65rem;
        z-index: 2;
    }
    
    .mobile-buttons .btn {
        padding: 0.35rem 0.4rem;
        font-size: 0.75rem;
    }
    
    /* 更紧凑的布局 */
    .simulation-header {
        margin-bottom: 1rem;
    }
    
    .simulation-header p {
        font-size: 0.9rem;
    }
    
    /* 更多事件指示器 */
    .more-events-indicator {
        text-align: center;
        margin-top: 0.5rem;
        margin-bottom: 0.5rem;
    }
    
    /* 禁用双击缩放 */
    body {
        touch-action: pan-x pan-y;
    }
    
    /* 紧凑型状态面板 */
    .mobile-panel .card-body {
        padding: 0.6rem;
    }
    
    .mobile-panel .progress {
        height: 5px !important;
    }
    
    .mobile-panel .col-12.mb-3 {
        margin-bottom: 0.4rem !important;
    }
    
    .mobile-panel .badge {
        padding: 0.3rem 0.5rem !important;
        font-size: 0.7rem !important;
    }
    
    .mobile-info-row [style*="padding: 0.75rem"] {
        padding: 0.5rem !important;
    }
    
    .mobile-info-row [style*="font-size: 0.85rem"] {
        font-size: 0.7rem !important;
    }
}