/* =========================================================================
   Learn to Trade - guided lesson page

   Follows the project design system (accent variables, 2px radii, uppercase
   letter-spaced labels) but runs calmer than the simulator: one column of copy,
   one visual, one action. Nothing competes for attention with the current step.

   Deliberately avoids any 100vh math. The market marquee (32px) plus the nav
   makes viewport-height layouts clip the chart on this master page, so the
   stage is sized in its own terms and the page scrolls normally.
   ========================================================================= */

.learn-page {
  --accent-green: #10b981;
  --accent-cyan:  #22d3ee;
  --accent-blue:  #3b82f6;
  --accent-red:   #ef4444;
  --accent-amber: #fbbf24;

  --section-dark:   #050508;
  --section-medium: #0c0c12;
  --section-light:  #16161f;

  --border-light: rgba(255, 255, 255, 0.15);
  --border-faint: rgba(255, 255, 255, 0.08);

  --text-primary:   #ffffff;
  --text-secondary: rgba(255, 255, 255, 0.80);
  --text-muted:     rgba(255, 255, 255, 0.60);

  background: var(--section-dark);
  min-height: 70vh;
  padding: 28px 0 64px;
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

.learn-shell {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 24px;
  align-items: start;
}

/* ============================== LESSON PANEL ============================== */

.learn-panel {
  background: var(--section-medium);
  border: 1px solid var(--border-faint);
  border-top: 3px solid var(--accent-green);
  border-radius: 2px;
  display: flex;
  flex-direction: column;
  min-height: 520px;
  /* Clears the sticky navbar (~70px) plus the market marquee (32px) so the panel
     doesn't slide underneath them. Capped to the remaining viewport with the
     body scrolling internally, so the Continue button is always reachable. */
  position: sticky;
  top: 108px;
  max-height: calc(100vh - 124px);
}

.learn-panel-head { padding: 18px 22px 0; }

.learn-panel-meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.learn-lesson-name {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-cyan);
}

.learn-step-counter {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.learn-progress {
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  overflow: hidden;
}

.learn-progress-fill {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--accent-green), var(--accent-cyan));
  transition: width 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

.learn-panel-body {
  flex: 1;
  padding: 24px 22px 8px;
  overflow-y: auto;
}

/* Each step fades and lifts in. Subtle - it marks the change without making
   the learner wait for it. */
.learn-panel-body.is-entering { animation: learnStepIn 320ms cubic-bezier(0.22, 1, 0.36, 1); }

@keyframes learnStepIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}

.learn-panel-footer {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 22px 20px;
  border-top: 1px solid var(--border-faint);
}

/* ================================ TYPOGRAPHY ============================= */

.learn-eyebrow {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--accent-green);
  margin-bottom: 10px;
}

.learn-title {
  font-size: 1.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin: 0 0 12px;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.learn-title.is-center { text-align: center; }

.learn-copy {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.learn-copy.is-center { text-align: center; }
.learn-copy strong { color: var(--text-primary); font-weight: 700; }
.learn-copy em { color: var(--accent-cyan); font-style: normal; }
.learn-copy a { color: var(--accent-cyan); }

.learn-points {
  list-style: none;
  margin: 0 0 16px;
  padding: 0;
}

.learn-points li {
  position: relative;
  padding-left: 20px;
  margin-bottom: 9px;
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-muted);
}

.learn-points li::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 0.6em;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-green);
  opacity: 0.65;
}

.learn-callout {
  border-left: 2px solid var(--accent-cyan);
  background: rgba(34, 211, 238, 0.06);
  padding: 12px 14px;
  font-size: 0.86rem;
  line-height: 1.55;
  color: var(--text-secondary);
  border-radius: 0 2px 2px 0;
}
.learn-callout em { color: var(--accent-cyan); font-style: normal; font-weight: 600; }

/* ============================== FIGURE LEDGER ============================ */

.learn-figures {
  border: 1px solid var(--border-faint);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 16px;
}

