/* Duel stage 1 styles (SCREENS.md D1-D14, D16, D19, D21).
   Reuses the ChallengeStage garden/cream-sheet composition (challenges.css) and Home TODAY card (quick-play.css). */

/* ---- Home tab numeric results badge (D1) --------------------------------------------------------------- */
.tabbar__item,
.rail__item {
  position: relative;
}
.tab-badge {
  position: absolute;
  top: 4px;
  right: 12%;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--alert, #e53935);
  color: #fff;
  font-size: 11px;
  font-weight: var(--w-bold);
  line-height: 20px;
  text-align: center;
  box-shadow: 0 0 0 2px #0f2044;
  pointer-events: none;
}

/* ---- Home TODAY Duel row (D1: replaces news row inside TODAY; shares quieter lila CTA with Daily) ----- */
.home-duel {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 62px;
  margin: 0 9px;
  padding: 7px 0;
  border-top: 1px solid #0012421c;
  color: var(--ink);
}
.home-duel__info {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 1 1 0;
  min-width: 0;
  text-align: left;
  color: var(--ink);
}
.home-duel__badge-wrap {
  position: relative;
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
}
.home-duel__count {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--alert, #e53935);
  color: #fff;
  font-size: 11px;
  font-weight: var(--w-bold);
  line-height: 19px;
  text-align: center;
  box-shadow: 0 0 0 2px #fff;
}
.home-duel__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1 1 0;
}
.home-duel__title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.home-duel__copy strong {
  font-size: 16px;
  font-weight: var(--w-bold);
  line-height: 1.1;
  color: var(--ink);
}
.home-duel__state {
  display: block;
  font-size: 13px;
  line-height: 15px;
  color: #53627b;
  white-space: normal;
  overflow: visible;
}
.home-duel__bar {
  display: block;
  width: 100%;
  max-width: 180px;
  height: 5px;
  margin-top: 2px;
  border-radius: 999px;
  background: #e3e7f0;
  overflow: hidden;
}
.home-duel__bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #744bc9, #ffb400);
}
.home-duel__stars {
  font-size: 12px;
}
.home-duel__play {
  flex: none;
  --btn-h: 44px;
  --btn-font: 15px;
  --btn-lip-h: 4px;
  --btn-travel: 3px;
  --btn-pad-x: 13px;
  --btn-pad-rest-b: 3px;
  --btn-pad-press-t: 4px;
  min-height: 44px;
  min-width: 98px;
  max-width: 164px;
  gap: 6px;
}
.home-duel__play .btn__icon {
  width: 18px;
  height: 18px;
}

/* Keep Daily and Duel TODAY buttons identical in prominence when Duel is enabled (only bottom PLAY is yellow). */
.home-events--with-duel .home-daily__play {
  min-width: 98px;
}
.layout-wide .home.home--quick .home-events--combined .home-duel {
  min-height: 90px;
  margin-inline: 16px;
  padding: 12px 0;
  gap: 14px;
}
.layout-wide .home.home--quick .home-events--combined .home-duel__badge-wrap {
  width: 56px;
  height: 56px;
}
.layout-wide .home.home--quick .home-events--combined .home-duel__copy strong {
  font-size: 22px;
}
.layout-wide .home.home--quick .home-events--combined .home-duel__state {
  font-size: 16px;
  line-height: 20px;
}
.layout-wide .home.home--spread .home-events--combined .home-duel {
  flex: none;
  min-height: calc(108 * var(--hk));
  margin: 0 calc(20 * var(--hk));
  padding: calc(14 * var(--hk)) 0;
  gap: calc(16 * var(--hk));
}
.layout-wide .home.home--spread .home-events--combined .home-duel__badge-wrap {
  width: calc(60 * var(--hk));
  height: calc(60 * var(--hk));
}
.layout-wide .home.home--spread .home-events--combined .home-duel__copy strong {
  font-size: calc(25 * var(--hk));
}
.layout-wide .home.home--spread .home-events--combined .home-duel__state {
  font-size: max(14px, calc(17 * var(--hk)));
  line-height: 1.3;
}
.layout-wide .home.home--spread .home-events--combined .home-duel__play {
  --btn-h: calc(56 * var(--hk));
  --btn-font: calc(20 * var(--hk));
  min-height: calc(56 * var(--hk));
  max-width: none;
  padding-inline: calc(22 * var(--hk));
}
.layout-wide .home.home--spread .home-events--combined.home-events--with-duel .home-events__combined-body {
  justify-content: flex-start;
}

