/* ==========================================================
   温度探究教室：走进微观与测量 - 离线专用纯原生样式表
   100% 离线自包含，零外部网络依赖，无需任何构建或前端框架
   ========================================================== */

/* 全局变量与配色定义 */
:root {
  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;

  --color-slate-50: #f8fafc;
  --color-slate-100: #f1f5f9;
  --color-slate-200: #e2e8f0;
  --color-slate-300: #cbd5e1;
  --color-slate-400: #94a3b8;
  --color-slate-500: #64748b;
  --color-slate-600: #475569;
  --color-slate-700: #334155;
  --color-slate-800: #1e293b;
  --color-slate-900: #0f172a;
  --color-slate-950: #020617;

  --color-rose-50: #fff1f2;
  --color-rose-100: #ffe4e6;
  --color-rose-200: #fecdd3;
  --color-rose-400: #fb7185;
  --color-rose-500: #f43f5e;
  --color-rose-600: #e11d48;
  --color-rose-700: #be123c;
  --color-rose-800: #9f1239;

  --color-amber-50: #fffbeb;
  --color-amber-100: #fef3c7;
  --color-amber-200: #fde68a;
  --color-amber-300: #fcd34d;
  --color-amber-400: #fbbf24;
  --color-amber-500: #f59e0b;
  --color-amber-600: #d97706;
  --color-amber-700: #b45309;
  --color-amber-800: #92400e;

  --color-emerald-50: #ecfdf5;
  --color-emerald-100: #d1fae5;
  --color-emerald-200: #a7f3d0;
  --color-emerald-300: #6ee7b7;
  --color-emerald-500: #10b981;
  --color-emerald-600: #059669;
  --color-emerald-700: #047857;
  --color-emerald-800: #065f46;

  --color-blue-50: #eff6ff;
  --color-blue-100: #dbeafe;
  --color-blue-200: #bfdbfe;
  --color-blue-500: #3b82f6;
  --color-blue-600: #2563eb;
  --color-blue-700: #1d4ed8;

  --color-indigo-50: #eef2ff;
  --color-indigo-100: #e0e7ff;
  --color-indigo-200: #c7d2fe;
  --color-indigo-500: #6366f1;
  --color-indigo-600: #4f46e5;
  --color-indigo-700: #4338ca;

  --color-purple-50: #faf5ff;
  --color-purple-100: #f3e8ff;
  --color-purple-200: #e9d5ff;
  --color-purple-600: #9333ea;
  --color-purple-700: #7e22ce;

  --color-sky-50: #f0f9ff;
  --color-sky-100: #e0f2fe;
  --color-sky-200: #bae6fd;
  --color-sky-500: #0ea5e9;
  --color-sky-600: #0284c7;
  --color-sky-700: #0369a1;
  --color-sky-800: #075985;
}

/* 基础重置 */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-sans);
  background-color: var(--color-slate-100);
  color: var(--color-slate-800);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  user-select: none;
  -webkit-user-select: none;
  line-height: 1.5;
}

/* 滚动条美化 */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}
::-webkit-scrollbar-thumb {
  background: var(--color-slate-300);
  border-radius: 4px;
}
::-webkit-scrollbar-track {
  background: transparent;
}

/* 容器布局 */
.container {
  width: 100%;
  max-width: 1280px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .container {
    padding-left: 1.5rem;
    padding-right: 1.5rem;
  }
}

@media (min-width: 1024px) {
  .container {
    padding-left: 2rem;
    padding-right: 2rem;
  }
}

/* 顶栏 Header */
header.app-header {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border-bottom: 1px solid var(--color-slate-200);
  padding: 0.75rem 0;
}

.header-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

@media (min-width: 768px) {
  .header-inner {
    flex-direction: row;
  }
}

.brand-wrapper {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: linear-gradient(135deg, var(--color-rose-500), var(--color-amber-400));
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  box-shadow: 0 4px 10px rgba(244, 63, 94, 0.25);
}

.brand-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--color-slate-800);
  line-height: 1.25;
}

.brand-subtitle {
  font-size: 0.75rem;
  color: var(--color-slate-500);
}

/* 导航栏 Tab */
.nav-tabs {
  display: flex;
  align-items: center;
  background: var(--color-slate-100);
  padding: 0.375rem;
  border-radius: 1rem;
  border: 1px solid var(--color-slate-200);
  font-size: 0.875rem;
  font-weight: 500;
  gap: 0.25rem;
  overflow-x: auto;
  max-width: 100%;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-radius: 0.75rem;
  border: none;
  background: transparent;
  color: var(--color-slate-600);
  cursor: pointer;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-family: inherit;
  font-size: 0.875rem;
}