.learn-figure-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 14px;
  font-size: 0.86rem;
  border-bottom: 1px solid var(--border-faint);
}
.learn-figure-row:last-child { border-bottom: 0; }
.learn-figure-row.is-emphasis { background: rgba(255, 255, 255, 0.03); }

.learn-figure-label { color: var(--text-muted); }

.learn-figure-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.learn-figure-value.is-pos { color: var(--accent-green); }
.learn-figure-value.is-neg { color: var(--accent-red); }

/* ================================== QUIZ ================================= */

.learn-question {
  font-size: 1rem;
  line-height: 1.55;
  color: var(--text-primary);
  margin-bottom: 16px;
}
.learn-question strong { color: var(--accent-cyan); }

.learn-options { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }

.learn-option {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 13px 15px;
  background: var(--section-light);
  border: 1px solid var(--border-faint);
  border-radius: 2px;
  color: var(--text-secondary);
  font-size: 0.92rem;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 140ms, background 140ms, color 140ms, transform 140ms;
}

.learn-option:hover:not(:disabled) {
  border-color: var(--border-light);
  background: #1c1c26;
  color: var(--text-primary);
  transform: translateX(2px);
}

.learn-option-marker {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.22);
  transition: border-color 140ms, background 140ms;
  position: relative;
}

.learn-options.is-locked .learn-option { cursor: default; }
.learn-options.is-locked .learn-option:hover { transform: none; }

.learn-option.is-correct {
  border-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.08);
  color: var(--text-primary);
}
.learn-option.is-correct .learn-option-marker {
  border-color: var(--accent-green);
  background: var(--accent-green);
}
/* Checkmark drawn in CSS so the marker needs no extra markup. */
.learn-option.is-correct .learn-option-marker::after {
  content: "";
  position: absolute;
  left: 4px;
  top: 1px;
  width: 4px;
  height: 8px;
  border: solid #05140f;
  border-width: 0 2px 2px 0;
  transform: rotate(43deg);
}

.learn-option.is-wrong {
  border-color: var(--accent-red);
  background: rgba(239, 68, 68, 0.07);
  color: var(--text-secondary);
}
.learn-option.is-wrong .learn-option-marker {
  border-color: var(--accent-red);
  background: var(--accent-red);
}
.learn-option.is-wrong .learn-option-marker::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 2px;
  height: 10px;
  background: #1a0505;
  box-shadow: 0 0 0 0 transparent;
  transform: rotate(45deg);
}
.learn-option.is-wrong .learn-option-marker::before {
  content: "";
  position: absolute;
  left: 6px;
  top: 2px;
  width: 2px;
  height: 10px;
  background: #1a0505;
  transform: rotate(-45deg);
}

/* ================================ FEEDBACK =============================== */

.learn-feedback {
  max-height: 0;
  opacity: 0;
  overflow: hidden;
  transition: max-height 300ms ease, opacity 220ms ease, margin 220ms ease;
  border-radius: 2px;
}

.learn-feedback.is-visible {
  max-height: 260px;
  opacity: 1;
  padding: 13px 15px;
  margin-bottom: 8px;
}

.learn-feedback.is-good {
  background: rgba(16, 185, 129, 0.08);
  border-left: 2px solid var(--accent-green);
}
.learn-feedback.is-corrective {
  background: rgba(251, 191, 36, 0.07);
  border-left: 2px solid var(--accent-amber);
}

.learn-feedback-head {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  margin-bottom: 6px;
}
.learn-feedback.is-good .learn-feedback-head { color: var(--accent-green); }
.learn-feedback.is-corrective .learn-feedback-head { color: var(--accent-amber); }

.learn-feedback-body {
  font-size: 0.88rem;
  line-height: 1.55;
  color: var(--text-secondary);
}
.learn-feedback-body strong { color: var(--text-primary); }

/* ============================== INSTRUCTION ============================== */

.learn-instruction {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 14px 16px;
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.30);
  border-radius: 2px;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 14px;
}
.learn-instruction strong { color: var(--accent-green); }

.learn-instruction-icon {
  color: var(--accent-green);
  font-size: 0.7rem;
  animation: learnNudge 1.5s ease-in-out infinite;
}

