/* =========================
   Global - Space Theme (星座主题配色)
========================= */

* {
  box-sizing: border-box;
  /* 替换为 Inter 字体，并保留一些备用字体 */
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif;
}


html, body {
  height: 100%; /* 确保 html 和 body 占据整个视口高度 */
  margin: 0;
  padding: 0;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #1a0b2e, #2d1b4e); /* 🎨 Deep Purple to Indigo (深紫到靛蓝) */
  color: #e5e7eb;
  /* min-height: 100vh; */
}

#app {
  min-height: 100vh; /* 保持，以防 quiz-screen 不活跃时 */
  height: 100%; /* 添加这行，确保 app 活跃时填充整个高度 */
  width: 100%;
  background: linear-gradient(135deg, #1a0b2e 0%, #2d1b4e 100%);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  transition: background-image 0.4s ease;
}

/* =========================
   Start Screen - Starry Purple (星空紫色)
========================= */

#start-screen {
  text-align: center;
  padding: 60px 20px;
  background: linear-gradient(135deg, #5b21b6 0%, #7c3aed 100%); /* 🎨 Purple Gradient (紫色渐变) */
  border-radius: 20px;
  margin: 40px auto;
  max-width: 800px; /* Increased max width for more text */
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

#start-screen h1 {
  font-size: 34px;
  margin-bottom: 30px;
  color: #fde047; /* 🎨 Golden Yellow (金黄色) */
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.intro {
  color: #f0f0f0;
  font-size: 16px;
  line-height: 1.6;
  margin-bottom: 30px;
}

#start-btn {
  font-size: 20px;
  padding: 14px 30px;
  border: none;
  border-radius: 14px;
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%); /* 🎨 Golden Button (金色按钮) */
  color: #000;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

#start-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 20px rgba(251, 191, 36, 0.6);
}

/* =========================
   Quiz Container - Deep Purple Background (深紫背景)
   Modified for two-column layout (修改为两列布局)
========================= */

#quiz-screen {
  display: flex; /* Make quiz-screen a flex container */
  flex-direction: column; /* Stack progress bar on top, then wrapper */
  max-width: 1600px; /* MODIFIED: Increased max-width for the entire quiz screen */
  margin: 50px auto; /* 顶部和底部各 50px 的外边距 */
  padding: 30px; /* 顶部和底部各 30px 的内边距 */
  background: linear-gradient(135deg, #2d1b4e 0%, #1e1338 100%); /* 🎨 Deep Purple Gradient (深紫渐变) */
  border-radius: 20px;
  color: #f8fafc;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  /* min-height: calc(100vh - 100px);  -- 移除这行 */
  max-height: calc(100vh - 100px); /* --- NEW --- 限制最大高度为视口高度减去上下外边距 (50px + 50px) */
  overflow: hidden; /* 防止 quiz-screen 自身内容溢出，内部滚动由子元素处理 */
}

/* quiz-content-wrapper for two-column layout (用于两列布局) */
.quiz-content-wrapper {
  display: flex;
  flex-grow: 1; /* 允许包装器占用可用空间 */
  gap: 20px; /* 面板之间的间距 */
  margin-top: 20px;
  overflow: hidden; /* 隐藏包装器自身的滚动条 */
  /* --- NEW --- */
  min-height: 0; /* 允许 flex item 正常收缩 */
  /* --- END NEW --- */
}

/* Left Panel: Question, Options, Feedback (左侧面板：题目、选项、反馈) */
.question-panel {
  flex: 2;
  display: flex;
  flex-direction: column;
  overflow-y: auto; /* 允许长问题滚动 */
  padding-right: 10px; /* 为滚动条留出空间 */
  /* --- NEW --- */
  min-height: 0; /* 关键：允许可滚动 flex item 正确收缩 */
  /* --- END NEW --- */
}

/* Right Panel: Code Display (右侧面板：代码显示) */
.code-panel {
  flex: 1.75; 
  overflow-y: auto; /* 允许长代码滚动 */
  padding-left: 10px; /* 为滚动条留出空间 */
  border-left: 1px solid rgba(253, 224, 71, 0.2); /* 分隔线 */
  /* --- NEW --- */
  min-height: 0; /* 关键：允许可滚动 flex item 正确收缩 */
  /* --- END NEW --- */
}

/* Adjust margins for elements inside the left panel (调整左侧面板内部元素的边距) */
.question-panel #question-title,
.question-panel .intro-section,
.question-panel #question-story,
.question-panel #question-prompt,
.question-panel #options,
.question-panel .feedback-section,
.question-panel #next-btn {
  margin-left: 0;
  margin-right: 0;
}

/* =========================
   Progress Bar - Gold-Purple Gradient (金紫渐变)
========================= */

.progress-container {
  width: 100%;
  height: 10px;
  background: #3d2b5f;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 24px;
}

#progress-text {
  color: #c4b5fd; /* 🎨 Light Purple (淡紫色) */
  font-size: 15px;
  margin-bottom: 12px;
  font-weight: 500;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #fbbf24, #a78bfa); /* 🎨 Gold to Purple (金到紫) */
  width: 0%;
  transition: width 0.3s ease;
  border-radius: 10px;
}

/* =========================
   Title & Story
========================= */

#question-title {
  color: #fde047; /* 保持金黄色 */
  font-size: 28px; /* 稍微增大标题字体 */
  margin-bottom: 20px;
  text-shadow: 0 0 12px rgba(253, 224, 71, 0.4); /* 增加标题阴影 */
}



/* =========================
   🆕 Constellation Image Style (星座图片样式)
========================= */

.constellation-img {
  width: 100%;
  max-width: 800px; /* MODIFIED: Increased max-width for the image */
  max-height: 750px; /* MODIFIED: Increased max-height for the image */
  object-fit: contain;
  margin: 20px auto;
  display: block;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(167, 139, 250, 0.3);
  border: 2px solid rgba(253, 224, 71, 0.2);
}

.binary-search-lab-panel {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 20px;
  border-radius: 18px;
  background: rgba(20, 10, 38, 0.72);
  border: 1px solid rgba(253, 224, 71, 0.18);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.22);
}

.binary-search-lab-line {
  margin: 0 0 10px;
  color: #f8fafc;
  font-size: 18px;
  line-height: 1.6;
  text-align: center;
}

.binary-search-lab-line strong {
  color: #fde047;
}

.binary-search-input-row {
  display: flex;
  gap: 12px;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.binary-search-input {
  width: 160px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(253, 224, 71, 0.24);
  background: rgba(10, 5, 24, 0.95);
  color: #ffffff;
  font-size: 18px;
  font-weight: 700;
  text-align: center;
}

/* =========================
   Options - Light Purple Tones (淡紫色系)
========================= */

#options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-top: 20px;
}

