/* static/css/style.css 简易版规范 */
:root {
    --primary: #4F46E5;
    --primary-light: #6366f1;
    --primary-dark: #4338ca;
    --text: #1F2937;
    --text-light: #6b7280;
    --bg-card: #ffffff;
    --bg-page: #f8fafc;
    --border: #e5e7eb;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
}

/* 全局重置与基础 */
*, *::before, *::after {
    box-sizing: border-box;
}

body {
    margin: 0;
    padding: 0;
    background: var(--bg-page);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
}

/* 布局容器 - 大屏幕更宽敞 */
.edu-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 24px;
    width: 100%;
}

/* 超大屏幕进一步扩展 */
@media (min-width: 1600px) {
    .edu-container {
        max-width: 1600px;
        padding: 32px 48px;
    }
}

@media (min-width: 1920px) {
    .edu-container {
        max-width: 1800px;
    }
}

/* 响应式网格 */
.edu-grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
}

.edu-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.edu-grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
}

/* 大屏幕网格优化 */
@media (min-width: 1400px) {
    .edu-grid-2 {
        gap: 32px;
    }
    .edu-grid-3 {
        gap: 28px;
    }
}

@media (max-width: 1024px) {
    .edu-grid-3 {
        grid-template-columns: repeat(2, 1fr);
    }
    .edu-grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .edu-grid-2,
    .edu-grid-3,
    .edu-grid-4 {
        grid-template-columns: 1fr;
    }
    
    .edu-container {
        padding: 16px;
    }
    
    /* 移动端：可视化在上，控制面板在下，prompt在最下 */
    .edu-grid-2 {
        display: flex;
        flex-direction: column;
    }
    
    /* 确保可视化部分（lab-stage/visual-stage）在第一位 */
    .edu-grid-2 .lab-stage,
    .edu-grid-2 .visual-stage,
    .edu-grid-2 section[aria-label*="画面"],
    .edu-grid-2 section[aria-label*="舞台"] {
        order: 1;
        width: 100%;
    }
    
    /* 控制面板在第二位 */
    .edu-grid-2 .control-stack,
    .edu-grid-2 section[aria-label*="控制"] {
        order: 2;
        width: 100%;
    }
    
    /* prompt-box 始终在最下面 */
    .prompt-box {
        order: 3;
        margin-top: 16px;
    }
}

/* 组件样式 - 卡片 */
.edu-card {
    background: var(--bg-card);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-md);
    padding: 28px;
    margin-bottom: 24px;
    transition: box-shadow 0.2s ease, transform 0.2s ease;
}

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

@media (min-width: 1400px) {
    .edu-card {
        padding: 36px;
        border-radius: var(--radius-lg);
    }
}

/* 标题样式 */
.edu-title {
    font-size: clamp(1.5rem, 3vw, 2.5rem);
    color: var(--primary);
    margin-bottom: 1rem;
    font-weight: 700;
    line-height: 1.3;
}

.edu-h2 {
    font-size: clamp(1.25rem, 2.5vw, 1.75rem);
    color: var(--text);
    margin-bottom: 0.75rem;
    font-weight: 600;
}

.edu-h3 {
    font-size: clamp(1.1rem, 2vw, 1.35rem);
    color: var(--text);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

/* 文本样式 */
.edu-text {
    font-size: clamp(1rem, 1.5vw, 1.15rem);
    line-height: 1.7;
    color: var(--text);
    margin-bottom: 1rem;
}

.edu-text-sm {
    font-size: 0.9rem;
    color: var(--text-light);
    line-height: 1.5;
}

/* 交互元素 - 按钮 */
.edu-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--primary);
    color: white;
    padding: 12px 24px;
    border-radius: var(--radius-sm);
    border: none;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 600;
    transition: all 0.2s ease;
    text-decoration: none;
}

.edu-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(79, 70, 229, 0.3);
}

.edu-btn:active {
    transform: translateY(0);
}

.edu-btn:disabled {
    background: #d1d5db;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

/* 按钮变体 */
.edu-btn-primary,
.edu-btn.primary {
    background: var(--primary);
    color: white;
}

.edu-btn-secondary,
.edu-btn.secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}

.edu-btn-secondary:hover,
.edu-btn.secondary:hover {
    background: #f3f4f6;
    border-color: #d1d5db;
}

