/* AN ECHO AWAY – shared demo chrome (start, play, end) and per-demo styles */

.aea-demo {
  display: grid;
  align-content: start;
  gap: 1.2rem;
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter-r);
  padding-block: 1.5rem 2.5rem;
  color: var(--text);
}

/* Start screen */
.aea-start {
  display: grid;
  gap: 1rem;
  justify-items: start;
  max-width: 54ch;
  padding-block: clamp(1rem, 6vh, 4rem);
}
.aea-start__eyebrow { margin: 0; color: var(--corona-hi); }
.aea-start__title {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: var(--step-2);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  line-height: 1.2;
}
.aea-start__text { margin: 0; font-size: 1.0625rem; }
.aea-start__controls { margin: 0; color: var(--muted); font-size: 0.875rem; }

/* Shared bits */
.aea-status {
  margin: 0;
  min-height: 1.6em;
  font-family: var(--mono);
  font-size: 0.875rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}
.aea-status strong { color: var(--text); font-weight: 500; }
.aea-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.8rem 1.2rem; }
.aea-actions { display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* ---------- Signal Delay Test ---------- */

.sdt__map {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 7;
  min-height: 240px;
  max-height: 62vh;
  max-width: 100%;
  border: 1px solid var(--line);
  background: var(--void);
  overflow: hidden;
}
.sdt__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }

.sdt__post {
  position: absolute;
  transform: translate(-50%, -22px);
  display: grid;
  justify-items: center;
  gap: 0.35rem;
  min-width: 52px;
  padding: 0 0 0.3rem;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.sdt__post::before {
  /* the hit target around the dot drawn on the canvas */
  content: "";
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid transparent;
  transition: border-color 0.2s;
}
.sdt__post:hover { color: var(--text); }
.sdt__post:hover::before { border-color: var(--line-strong); }
.sdt__post[aria-pressed="true"] { color: var(--text); }
.sdt__post[aria-pressed="true"]::before { border-color: var(--corona-hi); }
.sdt__post:focus-visible { outline: none; }
.sdt__post:focus-visible::before { border-color: var(--corona-hi); box-shadow: 0 0 0 3px rgba(243, 176, 113, 0.25); }
.sdt__done { width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }
.sdt__post.is-done .sdt__done { background: var(--corona); }

.sdt__station {
  position: absolute;
  transform: translate(-50%, 18px);
  margin: 0;
  font-family: var(--mono);
  font-size: 0.6875rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  text-transform: uppercase;
  pointer-events: none;
}

.sdt__timeline { display: grid; gap: 0.45rem; }
.sdt__track {
  position: relative;
  height: 10px;
  border: 1px solid var(--line);
  background: var(--hull);
}
.sdt__fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0;
  background: var(--corona);
  box-shadow: 0 0 12px var(--corona-glow);
}
.sdt__mark {
  position: absolute;
  top: -5px;
  bottom: -5px;
  width: 1px;
  background: var(--text);
}
.sdt__mark--send { left: 0; }
.sdt__caption { margin: 0; font-size: 0.75rem; color: var(--faint); font-family: var(--mono); text-transform: uppercase; letter-spacing: 0.1em; }

.sdt__compare {
  display: grid;
  gap: 1.1rem;
  padding: 1.4rem 1.4rem 1.5rem;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(232, 137, 58, 0.06), transparent 60%), var(--hull);
}
.sdt__bars { display: grid; gap: 0.6rem; }
.sdt__bar { height: 8px; width: 0; transition: width 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
.sdt__tagline {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: var(--step-1);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--corona-hi);
}

@media (max-width: 560px) {
  .sdt__map { aspect-ratio: 4 / 3; }
  .sdt__post { font-size: 0.6875rem; min-width: 44px; }
}