.option-btn {
  background: linear-gradient(135deg, #e9d5ff 0%, #ddd6fe 100%); /* 🎨 Light Purple Gradient (淡紫渐变) */
  color: #1f2937;
  border: 2px solid #c4b5fd;
  border-radius: 14px;
  padding: 16px 18px;
  font-size: 16px;
  cursor: pointer;
  text-align: left;
  transition: all 0.2s ease;
  width: 100%;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
  font-weight: 500;
}

.option-btn strong {
  color: #7c3aed;
  font-size: 18px;
  margin-right: 8px;
}

.option-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 16px rgba(167, 139, 250, 0.4);
  background: linear-gradient(135deg, #f3e8ff 0%, #e9d5ff 100%);
  border-color: #a78bfa;
}

.option-btn:disabled {
  cursor: default;
  opacity: 0.9;
}

/* =========================
   Correct / Wrong
========================= */

.option-btn.correct {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #6ee7b7;
  color: #065f46;
  box-shadow: 0 6px 16px rgba(16, 185, 129, 0.3);
}

.option-btn.correct strong {
  color: #047857;
}

.option-btn.wrong {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border-color: #fca5a5;
  color: #991b1b;
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.3);
}

.option-btn.wrong strong {
  color: #7f1d1d;
}

/* =========================
   Feedback & Explanation
========================= */

#feedback {
  margin-top: 20px;
  font-size: 18px;
  font-weight: bold;
  color: #fde047;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.3);
}

#explanation {
  margin-top: 16px;
  padding: 16px;
  background: transparent;
  color: #e9d5ff;
  line-height: 1.6;
  font-size: 15px;
}

/* =========================
   Next Button
========================= */

#next-btn {
  margin-top: 24px;
  padding: 14px 28px;
  font-size: 17px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#next-btn:disabled {
  background: linear-gradient(135deg, #6b7280 0%, #4b5563 100%);
  cursor: not-allowed;
  box-shadow: none;
}

#next-btn:not(:disabled):hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(16, 185, 129, 0.5);
}

/* =========================
   Mobile Friendly (移动端适配)
========================= */

@media (max-width: 900px) { /* Adjust breakpoint as needed (根据需要调整断点) */
  #quiz-screen {
    flex-direction: column; /* Stack panels vertically (垂直堆叠面板) */
    height: auto;
    max-width: 90%;
  }

  .quiz-content-wrapper {
    flex-direction: column; /* Vertical stack panels (垂直堆叠面板) */
    gap: 10px;
  }

  .question-panel, .code-panel {
    width: 100%;
    padding: 0;
    border-left: none;
    border-top: 1px solid rgba(253, 224, 71, 0.2); /* Separator when stacked (堆叠时顶部添加分隔线) */
    padding-top: 10px;
  }

  .code-display-container {
    height: 300px; /* Fixed height for code area on small screens (小屏幕上代码区域固定高度) */
  }

  #options {
    grid-template-columns: 1fr; /* Single column for options on small screens (小屏幕上选项单列显示) */
  }
}

/* =========================
   Animations
========================= */

.correct {
  animation: flashGreen 0.5s ease;
}

.wrong {
  animation: shake 0.4s ease;
}

@keyframes flashGreen {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.02); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px); }
  50% { transform: translateX(8px); }
  75% { transform: translateX(-8px); }
}

/* Temporary background flash effect (临时背景闪烁效果) */
.feedback-correct-bg {
  animation: flashGreenBg 0.5s ease-out;
}

