.duel-lab-page {
  background:
    radial-gradient(ellipse at 50% 0%, var(--tune-page-bg-glow) 0%, rgba(20, 45, 32, 0.05) 30%, transparent 66%),
    linear-gradient(180deg, var(--tune-page-bg-dark) 0%, var(--tune-page-bg-mid) 42%, var(--tune-page-bg-green) 100%);
}

.duel-lab-shell {
  width: min(1420px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 10px 18px 6px;
}

.duel-lab-topbar,
.lab-section-head,
.team-builder-head,
.battle-scoreboard,
.action-builder-head,
.battle-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.duel-lab-top-actions,
.setup-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.bot-toggle {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 12px;
  border: 1px solid rgba(124, 162, 148, 0.45);
  border-radius: 999px;
  color: var(--text);
  background: rgba(14, 23, 19, 0.78);
  font-weight: 900;
}

.bot-toggle input {
  width: 16px;
  min-height: 16px;
  accent-color: var(--teal);
}

.ghost-link {
  min-height: 40px;
  display: inline-grid;
  place-items: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  text-decoration: none;
  font-weight: 800;
}

.lab-card {
  margin-top: 18px;
  padding: 18px;
  border: 1px solid rgba(124, 162, 148, 0.5);
  border-radius: 10px;
  background: rgba(17, 25, 22, 0.7);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.28);
}

.lab-section-head h2 {
  margin: 0;
  font-size: clamp(1.25rem, 2vw, 2rem);
}

.lab-section-head.compact h2 {
  font-size: 1.05rem;
}

.lab-note,
.lab-message {
  margin: 12px 0 0;
  color: var(--muted);
  font-weight: 700;
  line-height: 1.45;
}

.lab-message.is-error {
  color: #ffb4a8;
}