@keyframes learnNudge {
  0%, 100% { transform: translateX(0); }
  50%      { transform: translateX(4px); }
}

/* ============================== LIVE READOUT ============================= */

.learn-live {
  text-align: center;
  padding: 20px 16px 16px;
  background: var(--section-light);
  border: 1px solid var(--border-faint);
  border-radius: 2px;
  margin-bottom: 12px;
}

.learn-live-lead {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.learn-live-value {
  font-size: 2.4rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
  transition: color 200ms;
}
.learn-live-value.is-pos { color: var(--accent-green); }
.learn-live-value.is-neg { color: var(--accent-red); }

.learn-live-note {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-muted);
  text-align: center;
  min-height: 2.6em;
}
.learn-live-note strong { color: var(--accent-cyan); }
.learn-live-note.is-swap { animation: learnStepIn 300ms ease; }

/* =============================== BUTTONS ================================= */

.learn-btn-primary {
  flex: 1;
  padding: 13px 20px;
  background: var(--accent-green);
  color: #04140d;
  border: 0;
  border-radius: 2px;
  font-size: 0.88rem;
  font-weight: 700;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: filter 140ms, opacity 140ms, transform 140ms;
}
.learn-btn-primary:hover:not(:disabled) { filter: brightness(1.1); }
.learn-btn-primary:active:not(:disabled) { transform: translateY(1px); }
.learn-btn-primary:disabled {
  background: rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.35);
  cursor: not-allowed;
}

.learn-btn-ghost {
  padding: 13px 18px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border-faint);
  border-radius: 2px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: color 140ms, border-color 140ms;
}
.learn-btn-ghost:hover { color: var(--text-primary); border-color: var(--border-light); }

.learn-btn-secondary {
  padding: 11px 18px;
  background: transparent;
  color: var(--accent-cyan);
  border: 1px solid rgba(34, 211, 238, 0.45);
  border-radius: 2px;
  font-size: 0.82rem;
  font-weight: 700;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  white-space: nowrap;
  cursor: pointer;
  transition: background 140ms, color 140ms;
}
.learn-btn-secondary:hover { background: rgba(34, 211, 238, 0.12); color: #fff; }

/* ================================= STAGE ================================= */

.learn-stage { position: relative; min-height: 520px; }

.learn-stage-mode { display: none; }
.learn-stage-mode.is-active { display: block; animation: learnStageIn 380ms ease; }

@keyframes learnStageIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* --- Mode 1: the buy-low/sell-high illustration --- */

.learn-illus {
  background: var(--section-medium);
  border: 1px solid var(--border-faint);
  border-radius: 2px;
  padding: 32px 28px 24px;
}

.learn-illus-svg { width: 100%; height: auto; display: block; }

.learn-illus-grid { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }

.learn-illus-line {
  stroke: var(--accent-green);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-dasharray: 620;
  stroke-dashoffset: 620;
  animation: learnDrawLine 1600ms cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes learnDrawLine { to { stroke-dashoffset: 0; } }

.learn-illus-area { opacity: 0; animation: learnFadeIn 700ms 900ms ease forwards; }

@keyframes learnFadeIn { to { opacity: 1; } }

.learn-illus-marker { opacity: 0; animation: learnFadeIn 400ms ease forwards; }
.learn-illus-marker.is-buy  { animation-delay: 700ms; }
.learn-illus-marker.is-sell { animation-delay: 1500ms; }

.learn-illus-marker circle { fill: var(--section-dark); stroke-width: 3; }
.learn-illus-marker.is-buy circle  { stroke: var(--accent-cyan); }
.learn-illus-marker.is-sell circle { stroke: var(--accent-green); }

.learn-illus-marker text {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-anchor: middle;
  font-family: 'Inter', sans-serif;
}
.learn-illus-marker.is-buy text  { fill: var(--accent-cyan); }
.learn-illus-marker.is-sell text { fill: var(--accent-green); }

.learn-illus-caption {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid var(--border-faint);
}

.learn-illus-chip {
  padding: 7px 14px;
  border: 1px solid rgba(34, 211, 238, 0.4);
  color: var(--accent-cyan);
  border-radius: 2px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.6px;
}
.learn-illus-chip.is-sell {
  border-color: rgba(16, 185, 129, 0.4);
  color: var(--accent-green);
}

.learn-illus-arrow { color: var(--text-muted); font-size: 1.1rem; }

/* --- Mode 2: the oversized candle --- */

.learn-candle-frame {
  position: relative;
  background: var(--section-medium);
  border: 1px solid var(--border-faint);
  border-radius: 2px;
  padding: 24px;
  display: flex;
  justify-content: center;
}

.learn-candle-svg {
  width: 100%;
  max-width: 300px;
  height: auto;
  display: block;
}

/* The hotspot layer sits exactly over the SVG's box, so percentage positions
   derived from viewBox units land on the geometry at any size. */
.learn-hotspots {
  position: absolute;
  top: 24px;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  width: min(300px, calc(100% - 48px));
  pointer-events: none;
}

.learn-hotspot {
  position: absolute;
  width: 30px;
  height: 30px;
  margin: -15px 0 0 -15px;
  border-radius: 50%;
  border: 2px dashed rgba(255, 255, 255, 0.45);
  background: rgba(0, 0, 0, 0.35);
  cursor: pointer;
  pointer-events: auto;
  padding: 0;
  transition: border-color 160ms, background 160ms, transform 160ms;
}
.learn-hotspot:hover:not(:disabled) {
  border-color: #fff;
  background: rgba(255, 255, 255, 0.14);
  transform: scale(1.12);
}

.learn-hotspot::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.5);
  animation: learnPing 2s cubic-bezier(0, 0, 0.2, 1) infinite;
}

