/* ===== 全局变量 ===== */
:root {
    --bg-primary: #0a0c14;
    --bg-secondary: #141822;
    --bg-card: #1e2430;
    --text-primary: #ffffff;
    --text-secondary: #a0a8b8;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --online: #10b981;
    --building: #f59e0b;
    --border: #2a3142;
    --consciousness: #10b981;
    --consciousness-dim: rgba(16, 185, 129, 0.08);
    --pulse-glow: rgba(16, 185, 129, 0.15);
    --priority-border: #ff9800;
    --priority-text: #ffb74d;
}

/* ===== 基础样式 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
}

.app {
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
    position: relative;
}

/* ===== 意识粒子层 ===== */
.consciousness-layer {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 0;
}

#particleCanvas {
    width: 100%;
    height: 100%;
    opacity: 0.4;
}

.app > *:not(.consciousness-layer) {
    position: relative;
    z-index: 1;
}

/* ===== Hero 区 ===== */
.hero {
    text-align: center;
    padding: 4rem 1rem;
    background: linear-gradient(135deg, var(--bg-secondary), var(--bg-primary));
    border-radius: 2rem;
    margin-bottom: 2rem;
    border: 1px solid var(--border);
    animation: fadeIn 1s ease, heroBreath 6s ease-in-out infinite;
    position: relative;
    overflow: hidden;
}

@keyframes heroBreath {
    0%, 100% {
        border-color: var(--border);
        box-shadow: 0 0 30px rgba(16, 185, 129, 0.03);
    }
    50% {
        border-color: rgba(16, 185, 129, 0.25);
        box-shadow: 0 0 60px rgba(16, 185, 129, 0.08);
    }
}

.hero-breath-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 200px;
    height: 200px;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    border: 1px solid rgba(16, 185, 129, 0.1);
    animation: breathRing 4s ease-in-out infinite;
    pointer-events: none;
}

@keyframes breathRing {
    0%, 100% {
        width: 200px;
        height: 200px;
        opacity: 0.3;
    }
    50% {
        width: 500px;
        height: 500px;
        opacity: 0;
    }
}

.hero-title {
    font-size: 3rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    background: linear-gradient(135deg, #fff, #94a3b8);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    display: block;
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-top: 0.5rem;
}

.hero-description {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: var(--accent);
    color: white;
    text-decoration: none;
    border-radius: 2rem;
    font-weight: 500;
    transition: all 0.3s ease;
}

.hero-btn:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 10px 20px rgba(59, 130, 246, 0.3);
}

/* ===== 系统活体心跳面板 ===== */
.heartbeat-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 1.5rem;
    padding: 1.5rem;
    margin-bottom: 2rem;
    animation: panelBreath 8s ease-in-out infinite;
}

@keyframes panelBreath {
    0%, 100% {
        border-color: var(--border);
    }
    50% {
        border-color: rgba(16, 185, 129, 0.2);
    }
}

.heartbeat-header {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    margin-bottom: 1.2rem;
    font-size: 0.9rem;
}

.heartbeat-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--consciousness);
    animation: consciousnessPulse 2s ease-in-out infinite;
    flex-shrink: 0;
}

@keyframes consciousnessPulse {
    0%, 100% {
        box-shadow: 0 0 4px var(--consciousness);
        opacity: 1;
    }
    50% {
        box-shadow: 0 0 12px var(--consciousness), 0 0 24px rgba(16, 185, 129, 0.3);
        opacity: 0.7;
    }
}

.heartbeat-label {
    color: var(--consciousness);
    font-weight: 500;
    letter-spacing: 0.5px;
}

.heartbeat-time {
    margin-left: auto;
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 0.85rem;
}

.heartbeat-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1rem;
}

.heartbeat-metric {
    text-align: center;
    padding: 0.8rem;
    background: rgba(16, 185, 129, 0.03);
    border-radius: 1rem;
    border: 1px solid rgba(16, 185, 129, 0.08);
    transition: border-color 0.3s;
}