.team-builder-grid,
.action-builder-grid,
.duel-arena {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.action-builder-grid {
  /* Without this, the grid's default align-items: stretch matches both panels to
     whichever one is taller, leaving visible empty space at the bottom of the shorter one
     whenever their content heights differ (e.g. validation messages, bot-controlled state). */
  align-items: start;
}

.duel-arena[hidden] {
  display: none;
}

.team-builder,
.action-builder,
.battle-team-state,
.battle-side-summary,
.battle-center-summary {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(165deg, rgba(60, 195, 160, 0.05), rgba(18, 31, 26, 0.74) 55%);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
}

.team-builder,
.action-builder {
  padding: 14px;
}

.team-builder-head {
  align-items: end;
  border-bottom: 1px solid rgba(124, 162, 148, 0.32);
  padding-bottom: 12px;
}

.team-builder-head h3,
.action-builder-head h3 {
  margin: 0;
  font-size: 1rem;
  text-transform: uppercase;
}

.team-builder-head div:not(:first-child) {
  display: grid;
  justify-items: end;
}

.team-builder-head span,
.action-builder-head span,
.action-cost {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.team-builder-head strong {
  color: var(--amber);
  font-size: 1.1rem;
}

.setup-role-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.setup-role-row {
  display: grid;
  grid-template-columns: 160px minmax(0, 1fr) 66px;
  gap: 10px;
  align-items: center;
}

.setup-role-row label {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.character-search-wrap {
  position: relative;
}

.character-search-input {
  width: 100%;
}

/* One consistent accent for every filled slot (not per-character color — with 12 mixed
   picks on screen at once, per-fighter-type color turned into distracting confetti). */
.setup-role-row.is-filled .character-search-input {
  background: linear-gradient(90deg, rgba(60, 195, 160, 0.08), transparent 45%), #101714;
  border-color: rgba(60, 195, 160, 0.32);
  border-left: 3px solid var(--teal);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
}

.setup-role-row.is-filled .role-cost-chip {
  border-color: var(--teal);
  color: var(--teal);
}


.character-search-results {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid rgba(124, 162, 148, 0.5);
  border-radius: 10px;
  background: rgba(9, 16, 13, 0.98);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
}

.character-search-option {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.character-search-option:hover,
.character-search-option:focus {
  outline: none;
  background: rgba(60, 195, 160, 0.14);
}

.character-search-option strong,
.character-search-option em {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.character-search-option strong {
  font-size: 0.9rem;
  font-weight: 950;
}

.character-search-option em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 800;
}

.character-search-option b {
  min-width: 34px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--amber);
  background: #101714;
  font-size: 0.78rem;
  text-align: center;
}

.character-search-empty {
  padding: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.role-cost-chip {
  min-height: 36px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--amber);
  background: #101714;
  font-weight: 900;
}

.battle-view {
  margin-top: 18px;
}

.battle-scoreboard {
  align-items: stretch;
  margin-top: 10px;
}

.battle-side-summary,
.battle-center-summary {
  padding: 12px 16px;
}

.battle-side-summary {
  flex: 1 1 0;
}

.battle-center-summary {
  min-width: min(360px, 100%);
  text-align: center;
}

.battle-side-summary strong,
.battle-center-summary strong {
  display: block;
  color: var(--text);
  font-size: 1.4rem;
  line-height: 1.1;
}

.battle-side-summary span:last-child,
.battle-center-summary span:last-child {
  color: var(--muted);
  font-weight: 800;
}

.battle-report {
  margin-top: 14px;
  /* .battle-view is a 2-column grid (desk + teams); without this the report auto-places
     into just one narrow column instead of spanning the full width. */
  grid-column: 1 / -1;
}

/* When there's a winner, the log panel is moved to be a direct child of .battle-view
   (see renderBattle in duel-lab.js). Same auto-placement issue as .battle-report above:
   without this it drops into the narrow "teams" column on the right instead of sitting
   centered, full-width, below the report. Scoped to the direct-child case only, so the
   in-battle layout (sidebar next to the action builder) is untouched. */
.battle-view > .battle-sidebar {
  grid-column: 1 / -1;
}

.battle-report-card {
  background: #141c18;
  border: 1px solid var(--line);
  border-radius: 14px;
  /* Tightened (was 26px 24px) so the whole report fits a typical desktop viewport
     without scrolling — see the height budget notes on .momentum-chart below. */
  padding: 18px 22px;
  text-align: center;
}

.battle-report-kicker {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.battle-report-winner {
  margin: 4px 0 2px;
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  font-weight: 900;
  color: var(--accent, var(--teal));
  text-shadow: 0 0 5px color-mix(in srgb, var(--accent, var(--teal)) 55%, transparent), 0 0 14px color-mix(in srgb, var(--accent, var(--teal)) 35%, transparent);
}

.battle-report-summary {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.battle-report-momentum {
  background: #0f1613;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 12px;
}

.battle-report-label {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-align: center;
}

.momentum-chart {
  width: 100%;
  /* Desktop-priority height budget for the whole report to fit one screen without
     scrolling (was 160px). Still tall enough to read the line's shape clearly. */
  height: 128px;
  display: block;
}

.momentum-midline {
  stroke: var(--line);
  stroke-width: 1;
  stroke-dasharray: 4 4;
}

.momentum-line {
  fill: none;
  /* stroke color comes from the inline gradient (see duel-lab.js) so it can shift between
     the two players' colors depending on who's ahead at each point on the line. */
  stroke-width: 3;
  stroke-linejoin: round;
  stroke-linecap: round;
}

.momentum-axis-label {
  margin: 0;
  color: var(--accent, var(--teal));
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.momentum-axis-top {
  margin-bottom: 4px;
}

.momentum-axis-bottom {
  margin-top: 4px;
  text-align: right;
}

.battle-report-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.74rem;
  line-height: 1.4;
  text-align: center;
}

.battle-report-rosters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
  text-align: left;
}

.battle-report-roster {
  background: #0f1613;
  border-radius: 10px;
  padding: 12px 14px;
}

.battle-report-roster-title {
  margin: 0 0 6px;
  color: var(--accent, var(--teal));
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.battle-report-roster-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 3px 0;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text);
}

.battle-report-roster-row.is-ko {
  color: #6d7f77;
  text-decoration: line-through;
}

@media (max-width: 560px) {
  .battle-report-rosters {
    grid-template-columns: 1fr;
  }
}

.battle-report-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

#battleReportStatus {
  margin-top: 10px;
}

#battleReportStatus:empty {
  margin-top: 0;
}

.duel-motion-stage {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 0.72fr) minmax(220px, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 260px;
  margin-top: 14px;
  overflow: hidden;
  border: 1px solid rgba(124, 162, 148, 0.34);
  border-radius: 14px;
  background:
    radial-gradient(circle at 50% 52%, rgba(60, 195, 160, 0.13), transparent 30%),
    linear-gradient(90deg, rgba(8, 17, 13, 0.74), rgba(23, 48, 33, 0.76), rgba(8, 17, 13, 0.74));
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.26);
}

.duel-motion-stage::before {
  content: "";
  position: absolute;
  inset: auto 9% 35px;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(188, 231, 211, 0.35), transparent);
}

.motion-fighter {
  position: relative;
  z-index: 2;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 14px;
}

.motion-meta {
  width: min(260px, 100%);
  display: grid;
  gap: 2px;
  padding: 10px 12px;
  border: 1px solid rgba(124, 162, 148, 0.28);
  border-radius: 10px;
  background: rgba(8, 17, 13, 0.54);
}

.motion-meta span,
.motion-meta em {
  color: var(--muted);
  font-size: 0.72rem;
  font-style: normal;
  font-weight: 900;
  text-transform: uppercase;
}

.motion-meta strong {
  overflow: hidden;
  color: var(--text);
  font-size: 1.25rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.motion-avatar {
  position: relative;
  width: clamp(110px, 12vw, 160px);
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border: 2px solid var(--accent);
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.12), transparent 32%),
    radial-gradient(circle, color-mix(in srgb, var(--accent) 22%, transparent), transparent 68%),
    #07110d;
  box-shadow:
    0 0 0 6px color-mix(in srgb, var(--accent) 10%, transparent),
    0 0 36px color-mix(in srgb, var(--accent) 38%, transparent);
}