@keyframes learnPing {
  0%        { transform: scale(1);   opacity: 0.8; }
  70%, 100% { transform: scale(2.1); opacity: 0; }
}

.learn-hotspot.is-found {
  border-style: solid;
  border-color: var(--accent-green);
  background: var(--accent-green);
  cursor: default;
}
.learn-hotspot.is-found::after { display: none; }

.learn-hotspot.is-shake { animation: learnShake 400ms ease; }

@keyframes learnShake {
  0%, 100%   { transform: translateX(0); }
  25%        { transform: translateX(-5px); }
  75%        { transform: translateX(5px); }
}

.learn-hotspot-label {
  position: absolute;
  transform: translate(-50%, -50%);
  padding: 3px 9px;
  background: var(--accent-green);
  color: #04140d;
  border-radius: 2px;
  font-size: 0.66rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  white-space: nowrap;
  pointer-events: none;
  animation: learnFadeIn 300ms ease forwards;
  opacity: 0;
}
/* Nudge each label clear of the candle body it annotates. */
.learn-hotspot-label.is-open  { margin-left: -46px; }
.learn-hotspot-label.is-close { margin-left: 48px; }
.learn-hotspot-label.is-high  { margin-top: -26px; }
.learn-hotspot-label.is-low   { margin-top: 26px; }

.learn-prompt {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 15px;
  background: var(--section-light);
  border: 1px solid var(--border-faint);
  border-radius: 2px;
  margin-bottom: 12px;
  font-size: 0.92rem;
  color: var(--text-primary);
}
.learn-prompt strong { color: var(--accent-cyan); }

.learn-prompt-count {
  flex-shrink: 0;
  padding: 3px 8px;
  background: rgba(34, 211, 238, 0.14);
  color: var(--accent-cyan);
  border-radius: 2px;
  font-size: 0.7rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

.learn-prompt-done { color: var(--accent-green); font-weight: 700; }

/* --- Mode 3: the live simulator --- */

.learn-chart-wrap {
  position: relative;
  background: var(--section-medium);
  border: 1px solid var(--border-faint);
  border-radius: 2px;
  overflow: hidden;
}

/* Fixed, generous chart height. Not viewport-derived - see the note at the top
   about the marquee clipping vh-based layouts on this master page. */
#learnChart { height: clamp(320px, 44vh, 460px); }

.learn-chart-badge {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(5, 5, 8, 0.78);
  border: 1px solid var(--border-faint);
  border-radius: 2px;
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  pointer-events: none;
}

.learn-chart-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-amber);
}

