/* MD3 核心变量定义 */
:root {
    --md-sys-color-primary: #006495;
    --md-sys-color-on-primary: #ffffff;
    --md-sys-color-primary-container: #cbe6ff;
    --md-sys-color-on-primary-container: #001e30;
    --md-sys-color-surface: #fcfcff;
    --md-sys-color-on-surface: #191c1e;
    --md-sys-color-surface-variant: #dee3eb;
    --md-sys-color-on-surface-variant: #42474e;
    --md-sys-color-outline: #72777f;
    --md-sys-color-error: #ba1a1a;
}

/* 基础布局 */
body {
    background-color: var(--md-sys-color-surface);
    color: var(--md-sys-color-on-surface);
    font-family: 'Roboto', 'Segoe UI', system-ui, -apple-system, sans-serif;
    margin: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

/* 顶部 Header */
header {
    width: 100%;
    padding: 48px 24px;
    background-color: var(--md-sys-color-primary-container);
    text-align: center;
    border-bottom-left-radius: 32px;
    border-bottom-right-radius: 32px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
    box-sizing: border-box;
}

header h1 {
    margin: 0;
    font-size: 2.5rem;
    color: var(--md-sys-color-primary);
    font-weight: 700;
}

header p {
    margin-top: 12px;
    color: var(--md-sys-color-on-primary-container);
    font-size: 1.1rem;
}

/* 主容器 */
main {
    width: 90%;
    max-width: 800px;
    margin: 32px 0;
}

/* 通用 MD3 卡片样式 */
.card {
    background-color: var(--md-sys-color-surface);
    border: 1px solid var(--md-sys-color-outline);
    border-radius: 28px; /* MD3 标准圆角 */
    padding: 24px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s ease-in-out;
}

.card-title {
    font-size: 1.25rem;
    font-weight: 500;
    margin-bottom: 16px;
    color: var(--md-sys-color-primary);
}

/* 监控专用卡片 */
.monitor-card {
    background-color: var(--md-sys-color-primary-container);
    border: none;
}

.monitor-value {
    font-size: 4rem;
    font-weight: 700;
    margin: 8px 0;
    color: var(--md-sys-color-on-primary-container);
    letter-spacing: -0.02em;
}

.stat-group {
    display: flex;
    gap: 16px;
    margin-top: 12px;
}

.stat-badge {
    background: rgba(255,255,255,0.4);
    padding: 10px 20px;
    border-radius: 16px;
    flex: 1;
}

.stat-label {
    font-size: 0.8rem;
    color: var(--md-sys-color-on-surface-variant);
    display: block;
    margin-bottom: 4px;
}

.stat-number {
    color: var(--md-sys-color-primary);
    font-size: 1.2rem;
    font-weight: 700;
}

/* 导航网格 */
.link-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.nav-button {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background-color: var(--md-sys-color-primary);
    color: var(--md-sys-color-on-primary);
    text-decoration: none;
    border-radius: 16px;
    font-weight: 500;
    transition: filter 0.2s;
}

.nav-button:hover {
    filter: brightness(1.1);
}

#theme-toggle {
    position: fixed;
    top: 24px;
    right: 24px;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 12px;
    border: none;
    background-color: var(--md-sys-color-primary-container);
    color: var(--md-sys-color-primary);
    cursor: pointer;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1000;
}

#theme-toggle svg {
    width: 24px;
    height: 24px;
    transition: transform 0.5s ease;
}

/* 模式切换时的图标显隐逻辑 */
body.dark-mode .sun-icon { display: none; }
body.dark-mode .moon-icon { display: block; }
body.dark-mode #theme-toggle {
    background-color: #354a5e;
    color: #cbe6ff;
}

/* 点击时的旋转动效 */
#theme-toggle:active svg {
    transform: rotate(45deg);
}

/* 暗黑模式色彩覆盖 */
body.dark {
  --md-sys-color-primary: #d0e4ff;
  --md-sys-color-on-primary: #003258;
  --md-sys-color-primary-container: #00497d;
  --md-sys-color-on-primary-container: #d1e4ff;
  --md-sys-color-surface: #1a1c1e;
  --md-sys-color-on-surface: #e2e2e6;
  --md-sys-color-surface-variant: #43474e;
  --md-sys-color-on-surface-variant: #c3c7cf;
  --md-sys-color-outline: #8d9199;
}

/* 按钮图标切换 */
#theme-toggle {
  position: fixed;
  top: 24px;
  right: 24px;
  background: var(--md-sys-color-primary-container);
  border: none;
  padding: 12px;
  border-radius: 50%;
  cursor: pointer;
  z-index: 1000;
}
body.dark .sun-icon { display: none; }
body.dark .moon-icon { display: inline-block !important; }