@keyframes flashGreenBg {
  0% { background: linear-gradient(180deg, #1a0b2e, #2d1b4e); } /* Original background */
  50% { background: linear-gradient(180deg, #1a0b2e, #2d1b4e), rgba(16, 185, 129, 0.2); } /* Overlay green translucent */
  100% { background: linear-gradient(180deg, #1a0b2e, #2d1b4e); }
}

.feedback-wrong-bg {
  animation: flashRedBg 0.5s ease-out;
}

@keyframes flashRedBg {
  0% { background: linear-gradient(180deg, #1a0b2e, #2d1b4e); } /* Original background */
  50% { background: linear-gradient(180deg, #1a0b2e, #2d1b4e), rgba(239, 68, 68, 0.2); } /* Overlay red translucent */
  100% { background: linear-gradient(180deg, #1a0b2e, #2d1b4e); }
}

/* Image shake animation (图片抖动动画) */
@keyframes shake-error {
  0%, 100% { transform: translateX(0) scale(1); filter: brightness(1); }
  25% { transform: translateX(-5px) scale(1.01); filter: brightness(1.2); }
  50% { transform: translateX(5px) scale(1.01); filter: brightness(1.2); }
  75% { transform: translateX(-5px) scale(1.01); filter: brightness(1.2); }
}
.constellation-img.shake-error {
  animation: shake-error 0.3s ease-in-out 2; /* Shake twice (抖动两次) */
  border-color: #f87171; /* Red border on error (错误时边框变红) */
}


/* =========================
   Modal
========================= */

.modal {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 999;
  backdrop-filter: blur(4px);
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: linear-gradient(135deg, #2d1b4e 0%, #1e1338 100%);
  border-radius: 20px;
  padding: 32px;
  text-align: center;
  max-width: 380px;
  width: 90%;
  animation: popIn 0.3s ease;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  border: 2px solid rgba(253, 224, 71, 0.3);
}

.modal-content h2,
.modal-content h3 {
  color: #fde047;
  margin-bottom: 16px;
}

.modal-content p {
  color: #e9d5ff;
  margin: 12px 0;
}

.modal-buttons {
  margin-top: 24px;
}

.modal-buttons button {
  margin: 8px;
  padding: 12px 24px;
  font-size: 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s ease;
}

#revive-btn {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #000;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

#revive-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(251, 191, 36, 0.6);
}

#restart-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

#restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.6);
}

@keyframes popIn {
  0% { transform: scale(0.7); opacity: 0; }
  100% { transform: scale(1); opacity: 1; }
}

/* =========================
   HUD
========================= */

#hud {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 24px;
  font-size: 24px;
  background: rgba(30, 19, 56, 0.9);
  padding: 12px 24px;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(253, 224, 71, 0.2);
}

/* =========================
   Game Buttons
========================= */

.game-btn {
  padding: 14px 26px;
  font-size: 16px;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
  color: white;
  transition: all 0.2s ease;
  font-weight: bold;
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.game-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(124, 58, 237, 0.5);
}

.game-btn.secondary {
  /* ... (保持原有样式) ... */
  margin-top: 15px; /* 调整按钮与上方文本的间距 */
  margin-bottom: 15px; /* 调整按钮与下方文本的间距 */
}

/* 确保它在 intro-section 内部时，布局正常 */
.intro-section .game-btn {
  margin-top: 15px;
  margin-bottom: 0; /* 如果按钮在 intro-section 底部，则不需要底部间距 */
}

.game-btn.primary {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #000;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
}

.game-btn.primary:hover {
  box-shadow: 0 6px 18px rgba(251, 191, 36, 0.5);
}

/* =========================
   Difficulty Buttons
========================= */

.difficulty-btn {
  display: block;
  width: 100%;
  margin: 12px 0;
  padding: 16px 0;
  font-size: 18px;
  border-radius: 14px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
  font-weight: bold;
}

.difficulty-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.3);
}

.difficulty-btn[data-level="easy"] {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  color: #065f46;
  border-color: #6ee7b7;
}

.difficulty-btn[data-level="normal"] {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
  color: #1e40af;
  border-color: #93c5fd;
}

.difficulty-btn[data-level="hard"] {
  background: linear-gradient(135deg, #fed7aa 0%, #fdba74 100%);
  color: #9a3412;
  border-color: #fb923c;
}

.difficulty-btn[data-level="reality"] {
  background: linear-gradient(135deg, #fecaca 0%, #fca5a5 100%);
  color: #991b1b;
  border-color: #f87171;
}

/* =========================
   Audio Control
========================= */

.audio-control {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.audio-control button {
  border: none;
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 16px;
  cursor: pointer;
  background: rgba(124, 58, 237, 0.9);
  color: white;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.audio-control button:hover {
  background: rgba(109, 40, 217, 1);
  transform: translateY(-2px);
}

/* =========================
   App Root
========================= */

#app {
  min-height: 100vh;
  width: 100%;
  background: linear-gradient(135deg, #1a0b2e 0%, #2d1b4e 100%);
  background-repeat: no-repeat;
  background-size: cover;
  background-position: center;
  transition: background-image 0.4s ease;
}

#app[style*="background-image: url"] {
  background: none;
}

/* =========================
   Summary Screen
========================= */

#summary-screen {
  /* 替换掉原来的 background 属性 */
  background: linear-gradient(rgba(0, 0, 0, 0.6), rgba(0, 0, 0, 0.6)), url('../images/final_view.png'); /* 半透明蒙版 + 背景图片 */
  background-size: cover; /* 确保图片覆盖整个区域 */
  background-position: center; /* 图片居中 */
  background-repeat: no-repeat; /* 不重复图片 */

  border-radius: 20px;
  max-width: 600px;
  margin: 60px auto;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  color: #f8fafc;
}

#summary-screen h2 {
  color: #fde047;
  font-size: 32px;
  margin-bottom: 24px;
}

#summary-screen p {
  color: #e9d5ff;
  font-size: 18px;
  margin: 16px 0;
}

/* =========================
   Course Specific Styles
========================= */

.mission-stats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin: 30px 0;
  flex-wrap: wrap;
}

/* =========================
   Quiz Briefing — structured layout
   (tagline · 4 act cards · key insight callout)
========================= */

.start-screen-description {
  text-align: left;
  max-width: 720px;
  margin: 0 auto 24px;
}

.brief-tagline {
  font-size: 17px;
  line-height: 1.6;
  color: #f5edff;
  text-align: center;
  margin: 0 0 24px;
  padding: 16px 20px;
  background: rgba(0, 0, 0, 0.18);
  border-radius: 12px;
  border-left: 4px solid #fde047;
}
.brief-tagline strong { color: #fde047; }

.brief-acts {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin: 8px 0 22px;
}

.brief-act {
  position: relative;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid rgba(253, 224, 71, 0.18);
  border-radius: 12px;
  padding: 16px 16px 14px 20px;
  transition: transform 0.15s, border-color 0.15s;
}
.brief-act:hover {
  transform: translateY(-2px);
  border-color: rgba(253, 224, 71, 0.5);
}

.brief-act-num {
  position: absolute;
  top: -12px;
  left: -12px;
  width: 34px;
  height: 34px;
  line-height: 34px;
  text-align: center;
  border-radius: 50%;
  background: linear-gradient(135deg, #fde047, #f59e0b);
  color: #2a1858;
  font-weight: 900;
  font-family: 'Fira Code', 'Georgia', serif;
  font-size: 15px;
  letter-spacing: -0.5px;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.35);
}

.brief-act h3 {
  color: #fde047;
  font-size: 15px;
  font-weight: 700;
  margin: 0 0 6px;
  letter-spacing: 0.2px;
}

.brief-act p {
  color: #e9dfff;
  font-size: 13.5px;
  line-height: 1.55;
  margin: 0;
}
.brief-act strong { color: #ff9db1; }
.brief-act code {
  font-family: 'Fira Code', monospace;
  font-size: 12.5px;
  background: rgba(0, 0, 0, 0.35);
  padding: 1px 6px;
  border-radius: 4px;
  color: #fde047;
}

.brief-note {
  background: rgba(253, 224, 71, 0.09);
  border-left: 3px solid #fde047;
  padding: 12px 16px;
  border-radius: 10px;
  color: #f5edff;
  font-size: 14px;
  line-height: 1.6;
  margin: 6px 0 0;
  text-align: left;
}
.brief-note strong { color: #fde047; }

@media (max-width: 640px) {
  .brief-acts { grid-template-columns: 1fr; }
  .brief-tagline { font-size: 15.5px; }
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.stat-icon {
  font-size: 32px;
}

.stat-label {
  font-size: 14px;
  color: #e9d5ff;
  font-weight: 500;
}

.course-info {
  margin-top: 20px;
  color: #c4b5fd;
}

.difficulty-desc {
  color: #e9d5ff;
  margin-bottom: 20px;
  font-size: 15px;
}

.difficulty-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 20px;
}

.diff-emoji {
  font-size: 36px;
}

.diff-name {
  font-size: 20px;
  font-weight: bold;
}

.diff-detail {
  font-size: 13px;
  opacity: 0.8;
}

.mission-progress {
  margin-bottom: 24px;
}

.progress-info {
  color: #c4b5fd;
  font-size: 15px;
  margin-bottom: 8px;
}

.progress-bar-container {
  width: 100%;
  height: 8px;
  background: #3d2b5f;
  border-radius: 10px;
  overflow: hidden;
}

.mission-title {
  color: #fde047;
  font-size: 24px;
  margin-bottom: 16px;
  text-shadow: 0 0 10px rgba(253, 224, 71, 0.3);
}

/* 优化 intro 部分，使其更像一个“简报” */
.intro-section {
  margin-bottom: 25px;
  padding: 18px 20px; /* 增加内边距 */
  background: rgba(124, 58, 237, 0.1); /* 略带透明的紫色背景 */
  border-left: 4px solid #a78bfa; /* 左侧更明显的边框 */
  border-radius: 8px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
}

.intro-section p { /* 确保 intro 内部的段落也有合适的样式 */
  color: #ffffff; 
  line-height: 1.7;
  font-size: 16px;
  margin-top: 0;
  margin-bottom: 10px; /* 段落之间有间距 */
}
.intro-section p:last-child {
  margin-bottom: 0; /* 最后一个段落底部无间距 */
}

/* 优化 story 部分，使其更突出且易读 */
.story.mission-context {
  background: transparent; /* 保持透明背景 */
  padding: 14px 0 14px 18px; /* 调整内边距 */
  border-left: 4px solid #fde047; /* 更粗的金黄色左边框，突出其重要性 */
  margin-bottom: 16px;
  color: #ffffff; 
  font-size: 16px; /* 稍微增大字体 */
  line-height: 1.7;
}

.question-prompt {
  margin-bottom: 24px;
  padding: 16px 18px;
  border-radius: 14px;
  background: rgba(253, 224, 71, 0.08);
  border: 1px solid rgba(253, 224, 71, 0.22);
  color: #fff8dc;
  font-size: 19px;
  line-height: 1.7;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.16);
}

/* 优化内联代码片段的样式 (例如 `input()`, `while`) */
.intro-section code,
.story.mission-context code,
#explanation code {
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', monospace; /* 使用等宽字体 */
  background-color: rgba(253, 224, 71, 0.15); /* 略带透明的黄色背景 */
  color: #fde047; /* 金黄色文本 */
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.95em; /* 略小于周围文本 */
  white-space: nowrap; /* 不换行 */
}

/* 优化 markdown 粗体和斜体 */
.intro-section strong,
.story.mission-context strong {
  color: #fde047; /* 粗体使用金黄色 */
  font-weight: 700; /* 确保粗体明显 */
}

.intro-section em,
.story.mission-context em {
  color: #a78bfa; /* 斜体使用浅紫色 */
  font-style: italic;
}

/* 优化列表样式，如果 intro/story 中包含列表 */
.intro-section ul,
.intro-section ol {
  margin-left: 20px;
  padding-left: 0;
  color: #e9d5ff;
  line-height: 1.7;
}
.intro-section ul li,
.intro-section ol li {
  margin-bottom: 5px;
}


.feedback-section {
  margin-top: 20px;
}

.summary-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
  padding: 40px 20px;
}

.summary-content {
  /* 替换掉原来的 background 属性 */
  background: transparent; /* 让内容区域背景透明，以便看到父元素的背景图片 */

  border-radius: 24px;
  padding: 48px 40px;
  max-width: 600px;
  text-align: center;
  /* 可选：移除或修改 box-shadow 和 border，因为现在整个卡片有了背景图，这些可能不再需要或看起来不协调 */
  box-shadow: none; /* 移除内层内容的阴影 */
  border: none; /* 移除内层内容的边框 */
  /* 如果需要，可以给内容区一个更浅的半透明背景，例如：background-color: rgba(0, 0, 0, 0.2); */
}

.summary-title {
  color: #fde047;
  font-size: 36px;
  margin-bottom: 24px;
  text-shadow: 0 0 20px rgba(253, 224, 71, 0.4);
}

.summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: linear-gradient(135deg, #7c3aed, #fbbf24);
  padding: 16px 32px;
  border-radius: 50px;
  margin-bottom: 32px;
  box-shadow: 0 8px 24px rgba(124, 58, 237, 0.4);
}

.badge-icon {
  font-size: 32px;
}

.badge-text {
  font-size: 20px;
  font-weight: bold;
  color: white;
}

.summary-stats {
  display: flex;
  justify-content: center;
  gap: 40px;
  margin: 32px 0;
}

.summary-stat .stat-icon {
  font-size: 40px;
}

.stat-value {
  color: #e9d5ff;
  font-size: 18px;
  margin: 0;
}

.summary-message {
  color: #e9d5ff;
  font-size: 16px;
  line-height: 1.8;
  margin: 24px 0;
}

.space-hud {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 24px;
  font-size: 24px;
  background: rgba(30, 19, 56, 0.9);
  padding: 12px 24px;
  border-radius: 50px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(253, 224, 71, 0.2);
}

.hud-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.hud-label {
  font-size: 12px;
  color: #c4b5fd;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.hud-value {
  font-size: 20px;
  font-weight: bold;
}

.modal-warning {
  color: #fde047;
  font-size: 16px;
  margin-bottom: 16px;
}

.modal-info {
  color: #e9d5ff;
  margin: 8px 0;
}

.modal-btn {
  padding: 14px 28px;
  font-size: 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  transition: all 0.2s ease;
}

#revive-btn {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #000;
  box-shadow: 0 4px 12px rgba(251, 191, 36, 0.4);
}

#revive-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(251, 191, 36, 0.6);
}

#restart-btn {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #fff;
  box-shadow: 0 4px 12px rgba(239, 68, 68, 0.4);
}

#restart-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(239, 68, 68, 0.6);
}

/* Starry Background Animation (星空背景动画) */
.stars-background {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: -1;
}

.stars, .stars2, .stars3 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: transparent;
}

.stars {
  background-image: 
    radial-gradient(2px 2px at 20px 30px, #eee, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 60px 70px, #fff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 50px 50px, #ddd, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 130px 80px, #fff, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 90px 10px, #eee, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 200px 200px;
  animation: twinkle 5s ease-in-out infinite;
  opacity: 0.3;
}

.stars2 {
  background-image: 
    radial-gradient(1px 1px at 100px 120px, #fff, rgba(0,0,0,0)),
    radial-gradient(1px 1px at 150px 60px, #eee, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 300px 300px;
  animation: twinkle 7s ease-in-out infinite;
  opacity: 0.2;
}

.stars3 {
  background-image: 
    radial-gradient(1px 1px at 75px 125px, #ddd, rgba(0,0,0,0)),
    radial-gradient(2px 2px at 180px 25px, #fff, rgba(0,0,0,0));
  background-repeat: repeat;
  background-size: 250px 250px;
  animation: twinkle 9s ease-in-out infinite;
  opacity: 0.25;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.6; }
}

/* Code Display Area Styles (代码显示区域样式) */
.code-display-container {
  background-color: #1e1338; /* Dark background (深色背景) */
  border: 1px solid #7c3aed; /* Purple border (紫色边框) */
  border-radius: 10px;
  padding: 15px;
  margin-top: 0;
  margin-bottom: 0;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.4);
  height: 100%; /* Fill available height (填充可用高度) */
  display: flex;
  flex-direction: column;
}

.code-display-container.hidden {
  display: none;
}

.code-display-container h3 {
  color: #fde047; /* Golden Yellow title (金黄色标题) */
  font-size: 18px;
  margin-top: 0;
  margin-bottom: 10px;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
  flex-shrink: 0; /* Don't shrink title (不收缩标题) */
}

/* Prism.js code block styles */
.code-display-container pre {
  margin: 0;
  padding: 0;
  flex-grow: 1; /* Allow pre to take up remaining space */
  overflow: auto; /* Ensure pre itself scrolls */
  min-height: 0; /* Important for flex item to shrink correctly */
  background: none !important; /* Remove default Prism background */
  border: none !important; /* Remove default Prism border */
}

.code-display-container code {
  font-family: 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', monospace; /* Programmer font (程序员字体) */
  font-size: 14px;
  line-height: 1.5;
  color: #e9d5ff; /* Light purple code (淡紫色代码) */
  display: block;
  white-space: pre-wrap; /* Allow code to wrap (允许代码换行) */
}

/* Prism.js Line Numbers Plugin Styles (Prism.js 行号插件样式) */
.line-numbers .line-numbers-rows {
    border-right-color: rgba(124, 58, 237, 0.3); /* Match theme color (匹配主题颜色) */
}
.line-numbers .line-numbers-rows span {
    color: rgba(253, 224, 71, 0.4); /* Line number color (行号颜色) */
}

/* **Custom Code Highlight Styles** (自定义代码高亮样式) */
.line-numbers-rows .line-highlight {
    background-color: rgba(253, 224, 71, 0.2); /* Yellow translucent background (黄色半透明背景) */
    box-shadow: inset 5px 0 0 rgba(253, 224, 71, 0.5); /* Left yellow border (左侧黄色边框) */
    display: block; /* Ensure highlight spans entire line (确保高亮跨越整行) */
    transition: background-color 0.3s ease, box-shadow 0.3s ease; /* Smooth transition (平滑过渡) */
}

/* Prism.js syntax highlighting colors (Prism.js 语法高亮颜色) */
.token.keyword,
.token.operator {
    color: #fde047 !important; /* Keywords and operators (关键词和运算符) */
}
.token.string {
    color: #a7f3d0 !important; /* Strings (字符串) */
}
.token.function {
    color: #fbbf24 !important; /* Functions (函数) */
}
.token.comment {
    color: #888 !important; /* Comments (注释) */
}
.token.number {
    color: #a78bfa !important; /* Numbers (数字) */
}

/* 🆕 Pulse Animation (脉冲动画) */
@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.pulse {
  animation: pulse 1.5s ease-in-out infinite;
}




/* =========================
   Option Code Display Styles (选项代码显示样式)
   优化后的颜色方案，确保在浅色按钮背景上的可读性
========================= */

/* 调整选项按钮的布局，使其字母和代码对齐 */
.option-btn {
    display: flex; /* 使用 flexbox 布局 */
    align-items: flex-start; /* 顶部对齐 */
    gap: 8px; /* 字母和代码之间的间距 */
    text-align: left; /* 文本左对齐 */
    padding: 12px 18px; /* 调整按钮内边距 */
}

.option-btn strong {
    flex-shrink: 0; /* 防止字母被压缩 */
    padding-top: 2px; /* 微调字母垂直对齐 */
}

/* 选项代码的容器 */
.option-code-wrapper {
    flex-grow: 1; /* 让代码容器占据剩余空间 */
    overflow-x: unset;
    max-height: unset;
    white-space: normal; /* 允许代码换行 */
}

/* 纯文字选项（ai-NN 概念题用，不是代码） */
.option-text {
    flex-grow: 1;
    white-space: normal;
    line-height: 1.5;
    color: inherit;
}

/* 覆盖 Prism.js 对 <pre> 标签的默认样式 */
.option-btn pre[class*="language-"] {
    margin: 0; /* 移除默认外边距 */
    padding: 0; /* 移除默认内边距 */
    background: none !important; /* 移除背景色，使其与按钮背景融合，使用 !important 确保覆盖 */
    border-radius: 0; /* 移除圆角 */
    white-space: pre-wrap; /* 允许代码自动换行 */
}

/* 覆盖 Prism.js 对 <code> 标签的默认样式，设置默认代码颜色 */
.option-btn code {
    font-family: 'Fira Code', 'Cascadia Code', 'Consolas', 'Monaco', monospace; /* 程序员字体 */
    font-size: 13px; /* 选项代码字体略小 */
    line-height: 1.4; /* 行高 */
    color: #333 !important; /* 默认代码颜色，深灰色，使用 !important 确保覆盖 */
    display: block; /* 确保代码块占据完整宽度 */
}

/* 调整 Prism.js 语法高亮颜色，使其在浅色按钮背景上更清晰 */
/* 使用更深的颜色，并确保 !important 优先级 */

.option-btn .token.keyword,
.option-btn .token.function { /* Python 的 input/print 通常被视为函数或关键字 */
    color: #8B5CF6 !important; /* 深紫色 */
}
.option-btn .token.operator {
    color: #333 !important; /* 深灰色 */
}
.option-btn .token.string {
    color: #16A34A !important; /* 深绿色 */
}
.option-btn .token.variable, /* 用于变量名，如 elevator_id */
.option-btn .token.punctuation { /* 用于括号、逗号等 */
    color: #333 !important; /* 深灰色 */
}
.option-btn .token.number {
    color: #C026D3 !important; /* 亮洋红色 */
}
.option-btn .token.comment {
    color: #6B7280 !important; /* 灰色 */
}

/* 当选项被选中（正确或错误）时，调整代码颜色以保持可读性 */
/* 正确选项 - 略微柔和但仍可读的深色 */
.option-btn.correct .token.keyword,
.option-btn.correct .token.function { color: #047857 !important; } /* 深绿色 */
.option-btn.correct .token.operator,
.option-btn.correct .token.variable,
.option-btn.correct .token.punctuation { color: #065f46 !important; } /* 更深的绿色 */
.option-btn.correct .token.string { color: #065f46 !important; }
.option-btn.correct .token.number { color: #059669 !important; }
.option-btn.correct code { color: #065f46 !important; }


/* 错误选项 - 略微柔和但仍可读的深色 */
.option-btn.wrong .token.keyword,
.option-btn.wrong .token.function { color: #B91C1C !important; } /* 深红色 */
.option-btn.wrong .token.operator,
.option-btn.wrong .token.variable,
.option-btn.wrong .token.punctuation { color: #991b1b !important; } /* 更深的红色 */
.option-btn.wrong .token.string { color: #991b1b !important; }
.option-btn.wrong .token.number { color: #7f1d1d !important; }
.option-btn.wrong code { color: #991b1b !important; }

/* 运行代码按钮 */
.run-code-button {
    margin-top: 15px;
    margin-bottom: 15px;
    width: 100%; /* 让按钮宽度与代码区域对齐 */
    padding: 10px 15px;
    font-size: 1.1em;
    font-weight: bold;
    border-radius: 8px;
    cursor: pointer;
    background-color: #4CAF50; /* 绿色 */
    color: white;
    border: none;
    transition: background-color 0.3s ease;
    flex-shrink: 0; /* 防止按钮被压缩 */
}

.run-code-button:hover:not(:disabled) {
    background-color: #45a049;
}

.run-code-button:disabled {
    background-color: #cccccc;
    cursor: not-allowed;
}

/* 代码输出区域 */
.code-output-container {
    margin-top: 20px;
    background-color: #282c34; /* 深色背景，类似终端 */
    border-radius: 8px;
    padding: 15px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    font-family: 'Fira Code', monospace;
    color: #abb2bf; /* 柔和的文本颜色 */
    font-size: 0.9em;
    max-height: 200px; /* 限制高度，防止输出过多撑开页面 */
    overflow-y: auto; /* 允许滚动 */
    border: 1px solid #3e4451;
    flex-shrink: 0; /* 防止输出区域被压缩 */
}

.code-output-container h4 {
    color: #61afef; /* 标题颜色 */
    margin-top: 0;
    margin-bottom: 10px;
    border-bottom: 1px solid #3e4451;
    padding-bottom: 5px;
}

.code-output {
    white-space: pre-wrap; /* 保留空白符和换行符 */
    word-wrap: break-word; /* 自动换行 */
    margin: 0;
    padding: 0;
    line-height: 1.4;
}

/* 错误输出样式 */
.code-output.error-output {
    color: #e06c75; /* 红色 */
    font-weight: bold;
}


.code-display-container {
  background-color: #1e1e1e; /* Dark background */
  border: 1px solid #333; /* Border to define the container */
  border-radius: 8px; /* Rounded corners */
  padding: 10px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2); /* Subtle shadow */
  overflow: hidden;
}

#current-code-snippet {
  background-color: #1e1e1e; /* Match the container */
  color: #04f955; /* Light text for visibility */
  font-family: 'Fira Code', monospace; /* Monospace font for coding */
  font-size: 14px;
  line-height: 1.5;
  border: none; /* Remove default border */
  outline: none; /* Remove outline on focus */
  width: 100%;
  height: 430px;
  min-height: 430px;
  resize: none; /* Prevent resizing */
  padding: 10px;
}

.run-code-button {
  margin-top: 10px;
  padding: 10px 20px;
  background-color: #007acc; /* Blue button */
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}

.run-code-button:hover {
  background-color: #005f99; /* Darker blue on hover */
}

.code-output-container {
  margin-top: 20px;
  background-color: #1e1e1e;
  color: #d4d4d4;
  padding: 10px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
  max-height: 150px;
  min-height: 126px;
  overflow-y: auto;
}


/* 在 style.css 文件底部添加 tic tak tok 游戏*/

#tictactoe-game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
    margin: 20px auto;
    width: 100%;
    max-width: 940px;
    padding: 14px;
    border-radius: 18px;
    background: linear-gradient(135deg, rgba(91, 33, 182, 0.2), rgba(45, 27, 78, 0.34));
    border: 1px solid rgba(253, 224, 71, 0.18);
}

.course-game-scoreboard {
    display: grid;
    grid-template-columns: repeat(3, minmax(120px, 1fr));
    gap: 10px;
    width: 100%;
}

.course-score-card {
    padding: 12px 12px 10px;
    border-radius: 18px;
    text-align: center;
    border: 1px solid rgba(253, 224, 71, 0.18);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.course-score-card.player-card {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.24), rgba(37, 99, 235, 0.14));
}

.course-score-card.goal-card {
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.22), rgba(217, 119, 6, 0.14));
}

.course-score-card.ai-card {
    background: linear-gradient(135deg, rgba(16, 185, 129, 0.2), rgba(5, 150, 105, 0.14));
}

.course-score-name {
    margin: 0 0 4px;
    font-size: 14px;
    font-weight: 700;
    color: #f8f1c2;
}

.course-score-value {
    margin: 0;
    font-size: clamp(26px, 4.2vw, 44px);
    line-height: 1;
    font-weight: 800;
    color: #fde047;
    text-shadow: 0 0 14px rgba(253, 224, 71, 0.22);
}

.course-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-top: 8px;
    min-width: 82px;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    color: #f8f1c2;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.course-score-badge.goal-badge {
    color: #fff7ed;
    background: rgba(31, 22, 51, 0.44);
    border-color: rgba(253, 224, 71, 0.2);
}

.course-score-card.flash-player {
    animation: flashPlayer 0.55s ease;
}

.course-score-card.flash-ai {
    animation: flashAi 0.55s ease;
}

.course-game-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 14px;
    justify-content: center;
    width: 100%;
    color: #ede9fe;
    font-size: 13px;
}

.course-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.course-legend-chip {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    font-weight: 800;
}

.course-legend-chip.number-chip {
    background: linear-gradient(135deg, #312e81, #5b21b6);
    color: #fef3c7;
}

.course-legend-chip.power-chip {
    background: linear-gradient(135deg, #d97706, #fbbf24);
    color: #25143f;
}

.course-legend-chip.trap-chip {
    background: linear-gradient(135deg, #7f1d1d, #b91c1c);
    color: #fff7ed;
}

.course-legend-chip.used-chip {
    background: #140b22;
    color: #94a3b8;
}

#game-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(62px, 78px));
    gap: 8px;
    background-color: #1a0b2e;
    padding: 10px;
    border-radius: 14px;
    border: 2px solid #a78bfa;
    width: 100%;
    justify-content: center;
}

.game-cell {
    min-width: 62px;
    min-height: 62px;
    background-color: #2d1b4e;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 24px;
    font-weight: bold;
    color: #fde047;
    cursor: pointer;
    transition: background-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.25);
}

.game-cell:hover {
    background-color: #4c337e;
    transform: translateY(-2px);
}

.game-cell.used {
    color: #94a3b8;
    background-color: #140b22;
    cursor: default;
    transform: none;
    box-shadow: none;
}

.game-cell.number-cell {
    background: linear-gradient(135deg, #312e81 0%, #5b21b6 100%);
}

.game-cell.power-cell {
    background: linear-gradient(135deg, #d97706 0%, #fbbf24 100%);
    color: #1f2937;
}

.game-cell.trap-cell {
    background: linear-gradient(135deg, #7f1d1d 0%, #b91c1c 100%);
    color: #fff7ed;
}

#game-status {
    width: 100%;
    font-size: 17px;
    font-weight: 700;
    color: #e9d5ff;
    min-height: 64px;
    line-height: 1.5;
    text-align: center;
    background: rgba(45, 27, 78, 0.7);
    border: 1px solid rgba(253, 224, 71, 0.2);
    border-radius: 12px;
    padding: 12px 16px;
    margin: 0;
}

#reset-game-btn {
    align-self: flex-start;
    margin-top: 2px;
}

@media (max-width: 900px) {
    .course-game-scoreboard {
        grid-template-columns: 1fr;
    }

    #game-board {
        grid-template-columns: repeat(4, minmax(56px, 1fr));
    }

    .game-cell {
        min-width: 56px;
        min-height: 56px;
        font-size: 22px;
    }
}

/* =========================
   Blackboard Screen (讲课界面 — slide deck)
========================= */

#blackboard-screen {
  max-width: 920px;
  margin: 40px auto;
  padding: 40px;
  background: linear-gradient(135deg, #2d1b4e 0%, #1e1338 100%);
  border-radius: 20px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

.blackboard-header {
  text-align: center;
  margin-bottom: 20px;
}

.blackboard-header h1 {
  color: #fde047;
  font-size: 26px;
  margin-bottom: 8px;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.3);
}

.blackboard-progress {
  color: #a78bfa;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

.blackboard-viewport {
  min-height: 620px;
}

.blackboard-slide {
  display: none;
  background: rgba(20, 10, 38, 0.55);
  border: 1px solid rgba(167, 139, 250, 0.35);
  border-radius: 14px;
  padding: 26px 30px;
  animation: blackboard-fade-in 0.25s ease;
}

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

@keyframes blackboard-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.blackboard-slide h2 {
  color: #fde047;
  font-size: 21px;
  margin: 0 0 16px;
  text-align: center;
}

.blackboard-bullets {
  list-style: none;
  margin: 18px 0 0;
  padding: 0;
}

.blackboard-bullets li {
  color: #e9d5ff;
  font-size: 16px;
  line-height: 1.6;
  padding: 8px 0 8px 26px;
  position: relative;
  border-bottom: 1px solid rgba(167, 139, 250, 0.15);
}

.blackboard-bullets li:last-child {
  border-bottom: none;
}

.blackboard-bullets li::before {
  content: "▸";
  position: absolute;
  left: 4px;
  color: #fbbf24;
}

.blackboard-bullets strong {
  color: #fbbf24;
}

.blackboard-bullets code {
  background: #14091f;
  border-radius: 4px;
  padding: 2px 6px;
  font-family: 'Fira Code', monospace;
  font-size: 13px;
  color: #a78bfa;
}

.blackboard-image-frame {
  margin: 0 0 8px;
  text-align: center;
}

.blackboard-image-frame img {
  max-width: 100%;
  max-height: 420px;
  border-radius: 12px;
  border: 2px solid rgba(251, 191, 36, 0.5);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
}

.blackboard-image-caption {
  margin: 10px auto 0;
  max-width: 640px;
  font-size: 14px;
  font-style: italic;
  color: #67e8f9;
  line-height: 1.5;
}

.blackboard-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 24px;
  gap: 16px;
}

.blackboard-nav .game-btn,
.blackboard-nav .start-btn {
  font-size: 17px;
  padding: 12px 26px;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-weight: bold;
}

.blackboard-nav .start-btn {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
  color: #000;
  box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

.blackboard-nav .game-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (max-width: 600px) {
  #blackboard-screen {
    padding: 24px 16px;
    margin: 16px;
  }

  .blackboard-slide {
    padding: 20px 18px;
  }
}

/* =========================
   🎴 Sticker Book (summary screen)
========================= */

.video-fullscreen-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.video-fullscreen-overlay.hidden {
  display: none;
}

.fullscreen-video {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.video-skip-btn {
  position: absolute;
  bottom: 28px;
  right: 28px;
  padding: 10px 20px;
  font-size: 15px;
  font-weight: 600;
  color: #1a0b2e;
  background: #fde047;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
}

.video-skip-btn:hover {
  background: #facc15;
}

.sticker-book {
  margin-top: 28px;
  padding: 22px;
  background: linear-gradient(135deg, rgba(124, 58, 237, 0.18) 0%, rgba(45, 27, 78, 0.6) 100%);
  border: 2px solid rgba(253, 224, 71, 0.25);
  border-radius: 18px;
  text-align: left;
}

.sticker-book-title {
  margin: 0 0 6px;
  color: #fde047;
  font-size: 22px;
}

.sticker-book-summary {
  margin: 0 0 14px;
  color: #ddd6fe;
  font-size: 14px;
}

.sticker-book-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.sticker-card {
  aspect-ratio: 3 / 4;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 6px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: transform 0.15s ease;
}

.sticker-card:hover {
  transform: translateY(-3px) rotate(-1deg);
}

.sticker-card.collected {
  background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 60%, #b45309 100%);
  border: 2px solid #fde047;
  box-shadow: 0 6px 18px rgba(251, 191, 36, 0.4);
}

.sticker-card.collected img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 8px;
}

.sticker-card.missed {
  background: rgba(30, 19, 56, 0.7);
  border: 2px dashed rgba(196, 181, 253, 0.3);
  color: rgba(196, 181, 253, 0.5);
}

.sticker-placeholder {
  font-size: 28px;
  line-height: 1;
}

.sticker-num {
  position: absolute;
  top: 4px;
  right: 6px;
  font-size: 10px;
  font-weight: 700;
  color: #1f1338;
  opacity: 0.7;
  background: rgba(255, 255, 255, 0.55);
  border-radius: 4px;
  padding: 0 3px;
}

.sticker-card.missed .sticker-num {
  color: rgba(196, 181, 253, 0.7);
  background: transparent;
}

@media (max-width: 700px) {
  .sticker-book-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}


/* ===== Blackboard interactive widgets (ai-06) ===== */
.blackboard-slide.has-widget:not(.widget-done) .blackboard-bullets,
.blackboard-slide.has-widget:not(.widget-done) .bb-reveal { display: none; }
.blackboard-slide.has-widget.widget-done .bb-skip { display: none; }
.blackboard-image-frame img.img-pop { animation: bb-img-pop 0.45s ease; }
@keyframes bb-img-pop {
  0% { opacity: 0.2; transform: scale(0.96); }
  100% { opacity: 1; transform: scale(1); }
}
.bb-widget {
  margin: 14px auto 0; max-width: 780px; padding: 14px 16px;
  background: rgba(88, 50, 160, 0.45); border: 2px dashed rgba(251, 191, 36, 0.7);
  border-radius: 12px; color: #f5f3ff; text-align: center;
}
.bb-widget-prompt { margin: 0 0 10px; font-size: 16px; line-height: 1.6; color: #fef3c7; }
.bb-widget-options, .bb-modes, .bb-presets { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-bottom: 8px; }
.bb-widget-btn, .bb-chip {
  background: #4c2a8f; color: #fef3c7; border: 1px solid rgba(251, 191, 36, 0.7);
  border-radius: 8px; padding: 8px 14px; font-size: 14px; cursor: pointer; font-family: inherit;
}
.bb-widget-btn:hover, .bb-chip:hover { background: #6b3fc4; }
.bb-widget-btn.picked { background: #fbbf24; color: #2a1250; font-weight: 700; }
.bb-chip { border-color: rgba(244, 114, 182, 0.8); color: #fbcfe8; }
.bb-widget-result { margin: 10px 0 0; font-size: 15px; color: #fde68a; min-height: 1.2em; }
.bb-mission { margin: 0 0 10px; font-size: 15px; color: #fde68a; }
.bb-skip {
  display: block; margin: 8px auto 0; background: none; border: none;
  color: #c4b5fd; font-size: 13px; cursor: pointer; text-decoration: underline;
}
.bb-transcript {
  text-align: left; background: #3a2270; border-radius: 8px; padding: 10px 12px;
  min-height: 70px; margin: 0 0 10px; white-space: pre-wrap; color: #f5f3ff;
  font-family: 'Fira Code', monospace; font-size: 13px;
}
.bb-transcript .line-model { color: #f5f3ff; }
.bb-transcript .line-tool { color: #fdba74; font-weight: 700; }
.bb-step-btn { font-size: 15px; }
.bb-form { display: flex; gap: 8px; margin-bottom: 10px; }
.bb-form input {
  flex: 1; padding: 8px 10px; border-radius: 8px; border: 1px solid #a78bfa;
  background: #3a2270; color: #f5f3ff; font-family: inherit;
}
.bb-form input::placeholder { color: #c4b5fd; }
.bb-sandbox-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; text-align: left; }
.bb-sandbox-cols h4 { margin: 0 0 6px; font-size: 13px; color: #fbbf24; }
.bb-size { color: #fde68a; font-weight: 400; }
.bb-chat, .bb-prompt {
  background: #3a2270; border-radius: 8px; padding: 8px 10px; height: 170px;
  overflow-y: auto; font-size: 13px; margin: 0; color: #f5f3ff;
}
.bb-prompt { white-space: pre-wrap; font-family: 'Fira Code', monospace; }
.bb-h { color: #fde047; margin-top: 4px; }
.bb-a { color: #ffffff; }
.bb-stats { margin: 8px 0 0; font-size: 13px; color: #fde68a; }
.bb-table { width: 100%; border-collapse: collapse; margin-top: 16px; font-size: 13px; color: #f5f3ff; }
.bb-table th { background: #4c2a8f; color: #fde047; padding: 8px 6px; border: 1px solid rgba(167, 139, 250, 0.5); }
.bb-table td { padding: 8px 6px; border: 1px solid rgba(167, 139, 250, 0.4); vertical-align: top; }
.bb-table-note { margin: 10px 0 0; font-size: 14px; color: #fde68a; line-height: 1.6; }
@media (max-width: 640px) { .bb-sandbox-cols { grid-template-columns: 1fr; } }


/* ===== CartPole widgets (rl-02) ===== */
.cp-canvas { display: block; width: 100%; max-width: 640px; margin: 10px auto; border-radius: 10px; border: 1px solid rgba(167, 139, 250, 0.5); background: #2a1250; }
.cp-widget kbd { background: #4c2a8f; border: 1px solid #fbbf24; border-radius: 4px; padding: 1px 6px; font-family: inherit; }
.cp-sliders { display: grid; gap: 6px; max-width: 520px; margin: 0 auto 8px; text-align: left; }
.cp-slider-row { display: grid; grid-template-columns: 160px 1fr 44px; gap: 8px; align-items: center; font-size: 14px; color: #fef3c7; }
.cp-slider-row input[type="range"] { width: 100%; accent-color: #fbbf24; }
.cp-slider-val { text-align: right; font-family: 'Fira Code', monospace; color: #fde047; }
.bb-widget-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* ===== rl-02 slide 2/4/5 widget additions ===== */
.bb-widget-prompt p { margin: 0 0 8px; }
.cp-rules { text-align: left; margin: 0 auto 10px; padding-left: 22px; max-width: 640px; font-size: 15px; line-height: 1.6; }
.cp-rules li { margin-bottom: 6px; }
.cp-tag-left, .cp-tag-right { font-weight: 800; padding: 0 6px; border-radius: 6px; color: #1a0b2e; }
.cp-tag-left { background: #60a5fa; }
.cp-tag-right { background: #fb923c; }
.bb-widget-btn.cp-btn-left { background: #1d4ed8; border-color: #60a5fa; color: #eff6ff; font-weight: 700; padding: 10px 22px; }
.bb-widget-btn.cp-btn-left:hover { background: #2563eb; }
.bb-widget-btn.cp-btn-right { background: #c2410c; border-color: #fb923c; color: #fff7ed; font-weight: 700; padding: 10px 22px; }
.bb-widget-btn.cp-btn-right:hover { background: #ea580c; }
.cp-limit-row { align-items: center; }
.cp-limit-label { font-size: 13px; color: #c4b5fd; }
.cp-readout { margin: 4px auto 8px; font-family: 'Fira Code', monospace; font-size: 12.5px; color: #fef3c7; max-width: 640px; min-height: 2.4em; }
.cp-board { max-width: 520px; margin: 12px auto 0; text-align: left; background: rgba(26, 11, 46, 0.55); border: 1px solid rgba(251, 191, 36, 0.5); border-radius: 10px; padding: 10px 14px; }
.cp-board-title { font-size: 13px; color: #fde68a; margin-bottom: 6px; }
.cp-board ol { margin: 0; padding: 0; list-style: none; }
.cp-board li { display: flex; justify-content: space-between; padding: 3px 8px; border-radius: 6px; font-size: 14px; color: #ede9fe; }
.cp-board li.mine { color: #fef3c7; background: rgba(251, 191, 36, 0.12); }
.cp-board li.latest { background: #fbbf24; color: #2a1250; font-weight: 800; }
.cp-board-more { margin-top: 6px; font-size: 13px; color: #fde68a; }
