/* Lesson-specific styles for the context window lesson. Prefix: ctx-. */
.ctx-intro {
  position: relative;
}

.ctx-hero-emoji {
  font-size: clamp(64px, 9vw, 112px);
  line-height: 1;
  margin-bottom: 14px;
  animation: ctx-float 2.8s ease-in-out infinite;
}

.ctx-reveal-card,
.ctx-side-note,
.ctx-board,
.ctx-live-window,
.ctx-forgotten-panel,
.ctx-consequence-card,
.ctx-strategy-card,
.ctx-recap-board,
.ctx-quiz {
  background: var(--panel);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.ctx-reveal-card {
  max-width: 820px;
  margin: 26px auto 0;
  padding: 24px 28px;
  border: 4px solid var(--memory);
  animation: ctx-pop .28s ease both;
}

.ctx-board-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(260px, .65fr);
  gap: 22px;
  align-items: stretch;
  margin: 26px auto;
}

.ctx-board {
  padding: 24px;
  border: 8px solid #f1e4c8;
  text-align: left;
  position: relative;
}

.ctx-board::before {
  content: "";
  position: absolute;
  left: 28px;
  right: 28px;
  bottom: 12px;
  height: 10px;
  border-radius: 999px;
  background: #ead8b1;
}

.ctx-board-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 16px 18px;
  margin-bottom: 14px;
  border-radius: 16px;
  font-size: clamp(18px, 2vw, 25px);
  font-weight: 800;
}

.ctx-board-row strong,
.ctx-system-sticky strong,
.ctx-message-card strong,
.ctx-window-head strong {
  white-space: nowrap;
  color: var(--ink);
}

.ctx-system {
  background: rgba(255, 207, 92, .35);
}

.ctx-prompt {
  background: rgba(255, 122, 162, .2);
}

.ctx-chat {
  background: rgba(124, 156, 255, .18);
}

.ctx-side-note {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.ctx-side-emoji,
.ctx-card-emoji {
  font-size: clamp(42px, 5vw, 64px);
  line-height: 1;
  margin-bottom: 12px;
}

.ctx-meter {
  position: relative;
  height: 44px;
  overflow: hidden;
  border-radius: 999px;
  background: #efe6dc;
  border: 3px solid #fff;
  box-shadow: inset 0 2px 8px rgba(43, 51, 80, .12);
}

.ctx-meter-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--hands), var(--memory), var(--brand));
  transition: width .28s ease;
}

.ctx-meter span {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-size: clamp(14px, 1.4vw, 18px);
  font-weight: 900;
  color: var(--ink);
}

.ctx-token-demo {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 8px;
  padding: 14px 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, .72);
  box-shadow: var(--shadow);
  font-size: clamp(18px, 2vw, 24px);
  animation: ctx-pop .28s ease both;
}

.ctx-token-demo b {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 12px;
  background: var(--eyes);
  box-shadow: 0 4px 0 rgba(43, 51, 80, .16);
}

.ctx-demo-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(260px, .75fr);
  gap: 20px;
  align-items: stretch;
  margin: 22px 0;
}

.ctx-live-window,
.ctx-forgotten-panel {
  padding: 18px;
  text-align: left;
}

.ctx-live-window {
  border: 5px solid var(--loop);
}

.ctx-forgotten-panel {
  border: 5px dashed #d8cec2;
  background: rgba(255, 255, 255, .72);
}

.ctx-window-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-size: clamp(18px, 2vw, 24px);
  font-weight: 900;
}

.ctx-demo-meter {
  margin-bottom: 16px;
}

.ctx-sticky-list,
.ctx-forgotten-list {
  display: grid;
  gap: 12px;
}

.ctx-system-sticky,
.ctx-message-card {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: #fff7d8;
  box-shadow: 0 4px 0 rgba(43, 51, 80, .08);
}

.ctx-message-card {
  background: #f4f7ff;
}

