/* ============================================================
   SolidPhysics Virtual Lab — Module System
   通用模块样式 · 卡片入口 · 参数控件 · 录屏模式
   ============================================================ */

/* ---------- 首页 3 卡片入口 ---------- */
.module-entry {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 48px;
    padding: 40px;
    background: radial-gradient(ellipse at 50% 30%, #0a1628 0%, #050510 100%);
}

.module-entry-title {
    text-align: center;
    margin-bottom: 8px;
}
.module-entry-title h1 {
    font-size: 20px;
    font-weight: 700;
    color: #e2e8f0;
    letter-spacing: 4px;
}
.module-entry-title p {
    font-size: 13px;
    color: #64748b;
    letter-spacing: 2px;
    margin-top: 6px;
}

.module-cards {
    display: flex;
    gap: 28px;
    flex-wrap: wrap;
    justify-content: center;
}

.module-card {
    width: 300px;
    height: 360px;
    border-radius: 20px;
    position: relative;
    cursor: pointer;
    overflow: hidden;
    background: rgba(10, 20, 40, 0.4);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid rgba(59, 130, 246, 0.12);
    transition: all 0.5s cubic-bezier(0.16, 1, 0.3, 1);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 24px;
    text-align: center;
}

.module-card:hover {
    transform: translateY(-8px) scale(1.02);
    border-color: rgba(59, 130, 246, 0.3);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5), 0 0 80px rgba(59, 130, 246, 0.06);
}

.module-card:active {
    transform: translateY(-2px) scale(0.98);
}

.module-card-glow {
    position: absolute;
    inset: 0;
    opacity: 0;
    transition: opacity 0.5s ease;
    pointer-events: none;
}

.module-card:hover .module-card-glow {
    opacity: 1;
}

.module-card-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
    transition: all 0.5s ease;
}

.module-card:hover .module-card-icon {
    transform: scale(1.1);
}

.module-card h2 {
    font-size: 22px;
    font-weight: 700;
    color: #f0f4ff;
    letter-spacing: 3px;
    position: relative;
    z-index: 1;
    margin-bottom: 4px;
}

.module-card .card-en {
    font-size: 11px;
    color: #64748b;
    letter-spacing: 2px;
    text-transform: uppercase;
    margin-bottom: 14px;
    position: relative;
    z-index: 1;
}

.module-card .card-desc {
    font-size: 13px;
    color: #94a3b8;
    line-height: 1.6;
    position: relative;
    z-index: 1;
}

.module-card .card-badge {
    position: absolute;
    top: 16px;
    right: 16px;
    font-size: 10px;
    padding: 3px 10px;
    border-radius: 999px;
    color: #94a3b8;
    border: 1px solid rgba(255, 255, 255, 0.06);
    background: rgba(0, 0, 0, 0.2);
    letter-spacing: 1px;
    z-index: 1;
}

/* 卡片 1: 晶格世界 */
.card-crystal .module-card-icon {
    background: rgba(59, 130, 246, 0.12);
    border: 1px solid rgba(59, 130, 246, 0.2);
}
.card-crystal .module-card-glow {
    background: radial-gradient(ellipse at 50% 0%, rgba(59, 130, 246, 0.08), transparent 70%);
}

/* 卡片 2: 电子世界 */
.card-electron .module-card-icon {
    background: rgba(139, 92, 246, 0.12);
    border: 1px solid rgba(139, 92, 246, 0.2);
}
.card-electron .module-card-glow {
    background: radial-gradient(ellipse at 50% 0%, rgba(139, 92, 246, 0.08), transparent 70%);
}

/* 卡片 3: 双能带异质结 */
.card-heterojunction .module-card-icon {
    background: rgba(6, 182, 212, 0.12);
    border: 1px solid rgba(6, 182, 212, 0.2);
}
.card-heterojunction .module-card-glow {
    background: radial-gradient(ellipse at 50% 0%, rgba(6, 182, 212, 0.08), transparent 70%);
}

