/* match */
.arena {
  background: var(--panel);
  background-image: var(--ring);
  background-repeat: repeat-x;
  background-position: top center;
  background-size: 192px 80px;
  border: var(--px) solid var(--line);
  box-shadow:
    inset var(--px) var(--px) 0 var(--hi),
    inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--lo);
  padding: 12px;
  padding-top: 88px;
}
.score {
  display: flex;
  justify-content: center;
  gap: 12px;
  align-items: center;
  font-family: var(--f-display);
  font-size: 16px;
  line-height: 24px;
  flex-wrap: wrap;
}
.score > div:first-child,
.score > div:last-child {
  background: var(--lo);
  padding: 8px 10px;
  min-width: 72px;
  max-width: 100%;
  text-align: center;
  border: var(--px) solid var(--line);
}
.score small {
  font-family: var(--f-cond);
  font-size: 16px;
  line-height: 16px;
  color: var(--muted);
  display: block;
  text-align: center;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 140px;
}
.stip {
  display: flex;
  gap: 6px;
  justify-content: center;
  flex-wrap: wrap;
}
.vs {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 8px;
  align-items: center;
}
.vs .side {
  display: grid;
  gap: 6px;
  min-width: 0;
}
.vs .mid {
  font-family: var(--f-display);
  font-size: 16px;
  color: var(--gold);
  text-align: center;
}
.total {
  font-family: var(--f-display);
  font-size: 16px;
  line-height: 24px;
  text-align: center;
}
.total.win {
  color: var(--ok);
}
.total.lose {
  color: #ff8a9a;
}
:root[data-theme='light'] .total.lose {
  color: var(--bad);
}
.log {
  font-family: var(--f-cond);
  font-size: 16px;
  line-height: 20px;
  display: grid;
  gap: 2px;
  max-height: 220px;
  overflow: auto;
}
.log .w {
  color: var(--ok);
}
.log .l {
  color: #ff8a9a;
}
.log .d {
  color: var(--warn);
}
.opps {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
.opp {
  border: var(--px) solid var(--line);
  box-shadow:
    inset var(--px) var(--px) 0 var(--hi),
    inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--lo);
  padding: 10px 12px;
  background: var(--panel2);
  cursor: pointer;
  text-align: left;
  display: grid;
  gap: 4px;
}
.opp:hover {
  border-color: var(--gold);
}
.opp .nm {
  font-family: var(--f-cond);
  font-size: 16px;
  line-height: 16px;
  text-transform: uppercase;
}
table {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--f-cond);
}
th,
td {
  padding: 4px 8px;
  border-bottom: var(--px) solid var(--line);
  text-align: left;
  font-size: 16px;
  line-height: 16px;
}
th {
  color: var(--muted);
  text-transform: uppercase;
}
tr.me td {
  color: var(--gold);
}
tr.q td {
  background: rgba(65, 166, 246, 0.12);
}
.tablewrap {
  overflow-x: auto;
}
/* draft board */
.board {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.board button {
  aspect-ratio: 3/4;
  border: var(--px) solid var(--line);
  background: repeating-linear-gradient(45deg, var(--panel2) 0 4px, var(--lo) 4px 8px);
  font-family: var(--f-display);
  color: var(--gold);
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  box-shadow: inset var(--px) var(--px) 0 var(--hi);
}
.board button.rev {
  background: var(--tc);
  border-color: var(--tc);
  color: #fff;
  font-family: var(--f-cond);
  font-size: 16px;
  line-height: 16px;
  text-align: center;
  cursor: default;
  box-shadow: none;
}
/* RD grid */
.rdgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  max-width: 440px;
  margin: 0 auto;
}
.tile {
  aspect-ratio: 1;
  min-width: 0;
  overflow: hidden;
  border: var(--px) solid var(--line);
  background: var(--panel2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  padding: 4px;
  position: relative;
  font-family: var(--f-cond);
  font-size: 16px;
  line-height: 16px;
  text-align: center;
}
.tile > span {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tile.empty {
  cursor: pointer;
  color: var(--muted);
  font-family: var(--f-display);
  background: var(--bg2);
}
.tile.empty:hover {
  border-color: var(--gold);
}
.tile.mine {
  border-color: var(--rope-blue);
  box-shadow: inset 0 0 0 var(--px) var(--rope-blue);
}
.tile.theirs {
  border-color: var(--rope-red);
  box-shadow: inset 0 0 0 var(--px) var(--rope-red);
}
.tile .arrow {
  position: absolute;
  color: var(--gold);
  font-size: 16px;
  line-height: 16px;
}
.tile .arrow.L {
  left: 4px;
  top: 50%;
  transform: translateY(-50%);
}
.tile .arrow.R {
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
}
.tile .arrow.U {
  top: 2px;
  left: 50%;
  transform: translateX(-50%);
}
.tile .arrow.D {
  bottom: 2px;
  left: 50%;
  transform: translateX(-50%);
}
.tile .tn {
  color: #fff;
  background: var(--tc);
  padding: 0 4px;
  text-transform: uppercase;
}
.tile .st {
  color: var(--muted);
}
.tile img {
  width: 64px;
  height: 64px;
  margin: -8px 0 -6px;
}
.hand {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
/* bracket */
.bracket {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
  font-family: var(--f-cond);
  font-size: 16px;
  line-height: 16px;
}
.bracket .rnd {
  display: grid;
  gap: 6px;
  align-content: center;
}
.bracket .m {
  border: var(--px) solid var(--line);
  padding: 4px 8px;
  background: var(--panel2);
}
.bracket .m div {
  display: flex;
  justify-content: space-between;
}
.bracket .m .w {
  color: var(--ok);
}
.chambers {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
.ladder {
  display: grid;
  gap: 4px;
}
.rung {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 10px;
  border: var(--px) solid var(--line);
  font-family: var(--f-cond);
  font-size: 16px;
  line-height: 16px;
  background: var(--panel2);
}
.rung.done {
  border-color: var(--ok);
  color: var(--ok);
}
.rung.next {
  border-color: var(--gold);
}
details summary {
  cursor: pointer;
  font-family: var(--f-cond);
  text-transform: uppercase;
  font-size: 16px;
  line-height: 20px;
}
details.panel summary {
  color: var(--gold);
}
.rules p {
  max-width: 60ch;
}
select,
input[type='text'],
textarea {
  background: var(--panel2);
  color: var(--fg);
  border: var(--px) solid var(--line);
  padding: 6px 8px;
  font: inherit;
  font-size: 16px;
}
textarea {
  width: 100%;
  min-height: 90px;
  font-family: monospace;
  font-size: 12px;
  line-height: 14px;
}
.kv {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 4px 12px;
  font-family: var(--f-cond);
  font-size: 16px;
  line-height: 16px;
}
.kv b {
  color: var(--gold);
  font-weight: 400;
}
.pips {
  display: flex;
  gap: 4px;
}
.pips i {
  width: 12px;
  height: 12px;
  background: var(--lo);
  border: var(--px) solid var(--line);
}
.pips i.on {
  background: var(--ok);
}
.more {
  display: grid;
  gap: 8px;
}
.more button {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--panel2);
  border: var(--px) solid var(--line);
  box-shadow:
    inset var(--px) var(--px) 0 var(--hi),
    inset calc(var(--px) * -1) calc(var(--px) * -1) 0 var(--lo);
  padding: 12px;
  text-align: left;
}
.more .t {
  font-family: var(--f-display);
  font-size: 16px;
  line-height: 16px;
  text-transform: uppercase;
}
.more .d {
  font-family: var(--f-cond);
  font-size: 16px;
  line-height: 16px;
  color: var(--muted);
}
.backrow {
  display: flex;
  align-items: center;
  gap: 8px;
}
b,
strong {
  font-weight: 400;
  color: var(--gold);
}
@media (min-width: 600px) {
  .grid2 {
    grid-template-columns: 1fr 1fr;
  }
  .chambers {
    grid-template-columns: 1fr 1fr;
  }
}
@media (max-width: 420px) {
  .vs {
    grid-template-columns: 1fr;
  }
}
/* ===== animation & glow layer (all stepped, 2px moves, pixel glow rings) ===== */
@keyframes px-in {
  0% {
    transform: translateY(8px);
    opacity: 0;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}
@keyframes slide-l {
  0% {
    transform: translateX(-80px);
    opacity: 0;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}
@keyframes slide-r {
  0% {
    transform: translateX(80px);
    opacity: 0;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}
@keyframes clash-l {
  0%,
  20% {
    transform: none;
  }
  50% {
    transform: translateX(16px);
  }
  70% {
    transform: translateX(16px);
  }
  100% {
    transform: none;
  }
}
@keyframes clash-r {
  0%,
  20% {
    transform: none;
  }
  50% {
    transform: translateX(-16px);
  }
  70% {
    transform: translateX(-16px);
  }
  100% {
    transform: none;
  }
}
@keyframes shake {
  0%,
  100% {
    transform: none;
  }
  20% {
    transform: translate(4px, -2px);
  }
  40% {
    transform: translate(-4px, 2px);
  }
  60% {
    transform: translate(2px, 2px);
  }
  80% {
    transform: translate(-2px, -2px);
  }
}
@keyframes burst {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  30% {
    transform: scale(1.4);
    opacity: 1;
  }
  80% {
    transform: scale(1);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0;
  }
}
@keyframes pop-in {
  0% {
    transform: scale(0);
    opacity: 0;
  }
  60% {
    transform: scale(1.25);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes bob {
  0%,
  100% {
    transform: none;
  }
  50% {
    transform: translateY(-4px);
  }
}
@keyframes ko {
  0% {
    transform: none;
  }
  30% {
    transform: translate(6px, 0);
  }
  100% {
    transform: translate(6px, 8px);
    opacity: 0.45;
  }
}
@keyframes flash {
  0% {
    filter: brightness(2.5);
  }
  100% {
    filter: none;
  }
}
@keyframes glow-gold {
  0%,
  100% {
    box-shadow:
      0 0 0 2px #ffcd75,
      0 0 0 4px rgba(255, 205, 117, 0.55),
      0 0 0 6px rgba(255, 205, 117, 0.2);
  }
  50% {
    box-shadow:
      0 0 0 2px #fff4c2,
      0 0 0 4px rgba(255, 244, 194, 0.75),
      0 0 0 8px rgba(255, 205, 117, 0.3);
  }
}
@keyframes glow-red {
  0%,
  100% {
    box-shadow:
      0 0 0 2px #b13e53,
      0 0 0 4px rgba(177, 62, 83, 0.5);
  }
  50% {
    box-shadow:
      0 0 0 2px #ff8a9a,
      0 0 0 4px rgba(255, 138, 154, 0.6),
      0 0 0 6px rgba(177, 62, 83, 0.3);
  }
}
@keyframes glow-text {
  0%,
  100% {
    text-shadow:
      0 0 0 currentColor,
      2px 2px 0 rgba(255, 205, 117, 0.35);
  }
  50% {
    text-shadow:
      0 0 2px currentColor,
      2px 2px 0 rgba(255, 205, 117, 0.75),
      -2px -2px 0 rgba(255, 205, 117, 0.35);
  }
}
@keyframes flip {
  0% {
    transform: scaleX(1);
  }
  45% {
    transform: scaleX(0);
  }
  55% {
    transform: scaleX(0);
  }
  100% {
    transform: scaleX(1);
  }
}
@keyframes dot-pulse {
  0%,
  100% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.5);
  }
}
@keyframes stripes {
  0% {
    background-position: 0 0;
  }
  100% {
    background-position: 16px 0;
  }
}
@keyframes rise {
  0% {
    transform: translate(-50%, 16px);
    opacity: 0;
  }
  100% {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}
@keyframes tile-hit {
  0%,
  100% {
    transform: none;
  }
  25% {
    transform: translate(-4px, 0);
  }
  50% {
    transform: translate(4px, 0);
  }
  75% {
    transform: translate(-2px, 0);
  }
}
@keyframes tab-pop {
  0% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-4px);
  }
  100% {
    transform: translateY(0);
  }
}
.view {
  animation: px-in 0.24s steps(4) both;
}
.view.noanim {
  animation: none;
}
.toast {
  animation: rise 0.2s steps(3) both;
}
.tabbar button.on img {
  animation: tab-pop 0.3s steps(3) 1;
}
.tabbar button.on {
  text-shadow: 0 0 2px var(--gold);
}
.tabbar button .dot {
  animation: dot-pulse 1s steps(2) infinite;
}
.chip.hot b,
.pill {
  animation: glow-text 1.2s steps(2) infinite;
}
.btn.hot:not(:disabled) {
  animation: glow-gold 1.2s steps(2) infinite;
}
.tile-m.hot {
  animation: glow-gold 1.4s steps(2) infinite;
}
.card:hover .art img {
  animation: bob 0.4s steps(2) infinite;
}
.card.sel {
  animation: glow-gold 1s steps(2) infinite;
  outline: none;
}
.card.t-legendary {
  box-shadow:
    0 0 0 2px rgba(255, 205, 117, 0.45),
    var(--px) var(--px) 0 var(--lo);
}
.card.t-survivor {
  box-shadow:
    0 0 0 2px rgba(255, 138, 154, 0.45),
    var(--px) var(--px) 0 var(--lo);
}
.card.mania {
  animation: glow-gold 2s steps(2) infinite;
}
.card.sel.mania,
.card.t-legendary.sel,
.card.t-survivor.sel {
  animation: glow-gold 1s steps(2) infinite;
}
.bar i,
.card .lvlbar i {
  transition: width 0.5s steps(8);
}
.bar.run i {
  background: repeating-linear-gradient(90deg, var(--gold) 0 8px, var(--gold2) 8px 16px);
  animation: stripes 0.5s steps(8) infinite;
}
.pips i.on {
  box-shadow: 0 0 0 2px rgba(56, 183, 100, 0.5);
}
.sighit {
  color: var(--gold);
  animation: glow-text 0.8s steps(2) infinite;
}
.board button.fx-flip {
  animation: flip 0.4s steps(6) both;
}
.log div:first-child.fx-line {
  animation: slide-l 0.25s steps(4) both;
}
.ready {
  animation: glow-gold 1.2s steps(2) infinite;
}
.tile.fx-new {
  animation: pop-in 0.3s steps(4) both;
}
.tile.fx-hit {
  animation:
    tile-hit 0.4s steps(4) 0.3s 2,
    flash 0.6s steps(3) 0.3s 1;
}
.tile.fx-won {
  animation: glow-gold 0.8s steps(2) 1.1s 3;
}
.tile.fx-lost {
  animation: ko 0.5s steps(4) 1.1s forwards;
}
/* fight stage */
.fight .side.me {
  animation:
    slide-l 0.3s steps(5) both,
    clash-l 0.4s steps(6) 0.6s 1;
}
.fight .side.op {
  animation:
    slide-r 0.3s steps(5) both,
    clash-r 0.4s steps(6) 0.6s 1;
}
.fight .side .cards {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.fight .side .card {
  width: 124px;
}
.fight .total,
.fight .note {
  opacity: 0;
  animation: pop-in 0.3s steps(4) 1s both;
}
.fight .note {
  animation: px-in 0.3s steps(4) 1.4s both;
}
.fight .mid {
  position: relative;
  min-height: 48px;
  display: grid;
  place-items: center;
}
.fight .burst {
  position: absolute;
  opacity: 0;
  animation: burst 0.5s steps(5) 0.75s both;
}
.fight .verdict {
  opacity: 0;
  animation:
    pop-in 0.35s steps(4) 1.8s both,
    glow-text 1s steps(2) 2.1s infinite;
}
.fight.done .card.fx-win {
  animation:
    bob 0.4s steps(2) 1.9s 4,
    glow-gold 1s steps(2) 1.9s infinite;
}
.fight.done .card.fx-lose {
  animation: ko 0.5s steps(4) 1.9s forwards;
}
.fight .card .art img {
  animation: bob 0.4s steps(2) infinite;
}
.fx-flash {
  animation: flash 0.5s steps(3) 1;
}
.banner-win {
  color: var(--gold);
  animation:
    pop-in 0.35s steps(4) both,
    glow-text 1s steps(2) 0.4s infinite;
}
.banner-lose {
  color: #ff8a9a;
  animation: pop-in 0.35s steps(4) both;
}
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .fight .total,
  .fight .note,
  .fight .verdict,
  .fight .burst {
    opacity: 1;
  }
}
html[data-reduce='1'] *,
html[data-reduce='1'] *::before,
html[data-reduce='1'] *::after {
  animation: none !important;
  transition: none !important;
}
html[data-reduce='1'] .fight .total,
html[data-reduce='1'] .fight .note,
html[data-reduce='1'] .fight .verdict,
html[data-reduce='1'] .fight .burst,
html[data-reduce='1'] .reveal {
  opacity: 1;
}
html[data-scan='0'] .app::after {
  display: none;
}
input[type='range'] {
  accent-color: var(--gold);
  height: 24px;
}

/* ===== draft board sequence ===== */
@keyframes deal {
  0% {
    transform: translate(-40px, -40px) scale(0.6);
    opacity: 0;
  }
  100% {
    transform: none;
    opacity: 1;
  }
}

@keyframes tease {
  0%,
  100% {
    transform: none;
  }
  50% {
    transform: translateY(-2px);
  }
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
@keyframes spotlight {
  0% {
    transform: scale(0.4);
    opacity: 0;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}
@keyframes rays {
  0% {
    transform: rotate(0) scale(1);
  }
  100% {
    transform: rotate(90deg) scale(1.05);
  }
}
.board.fx-deal button {
  animation: deal 0.35s steps(5) both;
}
.board.fx-deal button:nth-child(5n + 2) {
  animation-delay: 0.04s;
}
.board.fx-deal button:nth-child(5n + 3) {
  animation-delay: 0.08s;
}
.board.fx-deal button:nth-child(5n + 4) {
  animation-delay: 0.12s;
}
.board.fx-deal button:nth-child(5n + 5) {
  animation-delay: 0.16s;
}
.board.fx-deal button:nth-child(n + 6) {
  animation-delay: 0.2s;
}
.board.fx-deal button:nth-child(n + 11) {
  animation-delay: 0.3s;
}
.board.fx-deal button:nth-child(n + 16) {
  animation-delay: 0.4s;
}
.board.fx-deal button:nth-child(n + 21) {
  animation-delay: 0.5s;
}
.board.live button:not(.rev):not(:disabled) {
  cursor: pointer;
}
.board.live button:not(.rev):not(:disabled):hover {
  transform: translateY(-4px);
  box-shadow:
    0 0 0 2px var(--gold),
    inset var(--px) var(--px) 0 var(--hi);
}
.board.live button:not(.rev):not(:disabled):active {
  transform: translateY(0);
}
.board.live button:not(.rev):not(:disabled) {
  animation: tease 1.2s steps(2) infinite;
}
.board.live button:not(.rev):not(:disabled):nth-child(2n) {
  animation-delay: 0.3s;
}
.board.live button:not(.rev):not(:disabled):nth-child(3n) {
  animation-delay: 0.6s;
}
.board button.fx-flip {
  animation: flip 0.4s steps(6) both;
}
.reveal {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 6px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--lo);
  border: var(--px) solid var(--line);
  overflow: hidden;
  animation: spotlight 0.4s steps(5) 0.35s both;
}
.reveal .rays {
  position: absolute;
  inset: -60%;
  background: repeating-conic-gradient(from 0deg, rgba(255, 205, 117, 0.12) 0 10deg, transparent 10deg 20deg);
  animation: rays 6s steps(24) infinite;
  pointer-events: none;
}
.reveal .rays.big {
  background: repeating-conic-gradient(from 0deg, rgba(255, 205, 117, 0.3) 0 10deg, transparent 10deg 20deg);
}
.reveal .card {
  position: relative;
}
.reveal.big .card {
  animation: glow-gold 0.8s steps(2) 0.8s infinite;
}
.reveal .item {
  position: relative;
  display: grid;
  place-items: center;
  gap: 4px;
  padding: 8px;
  min-width: 148px;
  background: var(--panel2);
  border: var(--px) solid var(--tc);
}
.reveal .item .nm {
  font-family: var(--f-cond);
  font-size: 16px;
  line-height: 16px;
  text-transform: uppercase;
}
.reveal .pull {
  position: relative;
  font-family: var(--f-display);
  font-size: 16px;
  line-height: 24px;
  color: var(--gold);
  animation:
    pop-in 0.3s steps(4) 0.9s both,
    glow-text 1s steps(2) 1.2s infinite;
}
.reveal .what {
  position: relative;
  font-family: var(--f-cond);
  font-size: 16px;
  line-height: 16px;
  color: var(--muted);
  text-align: center;
}
.reveal .burst {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  animation: burst 0.6s steps(5) 0.5s both;
}
.reveal .bundle {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: center;
  position: relative;
}
.reveal .bundle .card {
  width: 128px;
}
.banner-reset {
  text-align: center;
  font-family: var(--f-display);
  font-size: 16px;
  line-height: 24px;
  color: var(--gold);
  padding: 8px;
  animation:
    pop-in 0.3s steps(4) both,
    glow-text 1s steps(2) 0.3s infinite;
}
.chip.bump {
  animation:
    pop-in 0.3s steps(4) 1,
    glow-text 1.2s steps(2) infinite;
}
