:root {
    /* 主色 */
    --color-primary: #1a3b54;
    --color-primary-hover: #0f2c40;
    --color-primary-active: #0a1f2e;

    /* 成功/答案色 */
    --color-success: #4a7a5c;
    --color-success-hover: #3a624a;
    --color-success-active: #2d4d3a;

    /* 文本 */
    --color-text: #000000;
    --color-text-light: #7a8fa0;
    --color-text-muted: #99aabb;
    --color-heading: #1a2a3a;

    /* 边框 / 背景 */
    --color-border: #f0f3f6;
    --color-border-dashed: #e8ecf0;
    --color-bg-soft: #f8fafc;
    --color-bg-hover: #f0f5fb;
    --color-active-bg: #b5d9fd;
    --color-tag-bg: #f4f8fe;
    --color-badge-bg: #eef3f9;
    --color-badge-text: #2c5775;
    --color-danger: #c74a3a;

    /* 圆角 */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --radius-pill: 20px;

    /* 阴影 */
    --shadow-card: 0 20px 60px rgba(0, 0, 0, 0.08);
    --shadow-card-hover: 0 25px 70px rgba(0, 0, 0, 0.10);
    --shadow-btn: 0 4px 16px rgba(26, 59, 84, 0.25);
    --shadow-btn-hover: 0 8px 24px rgba(26, 59, 84, 0.30);
    --shadow-btn-active: 0 2px 8px rgba(26, 59, 84, 0.20);
    --shadow-soft-hover: 0 6px 20px rgba(0, 0, 0, 0.08);
    --shadow-soft-active: 0 2px 8px rgba(0, 0, 0, 0.12);

    /* 玻璃面板 */
    --panel-bg: rgba(255, 255, 255, 0.1);
    --panel-border: 1px solid rgba(255, 255, 255, 0.5);
    --panel-blur: blur(10px);

    /* 背景图 */
    --bg-image: url("../images/bg.png");
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;

    background: var(--bg-image) center / cover no-repeat fixed;
    background-color: #f5f7fa;

    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: var(--color-text);
}

/* ============================================================
   容器 & 主布局
   ============================================================ */
.container {
    width: 100%;
    max-width: 1800px;
    height: 100dvh;
    max-height: 900px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    padding: 10px;
}

.main-layout {
    width: 100%;
    height: 100%;
    display: flex;
    gap: 12px;
    align-items: stretch;
}

/* ============================================================
   左侧信息面板
   ============================================================ */
.left-panel {
    width: 180px;
    min-width: 140px;
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-self: stretch;
    overflow-y: auto;
    justify-content: flex-start;
    align-items: center;

    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: var(--panel-border);
    backdrop-filter: var(--panel-blur);
    -webkit-backdrop-filter: var(--panel-blur);
    scrollbar-width: thin;
    scrollbar-color: rgba(45, 63, 84, 0.25) transparent;
}
.left-panel::-webkit-scrollbar {
    width: 6px;
}
.left-panel::-webkit-scrollbar-thumb {
    background: rgba(45, 63, 84, 0.25);
    border-radius: 3px;
}
.left-panel::-webkit-scrollbar-track {
    background: transparent;
}

.left-panel .info-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    align-items: center;
}

.left-panel .info-group .group-label {
    font-size: 20px;
    color: var(--color-text);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 8px;
    background: #f5f7fa;
    border-radius: var(--radius-sm);
    text-align: center;
    width: 100%;
}

.left-panel .info-item {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 6px 8px;
    background: var(--color-bg-soft);
    border-radius: var(--radius-sm);
    border: 1px solid var(--color-border);
    transition: background 0.2s ease, border-color 0.2s ease,
    color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
    cursor: pointer;
    width: 100%;
}

.left-panel .info-item:hover {
    background: var(--color-bg-hover);
    border-color: #d0dce8;
}

.left-panel .info-item.active {
    background-color: var(--color-active-bg);
    color: #fff;
    box-shadow: 0 4px 12px rgba(181, 217, 253, 0.5);
    transform: translateX(4px);
}
.left-panel .info-item.active .label {
    color: #1a3b54;
}

.left-panel .info-item .label {
    font-size: 15px;
    color: var(--color-text);
    font-weight: 600;
    text-align: center;
    transition: color 0.2s ease;
}