.edu-btn-sm {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.edu-btn-lg {
    padding: 14px 32px;
    font-size: 1.1rem;
}

/* 输入框 */
.edu-input {
    border: 2px solid var(--border);
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    width: 100%;
    font-size: 1rem;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.edu-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* 滑块美化 */
input[type="range"] {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 6px;
    background: #e5e7eb;
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    transition: transform 0.15s ease;
}

input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
}

input[type="range"]::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: var(--primary);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

/* 公式区块 */
.edu-formula {
    background: #f8fafc;
    padding: 20px;
    border-radius: var(--radius-sm);
    margin: 16px 0;
    overflow-x: auto;
    border: 1px solid var(--border);
}

/* 隐藏/显示控制 */
.hidden {
    display: none !important;
}

/* 提示词展示框 */
.prompt-box {
    background-color: #f0fdf4; /* 浅绿色背景 */
    border: 1px solid #bbf7d0; /* 绿色边框 */
    border-radius: var(--radius-sm);
    padding: 20px;
    margin-top: 24px;
    color: #166534; /* 深绿色文字 */
    font-family: 'Courier New', Courier, monospace; /* 等宽字体 */
    position: relative;
}

.prompt-box::before {
    content: "✨ Prompt / 提示词";
    display: block;
    font-weight: bold;
    margin-bottom: 10px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #15803d;
}

/* 移动端 prompt-box 优化 */
@media (max-width: 768px) {
    .prompt-box {
        padding: 16px;
        padding-top: 56px; /* 为按钮留出空间 */
        margin-top: 16px;
        font-size: 0.85rem;
        line-height: 1.5;
    }
    
    .prompt-box::before {
        font-size: 0.8rem;
        margin-bottom: 8px;
    }
    
    /* 移动端复制按钮调整 */
    .prompt-copy-btn,
    .prompt-box button[id*="copy"] {
        position: absolute;
        top: 12px;
        right: 12px;
        font-size: 0.85rem;
        padding: 6px 12px;
        z-index: 10;
    }
}

.lab-stage {
    width: 100%;
    min-height: 420px;
    background: #f9fafb;
    border-radius: var(--radius-md);
    border: 1px solid var(--border);
    overflow: hidden;
    position: relative;
}

.prompt-copy-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    z-index: 5;
    font-family: inherit;
}

/* 动画辅助类 */
.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

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

/* 滚动条美化（WebKit） */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f5f9;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* ========================================
   导航组件
   ======================================== */
nav.edu-container {
    padding: 12px 16px;
}

nav.edu-container .nav-btn {
    display: inline-block;
    background: var(--primary);
    color: #fff;
    padding: 8px 14px;
    border-radius: 10px;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.12);
    transition: transform 0.12s ease, box-shadow 0.12s ease;
}

nav.edu-container .nav-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 26px rgba(79, 70, 229, 0.16);
}

nav.edu-container .nav-btn:active {
    transform: translateY(0);
}

nav.edu-container .nav-btn:focus {
    outline: 3px solid rgba(79, 70, 229, 0.18);
    outline-offset: 2px;
}

@media (max-width: 420px) {
    nav.edu-container .nav-btn {
        padding: 8px 10px;
        border-radius: 8px;
    }
}

/* ========================================
   全局反馈按钮与面板
   ======================================== */
.global-feedback-btn {
    position: fixed;
    bottom: 32px;
    left: 50%;
    border: none;
    border-radius: 999px;
    background: #fff;
    color: #111;
    padding: 16px 34px;
    font-size: 1.1rem;
    letter-spacing: 0.02em;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    box-shadow: 0 18px 48px rgba(17, 17, 17, 0.18);
    transform: translateX(-50%);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    z-index: 9999;
}

.global-feedback-btn:hover {
    transform: translateX(-50%) translateY(-2px);
    box-shadow: 0 26px 60px rgba(17, 17, 17, 0.22);
}

.global-feedback-btn:focus {
    outline: 3px solid rgba(0, 0, 0, 0.2);
    outline-offset: 3px;
}

.feedback-panel {
    position: fixed;
    bottom: calc(32px + 72px);
    left: 50%;
    width: min(460px, calc(100% - 40px));
    background: #ffffff;
    color: #111827;
    border-radius: 18px;
    padding: 22px 26px;
    box-shadow: 0 30px 60px rgba(15, 23, 42, 0.16);
    opacity: 0;
    pointer-events: none;
    transform: translate(-50%, 10px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 9999;
    text-align: left;
}

.feedback-panel.active {
    opacity: 1;
    pointer-events: auto;
    transform: translate(-50%, 0);
}

.feedback-panel h4 {
    margin: 0 0 8px;
    font-size: 1rem;
    font-weight: 700;
}

.feedback-panel p {
    margin: 0 0 6px;
    font-size: 0.95rem;
    line-height: 1.55;
}

.feedback-panel .tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 999px;
    background: #fce96a;
    color: #111;
    font-weight: 700;
    margin-right: 6px;
    margin-bottom: 6px;
}

@media (max-width: 600px) {
    .global-feedback-btn {
        width: auto;
        min-width: 48px;
        padding: 8px 16px;
        font-size: 0.9rem;
        bottom: 18px;
        box-shadow: 0 12px 28px rgba(17, 17, 17, 0.18);
    }

    .feedback-panel {
        width: min(320px, calc(100% - 32px));
        bottom: calc(18px + 56px);
        padding: 18px 20px;
    }
}

/* ========================================
   页面切换与幻灯片
   ======================================== */
