/* ==========================================================================
   Arena — lobby, deck editor, battle board, replays.
   ========================================================================== */

/* hero theme colours (used by deck tiles, hero cards and the board) */
[data-theme=shonen] { --hc: #ff7a3d; }
[data-theme=isekai] { --hc: #38bdf8; }
[data-theme=seinen] { --hc: #a970ff; }
[data-theme=shojo] { --hc: #ff6fb5; }
[data-theme=sport] { --hc: #3ddc97; }
[data-theme=mecha] { --hc: #9fb3c8; }

/* battle card: catalogue card + cost / attack / health / text ---------------- */
.bc { position: relative; container-type: inline-size; user-select: none; -webkit-user-select: none; }
.bc .card { pointer-events: none; }
.bc .card .cbot { visibility: hidden; }
.bc .card .cbadge { display: none; }
.bc-cost, .bc-atk, .bc-hp {
  position: absolute; z-index: 6; display: grid; place-items: center;
  width: 21cqw; height: 21cqw; font: 900 12cqw/1 var(--display); color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .8);
}
.bc-cost { left: -3cqw; top: -3cqw; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8fdcff, #1d6fd1 70%); box-shadow: 0 0 0 1.2cqw #0b2a4a, 0 2cqw 4cqw rgba(0, 0, 0, .5); }
.bc-atk { left: -3cqw; bottom: -3cqw; border-radius: 30%; background: radial-gradient(circle at 35% 30%, #ffd36b, #d97706 75%); box-shadow: 0 0 0 1.2cqw #4a2a05; }
.bc-hp { right: -3cqw; bottom: -3cqw; border-radius: 50% 50% 45% 45%; background: radial-gradient(circle at 35% 30%, #ff8a8a, #c81e3a 75%); box-shadow: 0 0 0 1.2cqw #4a0a16; }
.bc-text {
  position: absolute; z-index: 5; left: 5cqw; right: 5cqw; bottom: 9cqw; max-height: 36%;
  padding: 3cqw 4cqw; border-radius: 4cqw; overflow: hidden;
  background: rgba(6, 10, 18, .82); border: 1px solid rgba(255, 255, 255, .12);
  font-size: 6.6cqw; line-height: 1.25; text-align: center; color: #e8f4ff;
}
.bc-count { position: absolute; right: 3cqw; top: 3cqw; z-index: 6; padding: 1cqw 3cqw; border-radius: 99px; background: rgba(0, 0, 0, .7); font: 700 8cqw var(--mono); }
.bc.dim { filter: grayscale(.8) brightness(.6); }

/* lobby ---------------------------------------------------------------------- */
.arena-tuto { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.arena-top { display: grid; grid-template-columns: minmax(260px, 340px) 1fr; gap: 16px; }
.arena-rank .bar { margin: 10px 0 4px; }
.arena-rank-main { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 6px; font-size: 18px; }
.rank-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 99px; background: var(--surface2); font-weight: 700; font-family: var(--display); font-size: 14px; }
.rank-badge .stars { color: var(--gold); font-size: 11px; letter-spacing: 1px; }
.rank-badge[data-rank=bronze] { color: #e0a070; }
.rank-badge[data-rank=argent] { color: #d7e1ea; }
.rank-badge[data-rank=or] { color: var(--gold); }
.rank-badge[data-rank=platine] { color: #7ef0e0; }
.rank-badge[data-rank=diamant] { color: #8fc8ff; }
.rank-badge[data-rank=maitre] { color: #ff9b6b; background: linear-gradient(135deg, rgba(255, 120, 60, .2), rgba(169, 112, 255, .2)); }
.deck-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; margin-top: 12px; max-height: 300px; overflow: auto; padding: 2px; }
.deck-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.deck-tile {
  --hc: var(--accent);
  display: flex; flex-direction: column; gap: 2px; text-align: left; padding: 12px 14px; border-radius: var(--radius-sm); cursor: pointer;
  border: 1px solid var(--line); background: linear-gradient(135deg, color-mix(in srgb, var(--hc) 18%, transparent), var(--surface));
  border-left: 4px solid var(--hc); transition: transform .15s, border-color .15s, box-shadow .15s;
}
.deck-tile:hover { transform: translateY(-2px); }
.deck-tile.on { border-color: var(--hc); box-shadow: 0 0 0 2px color-mix(in srgb, var(--hc) 60%, transparent), 0 8px 30px color-mix(in srgb, var(--hc) 25%, transparent); }
.deck-tile.big { min-height: 96px; justify-content: center; }
.deck-tile.bad { opacity: .7; }
.warn { color: #ffb05c; }
.ok-text { color: var(--green); }
.arena-modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 16px; }
.mode-card { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 20px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--surface); }
.mode-card.ranked { background: linear-gradient(135deg, rgba(56, 189, 248, .16), rgba(169, 112, 255, .1)); border-color: rgba(56, 189, 248, .35); }
.mode-card .btn { margin-top: auto; }
.mode-ic { font-size: 30px; }
.queue-box { margin-top: 16px; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--surface3); border-top-color: var(--accent); animation: k-gem .8s linear infinite; display: inline-block; flex: none; }
.hero-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.hero-card { padding: 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: linear-gradient(160deg, color-mix(in srgb, var(--hc) 16%, transparent), var(--surface)); }
.hero-card b { color: var(--hc); }
.hero-power { display: flex; gap: 10px; align-items: center; margin-top: 10px; }
.hero-chip { color: var(--hc); font-weight: 700; }
.hist { padding: 6px 0; border-bottom: 1px solid var(--line); }
.hist.win b { color: var(--green); }
.hist.loss b { color: #ff7a7a; }

/* deck editor ------------------------------------------------------------------ */
.deck-editor { display: grid; grid-template-columns: 1fr 340px; gap: 18px; align-items: start; }
.de-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 14px; }
.de-card { position: relative; padding: 0; border: 0; background: none; cursor: pointer; transition: transform .15s; }
.de-card:hover { transform: translateY(-3px) scale(1.02); }
.de-card.full { opacity: .45; }
.de-have { position: absolute; left: 50%; top: -8px; transform: translateX(-50%); z-index: 8; padding: 1px 8px; border-radius: 99px; background: #0b1b2b; border: 1px solid var(--line2); font: 700 11px var(--mono); }
.de-deck { position: sticky; top: 80px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 100px); }
.de-name { width: 100%; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--line2); background: var(--surface); font: 700 16px var(--display); }
.de-heroes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hero-pick { display: flex; flex-direction: column; padding: 6px 8px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-align: left; }
.hero-pick b { font-size: 12px; color: var(--hc); }
.hero-pick small { font-size: 10px; color: var(--muted); }
.hero-pick.on { border-color: var(--hc); background: color-mix(in srgb, var(--hc) 18%, transparent); }
.de-curve { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; height: 70px; align-items: end; }
.de-curve div { position: relative; height: 70px; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; }
.de-curve i { display: block; width: 70%; min-height: 2px; border-radius: 4px 4px 0 0; background: var(--grad); }
.de-curve b { position: absolute; top: -2px; font-size: 10px; }
.de-curve span { font-size: 10px; color: var(--muted); }
.de-list { overflow: auto; flex: 1; min-height: 120px; display: flex; flex-direction: column; gap: 3px; }
.de-row { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 8px; border: 1px solid var(--line); border-left: 3px solid var(--r-C); background: var(--surface); cursor: pointer; text-align: left; font-size: 13px; }
.de-row[data-r=U] { border-left-color: var(--r-U); } .de-row[data-r=R] { border-left-color: var(--r-R); } .de-row[data-r=E] { border-left-color: var(--r-E); } .de-row[data-r=L] { border-left-color: var(--r-L); } .de-row[data-r=M] { border-left-color: var(--r-M); }
.de-row:hover { background: rgba(255, 90, 60, .12); }
.de-cost { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: #1d6fd1; font: 700 12px var(--display); flex: none; }
.de-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.de-actions .btn { flex: 1; }
.deck-cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; margin-top: 14px; }

/* match: full-screen board -------------------------------------------------------- */
body.in-match { overflow: hidden; }
body.in-match .tabbar { display: none; }
.arena-match:not(.replay) { position: fixed; inset: 0; z-index: 60; background: radial-gradient(1200px 600px at 50% 50%, #12304a 0%, #08121d 55%, #05080d 100%); }
.arena-match.replay { position: relative; height: min(820px, calc(100vh - 160px)); min-height: 560px; border-radius: var(--radius); overflow: hidden; background: radial-gradient(1000px 500px at 50% 50%, #12304a, #06090f); margin-top: 12px; }
.am-board { position: absolute; inset: 0; }
.am-tools { position: absolute; right: 12px; top: 12px; z-index: 20; display: flex; gap: 6px; }
.am-emotes { position: absolute; right: 0; top: 44px; display: flex; flex-direction: column; gap: 4px; padding: 8px; border-radius: 12px; background: rgba(8, 14, 22, .95); border: 1px solid var(--line2); }
.replay-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.bt { position: absolute; inset: 0; display: grid; grid-template-columns: 1fr 250px; grid-template-rows: 100%; overflow: clip; touch-action: none; }
.bt.spectate { touch-action: auto; }
.bt-field { position: relative; overflow: clip; display: grid; grid-template-rows: auto 1fr 56px 1fr auto 150px; padding: 10px 16px 0; min-width: 0; }
.bt-field::before { content: ''; position: absolute; left: 4%; right: 4%; top: 18%; bottom: 26%; border-radius: 40px; background: radial-gradient(ellipse at center, rgba(56, 189, 248, .07), transparent 70%); border: 1px solid rgba(125, 211, 252, .08); pointer-events: none; }
.bt-side { display: flex; align-items: center; gap: 16px; justify-content: center; position: relative; z-index: 2; }
.bt-side.foe { flex-direction: column; gap: 4px; }
.bt-hero-row { display: flex; align-items: center; gap: 14px; }
.bt-hero { --hc: var(--accent); position: relative; width: 74px; height: 74px; border-radius: 50%; padding: 4px; background: conic-gradient(from 200deg, var(--hc), transparent 60%, var(--hc)); transition: box-shadow .3s, transform .15s; }
.bt-hero.turn { box-shadow: 0 0 0 3px var(--hc), 0 0 30px color-mix(in srgb, var(--hc) 60%, transparent); }
.bt-portrait, .bt-portrait .avatar { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; font-size: 28px; }
.avatar.bot { display: grid; place-items: center; background: #13263a; }
.bt-hp { position: absolute; right: -6px; bottom: -6px; display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50% 50% 45% 45%; background: radial-gradient(circle at 35% 30%, #ff8a8a, #c81e3a 75%); font: 900 14px var(--display); box-shadow: 0 0 0 2px #4a0a16; }
.bt-hp.hurt { color: #ffe1e1; }
.bt-armor { position: absolute; left: -6px; bottom: -6px; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px 6px 50% 50%; background: linear-gradient(#cbd5e1, #64748b); color: #0b1220; font: 900 13px var(--display); }
.bt-pinfo { min-width: 150px; }
.bt-pinfo b { font-family: var(--display); font-size: 14px; }
.bt-away { color: #ffb05c; animation: k-pulse 1s infinite; }
.bt-mana { display: flex; align-items: center; gap: 3px; margin-top: 4px; }
.bt-mana i { width: 11px; height: 14px; clip-path: polygon(50% 0, 100% 30%, 100% 70%, 50% 100%, 0 70%, 0 30%); background: rgba(255, 255, 255, .1); }
.bt-mana i.full { background: linear-gradient(#8fdcff, #1d6fd1); box-shadow: 0 0 6px #38bdf8; }
.bt-mana i.used { background: rgba(56, 189, 248, .25); }
.bt-mana span { margin-left: 6px; font: 700 12px var(--mono); color: #8fdcff; }
.bt-power {
  --hc: var(--accent); display: grid; grid-template-columns: auto 1fr; grid-template-rows: auto auto; column-gap: 8px; align-items: center;
  max-width: 190px; padding: 6px 10px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(8, 16, 26, .8); text-align: left; cursor: pointer; color: var(--text);
}
.bt-power .bt-pcost { grid-row: span 2; }
.bt-power b { font-size: 12px; }
.bt-power small { font-size: 10px; color: var(--muted); line-height: 1.2; }
.bt-power.ok { border-color: #3ddc97; box-shadow: 0 0 14px rgba(61, 220, 151, .45); }
.bt-power.used { opacity: .45; }
.bt-power:disabled { cursor: default; }
.bt-pcost { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #8fdcff, #1d6fd1 70%); font: 900 13px var(--display); flex: none; }
.bt-piles { display: flex; gap: 10px; font: 600 12px var(--mono); color: var(--muted); }
.bt-hand-foe { display: flex; justify-content: center; height: 30px; }
.bt-hand-foe i { width: 22px; height: 30px; margin: 0 -4px; border-radius: 4px; background: linear-gradient(135deg, #1d8fe1, #0b2a4a); border: 1px solid rgba(255, 255, 255, .25); box-shadow: 0 2px 6px rgba(0, 0, 0, .5); }

.bt-row { position: relative; z-index: 2; display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 0; padding: 6px 0; }
.bt-row.drop { background: radial-gradient(ellipse at center, rgba(61, 220, 151, .14), transparent 70%); }
.bt-empty { color: var(--faint); font-size: 13px; border: 2px dashed var(--line2); border-radius: 16px; padding: 18px 26px; }
.bt-mid { display: flex; align-items: center; justify-content: center; gap: 14px; position: relative; z-index: 3; }
.bt-hint { display: flex; align-items: center; gap: 12px; }
.bt-endturn { min-width: 150px; }
.bt-tip { max-width: 420px; font-size: 13px; padding: 6px 12px; border-radius: 12px; background: rgba(255, 200, 61, .14); border: 1px solid rgba(255, 200, 61, .35); color: #ffe6a6; }
.bt-turn { font: 700 13px var(--display); color: var(--muted); }
.bt-rope { position: absolute; left: 8%; right: 8%; top: 50%; height: 4px; margin-top: -2px; border-radius: 4px; background: rgba(255, 255, 255, .05); opacity: 0; transition: opacity .3s; pointer-events: none; }
.bt-rope.on { opacity: 1; }
.bt-rope i { display: block; height: 100%; margin: 0 auto; border-radius: 4px; background: linear-gradient(90deg, #ff4d2e, #ffc83d, #ff4d2e); box-shadow: 0 0 12px #ff7a3d; transition: width .25s linear; }

/* minions */
.mn {
  --c: var(--r-C); position: relative; width: clamp(62px, 8.2vw, 104px); aspect-ratio: 3 / 4; flex: none;
  border-radius: 44% 44% 18px 18px; transition: transform .18s, box-shadow .2s, opacity .2s; cursor: default;
}
.mn[data-r=U] { --c: var(--r-U); } .mn[data-r=R] { --c: var(--r-R); } .mn[data-r=E] { --c: var(--r-E); } .mn[data-r=L] { --c: var(--r-L); } .mn[data-r=M] { --c: var(--r-M); }
.mn-art { position: absolute; inset: 0; border-radius: inherit; background-size: cover; background-position: center 20%; border: 3px solid var(--c); box-shadow: 0 6px 18px rgba(0, 0, 0, .55); }
.mn.taunt .mn-art { border-radius: 14px; border-width: 5px; border-color: #b8c4d2; box-shadow: 0 0 0 3px #4b5563, 0 6px 18px rgba(0, 0, 0, .55); }
.mn.taunt { border-radius: 14px; }
.mn.divine::after { content: ''; position: absolute; inset: -6px; border-radius: inherit; background: radial-gradient(ellipse at center, transparent 55%, rgba(255, 230, 120, .55)); border: 2px solid rgba(255, 220, 100, .9); box-shadow: 0 0 16px rgba(255, 210, 80, .7); pointer-events: none; animation: k-pulse 2s infinite; }
.mn.stealth .mn-art { filter: saturate(.4) brightness(.75); opacity: .65; }
.mn.ready { cursor: grab; }
.mn.ready .mn-art { box-shadow: 0 0 0 3px #3ddc97, 0 0 20px rgba(61, 220, 151, .7); }
.mn-atk, .mn-hp { position: absolute; bottom: -8px; z-index: 2; display: grid; place-items: center; width: 26px; height: 26px; font: 900 13px var(--display); color: #fff; text-shadow: 0 1px 2px #000; }
.mn-atk { left: -6px; border-radius: 30%; background: radial-gradient(circle at 35% 30%, #ffd36b, #d97706 75%); }
.mn-hp { right: -6px; border-radius: 50% 50% 45% 45%; background: radial-gradient(circle at 35% 30%, #ff8a8a, #c81e3a 75%); }
.mn-hp.hurt { color: #ffd0d0; }
.mn-atk.up { color: #b6ffd8; }
.mn-icons { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); display: flex; gap: 1px; font-size: 13px; z-index: 2; }
.mn-icons i { font-style: normal; filter: drop-shadow(0 1px 2px #000); }
.mn-zz { position: absolute; right: 2px; top: 6px; font-size: 14px; animation: k-pulse 1.6s infinite; z-index: 2; }
.mn-name { position: absolute; left: -6px; right: -6px; bottom: 16px; text-align: center; font-size: 9.5px; font-weight: 700; line-height: 1.1; text-shadow: 0 1px 3px #000, 0 0 2px #000; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; pointer-events: none; }
.mn.enter { animation: mn-enter .45s var(--ease); }
@keyframes mn-enter { from { transform: translateY(-30px) scale(1.35); opacity: 0; } 60% { transform: translateY(4px) scale(.96); opacity: 1; } }
.mn.shake, .bt-hero.shake { animation: bt-shake .35s; }
@keyframes bt-shake { 20% { transform: translateX(-5px) rotate(-2deg); } 40% { transform: translateX(5px) rotate(2deg); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.dying { animation: mn-die .8s forwards; pointer-events: none; }
@keyframes mn-die { 30% { filter: brightness(2) saturate(0); } to { opacity: 0; transform: scale(.7) translateY(10px); filter: brightness(2) blur(4px) saturate(0); } }

/* targeting */
.bt.targeting .tgt { cursor: crosshair; }
.bt.targeting .mn.tgt .mn-art, .bt.targeting .bt-hero.tgt { box-shadow: 0 0 0 3px #ff5a3c, 0 0 22px rgba(255, 90, 60, .8); }
.bt.targeting .mn.tgt:hover, .bt.targeting .bt-hero.tgt:hover { transform: scale(1.08); }
.mn.sel { transform: translateY(-8px) scale(1.06); }
.bt-arrow { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 30; overflow: visible; }
.bt-arrow path { fill: none; stroke: #ff5a3c; stroke-width: 6; stroke-linecap: round; stroke-dasharray: 2 12; filter: drop-shadow(0 0 6px rgba(255, 90, 60, .8)); animation: bt-dash .5s linear infinite; }
@keyframes bt-dash { to { stroke-dashoffset: -14; } }

/* hand */
.bt-hand { display: flex; justify-content: center; align-items: flex-end; padding-bottom: 0; position: relative; z-index: 10; }
.hc { position: relative; width: clamp(84px, 8.8vw, 128px); margin: 0 -10px; transform: translateY(calc(32% + var(--lift, 0px))) rotate(var(--rot, 0deg)); transform-origin: 50% 120%; transition: transform .2s var(--ease), filter .2s; cursor: pointer; }
.hc.ok .card .ci { box-shadow: 0 0 0 2px #3ddc97, 0 0 18px rgba(61, 220, 151, .6); }
.bt:not(.my-turn) .hc, .hc:not(.ok) { filter: brightness(.82); }
.hc:hover, .hc.sel { transform: translateY(-14%) scale(1.25) rotate(0deg); z-index: 20; filter: none; }
.hc.lifted { opacity: .3; }
.hc.back i { display: block; aspect-ratio: 5 / 7; border-radius: 8px; background: linear-gradient(135deg, #1d8fe1, #0b2a4a); }
.bt-ghost { position: absolute; left: 0; top: 0; z-index: 40; pointer-events: none; transition: none; margin: 0; filter: drop-shadow(0 12px 24px rgba(0, 0, 0, .6)); }

/* preview, log, effects */
.bt-preview { position: absolute; right: 270px; top: 50%; transform: translateY(-50%); z-index: 35; width: 220px; display: none; pointer-events: none; }
.bt-preview.left { right: auto; left: 20px; }
.bt-preview.on { display: block; animation: pop-in .15s var(--ease); }
.bt-help { margin-top: 10px; padding: 10px 12px; border-radius: 12px; background: rgba(6, 12, 20, .95); border: 1px solid var(--line2); font-size: 12px; display: flex; flex-direction: column; gap: 5px; }
@keyframes pop-in { from { opacity: 0; transform: translateY(-50%) scale(.92); } }
.bt-log { border-left: 1px solid var(--line); background: rgba(4, 8, 14, .55); display: flex; flex-direction: column; min-height: 0; padding-top: 56px; }
.bt-log-head { padding: 0 14px 8px; font: 700 12px var(--display); color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.bt-log-list { overflow: auto; padding: 0 14px 14px; display: flex; flex-direction: column; gap: 6px; font-size: 12.5px; }
.bt-log-list .mine { color: #bfe9ff; }
.bt-fx, .bt-layer { position: absolute; inset: 0; pointer-events: none; z-index: 45; }
.bt-layer > * { pointer-events: auto; }
.bt-pop { position: absolute; transform: translate(-50%, -50%); font: 900 26px var(--display); text-shadow: 0 2px 6px #000; animation: bt-pop 1.2s forwards; white-space: nowrap; }
.bt-pop.dmg { color: #ff5a5a; }
.bt-pop.heal { color: #5dffb0; }
.bt-pop.shield { color: #ffe27a; font-size: 18px; }
.bt-pop.buff { color: #8fdcff; font-size: 18px; }
@keyframes bt-pop { 0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); } 15% { opacity: 1; transform: translate(-50%, -50%) scale(1.25); } 70% { opacity: 1; } to { opacity: 0; transform: translate(-50%, -120%) scale(1); } }
.bt-banner { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 14px 40px; border-radius: 99px; background: linear-gradient(90deg, transparent, rgba(29, 143, 225, .85), transparent); font: 900 clamp(22px, 3vw, 34px) var(--display); white-space: nowrap; animation: bt-banner 1.5s forwards; }
.bt-banner.small { font-size: 18px; background: linear-gradient(90deg, transparent, rgba(20, 30, 45, .9), transparent); }
@keyframes bt-banner { from { opacity: 0; transform: translate(-50%, -50%) scale(.8); } 15%, 75% { opacity: 1; transform: translate(-50%, -50%) scale(1); } to { opacity: 0; } }
.bt-flash { position: absolute; left: 50%; bottom: 170px; transform: translateX(-50%); padding: 8px 18px; border-radius: 12px; background: rgba(200, 30, 58, .9); font-weight: 700; animation: bt-banner 1.4s forwards; }
.bt-reveal { position: absolute; left: 50%; top: 42%; width: 200px; transform: translate(-50%, -50%); animation: bt-reveal .3s var(--ease); filter: drop-shadow(0 20px 40px rgba(0, 0, 0, .7)); }
.bt-reveal.out { opacity: 0; transition: opacity .3s; }
@keyframes bt-reveal { from { opacity: 0; transform: translate(-50%, -30%) scale(.6); } }
.bt-emote { position: absolute; padding: 8px 14px; border-radius: 16px 16px 16px 4px; background: #f4f1ff; color: #111; font-weight: 700; font-size: 14px; animation: bt-banner 2.6s forwards; transform: none; white-space: nowrap; }

/* mulligan and end screen */
.bt-mull, .bt-end { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 20px; text-align: center; background: rgba(3, 6, 12, .82); backdrop-filter: blur(6px); }
.bt-mull-cards { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; margin: 10px 0; }
.bt-mull-card { position: relative; width: clamp(110px, 14vw, 170px); padding: 0; border: 0; background: none; cursor: pointer; transition: transform .2s; }
.bt-mull-card:hover { transform: translateY(-6px); }
.bt-mull-card > span { position: absolute; inset: 0; display: none; place-items: center; z-index: 9; font: 900 16px var(--display); color: #fff; background: rgba(200, 30, 58, .45); border-radius: 12px; }
.bt-mull-card.on > span { display: grid; }
.bt-mull-card.on .bc { filter: grayscale(.7); }
.bt-end h1 { font-size: clamp(40px, 7vw, 72px); }
.bt-end.win h1 { background: var(--gold-grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.bt-end.loss h1 { color: #ff7a7a; }
.bt-end-rew { display: flex; flex-direction: column; gap: 6px; align-items: center; font-size: 17px; }
.rank-up { font: 900 20px var(--display); color: var(--gold); }

/* small screens */
@media (max-width: 900px) {
  .arena-top, .arena-modes, .deck-editor { grid-template-columns: 1fr; }
  .de-deck { position: static; max-height: none; }
  .bt { grid-template-columns: 1fr; }
  .bt-log { position: absolute; right: 0; top: 0; bottom: 0; width: 260px; z-index: 50; display: none; background: rgba(4, 8, 14, .96); }
  .bt.show-log .bt-log { display: flex; }
  .bt-preview, .bt-preview.left { right: auto; left: 50%; top: 40%; transform: translate(-50%, -50%); width: 190px; }
  .bt-field { grid-template-rows: auto 1fr 46px 1fr auto 112px; padding: 6px 6px 0; }
  .bt-pinfo { min-width: 0; font-size: 12px; }
  .bt-power { max-width: 120px; padding: 4px 6px; }
  .bt-power small { display: none; }
  .bt-hero { width: 54px; height: 54px; }
  .bt-piles { display: none; }
  .bt-row { gap: 5px; }
  .mn { width: clamp(42px, 12.4vw, 70px); }
  .mn-name { display: none; }
  .mn-atk, .mn-hp { width: 20px; height: 20px; font-size: 11px; }
  .hc { width: clamp(64px, 18vw, 92px); margin: 0 -14px; }
  .bt-tip { font-size: 11px; max-width: 220px; }
  .bt-end { gap: 10px; }
  .am-tools { top: 40%; right: 4px; flex-direction: column; }
  .am-emotes { right: 44px; top: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mn.enter, .dying, .bt-pop, .bt-banner, .bt-arrow path { animation-duration: .01s !important; }
}
.lite .mn.divine::after, .lite .bt-arrow path { animation: none; }
.replay-bar select { width: auto; }

/* ==========================================================================
   Arena v2 board: two rows a side, Reserve and Tension, technique band, replies
   ========================================================================== */
.bc.v2 .bc-text { bottom: 31cqw; max-height: 28%; }
.bc-tech {
  position: absolute; z-index: 6; left: 4cqw; right: 4cqw; bottom: 17cqw; display: flex; align-items: center; gap: 3cqw;
  padding: 2cqw 3cqw; border-radius: 4cqw; background: linear-gradient(90deg, rgba(255, 200, 61, .92), rgba(217, 119, 6, .92));
  color: #1b1000; font: 800 6.4cqw/1.1 var(--body); box-shadow: 0 1cqw 3cqw rgba(0, 0, 0, .45);
}
.bc-tech b { display: grid; place-items: center; flex: none; width: 10cqw; height: 10cqw; border-radius: 50%; background: #1b1000; color: #ffd36b; font: 900 6.4cqw var(--display); }
.bc-tech span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bc-tech.reply { background: linear-gradient(90deg, rgba(169, 112, 255, .95), rgba(91, 52, 182, .95)); color: #fff; }
.bc-tech.reply b { color: #d9c4ff; }

.bt.v2 .bt-field { grid-template-rows: auto minmax(0, .85fr) minmax(0, 1fr) 52px minmax(0, 1fr) minmax(0, .85fr) auto 140px; padding-top: 6px; }
.bt.v2 .bt-row { padding: 3px 0; border-radius: 22px; }
.bt.v2 .bt-row.r-back { background: rgba(255, 255, 255, .025); }
.bt.v2 .bt-row.r-back .mn { width: clamp(50px, 5.8vw, 78px); }
.bt.v2 .mn { width: clamp(56px, 6.6vw, 88px); }
.bt-row-label { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); font: 700 10px var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--faint); pointer-events: none; }
.bt.v2 .bt-row.drop { background: radial-gradient(ellipse at center, rgba(61, 220, 151, .2), transparent 70%); }
.mn.awakened .mn-art { box-shadow: 0 0 0 3px #ffc83d, 0 0 22px rgba(255, 200, 61, .75); }
.mn.ready.awakened .mn-art { box-shadow: 0 0 0 3px #3ddc97, 0 0 0 6px #ffc83d, 0 0 22px rgba(61, 220, 151, .7); }
.mn-move { position: absolute; right: -8px; top: 30%; z-index: 3; width: 22px; height: 22px; padding: 0; border-radius: 50%; border: 1px solid var(--line2); background: rgba(6, 12, 20, .9); color: #bfe9ff; font-size: 13px; cursor: pointer; opacity: 0; transition: opacity .15s; }
.mn:hover .mn-move, .mn-move:focus-visible { opacity: 1; }
@media (hover: none) { .mn-move { opacity: 1; } }
.bt-reserve { display: inline-flex; gap: 3px; margin-left: 8px; padding-left: 8px; border-left: 1px solid var(--line2); }
.bt-reserve i { width: 11px; height: 11px; border-radius: 50%; background: rgba(255, 255, 255, .1); clip-path: none; }
.bt-reserve i.full { background: linear-gradient(#e6d4ff, #8b5cf6); box-shadow: 0 0 6px #a970ff; }
.bt-tension { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.bt-tension-bar { display: flex; gap: 3px; }
.bt-tension-bar i { width: 16px; height: 8px; border-radius: 4px; background: rgba(255, 255, 255, .1); }
.bt-tension-bar i.on { background: linear-gradient(90deg, #ffd36b, #ff7a3d); box-shadow: 0 0 6px rgba(255, 160, 61, .7); }
.bt-tension.full .bt-tension-bar i { animation: k-pulse 1.2s infinite; }
.bt-awaken:disabled { opacity: .45; }
.bt-choice { position: absolute; z-index: 48; width: 220px; display: none; }
.bt-choice.on { display: block; animation: pop-in-up .15s var(--ease); }
@keyframes pop-in-up { from { opacity: 0; transform: translateY(8px) scale(.96); } }
.bt-choice-box { display: flex; flex-direction: column; gap: 6px; padding: 12px; border-radius: 14px; background: rgba(6, 12, 20, .97); border: 1px solid var(--line2); box-shadow: 0 16px 40px rgba(0, 0, 0, .6); }
.bt-choice-box .btn { justify-content: space-between; }
.bt-window { display: flex; align-items: center; gap: 12px; padding: 8px 14px; border-radius: 16px; background: rgba(91, 52, 182, .35); border: 1px solid rgba(169, 112, 255, .6); box-shadow: 0 0 24px rgba(169, 112, 255, .35); }
.bt-window > b { font-family: var(--display); }
.bt-reveal-label { margin-bottom: 8px; padding: 4px 12px; border-radius: 99px; background: rgba(6, 12, 20, .9); font: 800 13px var(--display); text-align: center; color: #ffd36b; }
@media (max-width: 900px) {
  .bt.v2 .bt-field { grid-template-rows: auto minmax(0, .8fr) minmax(0, 1fr) 46px minmax(0, 1fr) minmax(0, .8fr) auto 104px; }
  .bt.v2 .mn { width: clamp(40px, 11vw, 64px); }
  .bt.v2 .bt-row.r-back .mn { width: clamp(36px, 9.5vw, 56px); }
  .bt-row-label { display: none; }
  .bt-window { flex-wrap: wrap; justify-content: center; font-size: 12px; }
  .bt-tension-bar i { width: 10px; }
}

/* the painted decor of the match (public/img/arena), drawn at random for each match */
.bt.v2.has-arena { background: linear-gradient(rgba(4, 7, 12, .6), transparent 18%, transparent 66%, rgba(4, 7, 12, .82) 86%), radial-gradient(120% 90% at 50% 50%, transparent 45%, rgba(4, 7, 12, .55)), var(--arena-img) center / cover no-repeat, #08121d; }
.bt.v2.has-arena .bt-field::before { display: none; }
.bt.v2.has-arena .bt-row { background: rgba(6, 10, 18, .32); border: 1px solid rgba(255, 255, 255, .13); backdrop-filter: blur(3px) saturate(1.2); -webkit-backdrop-filter: blur(3px) saturate(1.2); }
.bt.v2.has-arena .bt-row.r-back { background: rgba(6, 10, 18, .42); }
.bt.v2.has-arena .bt-row-label { color: rgba(255, 255, 255, .55); }
.bt.v2.has-arena .bt-hero { --hc: var(--arena-accent); }
.bt.v2.has-arena .bt-pinfo, .bt.v2.has-arena .bt-piles, .bt.v2.has-arena .bt-tension .tiny { text-shadow: 0 1px 3px #000, 0 0 8px rgba(0, 0, 0, .8); }
.bt.v2.has-arena .bt-log { background: rgba(4, 8, 14, .72); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }

/* the log folds into a thin bar and opens again */
.bt-log-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bt-log-toggle { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border-radius: 8px; border: 1px solid var(--line2); background: rgba(255, 255, 255, .06); color: var(--ink); font: 700 14px var(--body); cursor: pointer; }
.bt-log-toggle:hover { background: rgba(255, 255, 255, .14); }
.bt.v2 { transition: grid-template-columns .25s var(--ease); }
.bt.v2.log-min { grid-template-columns: 1fr 40px; }
.bt.v2.log-min .bt-log { cursor: pointer; padding-top: 64px; align-items: center; }
.bt.v2.log-min .bt-log-head { flex-direction: column; padding: 0; }
.bt.v2.log-min .bt-log-head span { writing-mode: vertical-rl; transform: rotate(180deg); margin-top: 10px; order: 2; }
.bt.v2.log-min .bt-log-list { display: none; }
.bt.v2.log-min .bt-preview { right: 60px; }
@media (max-width: 900px) {
  .bt.v2.log-min { grid-template-columns: 1fr; }
  .bt-log-toggle { display: none; }
}

/* deck editor: the sheet of a hovered card */
.card-sheet {
  position: fixed; z-index: 80; width: 300px; max-height: calc(100vh - 16px); overflow: auto; padding: 14px 16px; border-radius: 16px;
  background: rgba(8, 13, 22, .97); border: 1px solid var(--line2); box-shadow: 0 20px 50px rgba(0, 0, 0, .6);
  font-size: 13px; line-height: 1.45; color: var(--ink); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.card-sheet.on { opacity: 1; transform: none; }
.card-sheet h4 { margin: 12px 0 4px; font: 800 13px var(--display); text-transform: uppercase; letter-spacing: .04em; color: #bfe9ff; }
.card-sheet p { margin: 0 0 4px; }
.card-sheet ul { margin: 0; padding-left: 0; list-style: none; display: grid; gap: 4px; }
.card-sheet ul b { color: #fff; }
.cs-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cs-head b { font: 800 17px var(--display); }
.cs-r { padding: 2px 8px; border-radius: 99px; font-size: 11px; font-weight: 700; background: color-mix(in srgb, var(--c, var(--r-C)) 30%, transparent); color: #fff; }
.cs-r[data-r=C] { --c: var(--r-C); } .cs-r[data-r=U] { --c: var(--r-U); } .cs-r[data-r=R] { --c: var(--r-R); } .cs-r[data-r=E] { --c: var(--r-E); } .cs-r[data-r=L] { --c: var(--r-L); } .cs-r[data-r=M] { --c: var(--r-M); }
.cs-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; font: 700 13px var(--mono); }
.cs-sig { padding: 1px 8px; border-radius: 99px; background: linear-gradient(90deg, #ffd36b, #ff7a3d); color: #2a1200; font: 800 11px var(--body); }
.cs-sub { margin-top: 4px; color: var(--muted); font-size: 12px; }
.cs-cost { display: inline-grid; place-items: center; width: 18px; height: 18px; margin-left: 4px; border-radius: 50%; background: #ffd36b; color: #2a1200; font-size: 11px; }
.cs-muted { color: var(--muted); font-size: 12px; }
@media (hover: none) { .card-sheet { display: none; } }

/* the rope of the v2 board: a braided fuse burning from both ends toward the end-turn button,
   behind it, with a spark at each end; red for the last five seconds */
.bt.v2 .bt-mid .bt-hint { position: relative; z-index: 2; }
.bt.v2 .bt-rope { left: 3%; right: 3%; height: 8px; margin-top: -4px; background: none; z-index: 1; }
.bt.v2 .bt-rope i { position: relative; height: 100%; border-radius: 6px; background: repeating-linear-gradient(-55deg, #e2ad62 0 5px, #9c6a2c 5px 10px); box-shadow: 0 0 0 1px rgba(0, 0, 0, .45), 0 0 12px rgba(255, 140, 40, .35); }
.bt.v2 .bt-rope i::before, .bt.v2 .bt-rope i::after {
  content: ''; position: absolute; top: 50%; width: 16px; height: 16px; margin-top: -8px; border-radius: 50%;
  background: radial-gradient(circle, #fff7cc 0%, #ffc23d 30%, #ff5a1a 60%, transparent 72%); box-shadow: 0 0 16px 5px rgba(255, 120, 30, .75);
  animation: rope-spark .18s infinite alternate;
}
.bt.v2 .bt-rope i::before { left: -8px; }
.bt.v2 .bt-rope i::after { right: -8px; }
@keyframes rope-spark { from { transform: scale(.8) rotate(0deg); } to { transform: scale(1.25) rotate(45deg); } }
.bt.v2 .bt-rope.hot i { background: repeating-linear-gradient(-55deg, #ff8a4a 0 5px, #b3261e 5px 10px); box-shadow: 0 0 0 1px rgba(0, 0, 0, .45), 0 0 18px rgba(255, 60, 30, .8); }
.bt.v2 .bt-endturn.hurry { animation: end-hurry .8s ease-in-out infinite; }
@keyframes end-hurry { 50% { box-shadow: 0 0 0 3px rgba(255, 90, 40, .55), 0 0 26px rgba(255, 90, 40, .6); } }
@media (prefers-reduced-motion: reduce) { .bt.v2 .bt-rope i::before, .bt.v2 .bt-rope i::after, .bt.v2 .bt-endturn.hurry { animation: none; } }

/* hand of the v2 board: cards I cannot pay this turn are greyed, their cost in red */
.bt.v2 .hc.dim .bc .card { filter: grayscale(.9) brightness(.55); }
.bt.v2 .hc.dim .bc-text, .bt.v2 .hc.dim .bc-tech { filter: grayscale(.8) brightness(.75); }
.bt.v2 .hc.dim:hover .bc .card { filter: grayscale(.6) brightness(.75); }
.bt.v2 .hc.no-perso .bc-cost { background: radial-gradient(circle at 35% 30%, #ff9a9a, #c81e3a 70%); box-shadow: 0 0 0 1.2cqw #4a0a16, 0 2cqw 4cqw rgba(0, 0, 0, .5); }
.bt.v2 .hc.no-tech .bc-tech b { background: #c81e3a; color: #fff; }

/* Arena lobby: a game screen (player card, deck in the middle, big PLAY button) */
.lobby { position: relative; z-index: 2; border-radius: 26px; overflow: visible; border: 1px solid rgba(90, 160, 255, .25); padding: clamp(14px, 2.5vw, 26px); isolation: isolate;
  background: linear-gradient(180deg, rgba(4, 10, 24, .55), rgba(4, 10, 24, .92) 80%), var(--decor) center / cover; box-shadow: 0 30px 80px -30px rgba(0, 0, 0, .8); }
.lobby::after { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 70% at 50% 45%, rgba(61, 139, 255, .22), transparent 70%); pointer-events: none; }
.lobby-alert { display: block; margin-bottom: 12px; padding: 10px 14px; border-radius: 12px; background: rgba(255, 90, 60, .2); border: 1px solid rgba(255, 120, 80, .55); font-weight: 700; }
.lobby-alert.off { background: rgba(0, 0, 0, .5); border-color: var(--line2); }
.lobby-grid { display: grid; grid-template-columns: 230px 1fr 280px; gap: 18px; align-items: stretch; }
.lobby-player, .lobby-play { display: flex; flex-direction: column; gap: 8px; padding: 16px; border-radius: 20px; background: rgba(6, 12, 26, .72); border: 1px solid rgba(255, 255, 255, .08); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.lobby-player { align-items: center; text-align: center; }
.lobby-player .avatar.lg { width: 84px; height: 84px; font-size: 32px; }
.lobby-name { font: 800 22px var(--display); }
.lobby-rank .rank-badge { font-size: 16px; }
.lobby-rp { font-size: 13px; color: var(--muted); }
.lobby-rp b { font: 800 30px var(--display); color: var(--text); }
.lobby-player .bar { width: 100%; }
.lobby-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; width: 100%; margin-top: 6px; }
.lobby-stats span { padding: 6px 2px; border-radius: 10px; background: rgba(255, 255, 255, .05); font-size: 11px; color: var(--muted); }
.lobby-stats b { display: block; font: 800 16px var(--display); color: var(--text); }

.lobby-deck { --hc: var(--accent); display: grid; grid-template-columns: 44px 1fr 44px; align-items: center; gap: 6px; padding: 10px; border-radius: 22px;
  background: radial-gradient(70% 80% at 50% 40%, color-mix(in srgb, var(--hc) 26%, transparent), transparent 75%); }
.lobby-deck-main { display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; }
.lobby-deck-name { font: 800 clamp(22px, 3vw, 32px) var(--display); text-transform: uppercase; text-shadow: 0 4px 18px rgba(0, 0, 0, .7); }
.lobby-deck .eyebrow { color: var(--hc); }
.lobby-arrow { height: 64px; border-radius: 14px; border: 1px solid var(--line2); background: rgba(6, 12, 26, .6); color: var(--text); font-size: 30px; cursor: pointer; transition: background .15s, transform .15s; }
.lobby-arrow:hover { background: color-mix(in srgb, var(--hc) 30%, rgba(6, 12, 26, .6)); transform: scale(1.05); }
.lobby-fan { position: relative; height: 190px; width: 100%; margin-bottom: 18px; }
.lobby-fan img { position: absolute; left: 50%; bottom: 0; width: 120px; height: 168px; object-fit: cover; border-radius: 12px; border: 3px solid var(--c); box-shadow: 0 14px 30px rgba(0, 0, 0, .6), 0 0 22px color-mix(in srgb, var(--c) 45%, transparent);
  transform: translateX(calc(-50% + var(--k) * 70px)) translateY(calc(var(--k) * var(--k) * 14px)) rotate(calc(var(--k) * 10deg)); transform-origin: 50% 100%; transition: transform .3s; }
.lobby-fan img:nth-child(2) { z-index: 1; }
.lobby-deck:hover .lobby-fan img { transform: translateX(calc(-50% + var(--k) * 86px)) translateY(calc(var(--k) * var(--k) * 16px - 6px)) rotate(calc(var(--k) * 13deg)); }
.lobby-fan-empty { display: grid; place-items: center; height: 100%; font-size: 90px; opacity: .3; }

.lobby-modes { display: grid; gap: 6px; }
.lobby-mode { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 14px; border: 1px solid transparent; background: rgba(255, 255, 255, .04); color: var(--text); text-align: left; cursor: pointer; }
.lobby-mode .ic { font-size: 22px; }
.lobby-mode b { display: block; font-size: 15px; }
.lobby-mode small { color: var(--muted); font-size: 11.5px; }
.lobby-mode.on { border-color: rgba(90, 209, 250, .6); background: rgba(90, 209, 250, .12); }
.lobby-levels { display: flex; gap: 6px; justify-content: center; }
.lobby-go { margin-top: auto; padding: 18px; border: 0; border-radius: 18px; cursor: pointer; font: 800 34px/1 var(--display); letter-spacing: .08em; color: #2a1a00;
  background: linear-gradient(180deg, #ffe08a, #ffb21e); box-shadow: 0 0 0 2px rgba(255, 220, 140, .5) inset, 0 14px 40px -10px rgba(255, 178, 30, .8); animation: lobby-pulse 2.4s ease-in-out infinite; transition: transform .15s; }
.lobby-go:hover:not(:disabled) { transform: translateY(-2px) scale(1.02); }
.lobby-go:disabled { filter: grayscale(1); opacity: .5; animation: none; cursor: not-allowed; }
@keyframes lobby-pulse { 50% { box-shadow: 0 0 0 2px rgba(255, 220, 140, .5) inset, 0 14px 60px -6px rgba(255, 178, 30, 1); } }
.lobby-play > .tiny { text-align: center; }

.lobby-tuto { display: flex; align-items: center; gap: 14px; width: 100%; margin-top: 14px; padding: 14px 18px; border-radius: 18px; border: 1px solid rgba(90, 209, 250, .45); background: rgba(90, 209, 250, .1); color: var(--text); text-align: left; cursor: pointer; }
.lobby-tuto > span:first-child { font-size: 28px; }
.lobby-tuto small { display: block; color: var(--muted); }
.lobby-tuto .go { margin-left: auto; color: var(--accent); white-space: nowrap; }
.lobby-tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-top: 14px; }
.lobby-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 14px 8px; border-radius: 16px; border: 1px solid var(--line); background: var(--surface); color: var(--text); text-align: center; cursor: pointer; transition: transform .15s, border-color .15s; }
.lobby-tile:hover { transform: translateY(-3px); border-color: rgba(90, 209, 250, .5); }
.lobby-tile > span { font-size: 24px; }
.lobby-tile small { font-size: 11.5px; color: var(--muted); }
.lobby-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.lobby-hist, .lobby-lb { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--surface2); }
.lobby-hist > b { width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; font: 800 14px var(--display); background: rgba(255, 255, 255, .08); }
.lobby-hist.win > b { background: rgba(61, 220, 151, .25); color: #3ddc97; }
.lobby-hist.loss > b { background: rgba(255, 90, 90, .2); color: #ff8a8a; }
.lobby-hist small { display: block; color: var(--muted); font-size: 11.5px; }
.lobby-lb > b { width: 20px; text-align: center; color: var(--gold); }

.queue-screen { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; background: rgba(2, 6, 16, .82); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.queue-card { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 28px; }
.queue-card > b { font: 800 28px var(--display); }
.queue-ring { position: relative; width: 150px; height: 150px; border-radius: 50%; display: grid; place-items: center; margin-bottom: 8px; }
.queue-ring::before { content: ''; position: absolute; inset: 0; border-radius: 50%; border: 4px solid rgba(90, 209, 250, .15); border-top-color: var(--accent); animation: lobby-spin 1.1s linear infinite; }
.queue-ring span { font: 800 34px var(--display); }
@keyframes lobby-spin { to { transform: rotate(360deg); } }

@media (max-width: 1000px) {
  .lobby-grid { grid-template-columns: 1fr 1fr; }
  .lobby-deck { grid-column: 1 / -1; order: -1; }
}
@media (max-width: 640px) {
  .lobby-grid { grid-template-columns: 1fr; }
  .lobby-play { order: 0; }
  .lobby-player { order: 1; }
  .lobby-player { display: grid; grid-template-columns: auto 1fr; text-align: left; align-items: center; column-gap: 12px; }
  .lobby-player .avatar.lg { grid-row: span 3; width: 64px; height: 64px; }
  .lobby-player .bar, .lobby-player > .tiny, .lobby-stats { grid-column: 1 / -1; }
  .lobby-tiles { grid-template-columns: repeat(3, 1fr); }
  .lobby-cols { grid-template-columns: 1fr; }
  .lobby-fan img { width: 96px; height: 134px; }
  .lobby-fan { height: 150px; }
}

/* rank emblems and the rank table shown on hover */
.rank-emblem { flex: none; vertical-align: middle; filter: drop-shadow(0 2px 4px rgba(0, 0, 0, .5)); }
.rank-badge .rank-emblem { margin: -3px 0; }
.rank-tip { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; cursor: help; outline: none; }
.rank-tip > .rank-emblem { filter: drop-shadow(0 0 12px rgba(255, 255, 255, .25)) drop-shadow(0 6px 10px rgba(0, 0, 0, .6)); transition: transform .2s; }
.rank-tip:hover > .rank-emblem, .rank-tip:focus > .rank-emblem { transform: scale(1.08) rotate(-3deg); }
.rank-tip-panel { position: absolute; z-index: 30; top: calc(100% + 8px); left: -16px; width: min(440px, 92vw); translate: 0 6px; opacity: 0; visibility: hidden; transition: opacity .15s, translate .15s, visibility .15s;
  padding: 14px; border-radius: 16px; text-align: left; background: rgba(8, 14, 28, .98); border: 1px solid rgba(90, 160, 255, .35); box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .8); }
.rank-tip:hover .rank-tip-panel, .rank-tip:focus .rank-tip-panel, .rank-tip:focus-within .rank-tip-panel { opacity: 1; visibility: visible; translate: 0 0; }
.rank-tip-title { display: block; margin-bottom: 8px; font: 800 18px var(--display); }
.rank-tip-panel table { width: 100%; border-collapse: collapse; font-size: 13px; }
.rank-tip-panel th { text-align: left; font-size: 11px; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; padding: 0 6px 6px; }
.rank-tip-panel td { padding: 5px 6px; border-top: 1px solid rgba(255, 255, 255, .06); white-space: nowrap; }
.rank-tip-panel td:last-child { white-space: normal; color: var(--muted); }
.rank-tip-panel td:first-child { display: flex; align-items: center; gap: 6px; font-weight: 700; }
.rank-tip-panel tr.on td { background: rgba(90, 209, 250, .12); }
.rank-tip-panel ul { margin: 10px 0 0; padding-left: 16px; font-size: 12.5px; color: var(--muted); display: grid; gap: 3px; }
/* phones: the table opens below the rank when tapped, inside the card */
@media (max-width: 640px) {
  .lobby-player .rank-tip { grid-column: 1 / -1; }
  .rank-tip-panel { position: static; width: 100%; translate: none; display: none; margin-top: 6px; }
  .rank-tip:hover .rank-tip-panel, .rank-tip:focus .rank-tip-panel, .rank-tip:focus-within .rank-tip-panel { display: block; translate: none; }
  .rank-tip-panel td:last-child { font-size: 11.5px; }
}
/* phones: the hand shows more of each card (no hover to lift them), with a little more room */
@media (max-width: 640px) {
  .hc { transform: translateY(calc(12% + var(--lift, 0px))) rotate(var(--rot, 0deg)); }
  .bt.v2 .bt-field { grid-template-rows: auto minmax(0, .8fr) minmax(0, 1fr) 42px minmax(0, 1fr) minmax(0, .8fr) auto 118px; }
  .hc:hover:not(.sel) { transform: translateY(calc(12% + var(--lift, 0px))) rotate(var(--rot, 0deg)); }
}
