.ar-section {container: routine / inline-size}
.ar-map {
  --ar-line: #8e6dc8;
  --ar-ice: #edf2f5;
  --ar-muted: #c4d0d8;
  --ar-gap: clamp(.95rem, 1.8vw, 1.4rem);
  background: radial-gradient(ellipse at 52% 35%, #2b2547 0%, transparent 49%), #071d2a;
  border: 1px solid #293b4e;
  border-radius: 12px;
  margin: .95rem 0 0;
  color: var(--ar-ice);
  padding: clamp(1rem, 2.3vw, 1.75rem);
  overflow: hidden;
}
.ar-flow {
  display: grid;
  grid-template-columns: minmax(0,1.04fr) var(--ar-gap) minmax(0,1fr) var(--ar-gap) minmax(0,1.06fr);
  align-items: center;
}
.ar-stage {min-width: 0}
.ar-label {
  margin-bottom: .6rem;
  color: #ccaaff;
  font: 580 .76rem/1.3 var(--sans);
  letter-spacing: .035em;
}
.ar-sources, .ar-results {list-style: none; margin: 0; padding: 0}
.ar-sources {display: grid; gap: .5rem}
.ar-source {
  display: flex;
  gap: .64rem;
  align-items: center;
  padding: .65rem .7rem;
  border: 1px solid #354759;
  border-radius: .55rem;
  min-height: 3.65rem;
  background: #102735;
}
.ar-source strong, .ar-source small {display: block}
.ar-source strong {font-size: .95rem; line-height: 1.25; font-weight: 610}
.ar-source small, .ar-agent-body p, .ar-output-note, .ar-results {font-size: .84rem; line-height: 1.35}
.ar-source small {color: var(--ar-muted); margin-top: .16rem}
.ar-mark, .ar-model-icon {
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  border-radius: .4rem;
  background: #fbfaf8;
  width: 1.85rem;
  height: 1.85rem;
}
.ar-map .workshop-brand, .ar-map .workshop-brand-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: none;
  box-shadow: none;
  background: none;
  width: 1.18rem;
  height: 1.18rem;
  min-width: 0;
}
.ar-map .workshop-brand img {width: 100%;height: 100%;object-fit: contain}
.ar-connector {height: 2px; background: var(--ar-line); position: relative; margin-top: 1.47rem}
.ar-connector i {
  position: absolute;
  height: .48rem; width: .48rem;
  top: 50%; right: 1px;
  border-top: 2px solid #bd9ae9;
  border-right: 2px solid #bd9ae9;
  transform: translateY(-50%) rotate(45deg);
}
.ar-agent-body, .ar-destination {border-radius: .65rem}
.ar-agent-body {
  position: relative;
  text-align: center;
  padding: .9rem .6rem .72rem;
  border: 1px solid #9274bd;
  background: linear-gradient(145deg,#28263b,#142430);
  box-shadow: 0 0 26px #ab78ff15;
}
.ar-portrait {
  width: 3.8rem;
  height: 3.8rem;
  border: 1px solid #a78dc6;
  border-radius: 50%;
  background-image: url('media/legacy-agentes-obsidiana.webp');
  background-size: 250%;
  background-position: 20% 68%;
  margin: 0 auto .55rem;
}
.ar-morning .ar-portrait {background-position: 75% 40%}
#step-view .sg-layout .ar-stage h3 {font: 650 clamp(1.08rem,1.55vw,1.26rem)/1.12 var(--sans); letter-spacing: -.035em; color: var(--ar-ice)}
#step-view .sg-layout .ar-agent-body p {color: #d5dbe2; margin-top: .4rem}
.ar-models {
  display: flex; flex-wrap: wrap;
  align-items: center; justify-content: center; gap: .32rem;
  margin-top: .78rem; padding-top: .56rem;
  border-top: 1px solid #585166;
  color: #c5d0d6; font-size: .72rem; line-height: 1.3;
}
.ar-model {display: inline-flex;align-items: center;gap: .19rem;color: #f5f5fa;font-weight: 560}
.ar-model-icon {width: 1.25rem; height: 1.25rem;border-radius: .28rem}
.ar-model-icon .workshop-brand, .ar-model-icon .workshop-brand-icon {width: .86rem; height: .86rem}
.ar-destination {
  padding: .95rem .85rem;
  border: 1px solid #476172;
  background: #102c3a;
}
.ar-output-kind {display: flex;align-items: center;gap: .4rem; color: #d4e2e8; font-size: .8rem; font-weight: 500; margin-bottom: .46rem}
.ar-output-kind .ar-mark {width: 1.4rem; height: 1.4rem}
.ar-output-kind .workshop-brand, .ar-output-kind .workshop-brand-icon {width: .91rem; height: .91rem}
.ar-file, .ar-results {margin-top: .75rem; padding-top: .6rem; border-top: 1px solid #3c5364}
.ar-file span, .ar-file code {display: block; font: 500 .84rem/1.45 var(--mono)}
.ar-file span {color: var(--ar-muted)}
.ar-file code {color: #e0caff; overflow-wrap: anywhere}
#step-view .sg-layout .ar-output-note {margin-top: .5rem; color: var(--ar-muted)}
.ar-results {display: grid;gap: .31rem;color: #e8eef0}
.ar-results li {display: flex; align-items: baseline; gap: .4rem}
.ar-results li:before {content: '';width: .28rem;height: .28rem;border-radius: 50%;background: #bd9ae9;flex-shrink: 0}
.ar-map figcaption {margin-top: 1.1rem; padding-top: .75rem; border-top: 1px solid #334453; font-size: .82rem; color: var(--ar-muted); line-height: 1.5}

@container routine (width > 620px) {
  .ar-flow {
    --ar-incoming: clamp(2rem, 3vw, 2.8rem);
    --ar-rail: calc(var(--ar-incoming) * .36);
    grid-template-columns: minmax(0,1.04fr) var(--ar-incoming) minmax(0,1fr) var(--ar-gap) minmax(0,1.06fr);
  }
  .ar-sources {position: relative; grid-auto-rows: 1fr}
  .ar-source {position: relative}
  .ar-source::after {
    content: '';
    position: absolute;
    top: 50%;
    left: calc(100% + 1px);
    width: calc(var(--ar-rail) + 1px);
    height: 2px;
    transform: translateY(-50%);
    background: var(--ar-line);
  }
  .ar-sources::after {
    content: '';
    position: absolute;
    left: calc(100% + var(--ar-rail));
    /* With three equal rows and two .5rem gaps, this inset is half a row. */
    inset-block: calc((100% - 1rem) / 6);
    width: 2px;
    background: var(--ar-line);
  }
  .ar-inputs + .ar-connector {
    margin-left: var(--ar-rail);
    /* Center the arrow on the cards, below the sources heading. */
    margin-top: calc(.76rem * 1.3 + .6rem);
  }
}

@container routine (max-width: 620px) {
  .ar-flow {display: flex; flex-direction: column; align-items: stretch}
  .ar-map {padding: .95rem}
  .ar-stage {width: 100%}
  .ar-connector {height: 1.5rem;width: 2px;margin: .2rem auto .28rem}
  .ar-connector i {top: auto; right: auto; left: 50%; bottom: 1px; transform: translateX(-50%) rotate(135deg)}
  .ar-agent-body {display: grid; grid-template-columns: 3.5rem 1fr; column-gap: .8rem; text-align: left; align-items: center; padding: .78rem}
  .ar-portrait {width: 3.45rem;height: 3.45rem;grid-row: span 2;margin: 0}
  .ar-models {grid-column: 1/-1; margin-top: .65rem}
  .ar-source {min-height: 3.25rem}
  .ar-label {margin-bottom: .4rem}
}