/* ---------- 模块通用布局 ---------- */
.module-overlay {
    position: fixed;
    inset: 0;
    z-index: 300;
    display: none;
    flex-direction: column;
    background: radial-gradient(ellipse at 30% 20%, #0a1628, #050510);
    animation: modIn 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.module-overlay.active { display: flex; }

@keyframes modIn {
    from { opacity: 0; transform: scale(0.96); }
    to { opacity: 1; transform: scale(1); }
}

.module-overlay.recording .mod-header,
.module-overlay.recording .mod-sidebar,
.module-overlay.recording .mod-toolbar { display: none !important; }
.module-overlay.recording .mod-main { grid-template-columns: 1fr !important; }

.mod-header {
    display: flex;
    align-items: center;
    padding: 10px 20px;
    background: rgba(10, 14, 26, 0.6);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(59, 130, 246, 0.08);
    flex-shrink: 0;
    gap: 14px;
    z-index: 10;
}

.mod-back {
    padding: 5px 16px;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.15);
    background: rgba(59, 130, 246, 0.05);
    color: #94a3b8;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.3s;
}
.mod-back:hover {
    background: rgba(59, 130, 246, 0.12);
    color: #e2e8f0;
    border-color: rgba(59, 130, 246, 0.3);
}

.mod-title {
    flex: 1;
    font-size: 15px;
    font-weight: 600;
    color: #e2e8f0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.mod-title span { color: #64748b; font-weight: 400; font-size: 12px; }

.mod-record-btn {
    padding: 5px 14px;
    border-radius: 6px;
    border: 1px solid rgba(239, 68, 68, 0.2);
    background: rgba(239, 68, 68, 0.06);
    color: #ef4444;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 6px;
}
.mod-record-btn:hover {
    background: rgba(239, 68, 68, 0.12);
    border-color: rgba(239, 68, 68, 0.35);
}
.mod-record-btn .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: #ef4444;
    animation: recPulse 1.5s ease-in-out infinite;
}

@keyframes recPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* ---------- 模块主体 ---------- */
.mod-body {
    flex: 1;
    display: grid;
    grid-template-columns: 220px 1fr;
    gap: 0;
    overflow: hidden;
    position: relative;
}

/* 左侧参数面板 */
.mod-sidebar {
    background: rgba(10, 14, 26, 0.35);
    backdrop-filter: blur(6px);
    padding: 16px;
    overflow-y: auto;
    border-right: 1px solid rgba(42, 58, 92, 0.15);
    flex-shrink: 0;
}

.mod-sidebar-label {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #3b82f6;
    margin-bottom: 14px;
}

.mod-ctrl-group {
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid rgba(42, 58, 92, 0.12);
}
.mod-ctrl-group:last-child { border-bottom: none; margin-bottom: 0; }

.mod-ctrl-label {
    font-size: 11px;
    color: #94a3b8;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
}
.mod-ctrl-label .val { color: #60a5fa; font-weight: 600; }

/* 自定义滑块 */
input[type="range"] {
    -webkit-appearance: none;
    width: 100%;
    height: 4px;
    border-radius: 2px;
    background: rgba(59, 130, 246, 0.15);
    outline: none;
    transition: background 0.3s;
}
input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b82f6;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
    transition: all 0.2s;
}
input[type="range"]::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}
input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #3b82f6;
    border: none;
    cursor: pointer;
}

/* 选择按钮组 */
.mod-btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}
.mod-opt-btn {
    padding: 5px 12px;
    border-radius: 6px;
    border: 1px solid rgba(42, 58, 92, 0.4);
    background: transparent;
    color: #94a3b8;
    font-size: 11px;
    cursor: pointer;
    transition: all 0.3s;
}
.mod-opt-btn:hover {
    border-color: rgba(59, 130, 246, 0.3);
    color: #e2e8f0;
}
.mod-opt-btn.active {
    background: rgba(59, 130, 246, 0.12);
    border-color: rgba(59, 130, 246, 0.35);
    color: #60a5fa;
}

/* 动作按钮 */
.mod-action-btn {
    width: 100%;
    padding: 8px 0;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    background: rgba(59, 130, 246, 0.08);
    color: #e2e8f0;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-bottom: 6px;
}
.mod-action-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.35);
}
.mod-action-btn:active { transform: scale(0.97); }

/* 右侧 3D 场景 */
.mod-main {
    position: relative;
    overflow: hidden;
    background: rgba(8, 12, 24, 0.4);
}

.mod-scene {
    width: 100%;
    height: 100%;
    position: relative;
}
.mod-scene canvas { width: 100% !important; height: 100% !important; display: block; }