.left-panel .rush-group {
    margin-top: 4px;
    padding-top: 8px;
    border-top: 2px dashed var(--color-border-dashed);
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.left-panel .rush-group:first-child {
    margin-top: 0;
    padding-top: 0;
    border-top: none;
}

/* ============================================================
   中间主内容
   ============================================================ */
.main-content {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.data-card {
    width: 100%;
    height: 100%;
    padding: 12px 18px;
    transition: box-shadow 0.3s ease;
    display: grid;
    place-items: center;
    overflow-y: auto;

    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: var(--panel-border);
    backdrop-filter: var(--panel-blur);
    -webkit-backdrop-filter: var(--panel-blur);

    scrollbar-width: thin;
    scrollbar-color: rgba(45, 63, 84, 0.25) transparent;
}
.data-card::-webkit-scrollbar {
    width: 8px;
}
.data-card::-webkit-scrollbar-thumb {
    background: rgba(45, 63, 84, 0.25);
    border-radius: 4px;
}
.data-card::-webkit-scrollbar-track {
    background: transparent;
}

.data-card:hover {
    box-shadow: var(--shadow-card-hover);
}

/* ============================================================
   右侧控制面板
   ============================================================ */
.right-panel {
    width: 130px;
    min-width: 130px;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-self: stretch;
    justify-content: space-between;

    background: var(--panel-bg);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: var(--panel-border);
    backdrop-filter: var(--panel-blur);
    -webkit-backdrop-filter: var(--panel-blur);
}

/* ============================================================
   按钮组
   ============================================================ */
.button-group {
    display: flex;
    flex-direction: column;
    gap: 10px;
    width: 100%;
}
.button-group-center {
    margin-top: auto;
}
.button-group-bottom {
    margin-top: auto;
    width: 100%;
}

/* ============================================================
   通用按钮样式
   ============================================================ */
.action-button {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0 16px;
    border: none;
    border-radius: var(--radius-md);
    font-size: 20px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.25s ease, box-shadow 0.25s ease,
    opacity 0.2s ease;
    background: #f5f7fa;
    color: var(--color-text);
    width: 100%;
    height: 48px;
    min-height: 48px;
    max-height: 48px;
    white-space: nowrap;
    box-sizing: border-box;
    flex-shrink: 0;
    transform: none !important;
    backface-visibility: hidden;
    overflow: hidden;
    position: relative;
}

.action-button span {
    flex-shrink: 0;
    display: inline-block;
    line-height: 1;
}

.action-button:hover,
.action-button:active,
.action-button:focus {
    transform: none !important;
}

.action-button:hover:not(:disabled) {
    box-shadow: var(--shadow-soft-hover);
}

.action-button:active:not(:disabled) {
    box-shadow: var(--shadow-soft-active);
}

.action-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ---- 刷新按钮 ---- */
.refresh-button {
    background: var(--color-primary);
    color: white;
    box-shadow: var(--shadow-btn);
}
.refresh-button:hover:not(:disabled) {
    background: var(--color-primary-hover);
    box-shadow: var(--shadow-btn-hover);
}
.refresh-button:active:not(:disabled) {
    background: var(--color-primary-active);
    box-shadow: var(--shadow-btn-active);
}
.refresh-button:disabled {
    opacity: 0.75;
    cursor: wait;
}
.refresh-button:disabled::after {
    content: none;
    animation: none;
    display: none;
}

/* ---- 查看答案按钮 ---- */
.answer-button {
    background: var(--color-success);
    color: white;
    box-shadow: 0 4px 16px rgba(74, 122, 92, 0.25);
}
.answer-button:hover:not(:disabled) {
    background: var(--color-success-hover);
    box-shadow: 0 8px 24px rgba(74, 122, 92, 0.30);
}
.answer-button:active:not(:disabled) {
    background: var(--color-success-active);
    box-shadow: 0 2px 8px rgba(74, 122, 92, 0.20);
}

/* ---- 清理缓存按钮 ---- */
#clear-btn {
    background: rgba(255, 255, 255, 0.3);
    color: var(--color-text);
}
#clear-btn:hover:not(:disabled) {
    background: var(--color-border-dashed);
    box-shadow: var(--shadow-soft-hover);
}
#clear-btn:active:not(:disabled) {
    box-shadow: var(--shadow-soft-active);
}

/* ============================================================
   加载状态
   ============================================================ */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    color: #8899aa;
    width: 100%;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--color-border-dashed);
    border-top-color: #3a7eb0;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-bottom: 25px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ============================================================
   数据项 & 题目
   ============================================================ */
.data-item {
    width: 100%;
    max-width: 1600px;
    align-self: start;
    animation: fadeIn 0.4s ease;
}

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

