@font-face { font-family: "Press"; src: url("assets/fonts/PressStart2P-Regular.ttf"); }
@font-face { font-family: "Pixel"; src: url("assets/fonts/PixelifySans.ttf"); font-weight: 400 700; }
@font-face { font-family: "Plex"; src: url("assets/fonts/IBMPlexSans-Regular.woff2") format("woff2"); font-weight: 400; }
@font-face { font-family: "Plex"; src: url("assets/fonts/IBMPlexSans-SemiBold.woff2") format("woff2"); font-weight: 600; }

@font-face { font-family: "Inter"; src: url("assets/fonts/Inter-Variable.woff2") format("woff2"); font-weight: 100 900; }

:root {
  --font-display: "Pixel", sans-serif;
  --font-head: "Plex", "IBM Plex Sans", sans-serif;
  --font-body: "Inter", "Plex", sans-serif;
}

h1, .brand, .pick-title, .result-word { font-family: var(--font-display); font-weight: 700; }
h2, h3, .modal-title, .rail-tab, .dex-title, .dex-card .name, .pick-name, .pick-premium { font-family: var(--font-head); font-weight: 600; letter-spacing: normal; }
h2, h3 { line-height: 1.25; }
.card .name, .card .effect, .card .pow, .seat-name, .opp-name, .score .label, .btn.refresh, .btn.fight { font-family: var(--font-head); font-weight: 600; letter-spacing: normal; text-transform: none; }
.manual p, .tip, .wait-line, .manual li, .dex-name, .dex-card dl, .dex-card dd, .pick-effect { font-family: var(--font-body); font-weight: 400; letter-spacing: normal; }

:root {
  --bg: #0c0a14;
  --panel: #15121f;
  --panel-2: #1c1829;
  --line: #2c2640;
  --ink: #ece8f6;
  --dim: #7d7596;
  --cyan: #3fe0ff;
  --magenta: #ff3fd0;
  --gold: #f5c84a;
  --red: #ff4d5e;
  --cw: min(8.2vw, 11vh);
  --ch: calc(var(--cw) * 1.42);
  --snap: cubic-bezier(0.2, 1.4, 0.4, 1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: "Pixel", ui-monospace, monospace;
  overflow: hidden;
  user-select: none;
}

body {
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(63, 224, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(63, 224, 255, 0.035) 1px, transparent 1px);
  background-size: 24px 24px;
  animation: grid-drift 36s linear infinite;
}

img { image-rendering: pixelated; display: block; }

body.hurt::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 25;
  animation: hurt 0.6s ease-out;
}

.label {
  font-family: "Pixel", sans-serif;
  font-size: 1.15rem;
  letter-spacing: 0.02em;
  color: var(--dim);
}

.value { font-family: "Press", monospace; font-variant-numeric: tabular-nums; }

.game {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: 170px minmax(0, 1fr) 170px;
  column-gap: 0.8vw;
  row-gap: 1.2vw;
  height: 100vh;
  padding: 0.8vh 6px;
}

.side {
  display: flex;
  flex-direction: column;
  gap: 1vh;
  width: 170px;
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 #000;
  padding: 1.4vh 0.7rem 1.6vh;
  min-height: 0;
}

.side-right {
  min-height: 0;
  overflow: hidden;
}

.side:not(.side-right) { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -ms-overflow-style: none; }
.side:not(.side-right)::-webkit-scrollbar { display: none; width: 0; height: 0; }
.side:not(.side-right) .brand { flex: none; }
.dex { flex: none; }
.rail-tab-cards { display: none; }

.brand {
  font-size: 1.48rem;
  color: var(--cyan);
  text-shadow: 2px 2px 0 #5a1a52;
  animation: brand 4s ease-in-out infinite;
  letter-spacing: 0.02em;
}

.mode-tag {
  width: 100%;
  padding: 0 0.15rem;
  font-family: "Press", monospace;
  font-size: 0.5rem;
  line-height: 1.4;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mode-tag.hidden { display: none; }

.round-line {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 0.35rem;
  width: 100%;
  margin: 0;
  padding: 0.08vh 0.15rem;
  border: 2px solid transparent;
  box-sizing: border-box;
}
.round-word {
  font-family: "Pixel", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--ink);
  margin: 0;
  padding: 0;
}
.round-line .value {
  font-size: 0.85rem;
  line-height: 1;
  color: var(--cyan);
  font-variant-numeric: tabular-nums;
  margin: 0;
  padding: 0;
}

.main {
  display: grid;
  grid-template-rows: 100px auto 1fr auto auto;
  justify-self: center;
  width: 100%;
  max-width: 1200px;
  grid-template-columns: minmax(0, 1fr);
  container-type: inline-size;
  --cw: min(8.2cqi, 11vh);
  gap: 0.8vh;
  min-width: 0;
  min-height: 0;
}

.mid {
  display: grid;
  grid-template-columns: max-content 1fr;
  grid-template-rows: auto 1fr;
  align-items: start;
  column-gap: 0.8rem;
  min-width: 0;
  min-height: 0;
}

.info {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-self: start;
  gap: 0.7rem;
  width: max-content;
}

.roster {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.45rem;
  width: max-content;
}