.motion-avatar span {
  display: none;
}

/* Silhouette figure retired - plain circle + initials matches the rest
   of the app (roster rows, character cards). Keep the animation rules
   below scoped to .motion-figure so they simply have nothing to animate. */
.motion-figure {
  display: none;
  position: absolute;
  z-index: 1;
  inset: 2% -18% -6%;
  background:
    linear-gradient(180deg, #f4fff8, color-mix(in srgb, var(--accent) 72%, #f4fff8) 46%, color-mix(in srgb, var(--accent) 58%, #07110d));
  -webkit-mask: url("./assets/fighter-silhouette.png") center / contain no-repeat;
  mask: url("./assets/fighter-silhouette.png") center / contain no-repeat;
  opacity: 0.92;
  filter:
    drop-shadow(0 0 16px color-mix(in srgb, var(--accent) 58%, transparent))
    drop-shadow(0 14px 18px rgba(0, 0, 0, 0.62));
  transform-origin: 50% 86%;
  animation: motionFigureIdle 2800ms ease-in-out infinite;
  will-change: transform, opacity;
}

.motion-figure::before,
.motion-figure::after {
  display: none;
}

.motion-hp {
  width: min(260px, 100%);
  display: grid;
  gap: 5px;
}

.motion-hp span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 900;
  text-align: center;
}

.motion-hp div {
  height: 9px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0e1713;
}

.motion-hp i {
  display: block;
  width: var(--hp, 100%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber));
  transition: width 520ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.motion-clash {
  position: relative;
  z-index: 4;
  display: grid;
  justify-items: center;
  align-content: center;
  min-height: 190px;
  text-align: center;
}

.motion-orb {
  width: 82px;
  height: 82px;
  border-radius: 999px;
  opacity: 0;
  background: radial-gradient(circle, var(--amber), var(--teal) 45%, transparent 70%);
}

.motion-clash p {
  min-height: 38px;
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 900;
}

.motion-clash strong {
  display: block;
  min-height: 30px;
  color: var(--amber);
  font-size: 1.35rem;
}

.motion-fighter.is-hit .motion-avatar {
  animation: duelHitShake 430ms ease;
}

.motion-fighter.is-hit .motion-figure {
  animation: motionFigureHit 430ms ease;
}

.motion-fighter.is-guard .motion-avatar::after,
.motion-fighter.is-special-defense .motion-avatar::after {
  content: "";
  position: absolute;
  inset: -15px;
  border: 3px solid var(--accent);
  border-radius: inherit;
  animation: duelShieldPulse 720ms ease;
}

.motion-fighter.is-read .motion-avatar {
  animation: duelReadDodge 760ms ease;
}

.motion-fighter.is-read .motion-figure {
  animation: motionFigureRead 760ms ease;
}

.motion-fighter.is-strike.is-left .motion-avatar {
  animation: duelStrikeLeft 680ms ease;
}

.motion-fighter.is-strike.is-left .motion-figure {
  animation: motionFigureStrikeLeft 680ms cubic-bezier(0.18, 0.84, 0.28, 1);
}

.motion-fighter.is-strike.is-right .motion-avatar {
  animation: duelStrikeRight 680ms ease;
}

.motion-fighter.is-strike.is-right .motion-figure {
  animation: motionFigureStrikeRight 680ms cubic-bezier(0.18, 0.84, 0.28, 1);
}

.motion-fighter.is-blitz.is-left .motion-avatar {
  animation: duelBlitzLeft 760ms ease;
}

.motion-fighter.is-blitz.is-left .motion-figure {
  animation: motionFigureBlitzLeft 760ms cubic-bezier(0.14, 0.84, 0.2, 1);
}

.motion-fighter.is-blitz.is-right .motion-avatar {
  animation: duelBlitzRight 760ms ease;
}

.motion-fighter.is-blitz.is-right .motion-figure {
  animation: motionFigureBlitzRight 760ms cubic-bezier(0.14, 0.84, 0.2, 1);
}

.motion-fighter.is-special-attack .motion-avatar {
  animation: duelSpecialCharge 880ms ease;
}

.motion-fighter.is-guard .motion-figure,
.motion-fighter.is-special-defense .motion-figure {
  animation: motionFigureGuard 760ms ease;
}

.motion-fighter.is-special-attack .motion-figure {
  animation: motionFigureSpecialAttack 880ms ease;
}

.motion-clash.is-impact .motion-orb {
  animation: duelImpactBurst 760ms ease;
}

.motion-clash.is-blitz .motion-orb {
  animation: duelSpeedLine 760ms ease;
}

.motion-clash.is-read .motion-orb {
  animation: duelReadRing 820ms ease;
}