.ctx-message-card p {
  margin: 0;
  text-align: left;
  font-size: clamp(15px, 1.45vw, 19px);
}

.ctx-message-number {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--loop);
  color: #fff;
  font-weight: 900;
}

.ctx-forgotten-list .ctx-message-card {
  background: #eee8e2;
  color: var(--muted);
}

.ctx-dropped {
  animation: ctx-drop .5s ease both;
  outline: 4px solid var(--brand);
}

.ctx-controls {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.ctx-demo-status {
  margin-top: 10px;
}

.ctx-consequence-card {
  max-width: 900px;
  min-height: 310px;
  margin: 24px auto;
  padding: 28px;
  border-top: 8px solid var(--accent);
}

.ctx-before-after {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.ctx-before-after > div {
  padding: 18px;
  border-radius: 16px;
  background: #fff6e9;
  text-align: left;
}

.ctx-before-after p {
  margin: 8px 0 0;
}

.ctx-strategy-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin: 26px 0;
}

.ctx-strategy-card {
  min-height: 230px;
  padding: 20px 16px;
  border-top: 7px solid var(--hands);
}

.ctx-strategy-card p {
  margin-bottom: 0;
  font-size: clamp(15px, 1.35vw, 19px);
}

.ctx-locked {
  opacity: .7;
  border-top-color: #d8cec2;
  background: rgba(255, 255, 255, .66);
}

.ctx-strategy-note {
  margin-top: 18px;
}

.ctx-recap-board {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin: 24px auto;
  padding: 22px;
  max-width: 950px;
  border: 6px solid var(--memory);
}

.ctx-recap-board > div {
  padding: 18px;
  border-radius: 16px;
  background: #fff8dc;
  font-size: clamp(18px, 2vw, 25px);
  font-weight: 900;
}

.ctx-quiz {
  max-width: 900px;
  margin: 26px auto 0;
  padding: 22px;
}

.ctx-answer {
  display: block;
  width: 100%;
  margin: 10px 0;
  padding: 14px 18px;
  border: 3px solid transparent;
  border-radius: 16px;
  background: #f4f7ff;
  color: var(--ink);
  font-family: var(--font);
  font-size: clamp(16px, 1.6vw, 21px);
  font-weight: 900;
  cursor: pointer;
  box-shadow: 0 4px 0 #d8ddf1;
}

.ctx-correct {
  background: rgba(99, 230, 168, .25);
  border-color: var(--hands);
}

.ctx-wrong {
  background: rgba(255, 122, 162, .2);
  border-color: var(--brand);
}

.ctx-feedback {
  margin: 14px 0 0;
  font-weight: 900;
}

@keyframes ctx-float {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-10px) rotate(2deg); }
}

@keyframes ctx-pop {
  from { opacity: 0; transform: translateY(12px) scale(.96); }
  to { opacity: 1; transform: none; }
}

@keyframes ctx-drop {
  from { opacity: .2; transform: translateY(-14px) scale(.95); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .ctx-board-wrap,
  .ctx-demo-grid,
  .ctx-before-after {
    grid-template-columns: 1fr;
  }

  /* Keep recap board 3-col down to ~600 px; it only has 3 short items */
  .ctx-strategy-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Remove forced heights that make scenes unnecessarily tall on mobile */
  .ctx-consequence-card {
    min-height: auto;
  }

  .ctx-strategy-card {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .ctx-strategy-grid {
    grid-template-columns: 1fr;
  }

  /* Stack the flex-row containers into a column on narrow phones */
  .ctx-board-row,
  .ctx-window-head {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }

  /* white-space: nowrap on strong tags would prevent wrapping — relax it here */
  .ctx-board-row strong,
  .ctx-window-head strong {
    white-space: normal;
  }

  /* These are actual grid containers, so grid-template-columns: 1fr works */
  .ctx-system-sticky,
  .ctx-message-card {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .ctx-recap-board {
    grid-template-columns: 1fr;
  }
}
