
.deal-intro {
  position: fixed;
  inset: 0;
  z-index: 44;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(60% 45% at 50% 48%, rgba(255, 140, 0, 0.35), rgba(10, 0, 20, 0.65));
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.deal-intro.show {
  visibility: visible;
  animation: intro-dim 300ms ease-out forwards;
}

.intro-dragon {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: translateY(30vh) scale(0.15);
}

.deal-intro.show .intro-dragon {
  animation: dragon-rise 650ms cubic-bezier(0.2, 1.3, 0.4, 1) forwards,
    dragon-bob 1400ms 650ms ease-in-out infinite alternate;
}

.intro-dragon-art {
  font-size: min(42vw, 200px);
  line-height: 1;
  margin-bottom: -0.32em;
  filter: sepia(1) saturate(3.2) hue-rotate(-14deg) brightness(1.1)
    drop-shadow(0 0 2px #6a4400) drop-shadow(0 0 18px #ffb400) drop-shadow(0 0 40px rgba(255, 106, 0, 0.7));
}

.intro-sign {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  width: min(74vw, 320px);
  padding: 16px 14px 18px;
  border-radius: 12px;
  border: 4px solid var(--neon-cyan);
  background:
    radial-gradient(80% 60% at 50% 0%, rgba(255, 255, 255, 0.14), transparent 70%),
    linear-gradient(180deg, #3a1a9a, #160a50);
  box-shadow: 0 0 0 3px #0a1a5a, 0 0 18px var(--neon-cyan), inset 0 0 14px rgba(66, 230, 255, 0.5), 0 12px 30px rgba(0, 0, 0, 0.6);
  text-align: center;
}

.intro-sign::before,
.intro-sign::after {
  content: "";
  position: absolute;
  top: -10px;
  width: 22px;
  height: 22px;
  border-radius: 50% 50% 40% 40%;
  background: radial-gradient(circle at 40% 35%, var(--gold-light), var(--gold) 50%, var(--gold-dark));
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.intro-sign::before { left: -10px; }
.intro-sign::after { right: -10px; }

.intro-sign-title {
  font-size: clamp(1.4rem, 7.5vw, 2rem);
  font-weight: 900;
  line-height: 1.05;
  background-image: linear-gradient(180deg, #ffe0fa, #ff6ad5 50%, #c01a9a 56%, #ffa0e8);
  filter: drop-shadow(0 2px 0 #3a0030) drop-shadow(0 0 8px rgba(255, 79, 216, 0.7));
}

.intro-sign-text {
  color: #fff;
  font-family: var(--display);
  font-size: clamp(1.3rem, 7vw, 1.8rem);
  font-weight: 900;
  line-height: 1.1;
  text-shadow: 0 3px 0 #0a0630, 0 0 12px rgba(66, 230, 255, 0.6);
}

.deal-doors {
  position: fixed;
  inset: 0;
  z-index: 47;
  display: flex;
  pointer-events: none;
  visibility: hidden;
}

.deal-doors.closed,
.deal-doors.opening {
  visibility: visible;
  pointer-events: auto;
}

.door {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transform: translateX(var(--open));
}

.door.left { --open: -100%; }
.door.right { --open: 100%; }

.deal-doors.closed .door {
  animation: door-close 320ms cubic-bezier(0.5, 0, 0.9, 1) forwards,
    door-flash 600ms 330ms ease-in-out;
}

.deal-doors.opening .door {
  animation: door-open 650ms cubic-bezier(0.4, 0, 0.6, 1) forwards;
}

.league-button {
  position: relative;
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 58px;
  border-radius: 12px;
  line-height: 1.1;
}

.league-icon {
  display: inline-flex;
  width: 22px;
  height: 22px;
}

.league-icon .league-mark { width: 100%; height: 100%; }

.league-rank {
  color: var(--gold-light);
  font-family: var(--display);
  font-size: 0.8rem;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 1px 0 #0a1a5a;
}

.league-button.up .league-rank { color: #7affb0; }
.league-button.down .league-rank { color: #ff8a96; }

.float-text.medal,
.medallion {
  --medal: var(--medal-gold);
}

.float-text.medal.bronze, .medallion.bronze { --medal: var(--medal-bronze); }
.float-text.medal.silver, .medallion.silver { --medal: var(--medal-silver); }
.float-text.medal.ruby, .medallion.ruby { --medal: var(--medal-ruby); }
.float-text.medal.sapphire, .medallion.sapphire { --medal: var(--medal-sapphire); }
.float-text.medal.celestial, .medallion.celestial { --medal: var(--medal-celestial); }

.float-text.medal {
  color: var(--medal);
  font-size: 1.05rem;
  letter-spacing: 0.04em;
  text-shadow: 1px 0 0 #000, -1px 0 0 #000, 0 1px 0 #000, 0 -1px 0 #000, 0 2px 4px rgba(0, 0, 0, 0.8);
  animation: medal-float 1100ms ease-out forwards;
}

#league-button > .float-text.medal { top: 0; }

.league-tab-row:not(:last-child) > .float-text.medal {
  top: calc(50% - 0.5px);
}

@keyframes medal-float {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(0.7); }
  18% { opacity: 1; transform: translate(-50%, -60%) scale(1.1); }
  30% { transform: translate(-50%, -70%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, calc(-50% - 34px)); }
}

@keyframes medal-fade {
  from { opacity: 1; }
  to { opacity: 0; }
}

.league-button.landed .league-icon {
  animation: league-land 450ms ease-out;
}

@keyframes league-land {
  40% { transform: scale(1.3); }
}

.medallion {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: radial-gradient(circle at 38% 30%, rgba(255, 255, 255, 0.75), transparent 42%),
    linear-gradient(180deg, transparent 40%, rgba(0, 0, 0, 0.3)), var(--medal);
  box-shadow: 0 0 0 1.5px var(--gold), 0 0 0 2.5px var(--gold-deep), 0 1px 2px rgba(0, 0, 0, 0.6);
  vertical-align: middle;
}

@media (prefers-reduced-motion: reduce) {
  .float-text.medal { animation: medal-fade 440ms ease-in 660ms both; }
  .league-button.landed .league-icon { animation: none; }
}


.league-mark {
  display: block;
  flex: none;
  width: 34px;
  height: 34px;
  color: var(--medal-gold);
  object-fit: contain;
  filter: drop-shadow(0 2px 1px rgba(0, 0, 0, 0.6));
}

.league-mark.bronze { color: var(--medal-bronze); }
.league-mark.silver { color: var(--medal-silver); }
.league-mark.platinum { color: var(--medal-platinum); }
.league-mark.diamond { color: var(--medal-diamond); }

.league-ladder { flex: none; min-width: 0; margin: 4px 0 8px; }

.league-tiers {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) max-content;
  align-items: end;
  gap: 4px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.league-tier {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 0;
  font-family: var(--display);
  color: var(--muted);
  text-shadow: 0 1px 0 #000;
}

.league-tier-badge { display: inline-flex; justify-content: center; }
.league-tier-name { font-size: 11px; letter-spacing: 0.02em; white-space: nowrap; }
.league-tier.current { color: var(--gold-light); }

.league-rungs {
  display: grid;
  grid-template-columns: repeat(3, 16px);
  gap: 2px;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
}

.league-rung { display: flex; flex-direction: column; align-items: center; gap: 5px; color: var(--muted); }
.league-rung-name { font-size: 11px; line-height: 1; }
.league-pip {
  position: relative;
  display: block;
  width: 8px;
  height: 8px;
  border: 1px solid var(--muted);
  border-radius: 50%;
  background: var(--navy-deep);
}

.league-rung.passed .league-pip,
.league-rung.current .league-pip { border-color: var(--gold); background: var(--gold); }
.league-rung.passed .league-pip::after {
  content: "";
  position: absolute;
  left: 1px;
  top: 1px;
  width: 4px;
  height: 2px;
  border-left: 1px solid var(--gold-deep);
  border-bottom: 1px solid var(--gold-deep);
  transform: rotate(-45deg);
}
.league-rung.current .league-pip { outline: 1px solid var(--gold-light); outline-offset: 2px; }
.league-rung.current .league-rung-name { color: var(--gold-light); text-decoration: underline; text-underline-offset: 2px; }
.league-rung.passed .league-rung-name { color: var(--text); }

.league-info {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  text-align: center;
}

.league-info-label { font-family: var(--display); font-size: 0.7rem; letter-spacing: 0.06em; text-shadow: 0 1px 0 #000; }
.league-timer { display: inline-block; margin-left: 8px; padding: 4px 8px; border: 1px solid var(--gold-deep); border-radius: 4px; background: var(--navy-deep); color: var(--gold-light); font-family: var(--display); font-size: 0.85rem; font-variant-numeric: tabular-nums; text-shadow: 0 1px 0 #000; }
.league-movement { margin-top: 6px; font-size: 0.8125rem; line-height: 1.35; }

.league-perk {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 0.85rem;
  letter-spacing: 0.06em;
  line-height: 1.3;
  color: var(--muted);
  text-shadow: 0 1px 0 #000;
}

.league-perk-now.on { color: var(--gold-light); }

.league-result {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: baseline;
  gap: 4px 8px;
  margin-bottom: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
}

.league-result-rank { font-family: var(--display); color: var(--text); font-size: 0.85rem; letter-spacing: 0.03em; text-shadow: 0 1px 0 #000; }
.league-result-rank { display: flex; align-items: center; gap: 6px; }
.league-result-rank .league-mark { width: 22px; height: 22px; }
.league-result-reward { font-family: var(--display); color: var(--gold-light); font-size: 1.15rem; font-variant-numeric: tabular-nums; text-shadow: 0 1px 0 #000; }
.league-result-note { grid-column: 1 / -1; color: var(--muted); font-size: 0.8125rem; line-height: 1.35; }

.league-result-label { font-family: var(--display); color: var(--muted); font-size: 0.75rem; letter-spacing: 0.06em; text-shadow: 0 1px 0 #000; }
.league-result-score { font-family: var(--display); color: var(--gold-light); font-size: 1rem; font-variant-numeric: tabular-nums; text-align: right; text-shadow: 0 1px 0 #000; }

.league-result[hidden] {
  display: none;
}

.league-weeks {
  display: flex;
  gap: 18px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--hairline);
}

.league-week {
  min-height: 44px;
  margin: 0 0 -1px;
  padding: 0 2px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font-family: var(--display);
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 0 #000;
  touch-action: manipulation;
  cursor: pointer;
}

.league-week.on {
  border-bottom-color: var(--gold);
  color: var(--gold-light);
}

.league-final {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 2px 0 4px;
  color: var(--gold-light);
  font-family: var(--display);
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-shadow: 0 1px 0 #000;
}

.league-final::before,
.league-final::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--gold);
  opacity: 0.45;
}

.league-weeks[hidden],
.league-final[hidden] {
  display: none;
}

.league-list {
  flex: 1 1 auto;
  min-height: 0;
  margin: 0;
  padding: 2px 2px 8px;
  list-style: none;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  /* No scroll anchoring: rows are reused by place, never inserted above the
     reader. In WebKit an anchor correction (a row above the view changing
     height) cancels a smooth scroll in flight, so the dock's return could
     stop short of YOU (playtest-league-dock-02.spec.js; see #1098). */
  overflow-anchor: none;
}

:is(.league-row, .league-dock) {
  display: grid;
  grid-template-columns: 2em 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 0;
  border-bottom: 1px solid var(--hairline);
  font-family: var(--display);
  font-size: 0.85rem;
  letter-spacing: 0.03em;
  color: var(--text);
  text-shadow: 0 1px 0 #000;
  font-variant-numeric: tabular-nums;
}

:is(.league-row, .league-dock).up .league-place::before { content: "▲ "; color: var(--jade); font-size: 0.7rem; }
:is(.league-row, .league-dock).down .league-place::before { content: "▼ "; color: var(--ruby); font-size: 0.7rem; }

.league-row.cut-up {
  border-bottom: 1px dashed var(--jade);
}

.league-row.cut-down {
  border-top: 1px dashed var(--ruby);
}

.league-cut {
  grid-column: 1 / -1;
  justify-self: start;
  font-size: 0.75rem;
  letter-spacing: 0.06em;
  line-height: 1.2;
  color: var(--jade);
}

.league-row.cut-down .league-cut { order: -1; color: var(--ruby); }
.league-cut[hidden] { display: none; }

.league-row.you {
  color: var(--gold-light);
}

.league-place {
  color: var(--muted);
  font-family: var(--display);
  text-align: right;
}

.league-avatar {
  position: relative;
  display: grid;
  place-items: center;
}

.league-face {
  --tint: var(--league-tint-0);
  --portrait: url("../art/league/rival-0.webp");
  position: relative;
  display: block;
  width: 22px;
  height: 22px;
  overflow: hidden;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: var(--tint) var(--portrait) no-repeat center / 108% auto;
  box-shadow: 0 0 0 1px var(--gold-deep), 0 1px 2px rgba(0, 0, 0, 0.6);
}

.league-face.tint-1 { --tint: var(--league-tint-1); --portrait: url("../art/league/rival-1.webp"); }
.league-face.tint-2 { --tint: var(--league-tint-2); --portrait: url("../art/league/rival-2.webp"); }
.league-face.tint-3 { --tint: var(--league-tint-3); --portrait: url("../art/league/rival-3.webp"); }
.league-face.tint-4 { --tint: var(--league-tint-4); --portrait: url("../art/league/rival-4.webp"); }
.league-face.tint-5 { --tint: var(--league-tint-5); --portrait: url("../art/league/rival-5.webp"); }
.league-face.tint-6 { --tint: var(--league-tint-6); --portrait: url("../art/league/rival-6.webp"); }
.league-face.tint-7 { --tint: var(--league-tint-7); --portrait: url("../art/league/rival-7.webp"); }
.league-face.you {
  --tint: var(--gold-deep);
  background: var(--tint) url("../art/profile-portraits/empress.webp") no-repeat center / contain;
}

.league-row.active .league-avatar::after {
  content: "";
  position: absolute;
  right: -2px;
  bottom: -1px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--jade);
  box-shadow: 0 0 0 2px var(--navy-deep);
}

.league-row,
.league-tab-row {
  position: relative;
  isolation: isolate;
}

.league-flash {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: linear-gradient(90deg, transparent, var(--league-flash) 30%, var(--league-flash) 70%, transparent);
  opacity: 0;
  pointer-events: none;
}

.league-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.league-score {
  color: var(--gold-light);
  font-family: var(--display);
  text-align: right;
}