.motion-clash.is-guard .motion-orb,
.motion-clash.is-special-defense .motion-orb {
  animation: duelGuardGlow 820ms ease;
}

.motion-clash.is-special-attack .motion-orb {
  animation: duelSpecialBurst 920ms ease;
}

.battle-team-state {
  padding: 12px;
}

.battle-team-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  color: var(--muted);
  font-weight: 900;
  text-transform: uppercase;
}

.combatant-list {
  display: grid;
  gap: 8px;
}

.combatant {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 116px;
  gap: 10px;
  align-items: center;
  padding: 9px;
  border: 1px solid rgba(124, 162, 148, 0.34);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 13%, transparent), transparent 40%),
    rgba(17, 25, 22, 0.78);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);
}

.combatant.is-ko {
  opacity: 0.48;
}

.combatant.is-used {
  border-style: dashed;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent 34%),
    rgba(12, 18, 16, 0.6);
}

.combatant.is-used .combatant-name strong,
.combatant.is-used .combatant-name span {
  opacity: 0.42;
}

.combatant.is-used .portrait {
  opacity: 0.45;
}

.combatant-name {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.combatant-name strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.combatant-name span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

/* Inline status word, not a separate badge line - rides on the existing
   "Cost X" text instead of adding a new row, so the card's height never
   changes and the page doesn't grow past one screen. nowrap+ellipsis above
   also means a long combo can never wrap to a second line either. */
.status-word {
  font-weight: 900;
  letter-spacing: 0.02em;
}

/* .status-word is nested inside the same <span> that .combatant.is-used
   .combatant-name span fades to 0.42 - opacity compounds down the tree, so
   a plain .status-word rule alone can't win; match the same specificity to
   override it back to fully legible. */
.combatant.is-used .combatant-name span .status-word.is-used-word {
  opacity: 1;
  color: var(--amber);
}

.hp-wrap {
  display: grid;
  gap: 4px;
}

.hp-label {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: right;
}

.hp-bar {
  height: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #0e1713;
}

.hp-fill {
  height: 100%;
  width: var(--hp, 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--amber));
}

.action-builder {
  display: grid;
  gap: 10px;
}

.action-builder.is-bot-controlled {
  border-color: rgba(60, 195, 160, 0.52);
  background:
    linear-gradient(135deg, rgba(60, 195, 160, 0.08), transparent 54%),
    rgba(18, 31, 26, 0.74);
}

.action-builder.is-bot-controlled select,
.action-builder.is-bot-controlled input {
  opacity: 0.58;
  cursor: not-allowed;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 800;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.check-row b {
  color: var(--amber);
}

.assist-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.action-button-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 5px;
}

.assist-type-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.assist-type-grid .action-choice em {
  display: block;
  color: var(--amber);
}

.action-choice {
  min-height: 28px;
  display: grid;
  align-content: center;
  gap: 1px;
  padding: 3px 5px;
  border: 1px solid rgba(124, 162, 148, 0.38);
  border-radius: 8px;
  color: var(--text);
  background:
    linear-gradient(135deg, rgba(60, 195, 160, 0.08), transparent 60%),
    rgba(11, 18, 15, 0.88);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2);
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

/* Split the action grid into a warm (offense) / cool (defense) read at a glance.
   Only touches the resting state — hover/is-selected below still wins on top of this,
   so the existing teal "you picked this" glow stays the one consistent selection cue. */
.action-choice.is-offense {
  border-color: rgba(240, 184, 75, 0.4);
  background:
    linear-gradient(135deg, rgba(240, 184, 75, 0.14), transparent 60%),
    rgba(11, 18, 15, 0.88);
}

.action-choice.is-offense span {
  color: #f0c076;
}

.action-choice.is-defense {
  border-color: rgba(90, 166, 214, 0.4);
  background:
    linear-gradient(135deg, rgba(90, 166, 214, 0.14), transparent 60%),
    rgba(11, 18, 15, 0.88);
}

.action-choice.is-defense span {
  color: #a9d6e8;
}

.action-choice span {
  display: block;
  overflow-wrap: break-word;
  font-size: 0.68rem;
  font-weight: 950;
  line-height: 1.15;
  text-transform: uppercase;
  white-space: normal;
}