/* ---- Badges, stars, avatars --------------------------------------------------------------------------- */
.duel-badge {
  display: block;
  object-fit: contain;
  flex: none;
}
.duel-badge--xs { width: 22px; height: 22px; }
.duel-badge--sm { width: 42px; height: 42px; }
.duel-badge--md { width: 56px; height: 56px; }
.duel-badge--lg { width: 76px; height: 76px; }
.duel-badge--hero {
  width: 148px;
  height: 148px;
  filter: drop-shadow(0 6px 14px rgba(27, 37, 89, 0.28));
  animation: duel-pop 0.45s var(--ease-out) both;
}
@keyframes duel-pop {
  from { transform: scale(0.55); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.reduced-motion .duel-badge--hero { animation: none; }

.duel-stars {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  line-height: 1;
}
.duel-star {
  color: #c2cadb;
  font-size: 1em;
}
.duel-star.is-earned {
  color: #f5a600;
}

.duel-robot-avatar {
  display: inline-grid;
  place-items: center;
  width: var(--size, 64px);
  height: var(--size, 64px);
  border-radius: 50%;
  background: #e7f2ff;
  border: 2px solid #c3dcf7;
  overflow: hidden;
  flex: none;
}
.duel-robot-avatar img {
  width: 92%;
  height: 92%;
  object-fit: contain;
}
.duel-fresh-avatar {
  display: inline-grid;
  place-items: center;
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: #eef3fb;
  overflow: hidden;
}
.duel-fresh-avatar .robot {
  width: 60px;
  height: 60px;
}

.duel-computer-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 12px;
  border-radius: 999px;
  background: #53658c;
  color: #fff;
  font-size: 12px;
  font-weight: var(--w-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.duel-computer-chip--sm {
  padding: 2px 8px;
  font-size: 10px;
}
.duel-computer-chip--quiz {
  padding: 2px 8px;
  font-size: 11px;
  background: rgba(27, 37, 89, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.45);
  margin-left: 6px;
}

/* ---- Duel stage & hub layout -------------------------------------------------------------------------- */
.duel-stage {
  width: 100%;
  max-width: none;
}
.duel-stage .duel-stage__content {
  justify-content: flex-start;
  padding-top: max(12px, var(--safe-top, 0px));
  padding-bottom: max(24px, var(--safe-bottom, 0px));
}
.duel-stage .async-design__back.icon-btn {
  background: transparent;
  color: var(--disc-header-ink, #1a2554);
}
.duel-stage .async-design__back.icon-btn svg {
  width: 52%;
  height: 52%;
}
.duel-stage__head,
.duel-stage__sheet,
.duel-stage__hero,
.duel-stage .async-design__context {
  width: min(100%, 560px);
  margin-inline: auto;
}
.duel-stage__head {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-bottom: 10px;
}
.duel-stage__right {
  position: absolute;
  right: 0;
  top: 2px;
}
.duel-stage__right .pill {
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 18, 66, 0.14);
}
.duel-stage--hub .duel-stage__sheet,
.duel-stage--review .duel-stage__sheet {
  margin-top: 6px;
  gap: 14px;
}
.duel-stage--found .duel-stage__hero,
.duel-stage--result .duel-stage__hero {
  flex: 0 0 162px;
  min-height: 162px;
}
.duel-stage--found .duel-stage__hero > .robot,
.duel-stage--result .duel-stage__hero > .robot {
  height: min(100%, 162px);
}
.duel-stage--robot .duel-stage__hero {
  flex: 1 0 215px;
  min-height: 215px;
  max-height: 270px;
}
.duel-stage--robot .duel-stage__hero > .robot {
  height: min(100%, 215px);
}

.duel-rank-panel {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 20px;
  background: #fff;
  border: 1.5px solid #e6e1d6;
}
.duel-rank-panel__body {
  flex: 1 1 0;
  min-width: 0;
}

.duel-rankbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.duel-rankbar__labels {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.duel-rankbar__current,
.duel-rankbar__next {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  color: var(--navy);
}
.duel-rankbar__next {
  font-size: 13px;
  font-weight: var(--w-semibold);
  color: #53658c;
}
.duel-rankbar__track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e5e8f2;
  overflow: hidden;
}
.duel-rankbar__fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffb400, #ffd54f);
  transition: width 0.6s var(--ease-out);
}
.reduced-motion .duel-rankbar__fill { transition: none; }
.duel-rankbar__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: var(--w-medium);
  color: #53658c;
}

.duel-resume-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: #fff7db;
  border: 1.5px solid #f0c94d;
  color: var(--navy);
}