/* ---------- Shared end panel ---------- */
.aea-end {
  display: grid;
  gap: 1.1rem;
  justify-items: start;
  padding: 1.6rem 1.5rem 1.7rem;
  border: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(232, 137, 58, 0.06), transparent 60%), var(--hull);
}
.aea-end__list { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.35rem; font-size: 0.9375rem; }
.aea-end__tagline {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: var(--step-1);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--corona-hi);
}

/* ---------- Out of Order ---------- */
.ooo__round { margin: 0; color: var(--corona-hi); }
.ooo__legend { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 1.6rem; }
.ooo__legend-item { display: flex; align-items: flex-end; gap: 0.5rem; }
.ooo__legend-bar { display: none; width: 6px; }
.ooo__legend.is-help .ooo__legend-bar { display: block; }
.ooo__legend-label { display: grid; font-size: 0.75rem; line-height: 1.35; color: var(--text); }
.ooo__legend-stage { color: var(--muted); }

.ooo__board {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px minmax(0, 1fr);
  border: 1px solid var(--line);
  background: var(--hull);
  touch-action: pan-y;
}
.ooo__col { position: relative; min-width: 0; }
.ooo__col--sent { border-right: 1px solid var(--line-strong); }
.ooo__col--recv { border-left: 1px solid var(--line-strong); }
.ooo__col-label {
  position: absolute;
  top: -1.9rem;
  margin: 0;
  color: var(--muted);
}
.ooo__col--sent .ooo__col-label { right: 0.4rem; }
.ooo__col--recv .ooo__col-label { left: 0.4rem; }
.ooo__board { margin-top: 2rem; }
.ooo__tick { position: absolute; height: 1px; width: 6px; background: var(--line); }
.ooo__tick--major { width: 10px; background: var(--line-strong); }
.ooo__col--sent .ooo__tick { right: 0; }
.ooo__col--recv .ooo__tick { left: 0; }
.ooo__lane { position: relative; }
.ooo__ruler {
  position: absolute;
  left: 50%;
  width: 6px;
  transform: translateX(-50%);
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.6);
}
.ooo__guide { position: absolute; height: 0; border-top: 1px dashed var(--line-strong); pointer-events: none; }
.ooo__solution { position: absolute; inset: 0; pointer-events: none; overflow: visible; }

.ooo__card {
  position: absolute;
  z-index: 2;
  height: 34px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 0.55rem;
  padding: 0 0.6rem;
  border: 1px solid var(--line-strong);
  border-left: 3px solid var(--post);
  background: var(--hull-2);
  color: var(--text);
  font-family: var(--body);
  font-weight: 400;
  font-size: 0.8125rem;
  line-height: 1.25;
  text-align: left;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: top 0.18s, left 0.18s, border-color 0.2s;
}
.ooo__card.is-sent { border-left-width: 1px; border-right: 3px solid var(--post); }
.ooo__card-post { font-size: 0.75rem; color: var(--post); }
.ooo__card-text { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ooo__card.is-dragging { z-index: 5; transition: none; cursor: grabbing; box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6); }
.ooo__card.is-held { z-index: 5; box-shadow: 0 0 0 1px var(--corona-hi), 0 8px 24px rgba(0, 0, 0, 0.6); }
.ooo__card.is-right { border-color: var(--corona); }
.ooo__card.is-wrong { opacity: 0.75; border-style: dashed; }
.ooo__card[aria-disabled="true"] { cursor: default; }
.ooo__card--ghost { opacity: 0.55; cursor: default; pointer-events: none; z-index: 1; }
.ooo__solution { z-index: 3; }

@media (max-width: 560px) {
  .ooo__card { font-size: 0.75rem; padding: 0 0.4rem; gap: 0.35rem; }
  .ooo__card-post { font-size: 0.6875rem; }
  .ooo__board { grid-template-columns: minmax(0, 1fr) 24px minmax(0, 1fr); }
}

/* ---------- Course Correction ---------- */
.cc__route { margin: 0; }
.cc__frame {
  position: relative;
  width: 100%;
  max-width: 720px;
  height: min(68vh, 620px);
  min-height: 340px;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--void);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.cc__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cc__hint { text-align: center; justify-self: center; }