.action-choice em {
  overflow: hidden;
  color: var(--muted);
  display: none;
  font-size: 0.56rem;
  font-style: normal;
  font-weight: 900;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.action-choice:hover:not(:disabled),
.action-choice.is-selected {
  border-color: color-mix(in srgb, var(--teal) 72%, white 10%);
  background:
    linear-gradient(135deg, rgba(60, 195, 160, 0.2), rgba(240, 184, 75, 0.06)),
    rgba(14, 28, 23, 0.95);
}

.action-choice.is-selected {
  box-shadow: inset 0 0 0 1px rgba(60, 195, 160, 0.72);
}

.action-choice:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

.action-cost {
  min-height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(124, 162, 148, 0.34);
  border-radius: 999px;
  background: #101714;
}

.action-cost.is-error {
  color: #ffb4a8;
  border-color: #a74236;
}

.battle-actions {
  justify-content: center;
  margin-top: 14px;
}

.battle-actions .primary-button,
.battle-actions .tool-button {
  min-width: 220px;
}

.battle-log-panel {
  margin-top: 14px;
}

.battle-log {
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding-left: 0;
  list-style: none;
}

.battle-log li {
  padding: 12px;
  border: 1px solid rgba(124, 162, 148, 0.34);
  border-radius: 8px;
  background: rgba(13, 21, 18, 0.72);
}

.battle-log strong {
  display: block;
  color: var(--text);
}

.battle-log p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.42;
}

/* Compact duel board */
.duel-lab-page .title-lockup {
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.duel-lab-page .title-lockup h1 {
  margin: 0;
  font-size: clamp(1rem, 1.3vw, 1.35rem);
}

.duel-lab-page .title-lockup .eyebrow {
  margin: 0;
}

.duel-lab-page .duel-lab-topbar {
  min-height: 36px;
}

.duel-lab-page .battle-view {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  grid-template-areas:
    "score score"
    "desk teams";
  gap: 8px;
  align-items: start;
  margin-top: 6px;
}

.duel-lab-page .battle-view[hidden] {
  display: none;
}

.duel-lab-page .battle-scoreboard {
  grid-area: score;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 0.6fr) minmax(0, 1fr);
  gap: 10px;
  margin-top: 0;
}

.duel-lab-page .battle-scoreboard[hidden],
.battle-scoreboard[hidden] {
  display: none;
}

.duel-lab-page .battle-side-summary,
.duel-lab-page .battle-center-summary {
  min-height: 34px;
  padding: 4px 12px;
}

.duel-lab-page .battle-center-summary {
  min-width: 0;
}

.duel-lab-page .battle-side-summary strong,
.duel-lab-page .battle-center-summary strong {
  font-size: 1rem;
}

