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

body {
    font-family: 'Courier New', monospace;
    background-color: #f7fafc;
    color: #111827;
    line-height: 1.6;
    min-height: 100vh;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
}

/* 头部样式 */
.header {
    text-align: center;
    margin-bottom: 30px;
    position: relative;
    margin-top: 50px;
}

.header h1 {
    font-size: 2.5rem;
    color: #111827;
    
}

.header p {
    font-size: 1.1rem;
    color: #6b7280;
    margin-bottom: 20px;
    margin-top: 20px;
}

/* 语言选择器样式 */
.language-selector {
    position: absolute;
    bottom: 0;
    right: 0;
}

.language-select {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 8px 12px;
    font-size: 14px;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 140px;
}

.language-select:hover {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.language-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.language-select option {
    padding: 8px;
}

/* 教学内容区域样式 */
main {
    max-width: 1000px;
    margin: 40px auto;
    padding: 0 20px;
}

main section {
    background: white;
    padding: 30px;
    margin-bottom: 30px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

main section h2 {
    color: #111827;
    font-size: 1.8rem;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

main section p {
    color: #374151;
    line-height: 1.6;
    margin-bottom: 15px;
}

main section ul, main section ol {
    color: #374151;
    line-height: 1.6;
    margin-left: 20px;
}

main section li {
    margin-bottom: 8px;
}

main section dl dt {
    font-weight: bold;
    color: #111827;
    margin-top: 15px;
    margin-bottom: 5px;
}

main section dl dd {
    color: #374151;
    margin-left: 20px;
    margin-bottom: 15px;
    line-height: 1.6;
}

/* 页脚样式 */
footer {
    max-width: 1200px;
    margin: 0 auto;
    padding: 20px;
    text-align: center;
    color: #6b7280;
    border-top: 1px solid #e5e7eb;
}

/* 控制面板样式 */
.controls {
    background: white;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    align-items: end;
}

.input-group {
    display: flex;
    flex-direction: column;
    min-width: 120px;
}

.input-group label {
    font-weight: bold;
    margin-bottom: 5px;
    color: #374151;
}

.input-group input {
    padding: 10px 12px;
    border: 2px solid #d1d5db;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 16px;
    transition: border-color 0.2s;
}

.input-group input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.button-group {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-right: 20px;
}

.btn {
    padding: 10px 10px;
    border: none;
    border-radius: 6px;
    font-family: 'Courier New', monospace;
    font-size: 14px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-primary {
    background-color: #3b82f6;
    color: white;
}

.btn-primary:hover:not(:disabled) {
    background-color: #2563eb;
}

.btn-secondary {
    background-color: #6b7280;
    color: white;
}

.btn-secondary:hover:not(:disabled) {
    background-color: #4b5563;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

/* 错误消息样式 */
.error-message {
    background-color: #fef2f2;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 6px;
    border-left: 4px solid #dc2626;
    margin-bottom: 20px;
    display: none;
}

.error-message.show {
    display: block;
}

/* 主舞台样式 */
.stage {
    background: white;
    padding: 40px;
    border-radius: 12px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-height: 400px;
    display: flex;
    justify-content: center;
    align-items: flex-start;
}

/* 计算容器 - 响应式布局 */
.calculation-container {
    display: flex;
    width: 100%;
    gap: 30px;
    justify-content: center;
    align-items: flex-start;
    position: relative; /* 为浮动按钮提供定位上下文 */
}

.button-group.demo-controls {
    display:flex;
    gap:10px;
    flex-wrap:wrap;
    margin-top:16px;
}

/* 宽屏布局 (桌面端) */
@media (min-width: 1024px) {
    .calculation-container {
        flex-direction: row;
    }
    
    .long-division {
        flex: 0 0 auto;
        min-width: 500px;
        max-width: 600px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .conversion-display {
        flex: 2;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        text-align: center;
    }
    
    .explanation-panel {
        flex: 1;
        width: auto;
        min-width: 300px;
        margin-right: 50px;
    }

    /* 演示区域右侧浮动按钮（桌面端） */
    .step-controls-floating {
        position: absolute;
        right: 10px;
        top: 10px;
        display: flex;
        gap: 10px;
        align-items: center;
        z-index: 5;
        left:10px;
    }
}

/* 移动端布局 */
@media (max-width: 1023px) {
    .calculation-container {
        flex-direction: column;
    }
    
    .long-division {
        width: 100%;
        margin-bottom: 20px;
        display: flex;
        justify-content: center;
        align-items: center;
    }
    
    .conversion-display {
        width: 100%;
        margin-bottom: 20px;
    }
    
    .explanation-panel {
        width: 100%;
        min-width: 300px;
    }
    
    .stage {
        padding: 20px;
    }

    /* 演示区域右侧按钮在移动端回归文档流并右对齐 */
    .step-controls-floating {
        position: static;
        margin: 10px 0;
        display: flex;
        gap: 10px;
        align-items: center;
        justify-content: flex-end;
        left: 8px;
    }
}

/* 说明面板样式 */
.explanation-panel {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    font-size: 16px;
    line-height: 1.5;
}

.explanation-content {
    color: #374151;
}

.explanation-content .step-number {
    color: #3b82f6;
    font-weight: bold;
}

.explanation-content .highlight {
    background-color: #dbeafe;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

.explanation-content .emoji {
    margin-right: 8px;
}

/* 隐藏状态 */
.explanation-panel.hidden {
    display: none;
}

/* 长除法布局 */
.long-division {
    font-size: 24px;
    font-weight: bold;
    position: relative;
    display: flex;
    align-items: flex-start;
    gap: 0px;
}

/* 除数区域 */
.divisor-section {
    display: flex;
    align-items: flex-end;
    position: relative;
    margin-top: 23px; /* 对齐到被除数行 */
}

.divisor-number {
    padding-right: 8px;
}

.division-symbol {
    position: relative;
    width: 15px;
    height: 50px;
}

.division-symbol::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    width: 2px;
    height: 50px;
    background-color: #111827;
}

.division-symbol::after {
    content: '';
    position: absolute;
    left: 2px;
    top: 0;
    width: 13px;
    height: 2px;
    background-color: #111827;
}

/* 主计算区域 */
.calculation-area {
    position: relative;
}

/* 商区域 */
.quotient-row {
    position: relative;
    height: 35px;            /* 改为固定高度 */
    margin-bottom: 5px;
    padding-bottom: 10px;
    line-height: 25px;       /* 确保文字垂直居中 */
}

.quotient-row::after {
    content: '';
    position: absolute;
    left: 0;
    bottom: 10px;
    right: 0;
    height: 2px;
    background-color: #111827;
    
}

.quotient-digit {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    position: relative;
    margin-bottom: 10px;
}

.quotient-digit.spacer {
    visibility: hidden;
}

/* 被除数区域 */
.dividend-row {
    margin-bottom: 10px;
}

.dividend-digit {
    display: inline-block;
    min-width: 30px;
    text-align: center;
    position: relative;
    padding: 5px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.dividend-digit.highlight {
    background-color: #dbeafe;
}

/* 步骤区域 */
.steps-area {
    position: relative;
    margin-top: 10px;
}

.step-row {
    margin-bottom: 25px;
    position: relative;
}

/* 分离数字定位样式 */
.separated-digit {
    position: absolute;
    min-width: 30px;
    text-align: center;
    font-family: "Courier New", monospace;
    font-size: 18px;
}

.product-digit {
    color: #111827;
}

.remainder-digit {
    color: #dc2626;
    font-weight: bold;
}

.bring-down-digit {
    color: #059669;
    font-weight: bold;
}

/* 传统带下数字样式（保持兼容） */
.bring-down-digit.inline {
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

/* 带下步骤样式 */
.bring-down-step {
    margin-bottom: 10px;
}

.bring-down-row {
    position: relative;
    margin-top: 5px;
}

.product-row {
    color: #6b7280;
    position: relative;
    margin-bottom: 3px;
}

.product-digit {
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

.subtraction-line {
    height: 2px;
    background-color: #111827;
    margin: 2px 0;
    position: relative;
    min-width: 30px;
}

.remainder-row {
    font-weight: bold;
    margin-top: 3px;
}

.remainder-digit {
    display: inline-block;
    min-width: 30px;
    text-align: center;
}

/* 小数部分样式 */
.decimal-point {
    color: #3b82f6;
    font-weight: bold;
}

.decimal-digit {
    color: #059669;
}

/* 负数样式 */
.negative {
    color: #dc2626;
}

/* 前导零样式 */
.leading-zero {
    opacity: 0.4;
    font-style: italic;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .container {
        padding: 15px;
    }
    
    .controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .input-group {
        min-width: auto;
    }
    
    .button-group {
        justify-content: center;
        margin-right: 10px;
    }
    
    .long-division {
        font-size: 20px;
    }
    
    .stage {
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .header h1 {
        font-size: 2rem;
    }
    
    .long-division {
        font-size: 18px;
    }
    
    .dividend-digit,
    .quotient-digit,
    .product-digit,
    .remainder-digit {
        min-width: 25px;
    }
}

/* =====教学性内容区====*/

/* ===== 基础样式 ===== */
body {
    font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
    line-height: 1.6;
    background: #f9f9fb;
    color: #333;
    margin: 0;
    padding: 0;
}

.container {
    max-width: 960px;
    margin: 0 auto;
    padding: 20px;
}

h1, h2, h3 {
    font-weight: 600;
    color: #2c3e50;
    margin-bottom: 12px;
}

p {
    margin: 8px 0 16px;
}

ul, ol {
    padding-left: 20px;
    margin: 8px 0 16px;
}

a {
    color: #0073e6;
    text-decoration: none;
}
a:hover {
    text-decoration: underline;
}

/* 小数转分数页面特有样式 */
.conversion-display {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    margin-bottom: 30px;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
}

/* 浮动按钮基础样式（通用） */
.step-controls-floating {
    display: flex;
    gap: 10px;
    align-items: center;
}

.conversion-step {
    text-align: center;
    width: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
}

.conversion-step h3 {
    color: #2563eb;
    font-size: 1.5rem;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 10px;
}

.step-content {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 20px;
}

.fraction-display {
    margin: 30px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.fraction {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    color: #1f2937;
    margin: 0 10px;
}

.numerator {
    padding: 5px 10px;
    text-align: center;
    min-width: 40px;
}

.fraction-line {
    width: 100%;
    height: 3px;
    background-color: #374151;
    margin: 5px 0;
    min-width: 60px;
}

.denominator {
    padding: 5px 10px;
    text-align: center;
    min-width: 40px;
}

.step-details {
    background: #f3f4f6;
    border-radius: 8px;
    padding: 15px;
    margin: 20px 0;
    text-align: left;
}

.step-details p {
    margin: 5px 0;
    font-size: 0.95rem;
}

.step-counter {
    background: #3b82f6;
    color: white;
    padding: 8px 16px;
    border-radius: 20px;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 15px;
}

/* 小数分析显示样式 */
.decimal-analysis {
    text-align: left;
    background: #f8fafc;
    border-radius: 8px;
    padding: 20px;
    margin: 20px 0;
    border-left: 4px solid #3b82f6;
}

.decimal-analysis p {
    margin: 10px 0;
    font-size: 1.1rem;
    color: #374151;
}

.decimal-analysis strong {
    color: #1f2937;
    font-weight: 600;
}

/* 等式显示样式 */
.equation-display {
    margin: 30px 0;
    display: flex;
    justify-content: center;
    align-items: center;
}

.equation-step {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
    justify-content: center;
}

.decimal-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1f2937;
}

.equals {
    font-size: 1.5rem;
    font-weight: bold;
    color: #3b82f6;
    margin: 0 10px;
}

.final-result {
    border: 2px solid #10b981;
    border-radius: 8px;
    padding: 10px;
    background: #f0fdf4;
}

.final-conclusion {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: #f8fafc;
    border-radius: 12px;
    border: 2px solid #3b82f6;
    font-size: 1.2rem;
    font-weight: bold;
}

.final-conclusion .decimal-value {
    font-size: 1.3rem;
    color: #1f2937;
}

.final-conclusion .equals {
    font-size: 1.3rem;
    color: #3b82f6;
}

/* 方程显示样式 */
.equation {
    font-family: 'Courier New', monospace;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    padding: 15px;
    margin: 15px 0;
    font-size: 1.1rem;
    white-space: pre-line;
}

/* 计算过程高亮 */
.highlight {
    background: #fef3c7;
    padding: 2px 4px;
    border-radius: 3px;
    font-weight: bold;
}

/* 错误提示样式增强 */
.error-message {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #dc2626;
    padding: 12px 16px;
    border-radius: 8px;
    margin: 15px 0;
    font-weight: 500;
}

/* 选择框样式 */
select {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 16px;
    color: #374151;
    cursor: pointer;
    transition: all 0.3s ease;
    min-width: 120px;
}

select:hover {
    border-color: #3b82f6;
}

select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

/* 教学内容区域网格布局 */
.content-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 20px;
    margin: 20px 0;
}

.content-card {
    background: white;
    border-radius: 8px;
    padding: 20px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.content-card h4 {
    color: #1f2937;
    margin-bottom: 15px;
    font-size: 1.1rem;
}

.content-card ul {
    margin: 0;
    padding-left: 20px;
}

.content-card li {
    margin: 8px 0;
    font-size: 0.95rem;
}

/* 响应式调整 */
@media (max-width: 768px) {
    .fraction {
        font-size: 1.5rem;
    }
    
    .conversion-display {
        padding: 20px;
    }
    
    .step-content {
        font-size: 1rem;
    }
    
    .content-grid {
        grid-template-columns: 1fr;
    }
}