.seat {
  position: relative;
  display: grid;
  grid-template-columns: 0.48rem minmax(0, 1fr) auto;
  align-items: center;
  column-gap: 0.4rem;
  width: 100%;
  padding: 0.08vh 0.15rem;
  line-height: 1.2;
  border: 2px solid transparent;
  background: transparent;
  transition: opacity 0.6s, filter 0.6s, transform 0.25s var(--snap), border-color 0.2s;
}
.seat .pip { width: 0.48rem; height: 0.48rem; background: var(--seat); box-shadow: 0 0 6px var(--seat); }
.seat-id { display: flex; align-items: center; gap: 0.3rem; min-width: 0; }
.seat-bot { flex: none; padding: 0 0.25rem; font-family: var(--font-body); font-weight: 500; font-size: 0.6rem; line-height: 1.35; color: var(--dim); border: 1px solid var(--line); }
.seat-name { min-width: 0; font-weight: 700; font-size: clamp(0.7rem, 1.5vh, 0.9rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-hp { font-size: clamp(0.58rem, 1.2vh, 0.74rem); color: var(--red); text-align: right; justify-self: end; font-variant-numeric: tabular-nums; }
.seat.me { border-color: rgba(63, 224, 255, 0.5); }
.seat.opp { border-color: var(--seat); transform: translateX(4px); box-shadow: -3px 0 0 var(--seat), 0 0 10px color-mix(in srgb, var(--seat) 35%, transparent); }
.seat.dead { opacity: 0.32; filter: grayscale(1); transform: none; box-shadow: none; border-color: transparent; }
.seat.dead .seat-name { text-decoration: line-through; }
.seat.struck { animation: struck 0.45s steps(6); }
.seat.fall { animation: fall 0.7s ease-out; }

.row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1vw;
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 #000;
  padding: 1.1vh 1vw;
}

.row-head { display: flex; flex-direction: column; gap: 0.6vh; min-width: 4.2rem; }
.opp-row .row-head { min-width: 0; }
.opp-name { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; font-size: 1.1rem; }
.opp-name .pip, .seat .pip { display: inline-block; }
.opp-name .pip { width: 0.75rem; height: 0.75rem; background: var(--seat); box-shadow: 0 0 8px var(--seat); }

.lane { display: flex; gap: 0.8vw; }
.lane.jokers { margin-left: auto; padding-left: 1vw; border-left: 2px dashed var(--line); }

.board-wrap { position: relative; }
.links { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; z-index: 4; }

.opp-row { --cw: min(5.8cqi, 7.8vh); --ch: calc(var(--cw) * 1.18); border-color: color-mix(in srgb, var(--seat) 45%, var(--line)); }
.opp-row .card .effect { display: none; }
.opp-row.ghost .board-wrap, .opp-row.ghost .jokers { opacity: 0.55; filter: saturate(0.5); }

.player-row { --cw: min(9.4cqi, 13vh); justify-content: center; align-self: center; background: transparent; border: none; box-shadow: none; padding: 0; }
.player-row .lane.jokers { margin-left: 2vw; }
.player-row.wide { --cw: min(7.4cqi, 11.5vh); }

.tip {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  justify-self: stretch;
  margin: 0;
  min-height: 1.2em;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: clamp(0.72rem, 1.35cqi, 0.9rem);
  line-height: 1.2;
  color: var(--ink);
  transition: opacity 0.25s steps(4), transform 0.25s steps(4);
}
.tip.out { opacity: 0; transform: translateY(-3px); }

.talent-slots {
  display: flex;
  gap: 0.5rem;
  align-self: stretch;
  flex: none;
}
.talent-slot {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 4.6rem;
  padding: 0.4rem 0.25rem;
  margin: 0;
  background: var(--panel-2);
  border: 2px solid var(--cyan);
  box-shadow: 3px 3px 0 #000;
  color: var(--ink);
  font: inherit;
  cursor: pointer;
  transition: transform 0.12s var(--snap), box-shadow 0.12s;
}
.talent-slot:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 #000; }
.talent-slot img { width: 2.4rem; height: 2.4rem; }
.talent-slot-name {
  font-family: "Pixel", sans-serif;
  font-weight: 700;
  font-size: 0.66rem;
  line-height: 1.1;
  text-align: center;
}
.talent-slot.empty { cursor: default; background: transparent; border: 2px dashed var(--line); box-shadow: none; }
.talent-slot.empty:hover { transform: none; box-shadow: none; }
.talent-slot.pending { opacity: 0; }
.talent-slot.fire { animation: slot-fire 0.45s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes slot-fire {
  0% { filter: brightness(1); }
  40% { transform: scale(1.08); filter: brightness(1.8); }
  100% { filter: brightness(1); }
}

.opp-talent-slots { align-self: center; gap: 0.6vw; padding-left: 1vw; border-left: 2px dashed var(--line); }
.opp-talent-slots .talent-slot { width: calc(var(--cw) * 1.05); height: var(--ch); padding: 0.2rem; gap: 0.2rem; border-color: var(--seat); }
.opp-talent-slots .talent-slot img { width: calc(var(--cw) * 0.5); height: calc(var(--cw) * 0.5); }
.opp-talent-slots .talent-slot-name { font-size: clamp(0.5rem, calc(var(--cw) * 0.15), 0.66rem); overflow-wrap: anywhere; }
.opp-talent-slots .talent-slot.empty { border-color: var(--line); }
@media (max-width: 1100px), (max-height: 620px) {
  .opp-talent-slots .talent-slot { width: var(--ch); padding: 0; justify-content: center; }
  .opp-talent-slots .talent-slot img { width: calc(var(--ch) * 0.7); height: calc(var(--ch) * 0.7); }
  .opp-talent-slots .talent-slot-name { display: none; }
}

.versus {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  align-self: center;
  justify-self: center;
  gap: 0.7vh;
  min-width: 0;
  width: 100%;
}
.versus-scores {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2.5cqi;
  min-width: 0;
  width: 100%;
}
.versus { position: relative; }
.wait-line { position: absolute; top: calc(100% + 0.4rem); left: 0; right: 0; margin: 0; text-align: center; font-size: 0.78rem; color: var(--dim); pointer-events: none; animation: vs 2.4s ease-in-out infinite; }
.wait-line.hidden { display: none; }
.fuse {
  width: min(28rem, 72%);
  height: 14px;
}
.fuse.hidden { display: none; }
.pick-fuse { width: min(28rem, 60%); }
.pick.fade .pick-fuse { opacity: 0; transition: opacity 0.3s ease-out; }
.fuse-track {
  position: relative;
  height: 10px;
  border: 2px solid #000;
  background: #1a120c;
  box-shadow: 2px 2px 0 #000;
  overflow: hidden;
  image-rendering: pixelated;
}
.fuse-fill {
  height: 100%;
  width: 100%;
  background: repeating-linear-gradient(90deg, #f5c84a 0 6px, #e0892a 6px 10px, #9a3a12 10px 12px);
  box-shadow: inset 0 2px 0 rgba(255, 230, 140, 0.35);
  image-rendering: pixelated;
}
.fuse-ember {
  position: absolute;
  top: -3px;
  width: 8px;
  height: 16px;
  background: #fff3a0;
  box-shadow: 0 0 0 2px #ff6a00, 0 0 8px #ff8a1a;
  animation: fuse-flicker 0.18s steps(2) infinite;
  image-rendering: pixelated;
}
@keyframes fuse-flicker {
  from { background: #fff3a0; }
  to { background: #ff7a20; }
}

.pick {
  position: fixed;
  inset: 0;
  z-index: 28;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 14, 0.78);
}
.pick.hidden { display: none; }
.pick.fade {
  background: rgba(8, 6, 14, 0);
  transition: background 0.55s ease;
  pointer-events: none;
}
.pick-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.4rem;
  max-width: calc(100vw - 32px);
}
.pick-title {
  font-size: clamp(1.6rem, 3.4vw, 2.6rem);
  color: var(--cyan);
  text-shadow: 3px 3px 0 #5a1a52;
  letter-spacing: 0.04em;
}
.pick-row {
  display: flex;
  gap: clamp(0.5rem, 1.2vw, 1rem);
  align-items: stretch;
}
.pick-card {
  --w: clamp(8.5rem, 13vw, 11.5rem);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  width: var(--w);
  min-height: calc(var(--w) * 1.5);
  padding: 0.9rem 0.7rem;
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 5px 5px 0 #000;
  color: var(--ink);
  font: inherit;
  text-align: center;
  cursor: pointer;
  animation: pick-in 0.42s var(--snap) both;
  animation-delay: calc(var(--i, 0) * 70ms);
  transition: transform 0.16s var(--snap), border-color 0.12s, box-shadow 0.16s, opacity 0.3s;
}
.pick-card:not(.locked):hover { transform: translateY(-6px); border-color: var(--cyan); box-shadow: 5px 11px 0 #000, 0 0 18px rgba(63, 224, 255, 0.25); }
.pick-art {
  display: grid;
  place-items: center;
  width: 72%;
  aspect-ratio: 1;
  background: #0d0b15;
  border: 2px solid #000;
}
.pick-art img { width: 82%; height: 82%; }
.pick-name {
  font-size: clamp(0.95rem, 1.5vw, 1.15rem);
  line-height: 1.1;
  color: var(--ink);
}
.pick-effect {
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--ink);
}
.pick-card.locked {
  gap: 0.6rem;
  cursor: default;
  background: #13111b;
  border-style: dashed;
  border-color: #3a3550;
  box-shadow: 5px 5px 0 #000;
  filter: grayscale(1);
  opacity: 0.55;
}
.pick-plus {
  font-family: "Press", monospace;
  font-size: 2.2rem;
  line-height: 1;
  color: var(--dim);
}
.pick-premium {
  font-size: 0.85rem;
  color: var(--dim);
}
.pick-card.chosen, .pick-card.gone { animation: none; }
.pick-card.chosen { border-color: var(--cyan); transform: translateY(-10px) scale(1.06); box-shadow: 5px 15px 0 #000, 0 0 26px rgba(63, 224, 255, 0.45); }
.pick-card.gone { opacity: 0; transform: translateY(12px) scale(0.96); transition: opacity 0.4s ease-out, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes pick-in {
  from { opacity: 0; transform: translateY(22px) scale(0.9); }
  to { opacity: 1; transform: none; }
}

.score {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  min-width: 12rem;
  padding: 0.7rem 1.1rem;
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 #000;
  transition: border-color 0.2s, opacity 0.3s, transform 0.3s var(--snap);
}

.score .value { font-size: 1.9rem; }
.opp-score { justify-content: flex-end; }
.opp-score .value { color: #ffb3ec; min-width: 3ch; text-align: right; }
.opp-score .value:empty::before { content: "\00a0"; }
.player-score .value { color: var(--cyan); }
.score.bump { animation: bump 0.18s var(--snap); }
.score.burst { animation: burst 0.5s var(--snap); }
.score.winner { border-color: var(--gold); transform: scale(1.08); box-shadow: 4px 4px 0 #000, 0 0 22px rgba(245, 200, 74, 0.45); }
.score.winner .value { color: var(--gold); }
.score.loser { opacity: 0.45; transform: scale(0.94); }
.vs { font-family: "Press", monospace; font-size: 0.8rem; color: var(--dim); animation: vs 2.4s ease-in-out infinite; }

.shop-row { gap: 1vw; --cw: min(7cqi, 10vh); }
.shop-row.five { --cw: min(6.5cqi, 9.8vh); }
.shop-row.six { --cw: min(6cqi, 9.5vh); }
.shop-row .btn { min-width: 9.5rem; }
.shop-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.1vh;
  min-width: 5.6rem;
}
.gold-box {
  display: flex;
  flex-direction: row;
  flex-wrap: nowrap;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  white-space: nowrap;
}
.gold-box.tick { animation: tick 0.3s var(--snap); }
.gold-ico { width: 24px; height: 24px; flex: none; background: url("assets/ui/gold.png") center / 24px 24px no-repeat; image-rendering: pixelated; }
.gold-box .value { font-size: 1.05rem; line-height: 24px; color: var(--gold); font-variant-numeric: tabular-nums; transform: translateY(2px); }
.shop-row .actions { margin-left: auto; display: grid; grid-template-columns: minmax(0, 1fr) 3.2rem; gap: 1vh 0.5rem; width: 13.5rem; flex: none; }
.shop-row .actions .btn { min-width: 0; }
.shop-row .actions .btn.fight { grid-column: 1 / -1; }
.btn.refresh { font-size: 1rem; line-height: 1.2; padding: 0.85rem 0.7rem; white-space: nowrap; }
.btn.lock { display: grid; place-items: center; padding: 0; }
.lock-ico { width: 28px; height: 28px; background: url("assets/ui/lock-open.png") center / 28px 28px no-repeat; image-rendering: pixelated; }
.btn.lock.on { border-color: #5fc8ff; background: #0f2433; box-shadow: 4px 4px 0 #000, 0 0 12px rgba(95, 200, 255, 0.35); }
.btn.lock.on .lock-ico { background-image: url("assets/ui/lock.png"); }
#shop.frozen .card .face { border-color: #8fdcff; box-shadow: 3px 3px 0 #000, 0 0 0 2px #2a7fb0, 0 0 14px rgba(140, 220, 255, 0.4); }
#shop.frozen .card .face::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(180deg, rgba(170, 230, 255, 0.24), rgba(110, 190, 255, 0.08) 45%, rgba(170, 230, 255, 0.2)); box-shadow: inset 0 0 0 2px rgba(191, 246, 255, 0.55); image-rendering: pixelated; }

.btn {
  font-family: var(--font-head);
  font-weight: 600;
  font-size: 0.95rem;
  letter-spacing: normal;
  color: var(--ink);
  background: var(--panel-2);
  border: 2px solid var(--line);
  box-shadow: 4px 4px 0 #000;
  padding: 1rem 1.3rem;
  cursor: pointer;
  min-width: 11rem;
  transition: transform 0.12s var(--snap), box-shadow 0.12s;
}

.btn:hover:not(:disabled) { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 #000; }
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 #000; transition-duration: 0.04s; }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn .price { color: var(--gold); margin-left: 0.4rem; }
.btn.refresh.free .price { color: #7dffa0; }
.btn.refresh { border-color: var(--cyan); }
.btn.fight { background: #3a0f34; border-color: var(--magenta); color: #ffe0f7; font-size: 1.2rem; line-height: 1.2; padding: 1.15rem 1rem; animation: ready 2.2s ease-in-out infinite; }
.btn.fight:disabled { animation: none; }
.btn.again { border-color: var(--cyan); font-size: 1rem; padding: 1.1rem 2rem; }

.card, .slot { position: relative; width: var(--cw); height: var(--ch); flex: none; }

.slot { border: 2px dashed var(--line); background: rgba(255, 255, 255, 0.015); }
.slot.joker { border-color: rgba(255, 63, 208, 0.28); }
.slot.sold { border-color: transparent; background: transparent; }

.card { cursor: pointer; perspective: 600px; z-index: 1; }
.card:not(.cpu):hover { z-index: 6; }
.card.enter { animation: enter 0.42s var(--snap) both; }
.card.leave { animation: leave 0.14s ease-in forwards; pointer-events: none; }
.card.bought { animation: bought 0.15s ease-in forwards; pointer-events: none; }

.tilt {
  width: 100%;
  height: 100%;
  --rx: 0deg;
  --ry: 0deg;
  --mx: 50%;
  transform: rotateX(var(--rx)) rotateY(var(--ry));
  transition: transform 0.18s ease-out;
  transform-style: preserve-3d;
}
.card:not(.cpu):hover .tilt { transform: translateY(-10px) scale(1.06) rotateX(var(--rx)) rotateY(var(--ry)); transition: transform 0.1s ease-out; }
.card:not(.cpu):active .tilt { transform: translateY(-4px) scale(0.97) rotateX(var(--rx)) rotateY(var(--ry)); transition-duration: 0.05s; }

.bob { width: 100%; height: 100%; }
.card.hit .bob { animation: hit 0.34s var(--snap); }
.card.surge .bob { animation: surge 0.6s ease-out; }
.card.deny .bob { animation: deny 0.3s steps(4); }

.face {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: linear-gradient(180deg, #221d33 0%, #17131f 100%);
  border: 2px solid #3a3352;
  box-shadow: 3px 3px 0 #000, inset 0 0 0 2px #0f0c17;
  padding: calc(var(--cw) * 0.07) calc(var(--cw) * 0.06) calc(var(--cw) * 0.05);
  animation: sway var(--dur) ease-in-out var(--phase) infinite;
  transition: box-shadow 0.15s, border-color 0.2s;
}
.card:not(.cpu):hover .face { box-shadow: 8px 12px 0 rgba(0, 0, 0, 0.75), inset 0 0 0 2px #0f0c17; }

.card.person .face { background: linear-gradient(180deg, #2a2038 0%, #18121f 100%); }
.card.joker .face { border-color: var(--magenta); background: linear-gradient(180deg, #2f1230 0%, #170c1a 100%); }
.card.linked .face { border-color: var(--cyan); box-shadow: 3px 3px 0 #000, 0 0 12px rgba(63, 224, 255, 0.35); }
.card.attached .face { border-color: var(--magenta); box-shadow: 3px 3px 0 #000, 0 0 12px rgba(255, 63, 208, 0.35); }
.card.doubled .face { border-color: var(--gold); }
.card.locked { cursor: default; }
.card.cpu { cursor: default; }
.card.locked .face { opacity: 0.42; filter: saturate(0.5); }

.sheen {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(105deg, transparent 30%, rgba(255, 255, 255, 0.14) 45%, transparent 60%);
  background-size: 250% 100%;
  background-position: var(--mx) 0;
  opacity: 0;
  transition: opacity 0.2s;
}
.card:not(.cpu):hover .sheen { opacity: 1; }

.card-info {
  position: absolute;
  top: calc(var(--cw) * 0.05);
  right: calc(var(--cw) * 0.05);
  z-index: 3;
  display: grid;
  place-items: center;
  width: max(13px, calc(var(--cw) * 0.19));
  height: max(13px, calc(var(--cw) * 0.19));
  margin: 0;
  padding: 0;
  font-family: "Press", monospace;
  font-size: max(7px, calc(var(--cw) * 0.09));
  line-height: 1;
  color: #ffc4ef;
  background: #170c1a;
  border: 1px solid var(--magenta);
  box-shadow: 1px 1px 0 #000;
  cursor: pointer;
}
.card-info::before { content: ""; position: absolute; inset: -7px; }
.card-info:hover { color: #fff; background: #4a1240; }
.card-info:focus-visible { outline: 2px solid var(--cyan); outline-offset: 1px; }


.home {
  position: absolute;
  top: calc(var(--cw) * 0.06);
  right: calc(var(--cw) * 0.06);
  width: calc(var(--cw) * 0.24);
  border: 1px solid #000;
  z-index: 2;
}

.art {
  width: 100%;
  height: calc(var(--ch) * 0.5);
  display: grid;
  place-items: center;
  background: #0d0b15;
  border: 2px solid #000;
  overflow: hidden;
}

.country .art img { width: 86%; height: auto; border: 2px solid #000; }
.person .art img { height: calc(var(--ch) * 0.5 - 4px); width: auto; }
.joker .art img { height: calc(var(--ch) * 0.38); width: auto; }

.name {
  margin-top: calc(var(--ch) * 0.04);
  font-size: calc(var(--cw) * 0.12);
  line-height: 1.1;
  text-align: center;
  min-height: calc(var(--cw) * 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
}
.card.shop .name {
  width: calc(100% + var(--cw) * 0.08);
  margin: calc(var(--ch) * 0.035) calc(var(--cw) * -0.04) 0;
  font-size: calc(var(--cw) * 0.15);
  min-height: calc(var(--cw) * 0.28);
}
.card.shop.country .art { height: calc(var(--ch) * 0.42); }
.card.shop.person .art { height: calc(var(--ch) * 0.46); }
.card.shop.person .art img { height: calc(var(--ch) * 0.46 - 4px); }
.card.shop .effect { font-size: calc(var(--cw) * 0.155); }
.card.shop .pow { min-width: calc(var(--cw) * 0.32); height: calc(var(--cw) * 0.32); font-size: calc(var(--cw) * 0.17); }
.card.shop .card-info { width: max(14px, calc(var(--cw) * 0.22)); height: max(14px, calc(var(--cw) * 0.22)); font-size: max(8px, calc(var(--cw) * 0.11)); }

.effect {
  margin-top: auto;
  font-size: calc(var(--cw) * 0.15);
  color: #ffc4ef;
  text-align: center;
  line-height: 1.1;
}

.pow {
  position: absolute;
  right: -0.5rem;
  bottom: -0.5rem;
  min-width: calc(var(--cw) * 0.3);
  height: calc(var(--cw) * 0.3);
  display: grid;
  place-items: center;
  font-size: calc(var(--cw) * 0.16);
  line-height: 1;
  color: #fff;
  background: #2a2340;
  border: 2px solid #000;
  padding: 0 3px;
  z-index: 2;
}
.pow.up { background: #4a1240; color: #ffc4ef; }

.sell {
  position: absolute;
  inset: auto 0 0 0;
  font-family: "Press", monospace;
  font-size: calc(var(--cw) * 0.09);
  text-align: center;
  padding: 0.3rem 0;
  background: rgba(255, 77, 94, 0.9);
  color: #fff;
  transform: translateY(6px);
  opacity: 0;
  transition: opacity 0.12s, transform 0.12s var(--snap);
}
.card:hover .sell, .card.armed .sell { opacity: 1; transform: none; }
body.fighting .card .sell { display: none; }
body.fighting .shop-row .card { opacity: 0.35; }

.shop-row .lane.reroll .card { animation: deal 0.38s var(--snap) both; }
.shop-row .lane.reroll .card:nth-child(2) { animation-delay: 0.05s; }
.shop-row .lane.reroll .card:nth-child(3) { animation-delay: 0.1s; }
.shop-row .lane.reroll .card:nth-child(4) { animation-delay: 0.15s; }

.link-group .glow { fill: none; stroke-width: 9; stroke-linecap: square; opacity: 0.22; }
.link-group .core { fill: none; stroke-width: 3; stroke-linecap: square; stroke-dasharray: 0.06 0.03; animation: flow 1.6s linear infinite; }
.link-group.border .glow, .link-group.border .core { stroke: var(--cyan); }
.link-group.attach .glow, .link-group.attach .core { stroke: var(--magenta); }
.link-group.attach .core { stroke-width: 2; }
.link-group .node { fill: #fff; stroke: #000; stroke-width: 1; }
.link-group.border .node { fill: var(--cyan); }
.link-group.attach .node { fill: var(--magenta); }
.link-group { filter: drop-shadow(0 0 4px rgba(63, 224, 255, 0.6)); animation: hum 2.6s ease-in-out infinite; }
.link-group.attach { filter: drop-shadow(0 0 4px rgba(255, 63, 208, 0.6)); }
.link-group.fresh .glow, .link-group.fresh .core { stroke-dasharray: 1 1; stroke-dashoffset: 1; animation: draw 0.55s ease-out forwards; }
.link-group.fresh .node { animation: pop 0.45s var(--snap) both; }
.link-group.fire { animation: fire 0.5s ease-out; }

.float {
  position: fixed;
  transform: translate(-50%, -100%);
  font-family: "Press", monospace;
  font-size: 1.1rem;
  pointer-events: none;
  z-index: 20;
  animation: rise 1s cubic-bezier(0.2, 0.8, 0.3, 1) forwards;
  text-shadow: 3px 3px 0 #000;
}
.float.base { color: #fff; }
.float.attach { color: var(--magenta); }
.float.link { color: var(--cyan); }
.float.chain { color: var(--gold); font-size: 1.6rem; }
.float.joker { color: #ffc4ef; }
.float.talent { color: #7dffa0; }
.float.talent.small { font-size: 0.7rem; }
.float.damage { color: var(--red); font-size: 1.8rem; }
.float.damage.small { font-size: 0.9rem; }

.row.shake { animation: shake 0.42s steps(6); }

.result {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4vh;
  background: rgba(8, 6, 14, 0.82);
  z-index: 30;
  animation: fade 0.3s ease-out;
}

.result.hidden { display: none; }
.result-word { font-size: clamp(3rem, 9vw, 7rem); text-shadow: 6px 6px 0 #000; animation: slam 0.6s var(--snap), float 3s ease-in-out 0.6s infinite; }
.outcome-win .result-word { color: var(--gold); text-shadow: 6px 6px 0 #000, 0 0 40px rgba(245, 200, 74, 0.5); }
.outcome-lose .result-word { color: var(--magenta); }
.result-delta { display: flex; align-items: baseline; gap: 1rem; font-family: "Press", monospace; }
.result-delta.hidden { display: none; }
.result-delta .value { font-size: clamp(1.6rem, 3.5vw, 2.6rem); text-shadow: 4px 4px 0 #000; font-variant-numeric: tabular-nums; min-width: 3.2ch; text-align: right; }
.result-delta .value.up { color: #7dffa0; }
.result-delta .value.down { color: var(--magenta); }
.result-delta .value.even { color: var(--ink); }
.delta-rating { font-size: 0.8rem; color: var(--ink); }

@keyframes sway {
  0%, 100% { transform: translateY(0) rotate(calc(var(--swing) * -1)); }
  50% { transform: translateY(-4px) rotate(var(--swing)); }
}
@keyframes enter {
  0% { transform: translateY(40px) scale(0.6) rotate(-8deg); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
@keyframes leave {
  100% { transform: translateY(-24px) scale(0.7) rotate(6deg); opacity: 0; }
}
@keyframes bought {
  100% { transform: translateY(-60px) scale(0.85); opacity: 0; }
}
@keyframes deal {
  0% { transform: translateX(-30px) rotate(-10deg) scale(0.8); opacity: 0; }
  100% { transform: none; opacity: 1; }
}
@keyframes hit {
  0% { transform: none; }
  35% { transform: translateY(-14px) scale(1.1) rotate(-3deg); filter: brightness(1.6); }
  100% { transform: none; }
}
@keyframes surge {
  0%, 100% { transform: none; filter: none; }
  40% { transform: translateY(-8px) scale(1.05); filter: brightness(1.5) drop-shadow(0 0 10px var(--gold)); }
}
@keyframes deny {
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}
@keyframes bump {
  50% { transform: scale(1.06); }
}
@keyframes burst {
  0% { transform: scale(1); }
  40% { transform: scale(1.16) rotate(-1deg); }
  100% { transform: scale(1); }
}
@keyframes tick {
  50% { transform: scale(1.06); }
}
@keyframes rise {
  0% { opacity: 0; transform: translate(-50%, -40%) scale(0.6); }
  15% { opacity: 1; transform: translate(-50%, -110%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -260%) scale(1); }
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
@keyframes struck {
  0%, 100% { transform: translateX(0); background: var(--panel-2); }
  20% { transform: translateX(-5px); background: #4a0f1c; }
  50% { transform: translateX(4px); background: #4a0f1c; }
}
@keyframes fall {
  0% { transform: scale(1.06); filter: brightness(2); }
  100% { transform: none; }
}
@keyframes draw {
  to { stroke-dashoffset: 0; }
}
@keyframes flow {
  to { stroke-dashoffset: -0.09; }
}
@keyframes hum {
  0%, 100% { opacity: 0.8; }
  50% { opacity: 1; }
}
@keyframes fire {
  0% { opacity: 1; filter: drop-shadow(0 0 2px #fff) brightness(2); }
  100% { opacity: 0.9; }
}
@keyframes pop {
  0% { transform: scale(0); transform-origin: center; transform-box: fill-box; }
  100% { transform: scale(1); transform-origin: center; transform-box: fill-box; }
}
@keyframes hurt {
  0% { background: radial-gradient(ellipse at center, rgba(255, 77, 94, 0.15) 30%, rgba(120, 0, 20, 0.85) 100%); }
  100% { background: radial-gradient(ellipse at center, transparent 60%, transparent 100%); opacity: 0; }
}
@keyframes brand {
  0%, 100% { text-shadow: 2px 2px 0 #5a1a52; }
  50% { text-shadow: 2px 2px 0 #5a1a52, 0 0 10px rgba(63, 224, 255, 0.6); }
}
@keyframes vs {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}
@keyframes ready {
  0%, 100% { box-shadow: 4px 4px 0 #000; }
  50% { box-shadow: 4px 4px 0 #000, 0 0 16px rgba(255, 63, 208, 0.5); }
}
@keyframes fade {
  from { opacity: 0; }
}
@keyframes slam {
  0% { transform: scale(2.2); opacity: 0; }
  60% { transform: scale(0.94); opacity: 1; }
  100% { transform: scale(1); }
}
@keyframes float {
  0%, 100% { transform: translateY(0) rotate(-1deg); }
  50% { transform: translateY(-8px) rotate(1deg); }
}

@keyframes grid-drift {
  to { background-position: 24px 24px, 24px 24px; }
}

a.brand { text-decoration: none; display: block; }


.banner {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100px;
  min-height: 100px;
  max-height: 100px;
}

.banner-slot {
  width: min(728px, 100%);
  height: 90px;
  max-width: 100%;
}

.side-right {
  overflow: hidden;
}

.rail {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.rail-tabs {
  display: flex;
  flex: none;
  border-bottom: 2px solid var(--line);
}

.rail-tab {
  flex: 1;
  margin: 0;
  padding: 0.45rem 0.15rem;
  font-size: 0.85rem;
  line-height: 1;
  color: var(--dim);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  cursor: pointer;
}

.rail-tab.on {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.rail-body {
  flex: 1;
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: none;
  -ms-overflow-style: none;
  padding: 0.6rem 0 0.4rem;
}

.rail-body::-webkit-scrollbar { display: none; width: 0; height: 0; }

.rail-pane.hidden { display: none; }

.dex-title {
  margin: 0 0 0.4rem;
  font-size: 0.85rem;
  color: var(--cyan);
}

.dex-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.dex-row {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  align-items: center;
  column-gap: 0.4rem;
  width: 100%;
  margin: 0;
  padding: 3px 4px 3px 2px;
  background: none;
  border: 0;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.dex-row:hover { color: var(--cyan); }

.dex-row img {
  width: 22px;
  height: 22px;
}

.dex-name {
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.manual {
  display: flex;
  flex-direction: column;
}

.manual section + section {
  margin-top: 0.55rem;
  padding-top: 0.55rem;
  border-top: 1px solid rgba(44, 38, 64, 0.85);
}

.manual h3 {
  margin: 0 0 0.3rem;
  font-size: 0.74rem;
  line-height: 1.3;
  color: var(--gold);
}

.manual ul {
  margin: 0;
  padding: 0;
  list-style: none;
}

.manual li {
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  line-height: 1.5;
  color: #c9c3da;
  overflow-wrap: break-word;
}

.manual p {
  margin: 0 0 0.3rem;
  font-size: 0.7rem;
  line-height: 1.5;
  color: #c9c3da;
  overflow-wrap: break-word;
}

.manual .sub {
  display: block;
  margin-bottom: 0.2rem;
  color: var(--gold);
}

.dex-pop {
  position: fixed;
  inset: 0;
  z-index: 26;
  display: grid;
  place-items: center;
  background: rgba(8, 6, 14, 0.72);
}

.dex-pop.hidden { display: none; }

.dex-card {
  width: min(320px, calc(100vw - 32px));
  padding: 1rem 1rem 1.1rem;
  background: var(--panel);
  border: 2px solid var(--line);
  box-shadow: 6px 6px 0 #000;
}

.dex-card .art {
  display: grid;
  place-items: center;
  height: 140px;
  margin-bottom: 0.8rem;
  background: #0d0b15;
  border: 2px solid #000;
}

.dex-card .art img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.dex-card .name {
  margin: 0 0 0.35rem;
  font-size: 1.2rem;
  color: var(--ink);
}

.dex-card dl {
  margin: 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.7rem;
  font-size: 0.85rem;
}

.dex-card dt { color: var(--dim); margin: 0; }
.dex-card dd { margin: 0; color: var(--ink); font-size: 0.76rem; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  .fuse-ember { animation: none; }

  .face, .brand, .vs, .btn.fight, .link-group, .link-group .core, .result-word, body.hurt::after, body { animation: none !important; }
}

.dock { display: flex; align-items: flex-end; gap: 0.6rem; min-width: 0; }
.dock > .shop-row { flex: 1; min-width: 0; }
.hud-ctrl { display: flex; flex-direction: column; gap: 0.5rem; flex: none; }
.hud-btn {
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  padding: 0;
  color: var(--dim);
  background: var(--panel-2);
  border: 2px solid var(--line);
  box-shadow: 3px 3px 0 #000;
  cursor: pointer;
  transition: transform 0.12s var(--snap), box-shadow 0.12s, color 0.12s, border-color 0.12s;
}
.hud-btn:hover { color: var(--ink); border-color: var(--cyan); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 #000; }
.hud-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; transition-duration: 0.04s; }
.hud-btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.hud-ico {
  width: 20px;
  height: 20px;
  background: currentColor;
  -webkit-mask: url("assets/ui/sound.png") center / 20px 20px no-repeat;
  mask: url("assets/ui/sound.png") center / 20px 20px no-repeat;
}
.hud-btn.mute.muted { color: var(--red); }
.hud-btn.mute.muted .hud-ico { -webkit-mask-image: url("assets/ui/sound-off.png"); mask-image: url("assets/ui/sound-off.png"); }
.hud-btn.quit:hover { border-color: var(--red); color: var(--red); }
.hud-btn.quit .hud-ico { -webkit-mask-image: url("assets/ui/quit.png"); mask-image: url("assets/ui/quit.png"); }

.result-actions { display: flex; gap: 1.2rem; flex-wrap: wrap; justify-content: center; transition: opacity 0.35s ease, transform 0.35s ease; }
.result-actions.wait { opacity: 0; transform: translateY(6px); pointer-events: none; }
.btn.menu { font-size: 1rem; padding: 1.1rem 2rem; }

.modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 6, 14, 0.78);
  animation: fade 0.2s ease-out;
}
.modal.hidden { display: none; }
.modal-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.6rem;
  max-width: calc(100vw - 32px);
  padding: 1.8rem 2rem;
  background: var(--panel);
  border: 2px solid var(--magenta);
  box-shadow: 6px 6px 0 #000;
}
.modal-title {
  font-size: clamp(1.3rem, 2.6vw, 1.9rem);
  color: var(--ink);
  text-shadow: 3px 3px 0 #5a1a52;
}
.modal-actions { display: flex; gap: 1rem; flex-wrap: wrap; justify-content: center; }
.modal-actions .btn { min-width: 8.5rem; }
.btn.quit-yes { border-color: var(--red); color: #ffd6da; }

body.fighting #shop.frozen .card { opacity: 0.7; }

.link-group.combo .core { stroke-width: 3; stroke-dasharray: 0.03 0.02; }
.link-group.combo .node { stroke: #000; }
.link-group.c-africa .glow, .link-group.c-africa .core { stroke: #f5c84a; }
.link-group.c-africa .node { fill: #f5c84a; }
.link-group.c-asia .glow, .link-group.c-asia .core { stroke: #ff6b5e; }
.link-group.c-asia .node { fill: #ff6b5e; }
.link-group.c-europe .glow, .link-group.c-europe .core { stroke: #8f9bff; }
.link-group.c-europe .node { fill: #8f9bff; }
.link-group.c-north-america .glow, .link-group.c-north-america .core { stroke: #7dffa0; }
.link-group.c-north-america .node { fill: #7dffa0; }
.link-group.c-south-america .glow, .link-group.c-south-america .core { stroke: #ff9a3c; }
.link-group.c-south-america .node { fill: #ff9a3c; }
.link-group.c-oceania .glow, .link-group.c-oceania .core { stroke: #d08bff; }
.link-group.c-oceania .node { fill: #d08bff; }

.menu-btn, .drawer-close { display: none; }
.menu-btn { position: absolute; top: 6px; right: 0; z-index: 6; place-items: center; width: 40px; height: 38px; padding: 0; background: var(--panel-2); border: 2px solid var(--line); box-shadow: 3px 3px 0 #000; cursor: pointer; }
.menu-btn span, .menu-btn span::before, .menu-btn span::after { display: block; width: 18px; height: 3px; background: var(--ink); }
.menu-btn span { position: relative; }
.menu-btn span::before, .menu-btn span::after { content: ""; position: absolute; left: 0; }
.menu-btn span::before { top: -6px; }
.menu-btn span::after { top: 6px; }
.menu-btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #000; }
.drawer-close { flex: none; place-items: center; width: 34px; height: 34px; margin: 0 0 4px 6px; padding: 0; color: var(--dim); background: var(--panel-2); border: 2px solid var(--line); box-shadow: 2px 2px 0 #000; cursor: pointer; }
.drawer-close .hud-ico { -webkit-mask-image: url("assets/ui/quit.png"); mask-image: url("assets/ui/quit.png"); }
.drawer-mask { display: none; position: fixed; inset: 0; z-index: 23; background: rgba(8, 6, 14, 0.6); }

@media (min-width: 1024px) and (max-width: 1259px) {
  .game { grid-template-columns: clamp(120px, 12vw, 170px) minmax(0, 1fr) clamp(140px, 14vw, 170px); }
  .side { width: 100%; }
  .brand { font-size: clamp(1.1rem, 1.6vw, 1.48rem); }
  .shop-head { min-width: 4rem; }
  .shop-row .talent-slots { gap: 0.4rem; }
  .shop-row .talent-slot { width: 2.6rem; padding: 0; justify-content: center; }
  .shop-row .talent-slot img { width: 1.8rem; height: 1.8rem; }
  .shop-row .talent-slot-name { display: none; }
  .shop-row .actions { width: clamp(8.5rem, 17cqi, 13.5rem); grid-template-columns: minmax(0, 1fr) 2.6rem; }
  .btn.refresh { font-size: 0.92rem; padding: 0.7rem 0.3rem; white-space: normal; line-height: 1.2; }
  .btn.fight { font-size: 1.08rem; padding: 1rem 0.4rem; }
}

@media (max-width: 1023px) {
  html, body { overflow-x: clip; overflow-y: auto; }
  .game { display: block; height: auto; min-height: 100dvh; padding: 6px 6px 8px; }
  .side:not(.side-right) { display: none; }
  .rail-tab-cards { display: block; }
  .main { position: relative; height: auto; min-height: calc(100dvh - 14px); max-width: none; grid-template-rows: 50px auto auto minmax(0, 1fr) auto; gap: 6px; }
  .banner { height: 50px; min-height: 50px; max-height: 50px; padding-right: 46px; }
  .banner-slot { width: min(320px, 100%); height: 50px; }
  .menu-btn { display: grid; }

  .side-right { position: fixed; top: 0; right: 0; bottom: 0; z-index: 24; width: min(300px, 86vw); padding: 10px 12px 12px; transform: translateX(105%); visibility: hidden; transition: transform 0.22s ease-out, visibility 0s linear 0.22s; }
  body.drawer-open .side-right { transform: none; visibility: visible; transition: transform 0.22s ease-out; }
  body.drawer-open .drawer-mask { display: block; }
  .drawer-close { display: grid; }

  .row { gap: 6px; padding: 6px; box-shadow: 3px 3px 0 #000; min-width: 0; }
  .lane { gap: 5px; min-width: 0; }
  .lane.jokers { padding-left: 6px; }

  .opp-row { --cw: min(calc((100cqi - 66px) / 7.3), 9dvh); --ch: calc(var(--cw) * 1.18); display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "head talents" "board jokers"; align-items: center; column-gap: 6px; row-gap: 5px; }
  .opp-row.wide { --cw: min(calc((100cqi - 74px) / 9.3), 9dvh); }
  .opp-row .row-head { grid-area: head; min-width: 0; }
  .opp-row .board-wrap { grid-area: board; min-width: 0; }
  .opp-row .lane.jokers { grid-area: jokers; }
  .opp-name { font-size: 0.95rem; min-width: 0; }
  .opp-name span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .opp-talent-slots { grid-area: talents; gap: 5px; padding-left: 6px; }
  .opp-talent-slots .talent-slot { width: 30px; height: 30px; padding: 0; justify-content: center; box-shadow: 2px 2px 0 #000; }
  .opp-talent-slots .talent-slot-name { display: none; }
  .opp-talent-slots .talent-slot img { width: 22px; height: 22px; }

  .mid { display: flex; flex-direction: column; align-items: stretch; gap: 5px; }
  .info { width: 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
  .round-line { width: auto; padding: 0; gap: 0.25rem; }
  .round-word, .round-line .value { font-size: 0.75rem; }
  .mode-tag { width: auto; max-width: 30%; }
  .roster { width: auto; flex: 1; min-width: 0; flex-direction: row; flex-wrap: wrap; justify-content: flex-end; gap: 3px; }
  .seat { width: auto; grid-template-columns: 0.42rem auto; column-gap: 0.22rem; padding: 1px 3px; }
  .seat-name { display: none; }
  .seat-hp { font-size: 0.56rem; }
  .seat.opp { transform: none; box-shadow: 0 0 8px color-mix(in srgb, var(--seat) 35%, transparent); }
  .tip { display: none; }
  .versus { gap: 4px; }
  .versus-scores { width: 100%; gap: 8px; padding: 0 4%; }
  .score.burst { animation-name: bump; }
  .score { flex: 1; min-width: 0; gap: 0.5rem; padding: 0.4rem 0.6rem; box-shadow: 3px 3px 0 #000; }
  .score .label { font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
  .score .value { font-size: 1.1rem; }
  .vs { font-size: 0.6rem; }
  .score.winner, .score.loser { transform: none; }
  .fuse { width: 100%; }
  .wait-line { position: static; font-size: 0.72rem; }

  .player-row { --cw: min(calc((100cqi - 20px) / 5.4), 9.6dvh); --ch: calc(var(--cw) * 1.42); flex-wrap: wrap; justify-content: center; align-content: center; row-gap: 10px; }
  .player-row.wide { --cw: min(calc((100cqi - 25px) / 6.4), 9dvh); }
  .player-row .board-wrap { display: flex; justify-content: center; width: 100%; }
  .player-row .lane.jokers { margin-left: 0; padding-left: 0; border-left: none; }

  .dock { position: relative; }
  .shop-row { --cw: min(calc((100cqi - 40px) / 4.5), 9.6dvh); --ch: calc(var(--cw) * 1.42); display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "head talents" "shop shop" "actions actions"; align-items: center; gap: 6px 8px; padding-right: 6px; }
  .shop-row.five { --cw: min(calc((100cqi - 45px) / 5.4), 9.2dvh); }
  .shop-row.six { --cw: min(calc((100cqi - 50px) / 6.4), 8.8dvh); }
  .shop-head { grid-area: head; flex-direction: row; gap: 10px; min-width: 0; justify-content: flex-start; }
  .shop-head .label { font-size: 0.95rem; }
  .shop-row .lane#shop { grid-area: shop; justify-content: center; padding-bottom: 4px; }
  .shop-row .talent-slots { grid-area: talents; justify-self: end; align-self: center; gap: 5px; margin-right: 80px; }
  .shop-row .talent-slot { width: 34px; height: 34px; padding: 0; gap: 0; box-shadow: 2px 2px 0 #000; }
  .shop-row .talent-slot img { width: 24px; height: 24px; }
  .shop-row .talent-slot-name { display: none; }
  .shop-row .actions { grid-area: actions; margin-left: 0; width: 100%; grid-template-columns: minmax(0, 1fr) 46px minmax(0, 1.25fr); gap: 8px; }
  .shop-row .actions .btn.fight { grid-column: auto; }
  .shop-row .btn { min-width: 0; min-height: 46px; box-shadow: 3px 3px 0 #000; }
  .btn.refresh { font-size: 0.95rem; padding: 0.6rem 0.4rem; }
  .btn.fight { font-size: 1.1rem; padding: 0.6rem 0.4rem; }
  .lock-ico { width: 24px; height: 24px; background-size: 24px 24px; }
  .hud-ctrl { position: absolute; left: auto; right: 8px; top: 8px; bottom: auto; flex-direction: row; gap: 6px; }
  .hud-btn { width: 34px; height: 34px; }

  .pick-panel { gap: 1rem; }
  .pick-row { flex-wrap: wrap; justify-content: center; }
  .pick-card { --w: min(11.5rem, calc((100vw - 3rem) / 3)); min-height: calc(var(--w) * 1.45); padding: 0.6rem 0.4rem; }
  .pick-effect { font-size: 0.7rem; line-height: 1.35; }
  .pick-name { font-size: 0.85rem; }
  .pick-card.locked { min-height: calc(var(--w) * 0.9); }
  .result-actions .btn { min-width: 0; }
}

@media (max-width: 1023px) and (max-height: 720px) {
  .player-row { --cw: min(calc((100cqi - 20px) / 5.4), 8.4dvh); }
  .player-row.wide { --cw: min(calc((100cqi - 25px) / 6.4), 8dvh); }
}

@media (max-width: 1023px) and (orientation: landscape) {
  .opp-row { --cw: min(calc((100cqi - 66px) / 7.3), 64px); }
  .opp-row.wide { --cw: min(calc((100cqi - 74px) / 9.3), 64px); }
  .player-row { --cw: min(calc((100cqi - 20px) / 5.4), 80px); }
  .player-row.wide { --cw: min(calc((100cqi - 25px) / 6.4), 76px); }
  .shop-row, .shop-row.five, .shop-row.six { --cw: min(calc((100cqi - 50px) / 6.4), 70px); }
}

html.booting body > :not(.boot) { visibility: hidden; }
.boot { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px; background: var(--bg); transition: opacity 0.28s ease; }
.boot.done { opacity: 0; pointer-events: none; }
.boot-bits { display: flex; gap: 8px; }
.boot-bits span { width: 14px; height: 14px; background: var(--cyan); box-shadow: 3px 3px 0 #000; animation: boot-hop 0.9s steps(3) infinite; }
.boot-bits span:nth-child(2) { background: var(--magenta); animation-delay: 0.15s; }
.boot-bits span:nth-child(3) { background: var(--gold); animation-delay: 0.3s; }
.boot-bits span:nth-child(4) { background: var(--cyan); animation-delay: 0.45s; }
.boot-word { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; color: var(--ink); text-shadow: 2px 2px 0 #5a1a52; }
@keyframes boot-hop { 0%, 60%, 100% { transform: translateY(0); } 30% { transform: translateY(-10px); } }
@media (prefers-reduced-motion: reduce) { .boot-bits span { animation: none; } }