.duel-hub-cta {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.duel-hub-cta__price {
  font-size: 14px;
  font-weight: var(--w-semibold);
  color: #53658c;
}

.duel-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.duel-section h3 {
  margin: 4px 0 0;
  font-size: 15px;
  font-weight: var(--w-bold);
  color: #53658c;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.duel-row {
  padding: 12px 14px;
  border-radius: 18px;
  gap: 12px;
}
.duel-row.is-unread {
  border: 1.5px solid #744bc9;
  background: #faf7ff;
}
.duel-row__icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
}
.duel-row .duel-robot-avatar,
.duel-row .fr-avatar {
  width: 46px;
  height: 46px;
}
.duel-row__name {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.duel-unread-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--alert, #e53935);
}

.duel-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 8px 8px;
  color: #53658c;
  text-align: center;
}
.duel-empty__robot {
  width: 128px;
  height: 128px;
}

/* ---- Intro (D3) & Searching (D5) ---------------------------------------------------------------------- */
.duel-intro-rules {
  width: 100%;
  max-width: 420px;
  gap: 8px;
  padding-top: 8px;
}
.duel-intro-rules__icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex: none;
}
.duel-searching {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 20px 10px;
  text-align: center;
}

/* ---- VS cards (D6 Opponent found & D16 Practice Robot) ------------------------------------------------ */
.duel-vs {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: stretch;
  gap: 8px;
}
.duel-vs__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 8px;
  border-radius: 18px;
  background: #fff;
  border: 1.5px solid #e6e1d6;
  text-align: center;
}
.duel-vs__card .fr-avatar,
.duel-vs__card .duel-robot-avatar {
  width: 64px;
  height: 64px;
}
.duel-vs__card strong {
  font-size: clamp(13px, 3.4vw, 15.5px);
  line-height: 1.2;
  font-weight: var(--w-bold);
  color: var(--navy);
  overflow-wrap: break-word;
  max-width: 100%;
}
.duel-vs__rank-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  background: #eef2fa;
  color: var(--navy);
  font-size: 13px;
  font-weight: var(--w-semibold);
}
.duel-vs__badge {
  align-self: center;
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: linear-gradient(180deg, #8b5cf6, #6538c8);
  color: #fff;
  font-size: 15px;
  font-weight: var(--w-extrabold);
  box-shadow: 0 3px 8px rgba(56, 28, 112, 0.28);
}
.duel-vs__sub,
.duel-vs__copy {
  margin: 0;
  color: #53658c;
  font-size: 15px;
  line-height: 1.35;
  text-align: center;
}
.duel-vs__rules {
  margin: 0;
  color: var(--navy);
  font-size: 14px;
  font-weight: var(--w-semibold);
  text-align: center;
}

/* ---- Between questions (D8) & Waiting (D11) ----------------------------------------------------------- */
.duel-between__saved {
  margin: 0;
  color: #168344;
  font-size: 14px;
  font-weight: var(--w-bold);
  text-align: center;
}
.duel-wait__body {
  margin: 0;
  color: #53658c;
  font-size: 15px;
  line-height: 1.4;
  text-align: center;
}

/* ---- Quiz opponent chip (D7) -------------------------------------------------------------------------- */
.duel-quiz__opponent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

/* ---- Result screen (D10 / D12 / D16) ------------------------------------------------------------------ */
.duel-result__kicker {
  margin: 0;
  color: #53658c;
  font-size: 14px;
  font-weight: var(--w-semibold);
  text-align: center;
}
.duel-result__outcome--win { color: #169447; }
.duel-result__outcome--draw { color: #3659b5; }
.duel-result__outcome--loss { color: var(--navy); }

.duel-score-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 12px;
  border-radius: 18px;
  background: #fff;
  border: 1.5px solid #e6e1d6;
}
.duel-score-card .async-design__scores {
  grid-template-columns: minmax(0, 1.3fr) minmax(30px, 0.65fr) 2px minmax(30px, 0.65fr) minmax(0, 1.3fr);
}
.duel-score-card .async-design__participant span:not(.duel-computer-chip) {
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 13px;
  font-weight: var(--w-semibold);
}
.duel-score-card__outof {
  margin: 0;
  font-size: 13px;
  font-weight: var(--w-semibold);
  color: #53658c;
  text-align: center;
}
.duel-score-card__tie {
  margin: 2px 0 0;
  font-size: 14px;
  font-weight: var(--w-semibold);
  color: #168344;
  text-align: center;
}

.duel-rating-box {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 18px;
  background: #fff;
  border: 1.5px solid #e6e1d6;
}
.duel-rating-box__delta-row {
  display: flex;
  justify-content: center;
}
.duel-delta-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: var(--w-extrabold);
  font-variant-numeric: tabular-nums;
}
/* Kind loss rule (DESIGN 3): win = green, loss = calm grey (never red). */
.duel-delta-pill.is-gain {
  background: #1ea853;
  color: #fff;
}
.duel-delta-pill.is-loss {
  background: #e2e6f0;
  color: #4f5f82;
}

.duel-rewards {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #fff;
  border: 1.5px solid #e6e1d6;
}
.duel-reward-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: var(--w-bold);
  color: var(--navy);
}
.duel-reward-chip img {
  width: 24px;
  height: 24px;
  object-fit: contain;
}

