:root {
  color-scheme: light;
  --ink: #172033;
  --muted: #667085;
  --paper: #f4f7fb;
  --panel: #ffffff;
  --line: #d9e2ef;
  --blue: #2f6fed;
  --green: #20a66a;
  --red: #ef4444;
  --shadow: 0 24px 70px rgba(25, 38, 66, 0.16);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: "Aptos", "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

button { font: inherit; cursor: pointer; }

.training-shell { min-height: 100vh; padding: 18px; }
.workspace { width: min(1600px, 100%); margin: 0 auto; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

h1 { margin: 0; font-size: 26px; line-height: 1.2; }
h2 { margin-top: 0; font-size: 20px; }

.toolbar, .course-switch, .mode-switch, .controls {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.course-switch, .mode-switch {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.lang-button, .course-button, .ghost-button, .secondary-button, .primary-button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
}

.lang-button, .course-button {
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
}

.lang-button.is-active, .course-button.is-active {
  color: #fff;
  background: var(--ink);
}

.ghost-button, .secondary-button {
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: var(--panel);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

.primary-button {
  padding: 0 18px;
  color: #fff;
  background: var(--blue);
}

.primary-button:disabled,
.secondary-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.lesson-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.65fr);
  gap: 16px;
}

.stage, .lesson-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.stage { padding: 16px; min-height: 520px; display: flex; flex-direction: column; gap: 12px; }
.lesson-panel { padding: 16px; display: flex; flex-direction: column; gap: 14px; }

.slide-figure { margin: 0; }

.image-frame {
  position: relative;
  width: 100%;
  overflow: auto;
  max-height: min(680px, calc(100vh - 220px));
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}

.slide-panel.is-click-step .image-frame {
  max-height: min(720px, calc(100vh - 200px));
}

.image-stack {
  position: relative;
  display: block;
  width: 100%;
}

.slide-figure img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
}

.slide-panel:not(.is-click-step) .slide-figure img {
  max-height: 420px;
  object-fit: contain;
}

.hotspot {
  position: absolute;
  border: 3px solid var(--red);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.14);
  cursor: pointer;
  animation: hotspot-pulse 1.6s ease-in-out infinite;
  z-index: 2;
  min-width: 44px;
  min-height: 44px;
}

.hotspot:focus-visible {
  outline: 3px solid #fbbf24;
  outline-offset: 2px;
}

.hotspot.is-done {
  border-color: var(--green);
  box-shadow: 0 0 0 6px rgba(32, 166, 106, 0.18);
  animation: none;
}

.hotspot::after {
  content: "";
  position: absolute;
  right: -11px;
  bottom: -11px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--red);
  box-shadow: 0 0 0 8px rgba(239, 68, 68, 0.15);
}

.hotspot.is-done::after {
  background: var(--green);
  box-shadow: 0 0 0 8px rgba(32, 166, 106, 0.15);
}

@keyframes hotspot-pulse {
  0%, 100% { box-shadow: 0 0 0 6px rgba(239, 68, 68, 0.14); }
  50% { box-shadow: 0 0 0 10px rgba(239, 68, 68, 0.28); }
}

.cursor-pointer {
  position: absolute;
  width: 32px;
  height: 32px;
  pointer-events: none;
  z-index: 3;
  background: center / contain no-repeat
    url("data:image/svg+xml,%3Csvg width='42' height='42' viewBox='0 0 42 42' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M9 4L33 23.5L21.8 25.2L17.1 37L9 4Z' fill='white'/%3E%3Cpath d='M9 4L33 23.5L21.8 25.2L17.1 37L9 4Z' stroke='%23111827' stroke-width='2.5' stroke-linejoin='round'/%3E%3Cpath d='M21.2 25.4L29.2 34.6' stroke='%23111827' stroke-width='2.5' stroke-linecap='round'/%3E%3C/svg%3E");
  filter: drop-shadow(0 6px 10px rgba(17, 24, 39, 0.22));
  transform: translate(-6px, -4px);
}

.click-hint {
  margin: 10px 0 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.5;
}

.click-hint.is-ok {
  background: #ecfdf3;
  border-color: #86efac;
  color: #166534;
}

.slide-figure figcaption {
  margin-top: 10px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

.text-only-panel, .checklist-panel {
  flex: 1;
  padding: 8px 4px;
}

.text-only-eyebrow {
  margin: 0 0 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.text-only-title { font-size: 24px; margin-bottom: 10px; }
.text-only-body, .text-only-note { line-height: 1.65; color: var(--ink); }
.text-only-note {
  margin-top: 12px;
  padding: 12px 14px;
  border-left: 4px solid var(--blue);
  background: #eff6ff;
  border-radius: 6px;
}

.text-only-checks, .check-list {
  margin: 12px 0 0;
  padding-left: 18px;
  line-height: 1.6;
}

.checklist-box label {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin: 10px 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  cursor: pointer;
}

.checklist-status {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #eef2ff;
  font-weight: 600;
}

.step-strip {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: auto;
}

.step-pill {
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.step-pill.is-current { border-color: var(--blue); color: var(--blue); background: #eff6ff; }
.step-pill.is-done { border-color: var(--green); color: var(--green); background: #ecfdf3; }

.progress-card { margin-bottom: 4px; }
.progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.progress-track {
  height: 8px;
  border-radius: 999px;
  background: #e8eef8;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--blue), #5b8df7);
  transition: width 200ms ease;
}

.instruction-card, .exam-card {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
  background: #fbfdff;
}

.panel-label {
  margin: 0 0 6px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
}

.field-note {
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  line-height: 1.55;
}

.exam-options { display: grid; gap: 8px; margin: 12px 0; }
.exam-option {
  text-align: left;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.exam-option.is-correct { border-color: var(--green); background: #ecfdf3; }
.exam-option.is-wrong { border-color: var(--red); background: #fef2f2; }

.result-message { min-height: 1.4em; line-height: 1.5; }
.result-message.is-ok { color: var(--green); }
.result-message.is-error { color: var(--red); }

.lesson-layout.is-read-step .instruction-card { display: none; }
.lesson-layout.is-read-step .stage { background: linear-gradient(180deg, #fff, #f8fbff); }

@media (max-width: 980px) {
  .lesson-layout { grid-template-columns: 1fr; }
  .stage { min-height: auto; }
}
