/* Mastery: "Ready to review" (_SkillReviews), the skill strip on the Teen journey, and the skill states on topic pages.
   Calm and compact: three small pips show introduced, practised, mastered; one clear action per row. */

.msr {
  --msr-ink: var(--ip-ink, #14231e);
  --msr-muted: var(--ip-muted, #5b6b66);
  --msr-line: var(--ip-line, rgba(20, 26, 51, .1));
  --msr-accent: var(--ip-primary, #1f7a63);
  --msr-soft: var(--ip-primary-soft, #e4f2ec);
  --msr-gold: var(--ip-gold-500, #d4a03a);
  --msr-surface: var(--ip-surface, #fff);
  display: grid;
  gap: 8px;
  color: var(--msr-ink);
  container-type: inline-size;
}

.msr--teens {
  --msr-ink: var(--tn-ink, #15122b);
  --msr-muted: var(--tn-muted, #5d5a75);
  --msr-line: var(--tn-line, rgba(21, 18, 43, .12));
  --msr-surface: var(--tn-surface-2, var(--tn-surface, #fff));
  --msr-accent: var(--tn-brand, #7c5cff);
  --msr-soft: color-mix(in srgb, var(--tn-brand, #7c5cff) 14%, transparent);
  --msr-gold: var(--tn-gold, #ffb547);
}

/* Placement on the Daily Deen dashboard and in the Teen journey grid. */
.dmd-history .msr {
  margin-block-start: 14px;
}

.tn-panel--skills {
  grid-column: span 7;
  display: grid;
  gap: 14px;
}

.msr-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.msr-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--msr-muted);
}

.msr-title .bi {
  color: var(--msr-accent);
  font-size: .95rem;
}

.msr-count {
  min-inline-size: 22px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--msr-soft);
  color: var(--msr-accent);
  font-size: .74rem;
  font-weight: 800;
  text-align: center;
}

.msr-lead,
.msr-empty {
  margin: 0;
  font-size: .82rem;
  line-height: 1.45;
  color: var(--msr-muted);
}

.msr-empty {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  border: 1px dashed var(--msr-line);
  border-radius: 12px;
}

.msr-empty-icon {
  color: var(--msr-accent);
  font-size: 1rem;
  line-height: 1.2;
}

.msr-list {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.msr-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding-block: 8px;
  padding-inline: 10px 8px;
  border: 1px solid var(--msr-line);
  border-radius: 12px;
  background: var(--msr-surface);
  transition: border-color .2s ease, box-shadow .2s ease;
}

.msr-item:hover,
.msr-item:focus-within {
  border-color: color-mix(in srgb, var(--msr-accent) 45%, var(--msr-line));
  box-shadow: 0 6px 18px color-mix(in srgb, var(--msr-accent) 14%, transparent);
}

/* Three pips: introduced, practised, mastered. The mastered pip is gold. */
.msr-steps {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 3px;
}

.msr-steps i {
  inline-size: 7px;
  block-size: 18px;
  border-radius: 4px;
  background: color-mix(in srgb, var(--msr-accent) 16%, transparent);
}

.msr-steps i.is-on {
  background: var(--msr-accent);
}

.msr-item--mastered .msr-steps i.is-on:last-child {
  background: var(--msr-gold);
}

.msr-text {
  display: grid;
  gap: 2px;
  min-inline-size: 0;
}

.msr-text strong {
  font-size: .86rem;
  font-weight: 700;
  line-height: 1.3;
}

.msr-text small {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 8px;
  font-size: .72rem;
  color: var(--msr-muted);
}

.msr-chip {
  padding: 0 7px;
  border-radius: 999px;
  background: var(--msr-soft);
  color: var(--msr-accent);
  font-weight: 800;
  line-height: 1.6;
}

.msr-item--mastered .msr-chip {
  background: color-mix(in srgb, var(--msr-gold) 22%, transparent);
  color: color-mix(in srgb, var(--msr-gold) 55%, var(--msr-ink));
}

.msr-text small a {
  color: inherit;
  font-weight: 600;
  text-decoration: underline;
  text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
  text-underline-offset: 2px;
}

.msr-go {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-block-size: 36px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--msr-accent);
  color: #fff;
  font-size: .8rem;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.msr-go:hover {
  filter: brightness(1.08);
  color: #fff;
}

.msr-go:focus-visible,
.msr-text small a:focus-visible {
  outline: 3px solid var(--ip-focus, #e6b85c);
  outline-offset: 2px;
}

.msr--teens .msr-go {
  color: var(--tn-on-bright, #0b0a1a);
}

.msr-go--ghost {
  background: transparent;
  color: var(--msr-accent);
  border: 1px solid color-mix(in srgb, var(--msr-accent) 40%, transparent);
}

.msr-go--ghost:hover {
  color: var(--msr-accent);
  background: var(--msr-soft);
}

/* The skill strip on the Teen journey: counts by state as one segmented bar. */
.msk {
  display: grid;
  gap: 10px;
}

.msk-bar {
  display: flex;
  block-size: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(124, 92, 255, .12);
}

.msk-bar i {
  display: block;
}

.msk-bar .is-mastered { background: var(--tn-gold, #ffb547); }
.msk-bar .is-practised { background: var(--tn-brand, #7c5cff); }
.msk-bar .is-introduced { background: color-mix(in srgb, var(--tn-brand, #7c5cff) 38%, transparent); }

.msk-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .8rem;
}

.msk-legend li {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.msk-legend b {
  font-size: 1rem;
}

.msk-legend .dot {
  inline-size: 9px;
  block-size: 9px;
  border-radius: 3px;
}

.msk-legend .dot.is-mastered { background: var(--tn-gold, #ffb547); }
.msk-legend .dot.is-practised { background: var(--tn-brand, #7c5cff); }
.msk-legend .dot.is-introduced { background: color-mix(in srgb, var(--tn-brand, #7c5cff) 38%, transparent); }

.msk-scale {
  margin: 0;
  font-size: .76rem;
  opacity: .8;
}

/* Topic page: when the next review falls, beside each objective's state. */
.lu-state__next {
  font-weight: 500;
  opacity: .8;
}

.lu-objectives__empty {
  margin: 10px 0 0;
  font-size: .8rem;
  line-height: 1.45;
  opacity: .85;
}

/* Topic hub: the small topics inside a big one (the letters inside the Arabic letters) as a tray under its card. */
.lu-card:has(.lu-card__inside) {
  display: flex;
  flex-direction: column;
}

.lu-card:has(.lu-card__inside) .lu-card__link {
  height: auto;
  border-end-start-radius: 0;
  border-end-end-radius: 0;
}

.lu-card__inside {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0;
  padding: 10px 12px 12px;
  list-style: none;
  border: 1px solid var(--ip-line, rgba(20, 26, 51, .1));
  border-block-start: 0;
  border-end-start-radius: 20px;
  border-end-end-radius: 20px;
  background: color-mix(in srgb, var(--ip-primary, #1f7a63) 5%, var(--ip-surface, #fff));
}

.lu-card__inside a {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .74rem;
  font-weight: 700;
  color: var(--ip-primary, #1f7a63);
  background: var(--ip-surface, #fff);
  border: 1px solid color-mix(in srgb, var(--ip-primary, #1f7a63) 22%, transparent);
  text-decoration: none;
}

.lu-card__inside a:hover {
  background: var(--ip-primary, #1f7a63);
  color: #fff;
}

.lu-card__inside a:focus-visible {
  outline: 3px solid var(--ip-focus, #e6b85c);
  outline-offset: 2px;
}

:root[data-theme="dark"] .msr {
  --msr-surface: color-mix(in srgb, var(--ip-surface, #12201b) 92%, #fff 3%);
  --msr-line: rgba(255, 255, 255, .12);
}

/* In a narrow card (the dashboard column, a phone) the button goes under the text. */
@container (max-width: 420px) {
  .msr-item {
    grid-template-columns: auto minmax(0, 1fr);
    align-items: start;
  }

  .msr-go {
    grid-column: 2;
    justify-self: start;
    min-block-size: 32px;
    padding-block: 4px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .msr-item {
    transition: none;
  }
}