.duel-quiet-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 2px 14px;
  padding-top: 2px;
}
.duel-quiet-action {
  background: transparent;
  border: 0;
  padding: 6px 4px;
  min-height: 36px;
  color: #53658c;
  font-size: 13px;
  font-weight: var(--w-semibold);
  line-height: 1.2;
  white-space: nowrap;
  cursor: pointer;
}
.duel-quiet-action:hover:not(:disabled) {
  color: var(--navy);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.duel-quiet-action:disabled {
  opacity: 0.5;
  cursor: default;
}

/* ---- Modals: D14 Ticket Prompt & D13 Rank-Up Overlay -------------------------------------------------- */
.duel-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(11, 20, 52, 0.78);
  backdrop-filter: blur(4px);
}
.duel-modal {
  position: relative;
  width: min(100%, 420px);
  max-height: calc(100dvh - 36px);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-radius: 26px;
  background: var(--card-warm, #fffdf6);
  color: var(--navy);
  text-align: center;
  box-shadow: 0 18px 42px rgba(0, 12, 42, 0.45);
}
.duel-ticket-modal__icon {
  width: 64px;
  height: 64px;
  object-fit: contain;
}
.duel-ticket-modal h2 {
  margin: 0;
  font-size: 22px;
  line-height: 1.2;
}
.duel-ticket-modal__body {
  margin: 0;
  font-size: 15px;
  line-height: 1.35;
  color: #53658c;
}
.duel-ticket-modal__actions {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}
.duel-ticket-modal__reset {
  margin: 0;
  font-size: 13px;
  color: #6b7897;
}

.duel-rankup {
  overflow: hidden;
  background: radial-gradient(circle at 50% 24%, #fff6cf 0%, #fffdf6 56%);
}
.duel-rankup__confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}
.duel-rankup__confetti span {
  position: absolute;
  top: 14px;
  width: 10px;
  height: 22px;
  border-radius: 999px;
  opacity: 0.9;
}
.duel-rankup__confetti span:nth-child(1) { left: 10%; background: #ffbd08; transform: rotate(-22deg); }
.duel-rankup__confetti span:nth-child(2) { left: 20%; top: 54px; background: #ff5c5c; transform: rotate(28deg); }
.duel-rankup__confetti span:nth-child(3) { left: 14%; top: 96px; background: #26c46d; transform: rotate(-16deg); }
.duel-rankup__confetti span:nth-child(4) { left: 26%; top: 24px; background: #37a4ff; transform: rotate(15deg); }
.duel-rankup__confetti span:nth-child(5) { right: 12%; background: #ff5c5c; transform: rotate(22deg); }
.duel-rankup__confetti span:nth-child(6) { right: 22%; top: 46px; background: #37a4ff; transform: rotate(-26deg); }
.duel-rankup__confetti span:nth-child(7) { right: 14%; top: 92px; background: #ffbd08; transform: rotate(18deg); }
.duel-rankup__confetti span:nth-child(8) { right: 26%; top: 18px; background: #26c46d; transform: rotate(-14deg); }

.duel-rankup__robot {
  position: relative;
  width: 140px;
  height: 140px;
}
.duel-rankup__robot > .robot {
  width: 100%;
  height: 100%;
}
.duel-rankup__head {
  margin: 0;
  font-size: 32px;
  font-weight: var(--w-extrabold);
  color: var(--navy);
  letter-spacing: 0.02em;
}
.duel-rankup__badge-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.duel-rankup__ribbon {
  padding: 5px 22px;
  border-radius: 999px;
  background: linear-gradient(180deg, #2748a8, #142a6e);
  border: 2px solid #f5be2c;
  color: #fff;
  font-size: 18px;
  font-weight: var(--w-bold);
  box-shadow: 0 3px 8px rgba(15, 32, 68, 0.25);
}
.duel-rankup__headline {
  margin: 0;
  font-size: 17px;
  font-weight: var(--w-bold);
  color: var(--navy);
}
.duel-rankup__floor {
  margin: 0;
  font-size: 14px;
  color: #53658c;
}
.duel-rankup__reward {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: 18px;
  background: #fff6db;
  border: 1.5px solid #f0c94d;
}
.duel-rankup__chest {
  width: calc(64px * var(--chest-scale, 1));
  height: calc(64px * var(--chest-scale, 1));
  object-fit: contain;
  flex: none;
}
.duel-rankup__chips {
  background: transparent;
  border: 0;
  padding: 0;
}

@media (min-width: 760px) {
  .duel-stage {
    margin-inline: auto;
  }
  .duel-stage__sheet {
    width: min(100%, 560px);
    align-self: center;
  }
  .duel-stage--robot .duel-stage__hero,
  .duel-stage--found .duel-stage__hero {
    flex: 0 0 176px;
    min-height: 176px;
    max-height: 196px;
  }
  .duel-stage--robot .duel-stage__hero > .robot,
  .duel-stage--found .duel-stage__hero > .robot {
    height: min(100%, 176px);
  }
  .duel-stage--result .duel-stage__hero {
    flex: 0 0 144px;
    min-height: 144px;
    max-height: 156px;
  }
  .duel-stage--result .duel-stage__hero > .robot {
    height: min(100%, 144px);
  }
}

/* ---- Phase 1: Visible categories (D6), upgraded between-question (D8), and finale flip (D10) ---- */

.duel-topics {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #fff;
  border: 1.5px solid #e6e1d6;
}
.duel-topics__label {
  font-size: 12px;
  font-weight: var(--w-bold);
  color: #53658c;
  letter-spacing: 0.02em;
}
.duel-topics__grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  width: 100%;
}
.duel-topic-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  background: var(--topic-bg, #7050b8);
  color: #fff;
  font-size: 12.5px;
  font-weight: var(--w-bold);
  line-height: 1.2;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16);
  max-width: 100%;
  min-width: 0;
}
.duel-topic-pill__icon {
  width: 16px;
  height: 16px;
  object-fit: contain;
  flex: none;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35));
}
.duel-topic-pill__name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Compact hero height on D8 & D10 flip so all controls sit comfortably above the fold */
.duel-stage--between .duel-stage__hero {
  flex: 0 0 104px;
  min-height: 104px;
  max-height: 112px;
}
.duel-stage--between .duel-stage__hero > .robot {
  height: min(100%, 104px);
}
.duel-stage--flip .duel-stage__hero {
  flex: 0 0 108px;
  min-height: 108px;
  max-height: 116px;
}
.duel-stage--flip .duel-stage__hero > .robot {
  height: min(100%, 108px);
}

/* D8: Compact VS score + 5 visual round pips */
.duel-turn-strip {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 16px;
  background: #fff;
  border: 1.5px solid #e6e1d6;
}
.duel-turn-strip__row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  gap: 8px;
}
.duel-turn-strip__side {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.duel-turn-strip__side--right {
  justify-content: flex-end;
  text-align: right;
}
.duel-turn-strip__side .fr-avatar,
.duel-turn-strip__side .duel-robot-avatar {
  width: 34px;
  height: 34px;
  flex: none;
}
.duel-turn-strip__fresh-dot {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #e9e4f8;
  color: #5a4399;
  display: grid;
  place-items: center;
  font-size: 16px;
  font-weight: var(--w-extrabold);
  flex: none;
}
.duel-turn-strip__meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.1;
}
.duel-turn-strip__name {
  font-size: 11px;
  font-weight: var(--w-semibold);
  color: #53658c;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.duel-turn-strip__score {
  font-size: 20px;
  font-weight: var(--w-extrabold);
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}
.duel-turn-strip__score--hidden {
  color: #6b7897;
}
.duel-turn-strip__hint {
  margin: 0;
  font-size: 11.5px;
  color: #6b7897;
  text-align: center;
}

.duel-pips {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.duel-pip {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: var(--w-extrabold);
  font-variant-numeric: tabular-nums;
  flex: none;
}
.duel-pip img {
  width: 14px;
  height: 14px;
  object-fit: contain;
}
.duel-pip.is-correct {
  background: #18b04d;
  color: #fff;
}
.duel-pip.is-wrong {
  background: #d83f3f;
  color: #fff;
}
.duel-pip.is-answered {
  background: #7050b8;
  color: #fff;
}
.duel-pip.is-next {
  background: #fff;
  color: #7050b8;
  border: 2.5px solid #7050b8;
}
.duel-pip.is-pending {
  background: #e1e6f0;
  color: #6b7897;
}

/* D8: Last question verdict card */
.duel-verdict {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px 14px;
  border-radius: 16px;
  border: 1.5px solid #dce2ee;
  cursor: pointer;
}
.duel-verdict.is-correct {
  background: #e8f8ed;
  border-color: #93dca9;
}
.duel-verdict.is-wrong {
  background: #feefef;
  border-color: #f0b1b1;
}
.duel-verdict__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.duel-verdict__title {
  font-size: 18px;
  font-weight: var(--w-extrabold);
  line-height: 1.2;
}
.duel-verdict.is-correct .duel-verdict__title { color: #138a3d; }
.duel-verdict.is-wrong .duel-verdict__title { color: #c73232; }
.duel-verdict__speed {
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid rgba(27, 37, 89, 0.14);
  color: var(--navy);
  font-size: 12px;
  font-weight: var(--w-bold);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.duel-verdict__answer {
  margin: 0;
  font-size: 14px;
  font-weight: var(--w-bold);
  color: var(--navy);
  line-height: 1.3;
}
.duel-verdict__exp {
  margin: 2px 0 0;
  font-size: 12.5px;
  color: #465578;
  line-height: 1.35;
}

/* D8: Category-colored UP NEXT card */
.duel-upnext {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 18px;
  background: var(--topic-bg, #7050b8);
  color: #fff;
  box-shadow: 0 3px 10px rgba(0, 18, 66, 0.14), inset 0 -3px 0 rgba(0, 0, 0, 0.18);
}
.duel-upnext__icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  flex: none;
}
.duel-upnext__icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35));
}
.duel-upnext__copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.45);
}
.duel-upnext__eyebrow {
  font-size: 11px;
  font-weight: var(--w-extrabold);
  letter-spacing: 0.05em;
  opacity: 0.94;
}
.duel-upnext__title {
  font-size: 19px;
  font-weight: var(--w-extrabold);
  line-height: 1.15;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.duel-upnext__tag {
  display: inline-block;
  align-self: flex-start;
  margin-top: 2px;
  padding: 1px 8px;
  border-radius: 999px;
  background: rgba(0, 18, 66, 0.26);
  font-size: 11px;
  font-weight: var(--w-bold);
}

.duel-pause-link {
  align-self: center;
  margin-top: -4px;
}
.duel-between__note {
  margin: -2px 0 0;
  font-size: 13px;
  color: #53658c;
  text-align: center;
}

/* D10: One-by-one Q1..Q5 Finale Flip stage */
.duel-flip__heading {
  margin: 0;
  font-size: 22px;
  font-weight: var(--w-extrabold);
  color: var(--navy);
  text-align: center;
}
.duel-flip__step {
  margin: -6px 0 0;
  font-size: 13.5px;
  font-weight: var(--w-semibold);
  color: #53658c;
  text-align: center;
}
.duel-flip__scores {
  padding: 10px 12px;
}
.duel-flip__scores .duel-flip__score-num {
  font-variant-numeric: tabular-nums;
}
.duel-flip__rows {
  display: flex;
  flex-direction: column;
  gap: 7px;
  cursor: pointer;
}
.duel-flip-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 34px;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 14px;
  background: #f4f6fb;
  border: 1.5px solid #e4e8f2;
  transition: background 180ms ease, border-color 180ms ease;
}
.duel-flip-row.is-revealed {
  background: #fff;
  border-color: #d6deed;
}
.duel-flip-row__topic {
  width: 100%;
  justify-content: center;
  padding: 6px 10px;
  font-size: 13px;
}
.duel-flip-badge {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 15px;
  font-weight: var(--w-extrabold);
}
.duel-flip-badge img {
  width: 17px;
  height: 17px;
  object-fit: contain;
}
.duel-flip-badge.is-hidden {
  background: #dfe5f0;
  color: #6b7897;
}
.duel-flip-badge.is-correct {
  background: #18b04d;
  color: #fff;
  animation: duel-badge-pop 280ms cubic-bezier(0.22, 1.35, 0.36, 1);
}
.duel-flip-badge.is-wrong {
  background: #d83f3f;
  color: #fff;
  animation: duel-badge-pop 280ms cubic-bezier(0.22, 1.35, 0.36, 1);
}
.duel-flip__skip {
  align-self: center;
}

@keyframes duel-badge-pop {
  0% { transform: scale(0.55) rotateY(90deg); opacity: 0.4; }
  70% { transform: scale(1.12) rotateY(0deg); opacity: 1; }
  100% { transform: scale(1) rotateY(0deg); opacity: 1; }
}

.reduced-motion .duel-flip-badge.is-correct,
.reduced-motion .duel-flip-badge.is-wrong {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .duel-flip-badge.is-correct,
  .duel-flip-badge.is-wrong {
    animation: none;
  }
}

/* D10: Settled compact 5-column round breakdown */
.duel-breakdown {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 8px 12px;
  border-radius: 16px;
  background: #fff;
  border: 1.5px solid #e6e1d6;
}
.duel-breakdown__heading {
  font-size: 12px;
  font-weight: var(--w-bold);
  color: #53658c;
  text-align: center;
}
.duel-breakdown__body {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: stretch;
  gap: 5px;
}
.duel-breakdown__legend {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  justify-content: flex-start;
  gap: 5px;
  padding: 7px 0;
  min-width: 0;
}
.duel-breakdown__who {
  height: 20px;
  line-height: 20px;
  font-size: 10px;
  font-weight: var(--w-bold);
  color: #53658c;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.duel-breakdown__spacer {
  height: 30px;
}
.duel-breakdown__name-spacer {
  height: 12px;
}
.duel-breakdown__grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}
.duel-breakdown__cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  padding: 6px 2px;
  border-radius: 12px;
  background: #f7f9fd;
  border: 1px solid #e3e8f2;
  cursor: pointer;
  min-width: 0;
  transition: transform 120ms ease, border-color 120ms ease;
}
.duel-breakdown__cell:hover {
  border-color: #7050b8;
  transform: translateY(-1px);
}
.duel-breakdown__dot {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
}
.duel-breakdown__dot img {
  width: 11px;
  height: 11px;
  object-fit: contain;
}
.duel-breakdown__dot.is-correct { background: #18b04d; }
.duel-breakdown__dot.is-wrong { background: #d83f3f; }
.duel-breakdown__topic {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--topic-bg, #7050b8);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: var(--w-extrabold);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.16);
}
.duel-breakdown__topic img {
  width: 17px;
  height: 17px;
  object-fit: contain;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35));
}
.duel-breakdown__name {
  width: 100%;
  font-size: 9.5px;
  letter-spacing: -0.02em;
  font-weight: var(--w-bold);
  color: #53658c;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---- Phase 2: 6s Live Queue, 8s Category Voting, Live Opponent Progress & 10s Live Rematch ---- */

.duel-live-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 11px;
  border-radius: 999px;
  background: #18b04d;
  color: #fff;
  font-size: 11px;
  font-weight: var(--w-extrabold);
  letter-spacing: 0.06em;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(24, 176, 77, 0.28);
}
.duel-live-badge__dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #fff;
  animation: duel-live-pulse 1.4s ease-in-out infinite;
}
@keyframes duel-live-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.45; transform: scale(0.75); }
}
.reduced-motion .duel-live-badge__dot {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .duel-live-badge__dot {
    animation: none;
  }
}