.tab-btn:hover {
  color: var(--color-slate-900);
}

.tab-btn.active {
  background: #ffffff;
  color: var(--color-rose-600);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-weight: 600;
}

/* 主内容区域 */
main.main-content {
  flex: 1;
  padding: 1.5rem 0 2rem;
}

.module-view {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.module-view.hidden {
  display: none !important;
}

/* 模块顶部 Banner */
.module-banner {
  border-radius: 1.5rem;
  padding: 1.5rem;
  color: #ffffff;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
  position: relative;
  overflow: hidden;
}

.banner-m1 {
  background: linear-gradient(135deg, #2563eb 0%, #4f46e5 50%, #f43f5e 100%);
}

.banner-m2 {
  background: linear-gradient(135deg, #059669 0%, #0d9488 50%, #0891b2 100%);
}

.banner-m3 {
  background: linear-gradient(135deg, #7c3aed 0%, #9333ea 50%, #db2777 100%);
}

.banner-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.banner-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.25;
}

.banner-desc {
  font-size: 0.875rem;
  margin-top: 0.375rem;
  line-height: 1.6;
  opacity: 0.95;
  max-width: 48rem;
}

.banner-watermark {
  position: absolute;
  right: -2rem;
  bottom: -2rem;
  opacity: 0.12;
  pointer-events: none;
}

/* 网格系统 */
.grid {
  display: grid;
  gap: 1.5rem;
}

.grid-cols-12 {
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

@media (max-width: 1023px) {
  .lg-col-span-5, .lg-col-span-7 {
    grid-column: span 12 / span 12;
  }
}

@media (min-width: 1024px) {
  .lg-col-span-5 {
    grid-column: span 5 / span 12;
  }
  .lg-col-span-7 {
    grid-column: span 7 / span 12;
  }
}

/* 卡片通用样式 */
.card {
  background: #ffffff;
  border-radius: 1.5rem;
  padding: 1.5rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  border: 1px solid var(--color-slate-200);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-slate-800);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.card-subtitle {
  font-size: 0.75rem;
  color: var(--color-slate-500);
  margin-top: 0.125rem;
}

/* 温度计与微观模拟专用样式 */
.mercury-gradient {
  background: linear-gradient(90deg, #f87171 0%, #ef4444 50%, #dc2626 100%);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.5);
}

.pill-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  border: 1px solid transparent;
}

.pill-rose {
  background: var(--color-rose-50);
  color: var(--color-rose-600);
  border-color: var(--color-rose-200);
}

.pill-emerald {
  background: var(--color-emerald-50);
  color: var(--color-emerald-600);
  border-color: var(--color-emerald-200);
}

.pill-amber {
  background: var(--color-amber-50);
  color: var(--color-amber-700);
  border-color: var(--color-amber-200);
}

.pill-blue {
  background: var(--color-blue-50);
  color: var(--color-blue-600);
  border-color: var(--color-blue-200);
}

.pill-purple {
  background: var(--color-purple-50);
  color: var(--color-purple-700);
  border-color: var(--color-purple-200);
}

/* 滑块样式 */
.custom-range {
  width: 100%;
  height: 0.625rem;
  background-color: var(--color-slate-200);
  border-radius: 0.5rem;
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  outline: none;
}

.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--color-rose-500);
  box-shadow: 0 2px 5px rgba(244, 63, 94, 0.4);
  cursor: pointer;
  border: 2px solid #ffffff;
  transition: transform 0.1s ease;
}

.custom-range::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.custom-range::-moz-range-thumb {
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  background: var(--color-rose-500);
  box-shadow: 0 2px 5px rgba(244, 63, 94, 0.4);
  cursor: pointer;
  border: 2px solid #ffffff;
}

/* 预设温阶按钮组 */
.preset-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 0.375rem;
}

.preset-btn {
  padding: 0.375rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.5rem;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
  text-align: center;
}

.preset-btn-indigo { background: var(--color-indigo-50); color: var(--color-indigo-700); }
.preset-btn-indigo:hover { background: var(--color-indigo-100); }

.preset-btn-blue { background: var(--color-blue-50); color: var(--color-blue-700); }
.preset-btn-blue:hover { background: var(--color-blue-100); }

.preset-btn-emerald { background: var(--color-emerald-50); color: var(--color-emerald-700); }
.preset-btn-emerald:hover { background: var(--color-emerald-100); }

.preset-btn-amber { background: var(--color-amber-50); color: var(--color-amber-700); }
.preset-btn-amber:hover { background: var(--color-amber-100); }

.preset-btn-rose { background: var(--color-rose-50); color: var(--color-rose-700); }
.preset-btn-rose:hover { background: var(--color-rose-100); }

/* 原理卡片网格 */
.principle-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
}

