/* Exercise mode: a calm, centered classroom card with a deliberately large answer target. */
.exercise-editor-panel {
  width: min(680px, 100%); max-height: min(820px, 92vh); overflow: auto; padding: 24px;
  border: 1px solid var(--line, #d4d4d4); border-radius: 16px; background: var(--surface, #fff);
  color: var(--ink, #18181b); box-shadow: var(--shadow-modal, 0 24px 72px rgb(0 0 0 / .22));
}
.exercise-editor-subtitle { margin: 4px 0 0; color: var(--muted, #57575a); font-size: 12px; }
.exercise-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 20px; }
.exercise-field { display: flex; min-width: 0; flex-direction: column; gap: 5px; color: var(--muted, #57575a); font-size: 12px; font-weight: 600; }
.exercise-field-wide { grid-column: 1 / -1; }
.exercise-field input, .exercise-field select, .exercise-field textarea {
  width: 100%; border: 1px solid var(--line, #d4d4d4); border-radius: 8px; background: var(--surface-soft, #fafafa);
  color: var(--ink, #18181b); padding: 9px 10px; font: inherit; font-weight: 400; outline: none;
}
.exercise-field input:focus, .exercise-field select:focus, .exercise-field textarea:focus { border-color: var(--focus-ring); box-shadow: 0 0 0 3px rgb(16 185 129 / .16); }
.exercise-field-group { display: contents; }
.exercise-check-field { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; color: var(--ink, #18181b); font-size: 12px; }
.exercise-check-field input { accent-color: var(--n-900, #18181b); }
.exercise-editor-note { min-height: 20px; margin-top: 12px; color: var(--muted, #57575a); font-size: 12px; }
.exercise-editor-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 12px; }
.exercise-primary-button, .exercise-secondary-button, .exercise-text-button, .exercise-icon-button {
  border: 1px solid transparent; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13px; line-height: 1.2; transition: background .16s ease, border-color .16s ease, transform .16s ease;
}
.exercise-primary-button { padding: 10px 15px; border-color: var(--btn-primary-border, #18181b); background: var(--btn-primary-bg, #18181b); color: var(--btn-primary-fg, #fff); font-weight: 700; }
.exercise-primary-button:hover:not(:disabled) { background: #303036; }
.exercise-primary-button:disabled { cursor: not-allowed; opacity: .42; }
.exercise-secondary-button { padding: 9px 12px; border-color: var(--btn-secondary-border, #e2e2e0); background: var(--btn-secondary-bg, #fff); color: var(--btn-secondary-fg, #18181b); font-weight: 600; }
.exercise-secondary-button:hover { background: var(--state-active-bg, #ededec); }
.exercise-text-button { padding: 7px 4px; background: transparent; color: var(--muted, #57575a); text-decoration: underline; text-underline-offset: 3px; }
.exercise-text-button:hover { color: var(--ink, #18181b); }
.exercise-icon-button { width: 32px; height: 32px; background: transparent; color: var(--muted, #57575a); font-size: 24px; }
.exercise-icon-button:hover { background: var(--state-active-bg, #ededec); color: var(--ink, #18181b); }

.exercise-progress-bar {
  position: fixed; z-index: var(--layer-stack-46); top: 82px; left: 50%; width: min(680px, calc(100vw - 48px));
  transform: translateX(-50%); padding: 12px 18px; border: 1px solid var(--line, #d4d4d4);
  border-radius: 999px; background: rgb(255 255 255 / .96); color: var(--ink, #18181b);
  box-shadow: 0 8px 24px rgb(24 24 27 / .12); backdrop-filter: blur(10px);
}
.exercise-student-card {
  position: fixed; z-index: var(--layer-stack-45); top: 160px; left: 50%; width: min(680px, calc(100vw - 48px)); max-height: calc(100vh - 190px);
  overflow: auto; transform: translateX(-50%); padding: 28px 32px 22px; border: 1px solid var(--line, #d4d4d4);
  border-radius: 24px; background: rgb(255 255 255 / .97); color: var(--ink, #18181b);
  box-shadow: 0 20px 56px rgb(24 24 27 / .18); backdrop-filter: blur(10px);
}
.exercise-student-card.is-correct { border-color: #16a34a; box-shadow: 0 0 0 2px rgb(22 163 74 / .16), 0 20px 56px rgb(24 24 27 / .18); }
.exercise-progress-row { display: flex; align-items: center; gap: 12px; color: var(--muted, #57575a); font-size: 12px; }
.exercise-progress-segments { display: flex; flex: 1; gap: 6px; }
.exercise-progress-segment { height: 7px; flex: 1; border-radius: 99px; background: var(--n-200, #e2e2e0); }
.exercise-progress-segment.is-current { background: var(--n-900, #18181b); }
.exercise-progress-segment.is-complete { background: #16a34a; }
/* 答对反馈（assets/answer-feedback.js）：刚完成那一格高亮一下；连对徽章。动效只用 transform / opacity，减弱动效时不弹 */
.exercise-progress-segment { transform-origin: center; will-change: transform; }
.exercise-progress-segment.is-just-done { background: #22c55e; box-shadow: 0 0 0 3px rgb(34 197 94 / .18); }
.answer-streak {
  display: inline-flex; align-items: center; gap: 4px; flex: none; height: 24px; padding: 0 8px 0 6px;
  border: 1px solid rgb(22 163 74 / .28); border-radius: 999px; background: rgb(22 163 74 / .08); color: #15803d;
  font-size: 12px; font-weight: 600; letter-spacing: 0; white-space: nowrap; transform-origin: center;
}
.answer-streak b { font-variant-numeric: tabular-nums; font-weight: 750; }
.answer-streak.is-milestone { border-color: #15803d; background: #15803d; color: #fff; box-shadow: 0 4px 12px rgb(21 128 61 / .28); }
.answer-streak[hidden] { display: none; }
body:not(.theme-light) .answer-streak { color: #86efac; background: rgb(34 197 94 / .12); border-color: rgb(34 197 94 / .32); }
body:not(.theme-light) .answer-streak.is-milestone { color: #052e16; background: #4ade80; border-color: #4ade80; }
.exercise-student-prompt { margin-top: 0; font-size: 20px; line-height: 1.45; font-weight: 750; }
.exercise-interaction { min-height: 280px; margin-top: 22px; }
.exercise-number-input { width: 100%; box-sizing: border-box; border: 1px solid var(--line, #d4d4d4); border-radius: 12px; padding: 15px 16px; background: #fff; color: var(--ink, #18181b); font-size: 24px; outline: none; }
.exercise-number-input:focus, .exercise-point-surface:focus { border-color: var(--focus-ring); box-shadow: 0 0 0 3px rgb(16 185 129 / .16); }
.exercise-slider-wrap { display: grid; gap: 14px; padding: 32px 8px; }
.exercise-slider-wrap input[type="range"] { width: 100%; height: 18px; accent-color: var(--n-900, #18181b); cursor: grab; }
.exercise-slider-wrap input[type="range"]:active { cursor: grabbing; }
.exercise-slider-value { color: var(--muted, #57575a); font: 600 16px ui-monospace, SFMono-Regular, Menlo, monospace; }
.exercise-point-surface {
  position: relative; width: 100%; height: 280px; overflow: hidden; border: 1px solid var(--line, #d4d4d4);
  border-radius: 16px; outline: none; background: linear-gradient(#e8e8e5 1px, transparent 1px), linear-gradient(90deg, #e8e8e5 1px, transparent 1px);
  background-size: 28px 28px; touch-action: none; cursor: crosshair;
}
.exercise-point-surface::before, .exercise-point-surface::after { position: absolute; content: ''; background: #a3a3a1; }
.exercise-point-surface::before { top: 50%; left: 0; width: 100%; height: 1px; }
.exercise-point-surface::after { top: 0; left: 50%; width: 1px; height: 100%; }
.exercise-point-target, .exercise-point-dot { position: absolute; z-index: var(--layer-stack-1); width: 28px; height: 28px; transform: translate(-50%, -50%); border-radius: 50%; }
.exercise-point-target { border: 3px dashed #57575a; background: rgb(255 255 255 / .65); }
.exercise-point-dot { border: 3px solid #18181b; background: #fff; cursor: grab; box-shadow: 0 3px 12px rgb(24 24 27 / .22); }
.exercise-point-dot:active { cursor: grabbing; }
.exercise-choice-list { display: grid; gap: 12px; }
.exercise-choice { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 58px; box-sizing: border-box; padding: 13px 16px; border: 1px solid var(--line, #d4d4d4); border-radius: 12px; background: #fff; color: var(--ink, #18181b); cursor: pointer; font-size: 18px; }
.exercise-choice input { width: 22px; height: 22px; accent-color: var(--n-900, #18181b); }
.exercise-choice:has(input:checked) { border-color: var(--n-900, #18181b); background: var(--state-active-bg, #ededec); }
.exercise-student-feedback { min-height: 28px; margin-top: 12px; color: var(--muted, #57575a); font-size: 15px; line-height: 1.5; }
.exercise-student-card.is-correct .exercise-student-feedback { color: #15803d; font-weight: 700; }
.exercise-success-mark { display: inline-flex; align-items: center; gap: 8px; color: #15803d; }
.exercise-success-mark svg { width: 22px; height: 22px; }
.exercise-success-star { display: inline-block; margin-left: 5px; animation: exercise-star-pop .6s ease-out both; vertical-align: -3px; }
.exercise-success-star svg { width: 18px; height: 18px; fill: #57575a; }
@keyframes exercise-star-pop { 0% { opacity: 0; transform: translateY(5px) scale(.5) rotate(-18deg); } 70% { opacity: 1; transform: translateY(-2px) scale(1.12) rotate(8deg); } 100% { opacity: 1; transform: translateY(0) scale(1) rotate(0); } }
.exercise-student-actions { display: block; margin-top: 4px; }
.exercise-support-actions { display: flex; align-items: center; justify-content: flex-end; gap: 14px; min-height: 34px; }
.exercise-check-button { width: 100%; min-height: 52px; margin-top: 10px; font-size: 16px; }
.exercise-page-actions { display: flex; justify-content: space-between; margin-top: 14px; border-top: 1px solid var(--line, #e2e2e0); }
.exercise-page-actions button:disabled { visibility: hidden; }
.exercise-teacher-summary { margin-top: 5px; color: var(--muted, #57575a); font-size: 11px; }
body.exercise-student-active #ai-assistant-bar,
body.exercise-student-active #ai-assistant-reopen,
body.exercise-student-active #ai-assistant-hist,
body.exercise-student-active #ai-assistant-cards,
body.exercise-student-active #sceneTimeline,
body.exercise-student-active #ai-assistant-note { visibility: hidden !important; pointer-events: none !important; }
body:not(.theme-light) .exercise-editor-panel, body:not(.theme-light) .exercise-progress-bar, body:not(.theme-light) .exercise-student-card { background: rgb(32 32 35 / .97); color: var(--ink, #f5f5f4); }
body:not(.theme-light) .exercise-field input, body:not(.theme-light) .exercise-field select, body:not(.theme-light) .exercise-field textarea, body:not(.theme-light) .exercise-number-input, body:not(.theme-light) .exercise-choice { background: var(--surface-soft, #18181b); color: var(--ink, #f5f5f4); }
body:not(.theme-light) .exercise-point-surface { background-color: #202023; background-image: linear-gradient(#3a3a3e 1px, transparent 1px), linear-gradient(90deg, #3a3a3e 1px, transparent 1px); }
body:not(.theme-light) .exercise-point-dot { background: #202023; border-color: #f5f5f4; }
@media (max-width: 640px) {
  .exercise-editor-panel { padding: 18px; }
  .exercise-form-grid { grid-template-columns: 1fr; }
  .exercise-field-wide { grid-column: auto; }
  .exercise-check-field { grid-column: auto; }
  .exercise-editor-actions { align-items: stretch; flex-direction: column; }
  .exercise-editor-actions > div { justify-content: flex-end; }
  .exercise-progress-bar { top: 76px; width: calc(100vw - 24px); padding: 10px 12px; }
  .exercise-student-card { top: 140px; width: calc(100vw - 24px); max-height: calc(100vh - 156px); padding: 22px 20px 18px; border-radius: 20px; }
  .exercise-student-prompt { font-size: 18px; }
  .exercise-interaction { min-height: 220px; }
  .exercise-point-surface { height: 220px; }
}