.edu-slide {
    display: none;
    animation: fadeIn 0.5s ease-out;
}

.edu-slide.active {
    display: block;
}

/* ========================================
   可视化舞台
   ======================================== */
.visual-stage {
    background: #fff;
    border: 3px solid #eee;
    border-radius: var(--radius-lg);
    padding: 20px;
    min-height: 260px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
}

.visual-stage canvas {
    width: 100% !important;
    height: auto !important;
    border-radius: var(--radius-md);
    display: block;
}

.lab-layout-wide {
    display: grid;
    gap: 32px;
    align-items: flex-start;
    grid-template-columns: minmax(0, 1.5fr) minmax(260px, 0.85fr);
}

@media (max-width: 900px) {
    .lab-layout-wide {
        grid-template-columns: 1fr;
    }
}

/* ========================================
   实验室布局（Lorenz 样式）
   ======================================== */
.control-stack {
    background: #f8fafc;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.hint-text {
    background: #eef2ff;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    color: var(--text);
    font-size: 0.95rem;
    line-height: 1.6;
}

.control-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.control-group label {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.control-group select,
.control-group .edu-input {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 1rem;
    background: #fff;
}

.legend-line {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    font-size: 0.95rem;
    color: var(--text-light);
    margin-top: 12px;
}

.legend-line span::before {
    content: '';
    display: inline-block;
    width: 12px;
    height: 12px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
}

.legend-line span[data-type="hidden"]::before {
    background: #cbd5f5;
}

.legend-line span[data-type="face"]::before {
    background: #fbbf24;
}

.legend-line span[data-type="match"]::before {
    background: #34d399;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 12px;
}

.stat-card {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 12px;
    text-align: center;
    background: var(--bg-card);
}

.stat-card span {
    display: block;
    font-size: 0.85rem;
    color: var(--text-light);
}

.stat-card strong {
    display: block;
    font-size: 1.4rem;
    color: var(--text);
    margin-top: 4px;
}

.message-panel {
    border: 1px dashed var(--border);
    border-radius: var(--radius-md);
    padding: 12px;
    min-height: 48px;
    font-weight: 600;
    color: var(--primary-dark);
    background: #eef2ff;
}

@media (max-width: 768px) {
    .control-stack {
        padding: 16px;
    }
    
    /* 移动端优化：更紧凑的控制面板 */
    .control-group {
        gap: 8px;
    }
    
    .stat-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    /* 移动端按钮全宽 */
    .edu-btn {
        width: 100%;
        padding: 12px;
        font-size: 1rem;
    }
}

/* ========================================
   控制面板
   ======================================== */
.controls-panel {
    background: #f7f1e3;
    padding: 15px;
    border-radius: 15px;
    margin-top: 20px;
    display: flex;
    gap: 20px;
    justify-content: center;
    flex-wrap: wrap;
    align-items: center;
}

.input-wrapper {
    display: flex;
    align-items: center;
    gap: 5px;
    background: white;
    padding: 5px 15px;
    border-radius: 30px;
    box-shadow: var(--shadow-sm);
}

.num-display {
    font-size: 1.3rem;
    font-weight: bold;
    width: 35px;
    text-align: center;
    color: var(--text);
}

/* ========================================
   消息反馈框
   ======================================== */
.msg-box {
    margin-top: 15px;
    padding: 15px;
    border-radius: 10px;
    text-align: center;
    font-weight: bold;
    font-size: 1.1rem;
    display: none;
    animation: fadeIn 0.3s;
}

.msg-correct {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.msg-wrong {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.msg-info {
    background: #e3f2fd;
    color: #0c5460;
    border: 1px solid #bee5eb;
}

/* ========================================
   进度指示器
   ======================================== */
.edu-progress {
    font-size: 0.9rem;
    color: var(--text-light);
    background: #e5e7eb;
    padding: 4px 12px;
    border-radius: 12px;
}

/* ========================================
   头部布局
   ======================================== */
.edu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px dashed var(--border);
    padding-bottom: 15px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 600px) {
    .edu-header {
        flex-direction: column;
        align-items: flex-start;
    }
}

/* ========================================
   按钮变体（游戏风格）
   ======================================== */
.edu-btn.success {
    background: #2ed573;
    box-shadow: 0 4px 0 #26af61;
}

.edu-btn.success:hover {
    background: #26de81;
}

.edu-btn.success:active {
    transform: translateY(3px);
    box-shadow: none;
}

/* 3D 按钮效果 */
.edu-btn-3d {
    background: #FF9F43;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 50px;
    font-size: 1rem;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 0 4px 0 #E67E22;
    transition: all 0.15s ease;
}

.edu-btn-3d:active {
    transform: translateY(3px);
    box-shadow: none;
}

.edu-btn-3d.blue {
    background: #54a0ff;
    box-shadow: 0 4px 0 #2e86de;
}

.edu-btn-3d.green {
    background: #2ed573;
    box-shadow: 0 4px 0 #26af61;
}