.learn-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-faint);
  border: 1px solid var(--border-faint);
  border-top: 0;
}

.learn-stat { background: var(--section-medium); padding: 12px 14px; }

.learn-stat-label {
  font-size: 0.64rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.learn-stat-value {
  font-size: 1.02rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}
.learn-stat-value.is-pos { color: var(--accent-green); }
.learn-stat-value.is-neg { color: var(--accent-red); }

/* --- Trade deck --- */

.learn-deck {
  display: flex;
  align-items: stretch;
  gap: 10px;
  margin-top: 12px;
  padding: 12px;
  background: var(--section-medium);
  border: 1px solid var(--border-faint);
  border-radius: 2px;
  transition: border-color 220ms;
}
.learn-deck.is-armed { border-color: rgba(16, 185, 129, 0.35); }

.learn-deck-qty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 16px 0 6px;
  border-right: 1px solid var(--border-faint);
}

.learn-deck-qty-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.6px;
  color: var(--text-muted);
}

.learn-deck-qty-value {
  font-size: 1.15rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.learn-trade-btn {
  flex: 1;
  padding: 15px 20px;
  border: 1px solid transparent;
  border-radius: 2px;
  font-size: 0.95rem;
  font-weight: 800;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 2px;
  cursor: pointer;
  position: relative;
  transition: filter 140ms, opacity 160ms, transform 120ms;
}

.learn-trade-btn.is-buy  { background: var(--accent-green); color: #04140d; }
.learn-trade-btn.is-sell { background: var(--accent-red);   color: #180404; }

.learn-trade-btn:hover:not(:disabled)  { filter: brightness(1.1); }
.learn-trade-btn:active:not(:disabled) { transform: translateY(1px); }

.learn-trade-btn:disabled {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.28);
  cursor: not-allowed;
}

/* Only the button the current step wants pressed pulses. */
.learn-trade-btn.is-wanted { animation: learnWanted 1.9s ease-in-out infinite; }

@keyframes learnWanted {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.55); }
  50%      { box-shadow: 0 0 0 9px rgba(16, 185, 129, 0); }
}
.learn-trade-btn.is-sell.is-wanted { animation-name: learnWantedSell; }

@keyframes learnWantedSell {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  50%      { box-shadow: 0 0 0 9px rgba(239, 68, 68, 0); }
}

.learn-trade-btn.is-refused { animation: learnShake 400ms ease; }

/* ============================== TRADE REVIEW ============================= */

.learn-review {
  border: 1px solid var(--border-faint);
  border-top: 3px solid var(--accent-green);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 16px;
}
.learn-review.is-loss { border-top-color: var(--accent-red); }

.learn-review-head {
  text-align: center;
  padding: 20px 16px 16px;
  background: rgba(16, 185, 129, 0.06);
}
.learn-review.is-loss .learn-review-head { background: rgba(239, 68, 68, 0.06); }

.learn-review-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.learn-review-pnl {
  font-size: 2.6rem;
  font-weight: 800;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--accent-green);
}
.learn-review.is-loss .learn-review-pnl { color: var(--accent-red); }

.learn-review-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--border-faint);
  border-top: 1px solid var(--border-faint);
}

.learn-review-cell {
  background: var(--section-medium);
  padding: 11px 8px;
  text-align: center;
}