.cc__total { margin: 0; font-family: var(--display); font-weight: 300; font-size: var(--step-2); letter-spacing: 0.08em; }

/* ---------- Alignment ---------- */
.al__count { margin: 0; color: var(--corona-hi); }
.al__frame {
  position: relative;
  width: 100%;
  height: min(64vh, 600px);
  min-height: 360px;
  border: 1px solid var(--line);
  background: var(--void);
  overflow: hidden;
  touch-action: none;
  cursor: grab;
}
.al__frame:active { cursor: grabbing; }
.al__frame:focus-visible { outline: 1px solid var(--corona-hi); outline-offset: 2px; }
.al__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.al__found { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.3rem; font-size: 0.875rem; color: var(--corona-hi); }
@media (max-width: 560px) { .al__frame { height: 360px; min-height: 0; } }

/* ---------- In Sync ---------- */
.insync__join { display: flex; flex-wrap: wrap; align-items: center; gap: 0.7rem; margin-top: 0.4rem; }
.insync__join .label { color: var(--muted); }
.insync__code-input,
.insync__link {
  min-height: 44px;
  padding: 0 0.8em;
  border: 1px solid var(--line-strong);
  border-radius: 0;
  background: var(--hull);
  color: var(--text);
  font-size: 1rem;
}
.insync__code-input { width: 9.5ch; text-transform: uppercase; letter-spacing: 0.2em; }
.insync__error { margin: 0; color: var(--corona-hi); font-size: 0.9375rem; }
.insync__notice { padding-block: 3rem; }

.insync__lobby { display: grid; gap: 1rem; justify-items: start; max-width: 58ch; padding-block: 1.5rem; }
.insync__code { margin: 0; font-size: clamp(2rem, 8vw, 3rem); letter-spacing: 0.3em; color: var(--text); }
.insync__share { display: flex; flex-wrap: wrap; gap: 0.6rem; width: 100%; }
.insync__link { flex: 1 1 16rem; min-width: 0; font-size: 0.8125rem; }