@media (min-width: 640px) {
  .principle-grid {
    grid-template-columns: 1fr 1fr;
  }
}

.info-card {
  padding: 0.875rem;
  border-radius: 1rem;
  font-size: 0.75rem;
  line-height: 1.6;
}

.info-card-amber {
  background: rgba(254, 243, 199, 0.7);
  border: 1px solid var(--color-amber-200);
}

.info-card-rose {
  background: rgba(255, 228, 230, 0.7);
  border: 1px solid var(--color-rose-200);
}

.info-card-header {
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  margin-bottom: 0.25rem;
}

/* 规格对比卡片 */
.specs-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.75rem;
  font-size: 0.75rem;
}

@media (min-width: 640px) {
  .specs-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

.spec-item {
  padding: 0.75rem;
  border-radius: 0.75rem;
  line-height: 1.5;
}

/* 模块2 拖拽测温台 */
.drag-canvas-wrapper {
  position: relative;
  width: 100%;
  height: 380px;
  background-color: var(--color-slate-900);
  border-radius: 1rem;
  border: 1px solid var(--color-slate-700);
  overflow: hidden;
  user-select: none;
}

.cursor-grab {
  cursor: grab;
}

.cursor-grab:active {
  cursor: grabbing;
}

/* 视线切换按钮 */
.sight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
}

.choice-btn {
  padding: 0.5rem 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.75rem;
  border: 1px solid var(--color-slate-200);
  background: #ffffff;
  color: var(--color-slate-700);
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  font-family: inherit;
}

.choice-btn:hover {
  background: var(--color-slate-100);
}

.choice-btn.active-emerald {
  background: var(--color-emerald-600);
  color: #ffffff;
  border-color: var(--color-emerald-600);
  box-shadow: 0 2px 6px rgba(5, 150, 105, 0.25);
}

.choice-btn.active-rose {
  background: var(--color-rose-500);
  color: #ffffff;
  border-color: var(--color-rose-500);
  box-shadow: 0 2px 6px rgba(244, 63, 94, 0.25);
}

.choice-btn.active-amber {
  background: var(--color-amber-500);
  color: #ffffff;
  border-color: var(--color-amber-500);
  box-shadow: 0 2px 6px rgba(245, 158, 11, 0.25);
}

.choice-btn.active-purple {
  background: var(--color-purple-600);
  color: #ffffff;
  border-color: var(--color-purple-600);
  box-shadow: 0 2px 6px rgba(147, 51, 234, 0.25);
}

/* 规范质检四步条目 */
.step-item {
  padding: 0.625rem 0.75rem;
  border-radius: 0.75rem;
  background: var(--color-slate-50);
  border: 1px solid var(--color-slate-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

/* 纯原生优雅数学公式排版 (完全无 MathJax 框架) */
.math-expr {
  font-family: "Cambria Math", "Latin Modern Math", "STIX Two Math", "Times New Roman", serif;
  font-size: 1.05em;
  font-style: italic;
  white-space: nowrap;
}

.math-expr sup {
  font-size: 0.75em;
  font-style: normal;
  vertical-align: super;
  line-height: 0;
}

.math-expr sub {
  font-size: 0.75em;
  font-style: normal;
  vertical-align: sub;
  line-height: 0;
}

.math-fraction {
  display: inline-flex;
  flex-direction: column;
  vertical-align: middle;
  text-align: center;
  padding: 0 0.2em;
  font-family: "Cambria Math", "Latin Modern Math", serif;
  font-style: italic;
}

.math-num {
  border-bottom: 1.5px solid currentColor;
  padding-bottom: 1px;
  line-height: 1;
}

.math-den {
  padding-top: 1px;
  line-height: 1;
}

/* 矢量图标辅助类 */
.svg-icon {
  width: 1em;
  height: 1em;
  display: inline-block;
  vertical-align: -0.125em;
  fill: currentColor;
  flex-shrink: 0;
}

/* 页脚 */
footer.app-footer {
  background: #ffffff;
  border-top: 1px solid var(--color-slate-200);
  padding: 1rem 0;
  font-size: 0.75rem;
  color: var(--color-slate-500);
  text-align: center;
}

.footer-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

@media (min-width: 640px) {
  .footer-inner {
    flex-direction: row;
  }
}