.learn-review-cell-label {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.4px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.learn-review-cell-value {
  font-size: 0.88rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.learn-review-math {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  padding: 15px 12px;
  border-top: 1px solid var(--border-faint);
  background: var(--section-light);
  font-variant-numeric: tabular-nums;
}

.learn-math-term { font-size: 0.9rem; font-weight: 700; color: var(--text-secondary); }
.learn-math-op   { font-size: 0.85rem; color: var(--text-muted); }

.learn-math-result { font-size: 1.05rem; font-weight: 800; }
.learn-math-result.is-pos { color: var(--accent-green); }
.learn-math-result.is-neg { color: var(--accent-red); }

/* ============================== COMPLETION =============================== */

.learn-seal {
  width: 56px;
  height: 56px;
  margin: 6px auto 18px;
  border-radius: 50%;
  border: 2px solid var(--accent-green);
  background: rgba(16, 185, 129, 0.10);
  color: var(--accent-green);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: learnSealIn 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.learn-seal svg { width: 26px; height: 26px; }

@keyframes learnSealIn {
  from { transform: scale(0.4); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

.learn-final-actions { display: flex; margin: 18px 0 22px; }
.learn-final-actions .learn-btn-primary { line-height: 1.2; }

.learn-capture {
  border: 1px solid var(--border-faint);
  border-left: 2px solid var(--accent-cyan);
  border-radius: 0 2px 2px 0;
  padding: 15px 16px;
  background: rgba(34, 211, 238, 0.04);
}

.learn-capture-label {
  font-size: 0.86rem;
  line-height: 1.5;
  color: var(--text-secondary);
  margin-bottom: 11px;
}

.learn-capture-row { display: flex; gap: 8px; }

.learn-capture-input {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  background: var(--section-dark);
  border: 1px solid var(--border-faint);
  border-radius: 2px;
  color: var(--text-primary);
  font-size: 0.88rem;
  font-family: inherit;
}
.learn-capture-input::placeholder { color: rgba(255, 255, 255, 0.28); }
.learn-capture-input:focus {
  outline: none;
  border-color: var(--accent-cyan);
}

.learn-capture-note {
  margin-top: 9px;
  font-size: 0.74rem;
  color: var(--text-muted);
}

.learn-capture.is-done {
  border-left-color: var(--accent-green);
  background: rgba(16, 185, 129, 0.06);
}

.learn-capture-done {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--accent-green);
}

.learn-restart {
  display: block;
  width: 100%;
  margin-top: 18px;
  padding: 8px;
  background: none;
  border: 0;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-family: inherit;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.learn-restart:hover { color: var(--text-secondary); }

/* =============================== RESPONSIVE ============================== */

@media (max-width: 991px) {
  .learn-shell {
    grid-template-columns: 1fr;
    gap: 16px;
  }
  /* Visual first on narrow screens: the chart is the thing being talked about,
     and a sticky panel would eat most of a phone viewport. */
  .learn-stage { order: 1; min-height: 0; }
  .learn-panel { order: 2; position: static; min-height: 0; }
  #learnChart { height: 300px; }
}

@media (max-width: 560px) {
  .learn-page { padding: 16px 0 48px; }
  .learn-shell { padding: 0 12px; }
  .learn-title { font-size: 1.3rem; }
  .learn-live-value { font-size: 2rem; }
  .learn-review-pnl { font-size: 2.1rem; }

  .learn-stats { grid-template-columns: repeat(2, 1fr); }
  .learn-review-grid { grid-template-columns: repeat(2, 1fr); }

  .learn-deck { flex-wrap: wrap; }
  .learn-deck-qty {
    width: 100%;
    flex-direction: row;
    align-items: baseline;
    gap: 8px;
    padding: 0 0 10px;
    border-right: 0;
    border-bottom: 1px solid var(--border-faint);
  }
  .learn-illus { padding: 20px 16px 16px; }
}

/* Respect a reduced-motion preference: the lesson must not depend on any of
   these animations to be completable. */
@media (prefers-reduced-motion: reduce) {
  .learn-panel-body.is-entering,
  .learn-stage-mode.is-active,
  .learn-illus-line,
  .learn-illus-area,
  .learn-illus-marker,
  .learn-hotspot::after,
  .learn-instruction-icon,
  .learn-trade-btn.is-wanted,
  .learn-seal,
  .learn-live-note.is-swap {
    animation: none !important;
    opacity: 1 !important;
    stroke-dashoffset: 0 !important;
  }
  .learn-progress-fill { transition: none; }
}