.duel-lab-page .battle-center-summary span {
  display: block;
  overflow: hidden;
  max-width: 100%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.battle-desk {
  grid-area: desk;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 12px;
  align-items: stretch;
  margin-top: 0;
}

.battle-main-panel,
.battle-sidebar {
  min-width: 0;
}

.duel-lab-page .duel-motion-stage {
  /* Middle column needs to comfortably fit "Player 1 -101 HP" on one line (worst case:
     longest player label + 3-digit damage) without wrapping mid-phrase. */
  grid-template-columns: minmax(150px, 1fr) minmax(150px, 0.7fr) minmax(150px, 1fr);
  min-height: clamp(96px, 12vh, 126px);
  margin-top: 0;
  border-radius: 10px;
}

.duel-lab-page .motion-fighter {
  gap: 4px;
  padding: 6px;
}

.duel-lab-page .motion-meta {
  width: min(190px, 100%);
  padding: 4px 8px;
  border-radius: 8px;
}

.duel-lab-page .motion-meta strong {
  font-size: 0.9rem;
}

.duel-lab-page .motion-avatar {
  width: clamp(48px, 5vw, 66px);
}

.duel-lab-page .motion-hp {
  width: min(190px, 100%);
}

.duel-lab-page .motion-clash {
  min-height: 64px;
}

/* .duel-motion-stage::before is a decorative ground line, pinned 35px up from the
   stage's bottom edge. That works in the spacious generic layout, but the compact
   in-game .motion-clash above is short enough that 35px lands mid-way through its
   result text ("X reads it wrong." / "Player 1 -101 HP") instead of below it.
   Pull it down to the stage's actual bottom edge here so it clears the text. */
.duel-lab-page .duel-motion-stage::before {
  bottom: 4px;
}

.duel-lab-page .motion-orb {
  width: 36px;
  height: 36px;
}

.duel-lab-page .motion-clash p {
  min-height: 18px;
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.2;
}

.duel-lab-page .motion-clash strong {
  min-height: 24px;
  /* Small margin below the column's new min-width so "Player 1 -101 HP" fits on one line. */
  font-size: 0.92rem;
  line-height: 1.22;
  white-space: pre-line;
}

.duel-lab-page .action-builder-grid {
  gap: 8px;
  margin-top: 5px;
}

.duel-lab-page .action-builder {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 6px;
}

.duel-lab-page .action-builder-head,
.duel-lab-page .assist-grid,
.duel-lab-page .action-cost {
  grid-column: 1 / -1;
}

.duel-lab-page .action-builder-head {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.duel-lab-page .field {
  gap: 4px;
}

.duel-lab-page .field:has(select[name="action"]),
.duel-lab-page .field:has(select[name="assistType"]) {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.duel-lab-page .field span {
  font-size: 0.64rem;
}

.duel-lab-page select,
.duel-lab-page input {
  min-height: 27px;
  padding: 0 8px;
  font-size: 0.78rem;
}

.duel-lab-page .check-row {
  gap: 6px;
  font-size: 0.78rem;
}

.duel-lab-page .check-row input {
  width: 15px;
  min-height: 15px;
}

.duel-lab-page .assist-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
}

.duel-lab-page .action-button-grid {
  grid-column: 1 / -1;
}

.duel-lab-page .action-builder.is-bot-controlled .action-choice {
  opacity: 0.58;
  cursor: not-allowed;
}

.duel-lab-page .action-cost {
  min-height: 22px;
  font-size: 0.7rem;
}

.duel-lab-page .battle-actions {
  justify-content: flex-start;
  gap: 10px;
  margin-top: 6px;
}

.duel-lab-page .battle-actions .primary-button,
.duel-lab-page .battle-actions .tool-button {
  min-width: 160px;
  min-height: 36px;
}

.duel-lab-page .battle-log-panel {
  height: 100%;
  max-height: calc(100vh - 142px);
  display: flex;
  flex-direction: column;
  margin-top: 0;
  padding: 12px;
}

.duel-lab-page .battle-log-panel .lab-section-head {
  flex: 0 0 auto;
}

.duel-lab-page .battle-log-panel .lab-section-head h2 {
  font-size: 0.9rem;
}

.duel-lab-page .battle-log-panel .tool-button {
  min-width: 84px;
  min-height: 32px;
  padding: 0 10px;
}

.duel-lab-page .battle-log {
  flex: 1 1 auto;
  gap: 7px;
  margin-top: 10px;
  overflow: auto;
  padding-right: 4px;
}

.duel-lab-page .battle-log li {
  padding: 9px 10px;
  border-radius: 7px;
}

.duel-lab-page .battle-log strong {
  font-size: 0.86rem;
  line-height: 1.25;
}

.duel-lab-page .battle-log p {
  margin-top: 4px;
  font-size: 0.78rem;
  line-height: 1.32;
}

.duel-lab-page .exchange-card-head {
  display: grid;
  gap: 3px;
}

.duel-lab-page .exchange-label {
  color: var(--muted);
  font-size: 0.58rem;
  font-weight: 950;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.duel-lab-page .exchange-result {
  color: var(--gold);
  font-weight: 950;
}

.duel-lab-page .exchange-damage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px 7px;
  color: var(--text);
  font-weight: 850;
}

.duel-lab-page .damage-separator {
  color: var(--muted);
  font-weight: 700;
}

.duel-lab-page .exchange-effects {
  display: grid;
  gap: 3px;
  margin-top: 6px;
}

.duel-lab-page .exchange-effects p {
  margin-top: 0;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 800;
}

.duel-lab-page .exchange-details {
  margin-top: 7px;
  padding-top: 6px;
  border-top: 1px solid rgba(124, 162, 148, 0.22);
}

.duel-lab-page .exchange-details summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 0.62rem;
  font-weight: 950;
  text-transform: uppercase;
}

.duel-lab-page .exchange-details p {
  color: var(--muted);
}

.duel-lab-page .battle-log li:not(:first-child) .exchange-result,
.duel-lab-page .battle-log li:not(:first-child) .exchange-damage,
.duel-lab-page .battle-log li:not(:first-child) .exchange-effects {
  display: none;
}

.duel-lab-page .duel-arena {
  grid-area: teams;
  grid-template-columns: 1fr;
  gap: 10px;
  align-self: stretch;
  margin-top: 0;
}

.duel-lab-page .battle-team-state {
  padding: 10px;
}

.duel-lab-page .battle-team-title {
  margin-bottom: 7px;
  font-size: 0.75rem;
}

.duel-lab-page .combatant-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}

.duel-lab-page .combatant {
  grid-template-columns: minmax(0, 1fr);
  gap: 4px;
  padding: 6px 7px;
  border-radius: 7px;
}

.duel-lab-page .combatant-name {
  gap: 6px;
}

.duel-lab-page .combatant-name .portrait {
  width: 30px;
  height: 30px;
  border-width: 1px;
  font-size: 0.68rem;
}

.duel-lab-page .combatant-name strong {
  font-size: 0.82rem;
  line-height: 1.05;
}

.duel-lab-page .combatant-name span {
  font-size: 0.64rem;
}

.duel-lab-page .hp-wrap {
  gap: 3px;
}

.duel-lab-page .hp-label {
  font-size: 0.66rem;
  text-align: left;
}

.duel-lab-page .hp-bar {
  height: 6px;
}

@keyframes duelHitShake {
  0%,
  100% {
    transform: translateX(0);
    filter: brightness(1);
  }
  25% {
    transform: translateX(-8px);
    filter: brightness(1.4);
  }
  50% {
    transform: translateX(7px);
  }
  75% {
    transform: translateX(-4px);
  }
}

@keyframes duelStrikeLeft {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }
  42% {
    transform: translateX(22px) scale(1.06);
  }
}

