.ml-page {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 14px 14px 24px;
}

.ml-stack { display: grid; gap: 8px; }
.ml-stack:empty { display: none; }
.ml-notice {
  margin: 0;
  padding: 24px 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--muted);
  text-align: center;
}

.ml-row, .ml-map-card, .ml-map-task {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  text-align: left;
  font: inherit;
  color: inherit;
  cursor: pointer;
}
.ml-row, .ml-map-card {
  min-height: 60px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.ml-row:disabled, .ml-map-task:disabled {
  color: #475467;
  background: #f7f8fb;
  cursor: default;
}
.ml-row-copy {
  display: grid;
  flex: 1;
  min-width: 0;
  gap: 3px;
  overflow-wrap: anywhere;
}
.ml-row-copy strong, .ml-panel strong { font-weight: 600; line-height: 1.4; }
.ml-row-glyph {
  display: grid;
  flex: 0 0 34px;
  place-items: center;
  height: 34px;
  border-radius: 10px;
  background: var(--brand-50);
  color: var(--brand);
}
.ml-row:disabled .ml-row-glyph { background: #e9edf3; color: #667085; }
.ml-chevron { color: var(--muted-2); }
.ml-meta, .ml-copy { margin: 0; overflow-wrap: anywhere; }
.ml-meta { color: var(--muted); font-size: 12px; line-height: 1.5; }
.ml-copy { color: var(--ink-2); line-height: 1.65; white-space: pre-wrap; }

.ml-badge {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 5px;
  padding: 2px 7px;
  border-radius: 10px;
  background: #eef1f6;
  color: #475467;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.5;
}
.ml-badge-brand { background: var(--brand-50); color: var(--brand); }
.ml-badge-ok { background: var(--ok-50); color: var(--ok); }
.ml-badge-muted { background: #e9edf3; color: #475467; }

.ml-filters { display: flex; gap: 6px; }
.ml-filters button {
  flex: 1 1 auto;
  min-height: 44px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink-2);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}
.ml-filters button[aria-pressed="true"] {
  border-color: var(--brand);
  background: var(--brand-50);
  color: var(--brand);
  font-weight: 600;
}
.ml-filters button > span { margin-left: 4px; font-variant-numeric: tabular-nums; }
.ml-filters button:focus-visible, .ml-row:focus-visible, .ml-map-card:focus-visible,
.ml-map-task:focus-visible, .ml-primary:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
}
.ml-section-title { margin: 14px 0 8px; font-size: 15px; line-height: 1.4; }

.ml-map-thumb {
  flex: 0 0 78px;
  width: 78px;
  height: 50px;
  border-radius: 8px;
  object-fit: cover;
  background: var(--brand-50);
}
.ml-map-hero, .ml-stage-card, .ml-panel, .ml-question {
  min-width: 0;
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.ml-map-hero { overflow: hidden; }
.ml-map-art {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  background: var(--brand-50);
}
.ml-map-summary { display: grid; gap: 7px; padding: 12px; }

.ml-progress {
  appearance: none;
  display: block;
  width: 100%;
  height: 6px;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  background: #e5eaf3;
  color: var(--brand);
}
.ml-progress::-webkit-progress-bar { background: #e5eaf3; }
.ml-progress::-webkit-progress-value { border-radius: 4px; background: var(--brand); }
.ml-progress::-moz-progress-bar { border-radius: 4px; background: var(--brand); }
.ml-map-card .ml-progress { height: 4px; margin-top: 2px; }

.ml-stage-list, .ml-task-list { margin: 0; padding: 0; list-style: none; }
.ml-stage-list { display: grid; gap: 12px; }
.ml-stage {
  position: relative;
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 8px;
}
.ml-stage:not(:last-child)::before {
  position: absolute;
  inset: 32px auto -16px 14px;
  width: 2px;
  background: #d6dfed;
  content: '';
}
.ml-stage-number, .ml-task-number, .ml-task-glyph {
  display: grid;
  place-items: center;
  border-radius: 50%;
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}
.ml-stage-number {
  z-index: 1;
  height: 30px;
  margin-top: 6px;
  border: 1px solid var(--brand);
  background: var(--brand-50);
  color: var(--brand);
}
.ml-stage-locked .ml-stage-number {
  border-color: #cbd4e2;
  background: #e9edf3;
  color: #475467;
}
.ml-stage-card { padding: 10px; }
.ml-stage-locked .ml-stage-card { background: #f7f8fb; }
.ml-stage-head { display: flex; align-items: start; justify-content: space-between; gap: 7px; }
.ml-stage-head h2, .ml-panel h2 { margin: 0; font-size: 14px; font-weight: 650; line-height: 1.45; }
.ml-stage-card > .ml-copy { margin-top: 6px; font-size: 12px; }
.ml-stage-progress {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 7px;
  margin: 8px 0;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.ml-stage-locked .ml-progress::-webkit-progress-value { background: #98a2b3; }
.ml-stage-locked .ml-progress::-moz-progress-bar { background: #98a2b3; }
.ml-task-list { display: grid; gap: 5px; }
.ml-map-task {
  min-height: 46px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 13px;
}
.ml-map-task .ml-meta { font-size: 11px; }
.ml-task-number, .ml-task-glyph {
  flex: 0 0 24px;
  height: 24px;
  background: var(--brand-50);
  color: var(--brand);
  font-size: 11px;
}
.ml-task-state {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 4px;
  color: var(--brand);
  font-size: 11px;
}
.ml-task-done .ml-task-state { color: var(--ok); }
.ml-map-task:disabled .ml-task-state { color: #475467; }
.ml-map-task:disabled :is(.ml-task-number, .ml-task-glyph) { background: #e9edf3; color: #475467; }

.ml-lock {
  position: relative;
  width: 9px;
  height: 7px;
  margin-top: 3px;
  border: 1px solid currentColor;
  border-radius: 2px;
}
.ml-lock::before {
  position: absolute;
  inset: -5px 1px auto;
  height: 5px;
  border: 1px solid currentColor;
  border-bottom: 0;
  border-radius: 4px 4px 0 0;
  content: '';
}

.ml-panel { padding: 12px; }
.ml-panel h2 + .ml-copy { margin-top: 6px; }
.ml-training-info {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 14px;
  margin: 12px 0 6px;
}
.ml-training-info dt { color: var(--muted); font-size: 12px; }
.ml-training-info dd { margin: 0; font-weight: 500; }
.ml-panel .ml-training-info + .ml-copy { margin-top: 10px; }

.ml-record-meta { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.ml-record-meta ~ .ml-panel + .ml-panel { margin-top: 8px; }
.ml-answer { color: var(--ink); }
#mlSurveyForm { display: grid; min-width: 0; gap: 12px; }
.ml-question { margin: 0; padding: 8px 10px 10px; }
.ml-question legend {
  width: fit-content;
  max-width: 100%;
  padding: 0 4px;
  font-size: 14px;
  font-weight: 600;
}
.ml-question legend .ml-badge { margin-left: 5px; vertical-align: 1px; }
.ml-question textarea {
  display: block;
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font: inherit;
  font-size: 16px;
  resize: vertical;
}
.ml-survey-options { display: grid; gap: 6px; }
.ml-score-options { display: flex; flex-wrap: wrap; }
.ml-option { position: relative; display: block; cursor: pointer; }
.ml-option input {
  position: absolute;
  top: 50%;
  left: 10px;
  width: 16px;
  height: 16px;
  margin: 0;
  transform: translateY(-50%);
  accent-color: var(--brand);
}
.ml-option > span {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 7px 9px 7px 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
}
.ml-score-options .ml-option input { opacity: 0; }
.ml-score-options .ml-option > span { padding: 7px 13px; }
.ml-option input:checked + span {
  border-color: var(--brand);
  background: var(--brand-50);
  color: var(--brand);
}
.ml-option input:focus-visible + span { outline: 2px solid var(--brand); outline-offset: 1px; }
.ml-primary {
  min-height: 46px;
  border: 0;
  border-radius: 10px;
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.ml-primary:disabled { opacity: .65; cursor: default; }