.mod-scene-hint {
    position: absolute;
    bottom: 14px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(100, 116, 139, 0.5);
    font-size: 11px;
    pointer-events: none;
    z-index: 5;
    letter-spacing: 1px;
}

.mod-watermark {
    position: absolute;
    bottom: 30px;
    right: 24px;
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.05);
    letter-spacing: 3px;
    pointer-events: none;
    z-index: 5;
}

/* 场景控制按钮 */
.mod-scene-controls {
    position: absolute;
    top: 12px;
    right: 12px;
    z-index: 10;
    display: flex;
    gap: 6px;
}
.mod-scene-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: 1px solid rgba(59, 130, 246, 0.15);
    background: rgba(10, 14, 26, 0.5);
    backdrop-filter: blur(6px);
    color: #94a3b8;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s;
}
.mod-scene-btn:hover {
    background: rgba(26, 38, 50, 0.7);
    border-color: rgba(59, 130, 246, 0.35);
    color: #e2e8f0;
}

/* ---------- 电子世界专用: 三并排对比 ---------- */
.mod-compare {
    position: absolute;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 12px;
}
.mod-compare-item {
    width: 100px;
    text-align: center;
    padding: 8px 10px;
    border-radius: 8px;
    background: rgba(10, 14, 26, 0.5);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(42, 58, 92, 0.2);
    cursor: pointer;
    transition: all 0.3s;
}
.mod-compare-item:hover {
    border-color: rgba(59, 130, 246, 0.3);
    background: rgba(10, 14, 26, 0.7);
}
.mod-compare-item.active {
    border-color: rgba(59, 130, 246, 0.35);
    background: rgba(59, 130, 246, 0.08);
}
.mod-compare-item .label {
    font-size: 9px;
    color: #64748b;
    letter-spacing: 1px;
    text-transform: uppercase;
}
.mod-compare-item .icon {
    font-size: 16px;
    margin-bottom: 2px;
}
.mod-compare-item .badge {
    font-size: 10px;
    color: #e2e8f0;
    font-weight: 600;
}

/* ============================================================
   能带理论教学模块
   ============================================================ */
.band-ui {
    position: absolute;
    top: 16px;
    left: 16px;
    right: 16px;
    z-index: 10;
    pointer-events: none;
}
.band-stage-title {
    font-size: 18px;
    font-weight: 700;
    color: #f0f4ff;
    letter-spacing: 1px;
    margin-bottom: 4px;
    text-shadow: 0 2px 12px rgba(0,0,0,0.5);
}
.band-stage-sub {
    font-size: 14px;
    color: #60a5fa;
    margin-bottom: 8px;
    font-weight: 500;
}
.band-stage-detail {
    font-size: 12px;
    color: #94a3b8;
    line-height: 1.6;
    max-width: 500px;
    text-shadow: 0 1px 8px rgba(0,0,0,0.5);
}

.band-nav {
    position: absolute;
    bottom: 120px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 101;
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(10, 14, 26, 0.7);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(42, 58, 92, 0.3);
    border-radius: 999px;
    padding: 6px 16px;
}
.band-nav button {
    padding: 4px 16px;
    font-size: 12px;
    font-weight: 500;
    color: #94a3b8;
    background: rgba(59, 130, 246, 0.08);
    border: 1px solid rgba(59, 130, 246, 0.15);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.band-nav button:hover {
    color: #e2e8f0;
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.3);
}
#band-counter {
    font-size: 12px;
    color: #64748b;
    min-width: 30px;
    text-align: center;
}

/* ---------- 响应式 ---------- */
@media (max-width: 900px) {
    .module-card { width: 240px; height: 300px; padding: 24px 16px; }
    .module-card h2 { font-size: 18px; }
    .module-card-icon { width: 60px; height: 60px; font-size: 24px; }
    .mod-body { grid-template-columns: 180px 1fr; }
}

@media (max-width: 640px) {
    .module-cards { flex-direction: column; align-items: center; }
    .module-card { width: 100%; max-width: 320px; height: 260px; }
    .mod-body { grid-template-columns: 1fr; }
    .mod-sidebar { display: none; }
    .module-entry { padding: 20px; gap: 24px; }
}