@keyframes duelStrikeRight {
  0%,
  100% {
    transform: translateX(0) scale(1);
  }
  42% {
    transform: translateX(-22px) scale(1.06);
  }
}

@keyframes duelBlitzLeft {
  0%,
  100% {
    transform: translateX(0) scale(1);
    box-shadow:
      0 0 0 6px color-mix(in srgb, var(--accent) 10%, transparent),
      0 0 36px color-mix(in srgb, var(--accent) 38%, transparent);
  }
  36% {
    transform: translateX(42px) scale(0.94);
    box-shadow:
      18px 0 0 -5px color-mix(in srgb, var(--accent) 50%, transparent),
      38px 0 0 -10px color-mix(in srgb, var(--accent) 32%, transparent);
  }
}

@keyframes duelBlitzRight {
  0%,
  100% {
    transform: translateX(0) scale(1);
    box-shadow:
      0 0 0 6px color-mix(in srgb, var(--accent) 10%, transparent),
      0 0 36px color-mix(in srgb, var(--accent) 38%, transparent);
  }
  36% {
    transform: translateX(-42px) scale(0.94);
    box-shadow:
      -18px 0 0 -5px color-mix(in srgb, var(--accent) 50%, transparent),
      -38px 0 0 -10px color-mix(in srgb, var(--accent) 32%, transparent);
  }
}

@keyframes duelReadDodge {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }
  35% {
    transform: translateY(-10px) rotate(-4deg);
  }
  62% {
    transform: translateY(4px) rotate(3deg);
  }
}

@keyframes duelSpecialCharge {
  0%,
  100% {
    transform: scale(1);
    filter: saturate(1);
  }
  44% {
    transform: scale(1.12);
    filter: saturate(1.8) brightness(1.28);
  }
}

@keyframes duelShieldPulse {
  0% {
    opacity: 0;
    transform: scale(0.88);
  }
  35% {
    opacity: 0.8;
  }
  100% {
    opacity: 0;
    transform: scale(1.24);
  }
}

@keyframes duelImpactBurst {
  0% {
    opacity: 0;
    transform: scale(0.25);
  }
  42% {
    opacity: 1;
    transform: scale(1.15);
  }
  100% {
    opacity: 0;
    transform: scale(1.8);
  }
}

@keyframes duelSpeedLine {
  0% {
    opacity: 0;
    transform: scaleX(0.25) scaleY(0.7);
  }
  35% {
    opacity: 1;
    transform: scaleX(1.7) scaleY(0.55);
  }
  100% {
    opacity: 0;
    transform: scaleX(2.2) scaleY(0.35);
  }
}

@keyframes duelReadRing {
  0% {
    opacity: 0;
    transform: rotate(0deg) scale(0.55);
  }
  45% {
    opacity: 0.92;
    transform: rotate(180deg) scale(1.05);
  }
  100% {
    opacity: 0;
    transform: rotate(360deg) scale(1.45);
  }
}

@keyframes duelGuardGlow {
  0% {
    opacity: 0;
    transform: scale(0.75);
  }
  45% {
    opacity: 0.85;
    transform: scale(1.05);
  }
  100% {
    opacity: 0;
    transform: scale(1.35);
  }
}

@keyframes duelSpecialBurst {
  0% {
    opacity: 0;
    transform: scale(0.35);
    filter: blur(6px);
  }
  45% {
    opacity: 1;
    transform: scale(1.35);
    filter: blur(0);
  }
  100% {
    opacity: 0;
    transform: scale(2);
    filter: blur(10px);
  }
}

@keyframes motionFigureIdle {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  50% {
    transform: translateY(-4px) scale(1.015);
  }
}

@keyframes motionFigureStrikeLeft {
  0%,
  100% {
    transform: translateX(0) rotate(0deg) scale(1);
  }
  22% {
    transform: translateX(-10px) rotate(-4deg) scale(0.98);
  }
  52% {
    transform: translateX(42px) translateY(-4px) rotate(10deg) scale(1.12);
  }
  66% {
    transform: translateX(18px) rotate(4deg) scale(1.03);
  }
}

@keyframes motionFigureStrikeRight {
  0%,
  100% {
    transform: translateX(0) rotate(0deg) scale(1);
  }
  22% {
    transform: translateX(10px) rotate(4deg) scale(0.98);
  }
  52% {
    transform: translateX(-42px) translateY(-4px) rotate(-10deg) scale(1.12);
  }
  66% {
    transform: translateX(-18px) rotate(-4deg) scale(1.03);
  }
}

@keyframes motionFigureBlitzLeft {
  0%,
  100% {
    opacity: 0.92;
    transform: translateX(0) scale(1);
  }
  20% {
    opacity: 0.64;
    transform: translateX(-16px) scaleX(0.9) scaleY(1.05);
  }
  42% {
    opacity: 1;
    transform: translateX(76px) translateY(-2px) scaleX(1.26) scaleY(0.9);
  }
  58% {
    transform: translateX(24px) scale(1.04);
  }
}

