/* Shared course activities use the tokens and fonts from al-brand.css. */
body { color: var(--al-ink); font-family: Inter, system-ui, sans-serif; }
.al-activity { box-sizing: border-box; max-width: 1060px; margin: 0 auto; padding: 24px; }
.al-activity *, .al-drag-preview { box-sizing: border-box; }
.al-activity ::selection { background: var(--al-rose-tint); color: var(--al-ink); }
.al-activity button { font: inherit; color: inherit; cursor: pointer; min-height: 44px; min-width: 44px; }
.al-activity button:focus-visible { outline: 3px solid var(--al-petrol-700); outline-offset: 3px; }
.al-activity button:disabled { cursor: default; }
.al-title { font-size: 22px; line-height: 1.4; color: var(--al-petrol); letter-spacing: -.02em; margin: 0 0 10px; }
.al-instructions { line-height: 1.55; font-size: 15px; color: var(--al-ink-2); max-width: 75ch; margin: 0 0 24px; }
.al-pool { margin-bottom: 20px; }
.al-pool-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.al-pool h2 { font-size: 16px; margin: 0; color: var(--al-petrol); }
.al-pool-heading button { border: 1px solid var(--al-line); background: var(--al-paper); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.al-pool-heading .al-destination { width: auto; flex-shrink: 0; margin-bottom: 0; }
.al-pool-heading button:disabled { color: var(--al-ink-2) !important; }
.al-pool-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.al-chip { display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; background: var(--al-paper); border: 1px solid var(--al-line); border-radius: 12px; overflow-wrap: anywhere; }
.al-item-button { border: 0; background: transparent; padding: 12px 14px; text-align: left; line-height: 1.5; font-size: 15px; border-radius: 12px; width: 100%; }
.al-chip:hover { border-color: var(--al-petrol-700); }
.al-drag-handle { display: flex; align-items: center; justify-content: center; min-height: 44px; min-width: 44px; color: var(--al-ink-2); cursor: grab; touch-action: none; user-select: none; }
.al-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); align-items: start; gap: 12px; }
.al-column { padding: 10px; border: 1px dashed #9db8c4; border-radius: 12px; min-width: 0; }
.al-column .al-chip + .al-chip { margin-top: 8px; }
.al-destination { width: 100%; border: 0; border-radius: 12px; padding: 10px; background: var(--al-paper); color: var(--al-petrol) !important; font-weight: 600 !important; line-height: 1.45; text-align: left; margin-bottom: 8px; }
.al-destination:hover:not(:disabled), .al-pool-heading button:hover:not(:disabled) { background: var(--al-rose-tint); }
.al-empty { color: var(--al-ink-2); font-size: 14px; line-height: 1.5; margin: 8px 4px; }
.al-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 24px; }
.al-primary, .al-secondary { border: 0; border-radius: 12px; padding: 12px 22px; font-weight: 600 !important; }
.al-primary { background: var(--al-petrol); color: white !important; }
.al-primary:hover { background: var(--al-petrol-700); }
.al-secondary { background: var(--al-paper); border: 1px solid var(--al-line); }
.al-secondary:hover { background: var(--al-rose-tint); }
.al-progress { color: var(--al-ink-2); font-size: 14px; margin: 0; font-variant-numeric: tabular-nums; }
.al-result { margin-top: 20px; background: var(--al-paper); padding: 18px; border-radius: 12px; border: 1px solid var(--al-line); line-height: 1.6; }
.al-result h2 { scroll-margin-top: 16px; font-size: 18px; color: var(--al-petrol); margin: 0 0 8px; }
.al-result p { margin: 0; max-width: 75ch; }
.al-chip.is-selected { border-color: var(--al-petrol); background: #e7f0f5; box-shadow: 0 0 0 1px var(--al-petrol); }
.al-chip.is-correct { border-color: var(--al-mint-deep); background: var(--al-mint-tint); }
.al-chip.is-wrong { border-color: var(--al-amber-deep); background: var(--al-amber-tint); }
.al-item-feedback { grid-column: 1 / -1; margin: 0; padding: 0 14px 12px; font-size: 14px; line-height: 1.5; }
.is-correct .al-item-feedback { color: var(--al-mint-deep); }
.is-wrong .al-item-feedback { color: var(--al-amber-deep); }
.is-dragging { opacity: .45; }
.is-drop-target { outline: 3px solid var(--al-rose-deep); outline-offset: 3px; background: var(--al-rose-tint); }
.al-drag-preview { position: fixed; z-index: 10; pointer-events: none; background: var(--al-paper); color: var(--al-ink); border: 1px solid var(--al-rose-deep); border-radius: 12px; box-shadow: 0 8px 22px rgba(0, 60, 92, .2); font: 15px/1.5 Inter, system-ui, sans-serif; padding: 12px; }
.al-drag-preview .al-drag-handle, .al-drag-preview .al-item-feedback { display: none; }
.al-drag-preview button { font: inherit; color: inherit; background: transparent; border: 0; text-align: left; }
.al-sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
[hidden] { display: none !important; }
@media (max-width: 600px) {
  .al-activity { padding: 16px 12px; }
  .al-title { font-size: 19px; }
  .al-instructions { margin-bottom: 18px; }
  .al-pool-items, .al-columns { grid-template-columns: minmax(0, 1fr); }
  .al-pool-heading { align-items: flex-start; }
}
@media (prefers-reduced-motion: no-preference) {
  .al-chip { transition: background-color .15s ease-out; }
}

/* Order steps keep their place while a drag preview moves above them. */
.al-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.al-step { display: grid; grid-template-columns: 28px minmax(0, 1fr) 92px 44px; gap: 4px; align-items: center; padding: 8px; border: 1px solid var(--al-line); background: var(--al-paper); border-radius: 12px; }
.al-step-number { text-align: center; color: var(--al-petrol); font-weight: 600; font-variant-numeric: tabular-nums; }
.al-step .al-item-button { padding: 8px; overflow-wrap: anywhere; }
.al-move-buttons { display: flex; gap: 4px; }
.al-move-button { display: flex; align-items: center; justify-content: center; border: 1px solid var(--al-line); border-radius: 12px; background: var(--al-cream); width: 44px; height: 44px; color: var(--al-petrol) !important; }
.al-move-button:hover:not(:disabled):not([aria-disabled="true"]) { background: var(--al-rose-tint); border-color: var(--al-rose-deep); }
.al-move-button:disabled, .al-move-button[aria-disabled="true"] { opacity: .45; cursor: default; }
.al-step.is-moved { border-color: var(--al-petrol); background: #e7f0f5; box-shadow: 0 0 0 1px var(--al-petrol); }
.al-step.is-selected { border-color: var(--al-petrol); background: #e7f0f5; box-shadow: 0 0 0 1px var(--al-petrol); }
.al-step.is-correct { border-color: var(--al-mint-deep); background: var(--al-mint-tint); }
.al-step.is-wrong { border-color: var(--al-amber-deep); background: var(--al-amber-tint); }
.al-step.is-drop-target { outline: 0; border-top: 4px solid var(--al-rose-deep); padding-top: 5px; }
.al-step-feedback { grid-column: 2 / -1; margin: 0; padding: 0 8px 4px; font-size: 14px; line-height: 1.5; color: var(--al-amber-deep); }
.is-correct .al-step-feedback { color: var(--al-mint-deep); }
@media (max-width: 600px) {
  .al-step { grid-template-columns: 24px minmax(0, 1fr) 44px 44px; gap: 2px; padding: 6px; }
  .al-move-buttons { flex-direction: column; }
}

/* Before Check, only the learner's own tap markers appear. */
.al-hotspot-tools { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.al-hotspot-tools button { font-size: 14px; padding: 10px 14px; }
.al-hotspot-viewport { overflow: auto; padding: 22px 0 0; }
.al-hotspot-picture { position: relative; width: 100%; max-width: 880px; margin: 0 auto; cursor: crosshair; }
.al-hotspot-picture img { display: block; width: 100%; height: auto; border-radius: 4px; }
.al-hotspot-marks { position: absolute; inset: 0; pointer-events: none; }
.al-hotspot-marker { position: absolute; display: flex; align-items: center; gap: 4px; width: 60px; height: 28px; pointer-events: none; }
.al-hotspot-marker-number { display: grid; place-items: center; width: 28px; height: 28px; border: 2px solid white; border-radius: 50%; background: var(--al-petrol); color: white; font-size: 13px; }
.al-activity .al-hotspot-remove { pointer-events: auto; width: 28px; height: 28px; min-width: 28px; min-height: 28px; padding: 0; border: 2px solid white; border-radius: 4px; background: var(--al-petrol); color: white; font-size: 22px; line-height: 1; }
.al-hotspot-point { position: absolute; width: 6px; height: 6px; transform: translate(-50%,-50%); border-radius: 50%; background: white; border: 2px solid var(--al-petrol); }
.al-hotspot-region { position: absolute; border: 2px solid var(--al-petrol); background: transparent; }
.al-hotspot-region.is-correct { border-color: var(--al-mint-deep); }
.al-hotspot-region.is-wrong { border-color: var(--al-amber-deep); }
.al-hotspot-verdict, .al-hotspot-legend-number { display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 28px; flex-shrink: 0; border: 1px solid var(--al-petrol); border-radius: 50%; background: var(--al-paper); color: var(--al-petrol); font-size: 13px; line-height: 1; font-weight: 600; font-variant-numeric: tabular-nums; }
.al-hotspot-verdict { position: absolute; z-index: 1; }
.al-hotspot-leaders { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.al-hotspot-leaders line { stroke: var(--al-petrol); stroke-width: 1.5; }
.al-hotspot-review { max-width: 880px; margin: 16px auto 0; }
.al-hotspot-review h3 { margin: 0 0 4px; color: var(--al-petrol); font-size: 18px; }
.al-hotspot-review p { margin: 0 0 12px; color: var(--al-ink-2); font-size: 14px; line-height: 1.5; }
.al-hotspot-legend { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.al-hotspot-legend li { display: flex; align-items: start; gap: 10px; line-height: 1.5; }
.al-hotspot-legend-text { padding-top: 2px; overflow-wrap: anywhere; }
.al-hotspot-notice { min-height: 24px; margin: 12px 0; font-size: 14px; line-height: 1.5; color: var(--al-ink-2); }
.al-hotspot-list { border: 1px solid var(--al-line); border-radius: 12px; padding: 12px; margin-top: 16px; display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 4px 16px; }
.al-hotspot-list legend { padding: 0 6px; font-weight: 600; color: var(--al-petrol); }
.al-hotspot-choice { display: flex; gap: 10px; align-items: center; min-height: 44px; font-size: 15px; line-height: 1.5; cursor: pointer; }
.al-hotspot-choice input { width: 24px; height: 24px; flex-shrink: 0; accent-color: var(--al-petrol); }
.al-hotspot-choice input:focus-visible { outline: 3px solid var(--al-petrol-700); outline-offset: 3px; }
.al-result-explanations { padding-left: 22px; margin: 16px 0 0; line-height: 1.6; }
.al-result-explanations li + li { margin-top: 10px; }
.al-hotspot-activity .al-toolbar:has(.al-primary:not([hidden])) { position: sticky; bottom: 0; z-index: 2; padding: 12px 0; background: var(--al-cream); }
.al-hotspot-viewport.is-enlarged .al-hotspot-picture { width: 880px; max-width: none; }
@media (max-width: 600px) {
  .al-hotspot-viewport { margin-inline: -12px; }
  .al-hotspot-list { grid-template-columns: minmax(0,1fr); }
  .al-hotspot-tools button { flex: 1 1 auto; }
}

/* The description and every focused row stay clear of the sticky Check bar. */
.al-hotspot-description { grid-column: 1 / -1; line-height: 1.6; margin-bottom: 8px; }
.al-hotspot-description h2 { font-size: 16px; margin: 4px 0; color: var(--al-petrol); }
.al-hotspot-description p { margin: 4px 0; }
.al-hotspot-list { scroll-margin-top: 16px; }
.al-hotspot-choice { scroll-margin-block: 12px 100px; }
.al-hotspot-notice { flex-basis: 100%; margin: 0; min-height: 0; }
.al-hotspot-notice:empty { display: none; }
.al-hotspot-region.is-neutral { border: 1px dashed #9db8c4; }
/* Placement lives beside each item as well as in the shared destination columns. */
.al-place-choices { grid-column: 1 / -1; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 0 10px 10px; }
.al-place-label { flex-basis: 100%; font-size: 14px; color: var(--al-petrol); }
.al-activity .al-place-button { flex: 1 1 100%; border: 1px solid var(--al-petrol-700); border-radius: 10px; background: var(--al-paper); color: var(--al-petrol) !important; font-weight: 600 !important; font-size: 15px; line-height: 1.35; padding: 10px 12px; text-align: left; }
@media (hover: hover) { .al-place-button:hover { background: var(--al-rose-tint); } }
/* Checked cards no longer move, so they drop the handle column. */
.al-chip.is-correct, .al-chip.is-wrong { grid-template-columns: minmax(0, 1fr); }
.al-column-feedback { margin: 4px 4px 12px; font-size: 14px; line-height: 1.5; color: var(--al-ink-2); }
/* Check is local to the work; its result keeps score and Retry together. */
.al-completion { margin: 24px 0; }
.al-completion .al-toolbar, .al-completion .al-result { margin: 0; }
.al-result-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.al-result-heading h2 { margin: 0; }
.al-result-explanation { margin-top: 12px; }
.al-result-explanation summary { cursor: pointer; color: var(--al-petrol); min-height: 44px; display: list-item; line-height: 44px; text-decoration: underline; text-underline-offset: 3px; }
.al-result-explanation summary:focus-visible { outline: 3px solid var(--al-petrol-700); outline-offset: 3px; }
@media (max-width: 600px) {
  .al-completion .al-toolbar { display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; }
  .al-completion .al-primary { width: 100%; }
}
.al-move-button { border-color: var(--al-petrol-700); }
@media (max-width: 600px) {
  .al-sort .al-item-button { padding: 8px 10px; line-height: 1.45; }
  .al-sort .al-instructions { font-size: 14px; }
  .al-sort .al-column { padding: 8px; }
  .al-sort .al-pool-heading .al-destination { font-size: 13px; }
}

@media (min-width: 601px) { .al-place-choices { display: none; } }
/* Bounded work areas leave the shared action row beside the work. */
.al-pool-items { height: 320px; overflow-y: auto; padding: 3px; scroll-padding: 8px; scrollbar-color: var(--al-petrol-700) var(--al-cream); align-content: start; }
.al-pool-items:has(.al-chip) { border-bottom: 1px solid var(--al-line); }
.al-sort:has(.al-result:not([hidden])) .al-pool-items { height: auto; }
.al-order .al-task { height: 360px; overflow-y: auto; padding: 3px; scroll-padding: 8px; scrollbar-color: var(--al-petrol-700) var(--al-cream); }
.al-order:has(.al-result:not([hidden])) .al-task { height: auto; overflow: visible; }

/* The reviewed picture and one explanation list share the result viewport. */
@media (min-width: 601px) {
  .al-hotspot-picture { max-width: min(880px, calc(max(260px, 100dvh - 380px) * var(--picture-ratio))); }
}
.al-hotspot-result-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 16px; }
.al-hotspot-result-picture { min-width: 0; }
.al-hotspot-result-picture > button { margin-top: 8px; font-size: 14px; padding: 10px 14px; }
.al-hotspot-result-layout .al-hotspot-viewport { padding: 0; margin: 0; overflow: auto; max-height: 360px; }
.al-hotspot-result-layout .is-enlarged .al-hotspot-picture { width: 880px; max-width: none; }
.al-hotspot-result-layout .al-hotspot-picture { width: 100%; max-width: none; cursor: default; }
.al-hotspot-result-layout .al-hotspot-review { min-width: 0; margin: 0; }
.al-hotspot-result-layout .al-hotspot-review h3 { font-size: 16px; }
.al-hotspot-feedback { max-height: 440px; overflow-y: auto; padding: 4px 10px 4px 4px; scroll-padding: 8px; scrollbar-color: var(--al-petrol-700) var(--al-cream); }
.al-hotspot-feedback:focus-visible { outline: 3px solid var(--al-petrol-700); outline-offset: 2px; }
.al-hotspot-feedback li { padding-bottom: 10px; border-bottom: 1px solid var(--al-line); }
.al-hotspot-legend-text strong { display: block; font-size: 14px; color: var(--al-petrol); }
.al-hotspot-legend-text p { font-size: 14px; margin: 4px 0 0; }
@media (max-width: 600px) {
  .al-hotspot-result-layout { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .al-hotspot-result-layout .al-hotspot-viewport { max-height: 280px; }
  .al-hotspot-feedback { max-height: 220px; }
}

/* Keep the expanded text path in the same work area as picture and Check.
   Internal list scrolling also works in an auto-sized cross-origin LMS frame. */
.al-hotspot-selection.has-list { display: grid; grid-template-areas: "picture list" "actions list"; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.al-hotspot-selection.has-list .al-hotspot-list { grid-area: list; display: block; min-width: 0; margin: 0; max-height: 360px; overflow-y: auto; scroll-padding: 8px; }
.al-hotspot-selection.has-list .al-hotspot-viewport { grid-area: picture; padding-top: 0; min-width: 0; }
.al-hotspot-selection.has-list .al-toolbar { grid-area: actions; margin: 0; }
.al-hotspot-selection.has-list .al-hotspot-picture { max-width: min(100%, calc(360px * var(--picture-ratio))); }
.al-hotspot-selection.has-list .is-enlarged .al-hotspot-picture { max-width: none; }
.al-hotspot-selection.has-list .is-enlarged { max-height: 360px; }
@media (max-width: 600px) {
  .al-hotspot-selection.has-list { grid-template-areas: "picture" "actions" "list"; grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .al-hotspot-selection.has-list .al-hotspot-list { max-height: 220px; }
  .al-hotspot-selection.has-list .is-enlarged { max-height: 260px; }
}
