/* The team: 3D board scene with the nine agents and a person. */
.team { padding-block: clamp(88px, 12vw, 168px); }
.team-head { margin-bottom: clamp(32px, 4vw, 48px); }
.team-head .body-l { max-width: 58ch; }

.team-stage {
  display: flex; flex-direction: column;
  height: clamp(460px, 40vw, 600px);
  border-radius: 28px;
  border: 1px solid var(--line);
  background:
    radial-gradient(120% 90% at 50% 0%, #FFFFFF 0%, rgba(255,255,255,0) 60%),
    linear-gradient(180deg, #F4F6F4 0%, #ECEFEC 100%);
  overflow: hidden;
  isolation: isolate;
}
.team-view { position: relative; flex: 1; min-height: 0; }
.team-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.team-overlay { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

/* top bar: current beat on the left, autonomy on the right */
.team-bar {
  display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap;
  padding: 10px 14px 10px 10px;
  background: rgba(255, 255, 255, .92);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 2;
}
.team-caption {
  display: flex; align-items: center; gap: 12px; min-width: 0;
  padding: 8px 14px; border-radius: 999px;
  background: var(--ink); color: #fff;
  font-weight: 500; font-size: .9375rem;
  transition: background .3s, color .3s;
}
.team-caption .mono { color: #AEB8C2; white-space: nowrap; }
.team-caption.you { background: var(--amber); color: #2B1E08; }
.team-caption.you .mono { color: #6B4A12; }

.team-hud {
  margin-left: auto;
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  font-size: .8125rem; line-height: 1.3; color: var(--ink-2);
}
.hud-run { display: inline-flex; align-items: center; gap: 7px; font-weight: 600; color: var(--green); }
.hud-lamp {
  width: 9px; height: 9px; border-radius: 50%; background: var(--green);
  box-shadow: 0 0 0 3px rgba(62, 155, 95, .18);
  animation: hudPulse 2.4s ease-in-out infinite;
}
@keyframes hudPulse { 50% { box-shadow: 0 0 0 6px rgba(62, 155, 95, 0); } }
.hud-level { font-weight: 600; color: var(--ink); }
.hud-level .mono { color: var(--grey); font-size: .6875rem; margin-right: 6px; font-weight: 400; }
.hud-meter { display: grid; gap: 4px; width: 150px; }
.hud-meter-top { display: flex; justify-content: space-between; gap: 8px; }
.hud-v { font-variant-numeric: tabular-nums; color: var(--grey); white-space: nowrap; }
.hud-v b { color: var(--ink); font-weight: 600; }
.hud-bar { display: block; height: 4px; border-radius: 99px; background: var(--steel); overflow: hidden; }
.hud-bar i { display: block; height: 100%; width: 3%; background: var(--blue); border-radius: inherit; transition: width .6s var(--ease); }
.hud-you { display: inline-flex; align-items: center; gap: 10px; padding-left: 16px; border-left: 1px solid var(--line); }
.hud-you .mono { color: var(--grey); font-size: .6875rem; }
.hud-you > span:not(.mono) { display: inline-flex; align-items: center; gap: 6px; color: var(--grey); transition: color .3s; }
.hud-you i { width: 12px; height: 12px; border-radius: 50%; border: 1.5px solid var(--line-2); transition: background .3s, border-color .3s; }
.hud-you .on { color: var(--ink) !important; }
.hud-you .on i { background: var(--amber); border-color: var(--amber-deep); }
@media (prefers-reduced-motion: reduce) { .hud-lamp { animation: none; } }

/* speech bubbles and name tags anchored to 3D points */
.tb {
  position: absolute; left: 0; top: 0;
  transform: translate(-50%, -100%);
  padding: 6px 10px 7px;
  border-radius: 10px;
  background: var(--paper);
  border: 1px solid var(--line-2);
  box-shadow: 0 6px 18px -8px rgba(29, 37, 44, .28);
  font: 500 .8125rem/1.25 var(--mono);
  color: var(--ink);
  white-space: nowrap;
  opacity: 0;
  transition: opacity .28s var(--ease);
  will-change: transform, opacity;
}
.tb::after {
  content: ""; position: absolute; left: 50%; bottom: -6px; width: 10px; height: 10px;
  background: inherit; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2);
  transform: translateX(-50%) rotate(45deg);
}
.tb.on { opacity: 1; }
.tb.red { color: #A63A2B; border-color: #EBC3BB; background: #FCF1EE; }
.tb.green { color: #2C7447; border-color: #C3E0CC; background: #F0F8F2; }
.tb.amber { color: #8A5A12; border-color: #EFD2A4; background: #FDF5E8; }
.tb.tag {
  padding: 3px 8px; border-radius: 999px; font-size: .6875rem; letter-spacing: .04em;
  background: var(--amber); border-color: var(--amber-deep); color: #3B2A0E; box-shadow: none;
}
.tb.tag::after { display: none; }

.team-loading {
  position: absolute; left: 14px; top: 12px; z-index: 2;
  padding: 6px 12px; border-radius: 999px; background: var(--paper); border: 1px solid var(--line);
  color: var(--grey);
}

.team-tip {
  position: absolute; z-index: 3; left: 0; top: 0;
  display: flex; gap: 10px; align-items: center;
  padding: 8px 12px 8px 8px; border-radius: 14px;
  background: var(--paper); border: 1px solid var(--line-2);
  box-shadow: 0 14px 32px -16px rgba(29, 37, 44, .4);
  pointer-events: none; max-width: 280px;
}
.team-tip img { width: 44px; height: 58px; object-fit: cover; border-radius: 8px; background: var(--steel); }
.team-tip b { display: block; font: 600 .875rem/1.2 var(--mono); }
.team-tip span { display: block; margin-top: 3px; font-size: .8125rem; color: var(--ink-2); line-height: 1.35; }

.team-fallback {
  position: absolute; inset: 0; display: flex; flex-wrap: wrap; align-content: center; justify-content: center;
  gap: 14px; padding: 24px;
}
.team-fallback li { display: grid; justify-items: center; gap: 6px; width: 104px; }
.team-fallback img { width: 104px; height: 138px; object-fit: cover; border-radius: 14px; background: #fff; }
.team-fallback span { font: 500 .75rem var(--mono); color: var(--ink-2); }

/* step rail */
.team-steps {
  margin-top: 20px;
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px;
}
.team-steps li {
  padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--line); background: var(--paper);
  font-size: .875rem; line-height: 1.4; color: var(--ink-2);
  transition: border-color .3s, background .3s, color .3s;
}
.team-steps li .mono { display: block; margin-bottom: 4px; color: var(--grey); }
.team-steps li.on { border-color: var(--blue); background: #F4F8FF; color: var(--ink); }
.team-steps li.on .mono { color: var(--blue); }
.team-steps li.is-you.on { border-color: var(--amber-deep); background: #FDF6EA; }
.team-steps li.is-you.on .mono { color: var(--amber-deep); }

@media (max-width: 1100px) {
  .hud-you { display: none; }
}
@media (max-width: 900px) {
  .team-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .team-hud { margin-left: 0; width: 100%; gap: 14px; }
}
@media (max-width: 640px) {
  .team-stage { height: 560px; border-radius: 20px; }
  .team-bar { padding: 8px; gap: 8px; }
  .team-caption { width: 100%; font-size: .8125rem; padding: 7px 12px; }
  .team-hud { font-size: .75rem; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 14px; }
  .hud-level .mono { display: none; }
  .hud-meter { width: auto; }
  .team-stage { height: 470px; }
  .tb { font-size: .6875rem; padding: 4px 7px 5px; }
  .team-steps { grid-template-columns: 1fr; }
}