@keyframes motionFigureBlitzRight {
  0%,
  100% {
    opacity: 0.92;
    transform: translateX(0) scale(1);
  }
  20% {
    opacity: 0.64;
    transform: translateX(16px) scaleX(0.9) scaleY(1.05);
  }
  42% {
    opacity: 1;
    transform: translateX(-76px) translateY(-2px) scaleX(1.26) scaleY(0.9);
  }
  58% {
    transform: translateX(-24px) scale(1.04);
  }
}

@keyframes motionFigureGuard {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  38% {
    transform: translateY(8px) scaleX(1.12) scaleY(0.92);
  }
  68% {
    transform: translateY(3px) scaleX(1.04) scaleY(0.98);
  }
}

@keyframes motionFigureRead {
  0%,
  100% {
    transform: translateX(0) translateY(0) rotate(0deg) scale(1);
  }
  34% {
    transform: translateX(-28px) translateY(-10px) rotate(-8deg) scale(0.94);
  }
  64% {
    transform: translateX(12px) translateY(4px) rotate(5deg) scale(1.02);
  }
}

@keyframes motionFigureSpecialAttack {
  0%,
  100% {
    transform: translateY(0) scale(1);
  }
  32% {
    transform: translateY(-12px) scale(1.16);
  }
  58% {
    transform: translateY(5px) scaleX(1.18) scaleY(0.92);
  }
}

@keyframes motionFigureHit {
  0%,
  100% {
    opacity: 0.92;
    transform: translateX(0) rotate(0deg);
  }
  24% {
    opacity: 0.58;
    transform: translateX(-12px) rotate(-7deg);
  }
  52% {
    transform: translateX(10px) rotate(5deg);
  }
  76% {
    transform: translateX(-5px) rotate(-2deg);
  }
}

@media (max-width: 1180px) {
  .duel-lab-page .battle-view {
    grid-template-columns: 1fr;
    grid-template-areas:
      "score"
      "desk"
      "teams";
  }

  .duel-lab-page .battle-desk {
    grid-template-columns: 1fr;
  }

  .duel-lab-page .battle-log-panel {
    max-height: 260px;
  }
}

@media (max-width: 980px) {
  .team-builder-grid,
  .duel-lab-page .action-builder-grid,
  .duel-lab-page .duel-arena,
  .duel-lab-page .battle-scoreboard {
    grid-template-columns: 1fr;
  }

  .duel-lab-page .battle-scoreboard {
    display: grid;
  }

  /* Keep both fighters side by side instead of stacking the whole stage
     vertically - stacking made this the tallest section on phone widths. */
  .duel-lab-page .duel-motion-stage {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-template-areas:
      "p1 p2"
      "clash clash";
    min-height: auto;
    padding-bottom: 10px;
  }

  .duel-lab-page #motionP1 {
    grid-area: p1;
  }

  .duel-lab-page #motionP2 {
    grid-area: p2;
  }

  .duel-lab-page #motionClash {
    grid-area: clash;
    min-height: 0;
    padding-top: 4px;
  }

  .duel-lab-page .motion-avatar {
    width: clamp(64px, 20vw, 96px);
  }

  .duel-lab-page .motion-meta,
  .duel-lab-page .motion-hp {
    width: 100%;
  }

  .duel-lab-page .motion-meta strong {
    font-size: 0.88rem;
  }

  /* Two narrower cards read fine at phone widths and cut the roster
     section's scroll length roughly in half versus one-per-row. */
  .duel-lab-page .combatant-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .duel-lab-page .action-builder {
    grid-template-columns: 1fr;
  }

  .duel-lab-page .action-builder-head span {
    max-width: none;
    text-align: left;
    white-space: normal;
  }
}

@media (max-width: 680px) {
  .duel-lab-page .duel-lab-shell {
    padding: 12px;
  }

  .duel-lab-page .duel-lab-topbar,
  .duel-lab-page .lab-section-head,
  .duel-lab-page .battle-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .duel-lab-page .assist-grid {
    grid-template-columns: 1fr;
  }

  /* Keep the search box and cost chip on one row - a lone "-" chip
     spanning the full width on its own row read as an empty button. */
  .duel-lab-page .setup-role-row {
    grid-template-columns: minmax(0, 1fr) 56px;
    grid-template-areas:
      "label label"
      "search chip";
    gap: 6px;
  }

  .duel-lab-page .setup-role-row label {
    grid-area: label;
  }

  .duel-lab-page .setup-role-row .character-search-wrap {
    grid-area: search;
  }

  .duel-lab-page .setup-role-row .role-cost-chip {
    grid-area: chip;
  }

  .duel-lab-page .team-builder-head {
    align-items: start;
    flex-direction: column;
  }

  .duel-lab-page .combatant {
    grid-template-columns: 1fr;
  }

  .duel-lab-page .hp-label {
    text-align: left;
  }
}
