/* 全局重置 */
body {
    background-color: #121212; /* 深黑背景 */
    color: #ffffff;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    min-height: 100vh;
}

header {
    margin-top: 50px;
    margin-bottom: 40px;
    padding: 0 20px;
    text-align: center;
}

h1 { 
    font-weight: 700; 
    text-shadow: 0 0 15px rgba(255,255,255,0.15);
    letter-spacing: 1px;
    margin-bottom: 20px;
}

/* --- 开关控件样式 (新增) --- */
.control-panel {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 12px;
    margin-top: 15px;
}

.switch-label {
    font-size: 0.95em;
    color: #ccc;
    user-select: none; /* 防止双击选中文字 */
}

/* Switch 本体 */
.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input { 
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: #444; /* 关闭时的深灰底色 */
    transition: .4s;
    border-radius: 34px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 16px;
    width: 16px;
    left: 4px;
    bottom: 4px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #4CAF50; /* 开启时的绿色 */
}

input:checked + .slider:before {
    transform: translateX(26px);
}

/* --- 布局容器 --- */
.grid-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 25px;
    width: 90%;
    max-width: 1200px;
    padding-bottom: 50px;
}

.loading-text {
    grid-column: 1 / -1;
    text-align: center;
    color: #666;
    margin-top: 50px;
}

/* --- 卡片样式 --- */
.card {
    border-radius: 16px;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.25s ease, box-shadow 0.25s ease;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
    display: flex;
    flex-direction: column;
    position: relative;
    border: 1px solid rgba(255,255,255,0.05);
    background-color: #1e1e1e; /* 卡片本身背景 */
}

.card:hover {
    transform: translateY(-8px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0,0,0,0.5);
    z-index: 10;
}

/* 封面图 */
.cover-img {
    width: 100%;
    aspect-ratio: 1/1; /* 强制正方形，即使没有图片也占位 */
    background-color: #2a2a2a; /* 没图时的深色占位背景 */
    object-fit: cover;
    display: block;
    position: relative;
}

/* 文字区域 */
.info {
    padding: 16px;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

/* 统一字体样式 */
.chart-text {
    color: #ffffff;
    font-size: 1.1em;
    line-height: 1.5;
    font-weight: 600; 
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.chart-id {
    opacity: 0.95; 
}

.chart-name {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* --- 弹窗样式 --- */
.modal-overlay {
    display: none; /* 默认隐藏 */
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.9);
    backdrop-filter: blur(10px);
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

.modal-box {
    background: #1e1e1e;
    padding: 30px;
    border-radius: 20px;
    text-align: center;
    max-width: 320px;
    width: 85%;
    box-shadow: 0 25px 50px rgba(0,0,0,0.8);
    border: 1px solid #333;
    animation: popIn 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    from { transform: scale(0.8); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.modal-title { margin: 0 0 10px 0; font-size: 1.5em; color: #fff; }
.sub-text { font-size: 0.9em; color: #aaa; margin: 0 0 20px 0; }

.qr-container {
    background: #fff;
    padding: 10px;
    border-radius: 12px;
    margin: 0 auto 20px auto;
    width: 200px;
    height: 200px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.qr-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.timer-text { 
    font-size: 1.2em; 
    color: #4CAF50; 
    font-weight: bold; 
}