.insync__title { margin: 0; }
.insync__scene {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 1rem;
  padding: 2.2rem clamp(1rem, 5vw, 3.5rem);
  border: 1px solid var(--line);
  background: radial-gradient(ellipse at 50% 50%, rgba(232, 137, 58, 0.06), transparent 70%), var(--hull);
}
.insync__node { display: grid; justify-items: center; gap: 0.6rem; }
.insync__disc {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
}
.insync__disc::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--text); }
.insync__node--me .insync__disc::after { background: var(--corona); box-shadow: 0 0 12px var(--corona-glow); }
.insync__name { margin: 0; color: var(--muted); }
.insync__dots { display: flex; gap: 6px; min-height: 8px; }
.insync__dot { width: 8px; height: 8px; border: 1px solid var(--line-strong); }
.insync__dot.is-on { background: var(--text); border-color: var(--text); }
.insync__node--me .insync__dot.is-on { background: var(--corona); border-color: var(--corona); }
.insync__path { height: 0; border-top: 1px dashed var(--line-strong); }
.insync__ring {
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1.5px solid var(--text);
  animation: insync-ring 1.1s ease-out forwards;
  pointer-events: none;
}
.insync__ring--strong { border-color: var(--corona-hi); box-shadow: 0 0 14px var(--corona-glow); }
@keyframes insync-ring { from { transform: scale(1); opacity: 1; } to { transform: scale(2.4); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .insync__ring { animation: insync-ring-still 0.9s linear forwards; }
  @keyframes insync-ring-still { from { opacity: 1; } to { opacity: 0; } }
}

.insync__instr { margin: 0; min-height: 3.2em; max-width: 60ch; }
.insync__pulse { justify-self: center; min-width: 12rem; min-height: 64px; font-size: 1rem; }
.insync__chips { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: center; }
.insync__chip { min-height: 38px; padding: 0.4em 0.9em; }
.insync__chiplog { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.2rem; justify-items: center; font-size: 0.8125rem; color: var(--muted); min-height: 1.5em; }

.insync__result {
  display: grid;
  gap: 0.7rem;
  padding: 1.3rem 1.4rem 1.4rem;
  border: 1px solid var(--line);
  background: var(--hull);
}
.insync__verdict {
  margin: 0;
  font-family: var(--display);
  font-weight: 300;
  font-size: var(--step-2);
  letter-spacing: 0.24em;
  color: var(--corona-hi);
}
.insync__verdict-line { margin: 0; color: var(--muted); }
.insync__timeline { position: relative; height: 34px; border-bottom: 1px solid var(--line-strong); }
.insync__tick { position: absolute; bottom: 0; width: 2px; transform: translateX(-1px); }
.insync__tick--lead { height: 18px; background: var(--text); }
.insync__tick--lead.is-last { height: 26px; }
.insync__tick--arrived { height: 10px; background: var(--faint); opacity: 0.8; }
.insync__tick--follow { height: 32px; background: var(--corona); box-shadow: 0 0 10px var(--corona-glow); }
.insync__legend { margin: 0; display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; font-size: 0.75rem; color: var(--muted); }
.insync__key::before { content: ""; display: inline-block; width: 10px; height: 2px; margin-right: 0.45em; vertical-align: middle; }
.insync__key--lead::before { background: var(--text); }
.insync__key--follow::before { background: var(--corona); }
.insync__key--arrived::before { background: var(--faint); }

@media (max-width: 560px) {
  .insync__scene { padding: 1.6rem 1rem; gap: 0.6rem; }
  .insync__disc { width: 56px; height: 56px; }
}

/* End screen: actions and the challenge link fallback */
.aea-end__actions { display: grid; gap: 0.7rem; }
.aea-end__link {
  width: 100%;
  min-height: 40px;
  padding: 0.4em 0.7em;
  background: var(--void);
  color: var(--text);
  border: 1px solid var(--line-strong);
  font-size: 0.8125rem;
}

/* ---------- Echo Window ---------- */
.ew__title { margin: 0; color: var(--corona-hi); }
.ew__frame {
  position: relative;
  width: 100%;
  height: clamp(300px, 62vh, 560px);
  border: 1px solid var(--line);
  background: var(--void);
  overflow: hidden;
  cursor: pointer;
}
.ew__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: manipulation; }
.ew__controls { justify-content: flex-start; }
.ew__send { min-width: 12rem; }
.ew__help { max-width: 62ch; }

/* ---------- Lightbend ---------- */
.lb__title { margin: 0; color: var(--corona-hi); }
.lb__frame {
  position: relative;
  width: 100%;
  height: clamp(320px, 64vh, 600px);
  border: 1px solid var(--line);
  background: var(--void);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  cursor: crosshair;
}
.lb__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.lb__controls { justify-content: flex-start; }
.lb__turn { min-width: 48px; padding-inline: 0.8em; font-size: 1.1rem; letter-spacing: 0; }
.lb__fire { min-width: 11rem; }
@media (max-width: 480px) {
  .lb__controls { display: grid; grid-template-columns: auto 1fr auto; gap: 0.6rem; }
  .lb__fire { min-width: 0; }
  .lb__controls > :last-child { grid-column: 1 / -1; justify-self: start; }
}

/* ---------- Signal Weave ---------- */
.sw__title { margin: 0; color: var(--corona-hi); }
.sw__frame {
  position: relative;
  width: 100%;
  margin: 0 auto;
  border: 1px solid var(--line);
  background: var(--void);
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}
.sw__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: pointer; }
.sw__canvas:focus-visible { outline: 2px solid var(--corona); outline-offset: -2px; }
.sw__controls { justify-content: flex-start; }
.sw__send { min-width: 11rem; }