.question-title {
    font-size: 30px;
    font-weight: 600;
    color: var(--color-heading);
    line-height: 1.6;
    padding-bottom: 8px;
    border-bottom: 2px solid #f0f4f8;
}

.question-title .type-badge {
    display: inline-block;
    background: var(--color-badge-bg);
    color: var(--color-badge-text);
    font-size: 20px;
    font-weight: 500;
    padding: 2px 14px;
    border-radius: var(--radius-pill);
    margin-right: 12px;
}

/* ============================================================
   选项列表
   ============================================================ */
.options-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin: 16px 0 20px 0;
}

.option-item {
    display: flex;
    align-items: flex-start;
    padding: 8px 16px;
    background: var(--color-bg-soft);
    border-radius: var(--radius-md);
    transition: background 0.2s ease, border-color 0.2s ease;
    border: 1px solid var(--color-border);
}
.option-item:hover {
    background: var(--color-bg-hover);
    border-color: #d0dce8;
}

.option-label {
    font-weight: 600;
    color: #3a7eb0;
    margin-top: 2px;
    margin-right: 12px;
    min-width: 28px;
    flex-shrink: 0;
    font-size: 20px;
}

.option-text {
    color: var(--color-text);
    line-height: 1.5;
    font-size: 20px;
}

.no-options {
    color: var(--color-text-muted);
    font-style: italic;
    padding: 10px 0;
}

/* ============================================================
   元数据标签 & 答案
   ============================================================ */
.meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 16px;
    padding-top: 12px;
    border-top: 1px dashed var(--color-border-dashed);
}

.answer-container {
    display: flex;
    align-items: center;
}

/* 答案显示样式 */
.answer-display {
    display: inline-block;
    color: red;
    padding: 4px 16px;
    border-radius: 20px;
    font-weight: 600;
    font-size: 25px;
    animation: fadeIn 0.3s ease;
}

/* ============================================================
   错误状态
   ============================================================ */
.error {
    text-align: center;
    padding: 30px 20px;
}
.error h2 {
    color: var(--color-danger);
    font-size: 22px;
    margin-bottom: 12px;
}
.error p {
    color: #667888;
    line-height: 1.6;
}

/* ============================================================
   响应式适配
   ============================================================ */

/* 中等屏（笔记本） */
@media (max-width: 1200px) {
    .left-panel {
        width: 150px;
        padding: 16px 12px;
    }
    .right-panel {
        width: 110px;
        padding: 14px 10px;
    }
    .question-title {
        font-size: 24px;
    }
    .question-title .type-badge {
        font-size: 17px;
    }
    .option-text {
        font-size: 18px;
    }
    .action-button {
        font-size: 17px;
        height: 44px;
        min-height: 44px;
        max-height: 44px;
    }
    .answer-display {
        font-size: 20px;
    }
}

/* 小屏 / 平板：改为上下布局 */
@media (max-width: 900px) {
    .container {
        height: auto;
        max-height: none;
        padding: 8px;
    }
    .main-layout {
        flex-direction: column;
        gap: 10px;
    }
    .left-panel,
    .right-panel {
        width: 100%;
        min-width: 0;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 8px;
        padding: 10px;
        overflow-x: auto;
        overflow-y: hidden;
        align-self: auto;
    }
    .left-panel .rush-group {
        margin-top: 0;
        padding-top: 0;
        border-top: none;
        width: auto;
        flex-direction: row;
        gap: 6px;
    }
    .left-panel .info-group {
        flex-direction: row;
        width: auto;
        gap: 6px;
    }
    .left-panel .info-item,
    .left-panel .info-group .group-label {
        width: auto;
        white-space: nowrap;
    }
    .right-panel {
        justify-content: center;
    }
    .button-group,
    .button-group-center,
    .button-group-bottom {
        flex-direction: row;
        margin-top: 0;
        width: auto;
    }
    .action-button {
        width: auto;
        padding: 0 20px;
    }
    .main-content {
        min-height: 60vh;
    }
    .data-card {
        padding: 16px;
    }
    .question-title {
        font-size: 20px;
    }
    .option-text {
        font-size: 16px;
    }
    .option-label {
        width: 28px;
        height: 28px;
        font-size: 16px;
    }
    .answer-display {
        font-size: 18px;
    }
}

/* 移动端：关闭 fixed 背景，避免抖动 */
@media (max-width: 768px) {
    body {
        background-attachment: scroll;
    }
}

/* 大屏加宽留白 */
@media (min-width: 1800px) {
    .container {
        max-width: 1900px;
    }
    .question-title {
        font-size: 32px;
    }
    .option-text {
        font-size: 22px;
    }
}