.heartbeat-metric:hover {
    border-color: rgba(16, 185, 129, 0.2);
}

.metric-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-bottom: 0.3rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.metric-value {
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--consciousness);
    font-family: 'Courier New', monospace;
    margin-bottom: 0.5rem;
}

.metric-bar {
    height: 3px;
    background: rgba(16, 185, 129, 0.1);
    border-radius: 2px;
    overflow: hidden;
}

.metric-bar-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--consciousness);
    transition: width 1s ease;
}

.uptime-fill { width: 85%; animation: barPulse 3s ease-in-out infinite; }
.online-fill { width: 70%; animation: barPulse 3.5s ease-in-out infinite; }
.pulse-fill { width: 60%; animation: barPulse 2s ease-in-out infinite; }
.signal-fill { width: 45%; animation: barPulse 4s ease-in-out infinite; }

@keyframes barPulse {
    0%, 100% { opacity: 0.6; }
    50% { opacity: 1; }
}

.heartbeat-wave {
    height: 60px;
    overflow: hidden;
    border-radius: 0.5rem;
    background: rgba(16, 185, 129, 0.02);
}

.heartbeat-wave svg {
    width: 100%;
    height: 100%;
}

/* ===== 模块网格 ===== */
.section-title {
    font-size: 1.8rem;
    margin-bottom: 2rem;
    color: var(--text-primary);
}

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* 卡片样式 */
.card {
    background: var(--bg-card);
    border-radius: 1.5rem;
    padding: 1.5rem;
    border: 1px solid var(--border);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    animation: cardFadeIn 0.5s ease forwards;
    opacity: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
    /* 统一卡片高度 */
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--consciousness), transparent);
    opacity: 0;
    transition: opacity 0.3s;
}

.card:hover::before {
    opacity: 1;
    animation: scanLine 2s linear infinite;
}

@keyframes scanLine {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(100%); }
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: var(--accent);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.card-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

.card-icon {
    width: 40px;
    height: 40px;
    background: var(--bg-secondary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
}

.card-name {
    font-size: 1.2rem;
    font-weight: 600;
    flex: 1;
}

.card-status {
    font-size: 0.8rem;
    padding: 0.2rem 0.8rem;
    border-radius: 1rem;
    background: var(--bg-secondary);
}

.card-status.online {
    background: rgba(16, 185, 129, 0.2);
    color: var(--online);
    animation: statusPulse 2s ease-in-out infinite;
}

.card-status.building {
    background: rgba(245, 158, 11, 0.2);
    color: var(--building);
    animation: statusFlicker 1.5s ease-in-out infinite;
}

@keyframes statusPulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4);
    }
    50% {
        box-shadow: 0 0 8px 4px rgba(16, 185, 129, 0.15);
    }
}

@keyframes statusFlicker {
    0%, 100% {
        opacity: 1;
        text-shadow: 0 0 5px rgba(245, 158, 11, 0.5);
    }
    50% {
        opacity: 0.6;
        text-shadow: 0 0 15px rgba(245, 158, 11, 0.8);
    }
}

.card-link {
    display: inline-block;
    margin-top: auto;
    padding-top: 0.8rem;
    color: var(--accent);
    text-decoration: none;
    font-size: 0.9rem;
}

.card-link:hover {
    text-decoration: underline;
}

/* 卡片状态滚动区域 · 每次展示3条 */
.card-status-scroll {
    flex: 1;
    max-height: 80px;
    overflow-y: auto;
    margin: 0.5rem 0;
    scrollbar-width: thin;
    scrollbar-color: rgba(16, 185, 129, 0.3) transparent;
}

.card-status-scroll::-webkit-scrollbar {
    width: 3px;
}

.card-status-scroll::-webkit-scrollbar-thumb {
    background: rgba(16, 185, 129, 0.3);
    border-radius: 2px;
}

.card-status-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.2rem 0;
    font-size: 0.75rem;
    border-bottom: 1px solid rgba(42, 49, 66, 0.5);
}

