/* ============ Lessons ============ */
/* A next step pushed by an achievement notification. */
.lessons-focus {
  flex-shrink: 0;
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 8px 8px 0;
  padding: 7px 6px 7px 8px;
  background: var(--bg-mid);
  border: 1px solid var(--cardBorders);
  border-left: 2px solid var(--journey);
  border-radius: 4px;
}

.lessons-focus[hidden] { display: none; }

.lessons-focus-icon {
  font-size: 15px;
  color: var(--journey);
  margin-top: 1px;
  flex-shrink: 0;
}

.lessons-focus-text {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.lessons-focus-kicker {
  font-family: var(--font-condensed);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.lessons-focus-name {
  font-size: 11px;
  line-height: 1.3;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lessons-focus-clear {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  padding: 0;
  background: none;
  border: 0;
  border-radius: 3px;
  color: var(--text-muted);
  font-size: 14px;
  cursor: pointer;
  flex-shrink: 0;
}

.lessons-focus-clear:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
}

/* The checked journey's name, above the stack it fills. One line that
   truncates: the rail is narrow, and a long title should not push the stack
   down. */
.lessons-journey {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 8px 0;
  min-width: 0;
}

.lessons-journey[hidden] { display: none; }

.lessons-journey-icon {
  flex-shrink: 0;
  font-size: 16px;
  color: var(--journey);
}

.lessons-journey-name {
  min-width: 0;
  font-family: var(--font-ui);
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: 0.01em;
  color: #f5f5f5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The end of a journey: the stack is folded away and the rail points at the
   next one. The trophy bursts once when this state first appears, then the
   other journeys wait underneath as the incentive. */
.lessons-complete {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  padding: 28px 12px;
  text-align: center;
  overflow-y: auto;
}

.lessons-complete[hidden] { display: none; }

.lessons-complete-mark {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 64px;
  height: 64px;
}

.lessons-complete-icon {
  font-size: 40px;
  color: var(--journey);
  animation: lessons-trophy-pop 520ms cubic-bezier(0.2, 1.4, 0.4, 1) both;
}

/* The shock ring under the sparks: one expanding circle reads as the bang the
   dots are flying out of. */
.lessons-flash {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border: 2px solid rgba(255, 209, 102, 0.85);
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  animation: lessons-flash-ring 620ms ease-out both;
}

@keyframes lessons-flash-ring {
  0% { opacity: 0.9; transform: scale(0.35); }
  100% { opacity: 0; transform: scale(5.5); }
}

/* Eight sparks thrown out around the cup. Their direction and stagger come
   from inline custom properties on each one. */
.lessons-spark {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 6px;
  height: 6px;
  margin: -3px 0 0 -3px;
  border-radius: 50%;
  background: var(--spark, #ffd166);
  box-shadow: 0 0 7px var(--spark, #ffd166);
  opacity: 0;
  pointer-events: none;
  animation: lessons-spark-burst 850ms ease-out var(--delay, 0ms) both;
}

.lessons-spark:nth-child(3n) { --spark: #ff9f1c; }
.lessons-spark:nth-child(3n + 1) { --spark: #ffe066; }

@keyframes lessons-trophy-pop {
  0% { opacity: 0; transform: scale(0.6); }
  60% { opacity: 1; transform: scale(1.12); }
  100% { opacity: 1; transform: scale(1); }
}

@keyframes lessons-spark-burst {
  0% { opacity: 0; transform: translate(0, 0) scale(1); }
  12% { opacity: 1; }
  60% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)) scale(0.25); }
}

@media (prefers-reduced-motion: reduce) {
  .lessons-complete-icon,
  .lessons-flash,
  .lessons-spark { animation: none; }
  .lessons-flash,
  .lessons-spark { display: none; }
}

.lessons-complete-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.lessons-complete-hint {
  max-width: 190px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--text-muted);
}

.lessons-complete-hint[hidden] { display: none; }

/* The other unfinished journeys, offered as the way into a new series. */
.lessons-next {
  width: 100%;
  margin-top: 20px;
  text-align: left;
}

.lessons-next[hidden] { display: none; }

.lessons-next-title {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  color: var(--text-primary);
}

.lessons-next-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lessons-next-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 11px 12px;
  background: linear-gradient(90deg, #8d10c7, #cf10a4);
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  font-family: inherit;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 0.15s;
}

.lessons-next-item:hover { filter: brightness(1.12); }

.lessons-next-item .material-symbols-outlined { font-size: 18px; }

.lessons-next-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lessons-grid[hidden] { display: none; }

.lessons-grid {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 8px;
  align-content: start;
}

.lessons-empty {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--text-muted);
  padding: 40px 16px;
  font-size: 14px;
}

.lessons-empty-title {
  color: var(--text-secondary);
}

/* Only the "nothing is checked" state carries this: it says where the list
   comes from, so the empty rail reads as a choice rather than a failure. */
.lessons-empty-hint {
  margin-top: 8px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-muted);
}

/* ============ Level badge ============ */
/* The "Level n" chip in the skill tree's lesson popup. Orbit levels can be
   added in the Skill Tree editor, so the palette repeats. */
.lessons-tier {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tier-1 {
  background: rgba(74, 144, 217, 0.2);
  color: #4a90d9;
}

.tier-2 {
  background: rgba(176, 128, 208, 0.2);
  color: #b080d0;
}

.tier-3 {
  background: rgba(217, 160, 64, 0.2);
  color: #d9a040;
}

.tier-4 {
  background: rgba(224, 112, 112, 0.2);
  color: #e07070;
}

/* Orbit levels can be added in the Skill Tree editor, so the palette repeats. */
.tier-5,
.tier-9 {
  background: rgba(112, 176, 208, 0.2);
  color: #70b0d0;
}

.tier-6,
.tier-10 {
  background: rgba(80, 176, 112, 0.2);
  color: #50b070;
}

.tier-7,
.tier-11 {
  background: rgba(208, 138, 176, 0.2);
  color: #d08ab0;
}

.tier-8,
.tier-12 {
  background: rgba(160, 192, 96, 0.2);
  color: #a0c060;
}

/* ============ Lesson pills ============ */
/* One row per lesson, and the two halves carry different things: the disc on
   the left holds the category colour, the pill's own fill holds the state.
   Done is a dark pill with the colour kept bright on the disc and a green
   check at the end, to do puts the colour on the pill itself, and locked is a
   bare outline. */
.lessons-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.lessons-card {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
  /* Even all round: the disc is what the eye reads as the left edge, so it sits
     flush inside the pill rather than padded away from it. */
  padding: 3px 14px 3px 3px;
  border-radius: 999px;
  border: 1px solid transparent;
  cursor: default;
  min-height: 44px;
  flex-shrink: 0;
  transition: filter 0.15s, border-color 0.15s;
}

.lessons-bullet {
  flex-shrink: 0;
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  font-size: 20px;
}

.lessons-name {
  flex: 1;
  min-width: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* The trailing glyph, which follows the state: an arrow while there is
   something left to do, a check once it is done. */
.lessons-go {
  flex-shrink: 0;
  font-size: 20px;
}

/* To do: the pill wears the category colour, under a disc of the same colour
   washed towards white. This is the one to click, so it is the loudest row. */
.lessons-card.available {
  background: linear-gradient(90deg, var(--tint), var(--tint2, var(--tint)));
  border-color: color-mix(in srgb, var(--tint) 72%, #101010);
  color: #ffffff;
}

.lessons-card.available .lessons-bullet {
  background: rgba(255, 255, 255, 0.26);
  color: #ffffff;
}

.lessons-card.available .lessons-go { color: #ffffff; }

.lessons-card.available .lessons-name { color: #ffffff; }

.lessons-card.claimable { cursor: pointer; }
.lessons-card.claimable:hover { filter: brightness(1.1); }

/* Done: the colour leaves the pill and settles on the disc, so a claimed
   lesson still reads as its category without shouting. */
.lessons-card.unlocked {
  background: #2c2c2c;
  border-color: #3d3d3d;
  color: #f0f0f0;
}

.lessons-card.unlocked .lessons-bullet {
  background: linear-gradient(135deg, var(--tint), var(--tint2, var(--tint)));
  color: #161616;
}

/* Brighter than --success, which is too muted to register at this size against
   the dark pill. */
.lessons-card.unlocked .lessons-go { color: #3ddc5a; }

.lessons-card.unlocked .lessons-name { color: #f2f2f2; }

/* Locked: the category colour survives only as a whisper in the outline. */
.lessons-card.locked {
  background: none;
  border-color: color-mix(in srgb, var(--tint, #6a6a6a) 40%, #3a3a3a);
  color: var(--text-muted);
}

.lessons-card.locked .lessons-bullet {
  background: #333333;
  color: #8a8a8a;
}

.lessons-card.locked .lessons-go { color: #7a7a7a; }

.lessons-card.locked .lessons-name { color: var(--text-muted); }

/* A locked lesson whose whole point is not to be known yet must not leak its
   category through that outline. */
.lessons-card.hidden.locked { border-color: #3a3a3a; }

/* ============ Unfolded lesson ============ */
/* The pill opens into a card: the lesson's own page, on its category colour. */
.lessons-card.expanded {
  display: block;
  border-radius: 14px;
  padding: 14px 16px 16px;
  cursor: pointer;
  /* The list is a flex column: without this the open card is squeezed to fit
     and its content spills over its neighbours. */
  flex-shrink: 0;
}

.lessons-fold-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.lessons-tile {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.22);
  font-size: 22px;
}

.lessons-cat {
  flex: 1;
  min-width: 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.62);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lessons-close {
  flex-shrink: 0;
  font-size: 20px;
  color: rgba(255, 255, 255, 0.55);
  cursor: pointer;
}

.lessons-close:hover { color: #ffffff; }

.lessons-fold-name {
  margin-top: 14px;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
  color: #ffffff;
}

.lessons-fold-desc {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.78);
}

.lessons-fold-req {
  margin-top: 8px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.55);
}

.lessons-fold-foot {
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.lessons-levels {
  display: flex;
  gap: 8px;
  flex: 1;
}

.lessons-level {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: transparent;
}

.lessons-level .material-symbols-outlined { font-size: 16px; }

/* A level the lesson has reached. */
.lessons-level.reached {
  border-color: rgba(255, 255, 255, 0.75);
  color: rgba(255, 255, 255, 0.9);
}

.lessons-fold-state {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}

.lessons-fold-claim {
  flex-shrink: 0;
  padding: 7px 18px;
  border: none;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: #141414;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.lessons-fold-claim:hover { background: #ffffff; }

/* Locked content sits on a plain dark card rather than a coloured one. */
.lessons-card.locked.expanded {
  background: var(--bg-mid);
  border-color: var(--cardBorders);
}

.lessons-card.locked.expanded .lessons-tile { background: #3a3a3a; }
.lessons-card.locked.expanded .lessons-cat { color: var(--text-muted); }
.lessons-card.locked.expanded .lessons-level { border-color: #4a4a4a; }
.lessons-card.locked.expanded .lessons-level.reached { border-color: #8a8a8a; color: #b0b0b0; }
