body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f4f7f9;
    /* 页面背景色 */
    color: #333;
    margin: 0;
}

/* --- 核心布局修改 --- */
.container {
    display: flex;
    gap: 2rem;
    width: 95%;
    max-width: 1200px;
    margin: 0 auto;
    padding-top: 2rem;
    padding-bottom: 0;
    align-items: flex-start;
}

.left-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2rem;
}

/* --- 主内容区样式 --- */
.main-content {
    width: 100%;
}

.controls-panel,
#flashcard-container {
    background: white;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.start-form {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
}

#round-size {
    width: 60px;
    padding: 0.5rem;
    border: 1px solid #ccc;
    border-radius: 4px;
    text-align: center;
}

.card {
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    border-bottom: 1px solid #eee;
    margin-bottom: 1.5rem;
}

#word-display {
    font-size: 3.5rem;
    font-weight: bold;
    color: #1a237e;
    margin: 0;
}

#meaning-display {
    font-size: 1.5rem;
    color: #555;
    margin-top: 1rem;
    opacity: 1;
    transition: opacity 0.3s ease-in-out;
}

/* --- 按钮样式 --- */
button {
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: 4px;
    background-color: #3f51b5;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.2s;
    min-width: 140px;
    text-align: center;
}

button:hover {
    background-color: #303f9f;
}

button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

.button-grid {
    width: 100%;
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-top: 1.5rem;
}

.button-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

#prev-btn {
    order: 2;
}

#new-round-btn {
    order: 1;
}

#progress-indicator {
    font-weight: 500;
    color: #777;
    padding-bottom: 1rem;
}

/* --- 右侧边栏样式 --- */
.history-sidebar {
    flex-basis: 320px;
    flex-shrink: 0;
    background: #ffffff;
    padding: 1.5rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 2rem;
    max-height: calc(100vh - 4rem);
    display: flex;
    flex-direction: column;
}

.history-sidebar h3 {
    margin-top: 0;
    border-bottom: 2px solid #3f51b5;
    padding-bottom: 0.5rem;
    flex-shrink: 0;
}

#history-list {
    flex-grow: 1;
    overflow-y: auto;
    margin: 1rem 0;
}

/* --- 学习记录项样式  --- */
.history-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.75rem 0.5rem;
    border-bottom: 1px solid #f0f0f0;
    transition: background-color 0.2s;
}

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

.history-item .details {
    flex-grow: 1;
}

.history-item .word {
    font-weight: bold;
    transition: color 0.2s;
    /* 为颜色变化添加过渡 */
}

.history-item .meaning {
    color: #666;
    font-size: 0.9em;
}

.history-item.marked .word {
    color: #c62828;
    /* 标记后单词变红 */
}

/* 新增：标记按钮的样式 */
.mark-btn {
    padding: 0.25rem 0.6rem;
    font-size: 0.8rem;
    background-color: #78909c;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    flex-shrink: 0;
    /* 防止按钮被压缩 */
    margin-left: 1rem;
    /* 与左侧内容保持距离 */
    min-width: auto;
    /* 覆盖全局按钮的 min-width */
}

.mark-btn:hover {
    background-color: #546e7a;
}

/* 已标记状态下按钮的样式 */
.history-item.marked .mark-btn {
    background-color: #ef5350;
}

.history-item.marked .mark-btn:hover {
    background-color: #d32f2f;
}

/* --- 学习记录项样式结束 --- */


#history-pagination {
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding-top: 0.75rem;
    border-top: 1px solid #eee;
}

#history-pagination button {
    padding: 0.5rem 1rem;
    background-color: #5c6bc0;
    font-size: 0.9rem;
    min-width: auto;
}

#history-pagination button:hover {
    background-color: #3f51b5;
}

#history-pagination button:disabled {
    background-color: #ccc;
    opacity: 0.6;
    cursor: not-allowed;
}

#history-page-indicator {
    font-size: 0.9em;
    color: #555;
    font-weight: 500;
}


/* --- iFrame 图谱样式 --- */
#graph-iframe-wrapper {
    background: white;
    padding: 1.5rem 2rem 2rem 2rem;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    margin-bottom: 0;
}

#graph-iframe-wrapper h3 {
    text-align: center;
    margin-top: 0;
    margin-bottom: 1rem;
    color: #333;
    font-size: 1.1rem;
}

#word-graph-iframe {
    width: 100%;
    height: 600px;
    border: 1px solid #eee;
    border-radius: 6px;
}


/* --- 通用工具类 --- */
.hidden {
    display: none !important;
}

/* --- 底部链接样式 (最终版 - 紧密挨着，背景统一) --- */
.footer-links {
    color: #555;
    padding: 2rem 0;
    text-align: center;
    margin-top: 0;
    margin-bottom: 0;
    border-top: 1px solid #eee;
    clear: both;
    background-color: #f4f7f9;
}

.footer-links .links-wrapper {
    display: flex;
    justify-content: center;
    gap: 3rem;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

.footer-links a {
    color: #666;
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    transition: color 0.2s ease-in-out;
    position: relative;
}

.footer-links a:hover {
    color: #3f51b5;
}

.footer-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 1px;
    bottom: -3px;
    left: 50%;
    transform: translateX(-50%);
    background-color: #3f51b5;
    transition: width 0.3s ease-out;
}

.footer-links a:hover::after {
    width: 100%;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .container {
        flex-direction: column;
        padding-top: 1rem;
        padding-bottom: 0;
    }

    .left-column {
        width: 100%;
    }

    .history-sidebar {
        position: static;
        width: 100%;
        max-height: none;
        margin-bottom: 0;
        /* 关键：添加 box-sizing: border-box; */
        box-sizing: border-box;
        /* 让 padding 包含在 100% 宽度内 */
    }

    .footer-links .links-wrapper {
        flex-direction: column;
        gap: 0.8rem;
    }

    .footer-links {
        padding: 1.5rem 0;
        margin-top: 0;
    }
}

@media (max-width: 480px) {
    #word-display {
        font-size: 2.5rem;
    }

    #meaning-display {
        font-size: 1.2rem;
    }

    .button-grid {
        flex-direction: column;
        align-items: center;
        gap: 1rem;
    }

    .button-column {
        width: 100%;
        align-items: center;
    }

    button {
        width: 80%;
        min-width: unset;
    }

    #progress-indicator {
        order: 3;
        margin-top: 1rem;
    }
}