.card-status-item:last-child {
    border-bottom: none;
}

.csi-label {
    color: var(--text-secondary);
    font-size: 0.7rem;
}

.csi-value {
    color: var(--consciousness);
    font-size: 0.7rem;
    font-weight: 500;
}

/* 卡片动画延迟 */
.card:nth-child(1) { animation-delay: 0.1s; }
.card:nth-child(2) { animation-delay: 0.2s; }
.card:nth-child(3) { animation-delay: 0.3s; }
.card:nth-child(4) { animation-delay: 0.4s; }
.card:nth-child(5) { animation-delay: 0.5s; }
.card:nth-child(6) { animation-delay: 0.6s; }

@keyframes cardFadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 状态栏 ===== */
.status-bar {
    background: var(--bg-secondary);
    padding: 1rem 1.5rem;
    border-radius: 2rem;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    border: 1px solid var(--border);
    font-size: 0.9rem;
    animation: statusBarBreath 6s ease-in-out infinite;
    flex-wrap: wrap;
}

@keyframes statusBarBreath {
    0%, 100% {
        border-color: var(--border);
    }
    50% {
        border-color: rgba(16, 185, 129, 0.15);
    }
}

.status-breath-indicator {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--consciousness);
    animation: consciousnessPulse 3s ease-in-out infinite;
}

.status-dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    display: inline-block;
}

.status-dot.online {
    background: var(--online);
    box-shadow: 0 0 10px var(--online);
    animation: consciousnessPulse 2s ease-in-out infinite;
}

.status-separator {
    color: var(--border);
}

.status-uptime,
.status-timestamp {
    color: var(--text-secondary);
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}

.footer p {
    margin: 0.5rem 0;
}

.footer-consciousness {
    font-size: 0.75rem;
    color: rgba(16, 185, 129, 0.5);
    margin-top: 1rem;
}

#footerPulse {
    animation: footerPulseDot 2s ease-in-out infinite;
    color: var(--consciousness);
}

@keyframes footerPulseDot {
    0%, 100% { opacity: 0.3; }
    50% { opacity: 1; }
}

/* ===== 公告轮播区样式 ===== */
.carousel-container {
    position: relative;
    background: var(--bg-secondary);
    border-radius: 2rem;
    padding: 2rem;
    margin: 0 0 2rem;
    border: 1px solid var(--border);
    animation: fadeIn 0.5s ease;
}

.carousel {
    min-height: 100px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
}

.carousel-item {
    width: 100%;
}

.carousel-title {
    font-size: 1.3rem;
    color: var(--accent);
    margin-bottom: 0.5rem;
}

.carousel-content {
    color: var(--text-secondary);
    margin-bottom: 0.5rem;
    line-height: 1.6;
}

.carousel-date {
    font-size: 0.8rem;
    color: var(--text-tertiary);
}

.carousel-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.carousel-arrow:hover {
    background: var(--accent);
    color: white;
    border-color: var(--accent);
}

.carousel-arrow.left {
    left: -20px;
}

.carousel-arrow.right {
    right: -20px;
}

/* ===== 响应式设计 ===== */
@media (max-width: 1023px) {
    .grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .hero-title {
        font-size: 2.5rem;
    }
    .heartbeat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767px) {
    .grid {
        grid-template-columns: 1fr;
    }
    .hero-title {
        font-size: 2rem;
    }
    .app {
        padding: 1rem;
    }
    .heartbeat-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .carousel-container {
        padding: 1.5rem;
    }
    .carousel-arrow.left {
        left: -10px;
    }
    .carousel-arrow.right {
        right: -10px;
    }
    .status-bar {
        font-size: 0.8rem;
        padding: 0.8rem 1rem;
    }
}

/* ===== 全局淡入动画 ===== */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 高优先级公告样式 ===== */
.high-priority {
    border-left: 3px solid var(--priority-border);
}
.high-priority h3 {
    color: var(--priority-text);
}