.duel-found-live-row {
  display: flex;
  justify-content: center;
  margin-bottom: -4px;
}

.duel-queue-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}
.duel-queue-head h2 {
  margin: 0;
  font-size: 20px;
  font-weight: var(--w-extrabold);
  color: var(--navy);
}
.duel-queue-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  border-radius: 18px;
  background: #fff;
  border: 1.5px solid #e6e1d6;
}
.duel-queue-card__top {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--navy);
  font-size: 15px;
}
.duel-timer-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e1e6f0;
  overflow: hidden;
}
.duel-timer-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ffbd08, #ff9900);
  transition: width 100ms linear;
}
.duel-timer-fill--vote {
  background: linear-gradient(90deg, #7050b8, #9d6be8);
}

/* 8-second Pick 1 of 3 Category Voting */
.duel-stage--vote .duel-stage__hero {
  flex: 0 0 132px;
  min-height: 132px;
  max-height: 148px;
}
.duel-stage--vote .duel-stage__hero > .robot {
  height: min(100%, 132px);
}
.duel-vote-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.duel-vote-head h2 {
  margin: 0;
  flex: 1;
  text-align: center;
  font-size: 21px;
  font-weight: var(--w-extrabold);
  color: var(--navy);
}
.duel-vote-timer {
  flex: none;
  min-width: 50px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #7050b8;
  color: #fff;
  font-size: 14px;
  font-weight: var(--w-extrabold);
  font-variant-numeric: tabular-nums;
  text-align: center;
}
.duel-vote-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.duel-vote-card {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 2.5px solid transparent;
  background: var(--topic-bg, #7050b8);
  color: #fff;
  text-align: left;
  cursor: pointer;
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.16), 0 4px 12px rgba(15, 32, 68, 0.14);
  transition: transform 120ms ease, opacity 150ms ease, border-color 150ms ease;
}
.duel-vote-card:hover:not(:disabled) {
  transform: translateY(-1px);
}
.duel-vote-card:active:not(:disabled) {
  transform: translateY(1px);
}
.duel-vote-card.is-selected {
  border-color: #ffbd08;
  box-shadow: 0 0 0 3px rgba(255, 189, 8, 0.35), inset 0 -3px 0 rgba(0, 0, 0, 0.16);
}
.duel-vote-card.is-dimmed {
  opacity: 0.45;
  cursor: default;
}
.duel-vote-card__icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.22);
  display: grid;
  place-items: center;
  flex: none;
}
.duel-vote-card__icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.35));
}
.duel-vote-card__copy {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.duel-vote-card__title {
  font-size: 18px;
  font-weight: var(--w-extrabold);
  color: #fff;
  line-height: 1.2;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}
.duel-vote-card__tag {
  font-size: 11px;
  font-weight: var(--w-bold);
  color: rgba(255, 255, 255, 0.94);
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.3);
}
.duel-vote-card__picked {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 6px;
  border-radius: 999px;
  background: #fff;
  color: var(--navy);
  font-size: 12px;
  font-weight: var(--w-extrabold);
  box-shadow: 0 2px 6px rgba(0, 12, 42, 0.18);
}
.duel-vote-card__check-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #18b04d;
  display: grid;
  place-items: center;
  flex: none;
}
.duel-vote-card__check-dot img {
  width: 11px;
  height: 11px;
  object-fit: contain;
}
.duel-vote-status {
  margin: 0;
  font-size: 14px;
  font-weight: var(--w-bold);
  color: var(--navy);
  text-align: center;
}
.duel-vote-status.is-opp-locked {
  color: #168344;
}
.duel-vote-hint {
  margin: 0;
  font-size: 12px;
  color: #6b7897;
  text-align: center;
}

/* Voted topic highlight on D6 */
.duel-topic-pill.is-voted {
  box-shadow: 0 0 0 2px #ffbd08, inset 0 -2px 0 rgba(0, 0, 0, 0.16);
}
.duel-topic-pill__tag {
  margin-left: 2px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  color: var(--navy);
  font-size: 10px;
  font-weight: var(--w-extrabold);
  text-shadow: none;
}

/* Live opponent progress pill (D7 banner + D8 strip) */
.duel-live-prog {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: var(--w-extrabold);
  line-height: 1.2;
  white-space: nowrap;
}
.duel-live-prog--live {
  background: #e6f7ec;
  color: #168344;
}
.duel-live-prog--done {
  background: #ede7fa;
  color: #5b3da6;
}
.duel-live-prog--reconnecting {
  background: #fdecec;
  color: #c22e2e;
}
.duel-live-prog--quiz {
  font-size: 11px;
  padding: 2px 8px;
}

/* 10-second live rematch banner on settled D10 */
.duel-rematch-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px 14px;
  border-radius: 18px;
  background: #f5f7fc;
  border: 1.5px solid #dce2ee;
}
.duel-rematch-card.is-incoming {
  background: #e8f8ee;
  border-color: #8fd8a6;
}
.duel-rematch-card__incoming {
  margin: 0;
  font-size: 14px;
  font-weight: var(--w-extrabold);
  color: #168344;
  text-align: center;
}
.duel-rematch-card__wait {
  margin: 0;
  font-size: 14px;
  font-weight: var(--w-bold);
  color: var(--navy);
  text-align: center;
}
