/* Cardbound 0.4: the playing cards, the table, the fight's hand tray and the
   Cardwright. Loaded after table-ui.css. Everything is in frame pixels.

   A card is sized by one number, --w; every measure inside it is a share of
   that, so the same markup is a 108px card in the hand, a 42px card in a
   sealed slot and a 50px card in the deck view. */

/* ================================= CARDS ================================= */

.pc {
  --w: 108px; --tilt: 0deg; --drop: 0px;
  position: relative; display: block; flex: none;
  width: var(--w); height: calc(var(--w) * 1.4);
  padding: 0; margin: 0; border: 0; border-radius: calc(var(--w) * .05);
  /* The face is a baked pixel sprite (table-art.js). */
  background: center / 100% 100% no-repeat;
  box-shadow: 0 calc(var(--w) * .035) 0 #8f8468, 0 calc(var(--w) * .1) calc(var(--w) * .07) #17101f88;
  rotate: var(--tilt); translate: 0 var(--drop);
  transition: translate .16s cubic-bezier(.25, 1.6, .6, 1), box-shadow .16s, filter .12s;
  user-select: none; -webkit-user-select: none;
}
button.pc { cursor: pointer; }

/* An inscription is a seal in the free corner: blue adds Might, red adds
   Mult, the way those colours read everywhere else at this table. */
.pc-seal {
  /* Pinned over the corner, half off the card, so it covers no pip. */
  position: absolute; top: calc(var(--w) * -.07); right: calc(var(--w) * -.07); z-index: 1;
  min-width: calc(var(--w) * .27); height: calc(var(--w) * .27); padding: 0 calc(var(--w) * .03);
  display: grid; place-items: center; border-radius: calc(var(--w) * .13);
  font: 400 calc(var(--w) * .17)/1 var(--display); color: #fff;
  background: var(--seal, #269bd4); box-shadow: 0 calc(var(--w) * .02) 0 var(--seal-lo, #166291), 0 0 0 1px #1f1b24;
}
.pc.m-steel { --seal: #269bd4; --seal-lo: #166291; }
.pc.m-ember { --seal: #e8574c; --seal-lo: #953e39; }
.pc.m-echo  { --seal: #9a6cd0; --seal-lo: #5f3d8a; box-shadow: calc(var(--w) * .05) calc(var(--w) * -.04) 0 -1px #d9cdee, calc(var(--w) * .05) calc(var(--w) * -.04) 0 1px #1f1b24, 0 calc(var(--w) * .035) 0 #8f8468, 0 calc(var(--w) * .1) calc(var(--w) * .07) #17101f88; }

/* Under a chosen card: does it score, or is it along for the ride. */
.pc-note {
  position: absolute; left: -8px; right: -8px; bottom: calc(var(--w) * -.25);
  font: 800 11px/1 var(--ui); letter-spacing: 1.6px; color: #f6d37c; text-shadow: 0 1px 0 #1d1427;
  pointer-events: none;
}
.pc-note.k { color: #b5aac2; }

.pc.on {
  translate: 0 calc(var(--drop) - 26px);
  box-shadow: 0 0 0 3px #f2c858, 0 calc(var(--w) * .035 + 3px) 0 #a2803a, 0 calc(var(--w) * .22) calc(var(--w) * .1) #17101f77;
}
.pc.on:not(.sc) { filter: saturate(.75) brightness(.93); }
.pc.dim { filter: saturate(.35) brightness(.72); }
.pc.gone { filter: saturate(.2) brightness(.55); }
@media (hover: hover) {
  button.pc:not(.on):hover { translate: 0 calc(var(--drop) - 7px); filter: brightness(1.04); }
}
button.pc:focus-visible { outline: 3px solid #ffda6b; outline-offset: 4px; }

/* Sizes. */
.pc.m { --w: 42px; }
.pc.s { --w: 45px; }
.pc.m .pc-note, .pc.s .pc-note, .pc.m .pc-seal, .pc.s .pc-seal { display: none; }
.pc.s.on { translate: 0 -6px; box-shadow: 0 0 0 3px #f2c858, 0 5px 0 #a2803a; }
/* Tiny: the fight's tray and one-line summaries, lapped like a held hand. */
.pc.t { --w: 25px; box-shadow: 0 2px 0 #8d8168; rotate: none; translate: none; }
.pc.t + .pc.t { margin-left: -7px; }

.pc-stack { position: relative; display: block; width: 74px; height: 104px; margin: 0 8px 8px 0; }
.pc-stack .pc { --w: 70px; position: absolute; left: 0; top: 0; }
.pc-stack .pc:nth-child(2) { left: 4px; top: 4px; }
.pc-stack .pc:nth-child(3) { left: 8px; top: 8px; }
.pc-stack-n { display: block; text-align: center; }
.pc-stack-n b { display: block; font: 400 34px/1 var(--display); color: #fff; text-shadow: 0 3px 0 #1f162a; }
.pc-stack-n small { display: block; font: 11px/1.2 var(--ui); color: #cae2cb; }

.menu-ornament .pc { --w: 137px; }
.menu-ornament .pc + .pc { position: absolute; left: 32px; top: 37px; rotate: -13deg; }

/* Suit colours as text, for rider lines on dark panels. */
.su0 { --suit: #9db6e8; } .su1 { --suit: #ff8f9b; } .su2 { --suit: #7fd6ae; } .su3 { --suit: #f4bd62; }
.rider { display: inline-flex; align-items: center; gap: 4px; color: var(--suit); font: 400 18px/1 var(--display); white-space: nowrap; }
.rider .suit { width: 13px; height: 13px; flex: none; }
.rider.off { opacity: .32; }

/* ================================ THE TABLE =============================== */

.tb { position: absolute; inset: 0; }
.tb-side {
  position: absolute; left: 18px; top: 18px; bottom: 18px; width: 280px; padding: 12px;
  display: flex; flex-direction: column; gap: 8px;
  background: #4b4652; border: 4px solid #9a94a1; border-radius: 4px; box-shadow: 0 6px 0 #292331;
}
.tb-blind { background: #3d8490; border-radius: 3px; padding: 9px 10px; text-align: center; }
.tb-blind.big { background: #c8934b; } .tb-blind.boss { background: #ba5a52; }
.tb-blind b { display: block; font: 400 31px/1 var(--display); color: #fff; text-shadow: 0 2px 0 #0004; }
.tb-blind span { display: block; margin-top: 4px; font: 11px/1.2 var(--ui); color: #eeebf2; letter-spacing: .5px; }

.tb-now { background: #37303e; border-radius: 3px; padding: 9px 8px 8px; text-align: center; }
.tb-now .label { font-size: 18px; color: #d0cad7; }
.tb-now h3 { font: 400 34px/1 var(--display); margin: 4px 0 3px; color: #fff; text-shadow: 0 3px 0 #211b29; white-space: nowrap; }
.tb-now h3.long { font-size: 28px; padding: 3px 0; }
.tb-now p { font: 11px/1.3 var(--ui); color: #d6d0dd; min-height: 14px; }
.tb-wells { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin-top: 8px; }
.tb-wells > div { border-radius: 3px; padding: 6px 4px 5px; background: #219ed9; box-shadow: 0 4px 0 #17618a; }
.tb-wells > div + div { background: #e8665a; box-shadow: 0 4px 0 #984138; }
.tb-wells span { display: block; font: 700 10px/1 var(--ui); color: #fff; letter-spacing: 1px; }
.tb-wells strong { display: block; font: 400 42px/1 var(--display); color: #fff; text-shadow: 0 3px 0 #0004; margin-top: 2px; }
.tb-wells small { display: block; font: 10px/1.1 var(--ui); color: #ffffffd0; margin-top: 1px; }

.tb-riders { background: #37303e; border-radius: 3px; padding: 7px 10px; display: grid; gap: 5px; }
.tb-riders > div { display: flex; align-items: center; gap: 8px; }
.tb-riders .rider { width: 78px; font-size: 20px; }
.tb-riders .rider .suit { width: 15px; height: 15px; }
.tb-riders em { font: normal 11px/1.2 var(--ui); color: #dbd6e1; }
.tb-riders em b { color: #fff; }
.tb-riders > div.off { opacity: .45; }

.tb-counts { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; text-align: center; }
.tb-counts > div { background: #37303e; border-radius: 3px; padding: 6px 4px 5px; }
.tb-counts span { display: block; font: 400 19px/1 var(--display); color: #dcd7e2; }
.tb-counts b { display: block; font: 400 42px/1 var(--display); color: #4abdf4; }
.tb-counts > div + div b { color: #fb756c; }

.meters { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.meter { background: #37303e; border-radius: 3px; padding: 6px 8px; display: flex; align-items: center; gap: 6px; color: var(--suit); }
.meter .suit { width: 15px; height: 15px; flex: none; }
.meter b { font: 400 18px/1 var(--display); color: #eae6ef; }
.meter .pips { display: flex; gap: 2px; margin-left: auto; }
.meter .pips i { width: 6px; height: 9px; border-radius: 2px; background: #261f2e; box-shadow: inset 0 0 0 1px #484250; }
.meter .pips i.on { background: var(--suit); box-shadow: none; }

.tb-gold { background: #37303e; border-radius: 3px; padding: 6px 12px; display: flex; align-items: center; justify-content: space-between; margin-top: auto; }
.tb-gold span { font: 400 22px/1 var(--display); color: #e7e4ec; }
.tb-gold strong { font: 400 40px/1 var(--display); color: var(--gold); text-shadow: 0 2px 0 #241f2b; }
.tb-sidebtns { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tb-sidebtns .btn { font-size: 22px; padding: 8px 6px 7px; }

.tb-main { position: absolute; left: 320px; right: 20px; top: 20px; bottom: 20px; }
.tb-head { position: absolute; left: 0; right: 0; top: 0; height: 46px; display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.tb-head h1 { text-transform: uppercase; font: 400 42px/1 var(--display); color: #f5f1df; text-shadow: 0 3px 0 #231a2e; }
.tb-head p { font: 12.5px/1.45 var(--ui); color: #dcebdc; text-align: right; max-width: 560px; }
.tb-head p b { color: #fff; }

/* The sealed hands, in the order they were made, and the pile beside them. */
.tb-slots { position: absolute; left: 0; right: 0; top: 54px; height: 180px; display: flex; gap: 12px; }
.tb-slot {
  --mw: 42px;
  flex: 1; min-width: 0; position: relative; padding: 8px 10px;
  border: 3px dashed #85719e; border-radius: 4px; background: #100b1580;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.tb-slots.four .tb-slot { --mw: 33px; padding: 8px 6px; }
.tb-slot .pc.m { --w: var(--mw); }
.tb-slot-head { display: flex; align-items: center; gap: 7px; width: 100%; height: 26px; }
.tb-slot-head kbd, .ht kbd {
  flex: none; min-width: 21px; height: 21px; padding: 0 4px; display: grid; place-items: center;
  border-radius: 2px; background: #2a2135; color: #dcebdc; box-shadow: 0 2px 0 #171120;
  font: 400 17px/1 var(--display);
}
.tb-slot-head b { font: 400 27px/1 var(--display); color: #fff; text-shadow: 0 2px 0 #1d1427; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-slots.four .tb-slot-head b { font-size: 22px; }
.tb-slot-head .lv { margin-left: auto; font: 400 17px/1 var(--display); color: #f6d37c; white-space: nowrap; }
.tb-slot-cards { display: flex; gap: 4px; justify-content: center; align-items: center; height: calc(var(--mw) * 1.4 + 6px); }
.tb-slot-nums { display: flex; gap: 6px; width: 100%; }
.tb-slot-nums span { flex: 1; border-radius: 2px; padding: 3px 4px 2px; text-align: center; font: 700 9px/1 var(--ui); letter-spacing: .8px; color: #fff; background: #219ed9; box-shadow: 0 3px 0 #17618a; }
.tb-slot-nums span + span { background: #e8665a; box-shadow: 0 3px 0 #984138; }
.tb-slot-nums b { display: block; font: 400 25px/1 var(--display); letter-spacing: 0; text-shadow: 0 2px 0 #0004; }
.tb-slot-riders { display: flex; gap: 10px; justify-content: center; min-height: 18px; margin-top: 2px; }
.tb-slot-riders .rider { font-size: 17px; }
.tb-slot.sealed { border-style: solid; border-color: #a091b4; background: #282033cc; box-shadow: 0 5px 0 #1d1528; }
.tb-slot.next { border-color: #f2c858; background: #2d2834cc; }
.tb-slot.open .tb-slot-head b { color: #c5bad2; }
.tb-slot-empty { flex: 1; display: grid; place-content: center; text-align: center; gap: 6px; }
.tb-slot-empty strong { font: 400 24px/1 var(--display); color: #cfe3d2; }
.tb-slot-empty span { font: 11.5px/1.4 var(--ui); color: #c0b6cc; max-width: 200px; }
.tb-slot.next .tb-slot-empty strong { color: #f6d98e; }
.tb-slot.next .tb-slot-cards .pc { opacity: .78; }

.tb-pile {
  flex: none; width: 112px; border: 0; background: none; padding: 6px 0 0; cursor: pointer; color: #fff;
  display: flex; flex-direction: column; align-items: center;
}
.tb-pile:focus-visible { outline: 3px solid #ffda6b; border-radius: 3px; }
@media (hover: hover) { .tb-pile:hover { filter: brightness(1.12); } }

.tb-relics {
  position: absolute; left: 0; right: 0; top: 244px; height: 64px; padding: 6px 10px;
  display: flex; align-items: center; gap: 9px;
  background: #100b15a6; border: 3px solid #826e9b; border-radius: 4px;
}
.tb-relics > .label { width: 86px; flex: none; font-size: 19px; line-height: .95; }
.tb-relics > .label small { display: block; font: 10px/1.2 var(--ui); color: #cfc6da; letter-spacing: 0; margin-top: 3px; }
.tb-relic-row { flex: 1; min-width: 0; display: flex; gap: 7px; align-items: center; }
.tb-relic {
  flex: none; width: 46px; height: 46px; display: grid; place-items: center; position: relative;
  background: color-mix(in srgb, var(--slot, #978aa8) 40%, #e9eddf); border: 3px solid #f8f6ed; border-radius: 2px; box-shadow: 0 3px 0 #a39cac;
}
.tb-relic canvas { max-width: 36px; max-height: 36px; }
.tb-relic.card-relic::after { content: ''; position: absolute; right: -4px; top: -4px; width: 11px; height: 11px; border-radius: 50%; background: #f2c858; box-shadow: 0 0 0 2px #2d203d; }
.tb-relic.empty { background: #100b1570; border: 2px dashed #907da9; box-shadow: none; }
.tb-relics p { font: 12px/1.4 var(--ui); color: #cde2d0; }

.tb-bar { position: absolute; left: 4px; right: 4px; top: 318px; height: 28px; display: flex; align-items: center; justify-content: space-between; font: 12px/1 var(--ui); color: #d5e8d8; }
.tb-bar b { color: #fff; }
.tb-sort { display: flex; align-items: center; gap: 7px; }
.tb-sort .btn { font-size: 19px; padding: 4px 10px 3px; --b: #5f5769; --b-lo: #3e3648; box-shadow: 0 3px 0 var(--b-lo); }
.tb-sort .btn.on { --b: var(--orange); --b-lo: var(--orange-lo); }

.tb-hand { position: absolute; left: 0; right: 0; top: 352px; height: 208px; padding-top: 30px; display: flex; justify-content: center; gap: 9px; }
.tb-hand.done .pc { filter: saturate(.45) brightness(.8); }
.tb-hand-empty { align-self: center; font: 13px/1.5 var(--ui); color: #cfe3d2; text-align: center; }

.tb-actions { position: absolute; left: 0; right: 0; bottom: 6px; height: 66px; display: flex; gap: 12px; align-items: stretch; }
.tb-actions .btn { font-size: 29px; padding: 8px 14px 7px; min-width: 0; }
.tb-actions .btn .sub { font-size: 11px; margin-top: 4px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
#tbBack { flex: none; width: 112px; font-size: 22px; }
#tbSuggest { flex: .8; --b: var(--orange); --b-lo: var(--orange-lo); font-size: 24px; }
#tbDiscard { flex: 1; --b: var(--red); --b-lo: var(--red-lo); }
#tbSeal { flex: 1.5; --b: var(--blue); --b-lo: var(--blue-lo); }
#tbFight { flex: 1.25; --b: #5f5769; --b-lo: #3e3648; }
#tbFight.ready { --b: var(--green); --b-lo: var(--green-lo); animation: tbReady 1.1s ease-in-out infinite; }
@keyframes tbReady { 50% { filter: brightness(1.18); } }

/* ============================ THE FIGHT'S TRAY ============================ */

#handTray { left: 322px; right: 150px; bottom: 15px; height: 44px; display: flex; gap: 8px; }
.ht {
  flex: 1; min-width: 0; max-width: 268px; height: 44px; position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 7px; padding: 0 8px 3px 7px;
  border: 2px solid #67577a; border-radius: 3px; background: #312343; box-shadow: 0 4px 0 #1d1427;
  color: #fff; text-align: left; cursor: pointer; pointer-events: auto;
  transition: filter .12s, border-color .12s;
}
.ht kbd { background: #21172d; }
.ht-cards { display: flex; gap: 2px; flex: none; }
.ht-txt { min-width: 0; flex: 1; }
.ht-txt b { display: block; font: 400 21px/1 var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-shadow: 0 2px 0 #0004; }
.ht-txt small { display: block; font: 400 17px/1 var(--display); white-space: nowrap; color: #cfe3d2; }
.ht-txt small i { font-style: normal; }
.ht-bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: #0000; }
.ht-bar i { display: block; height: 100%; width: 0; background: #f2c858; }
.ht.next { border-color: #f2c858; background: #3c2c4f; }
.ht.next kbd { background: #f2c858; color: #2b2410; box-shadow: 0 2px 0 #9a7a2c; }
.ht.live { border-color: #ffe08a; background: #6b5320; box-shadow: 0 4px 0 #3b2e12, 0 0 14px #f2c85866; }
.ht.used:not(.live) { filter: saturate(.3) brightness(.62); cursor: default; }
.ht.used kbd { visibility: hidden; }
.ht.wait { cursor: default; filter: brightness(.78); }
@media (hover: hover) { .ht:not(.used):not(.wait):hover { filter: brightness(1.15); } }
#frame.surging #arenaViewport { box-shadow: 0 0 0 6px #f2c858, 0 -6px 0 6px #6b5320, 0 6px 0 6px #6b5320, -6px 0 0 6px #6b5320, 6px 0 0 6px #6b5320, 0 0 30px 6px #f2c85888; }
/* The aim hint used to sit where the tray is: it moves into the arena's corner. */
#combatHint { left: auto; right: 34px; bottom: auto; top: 618px; font-size: 15px; color: #e1dce8b0; text-shadow: 0 1px 0 #000; }
#cbHandBadge.live { color: #ffe08a; }

/* The run sidebar's line about the deck, between fights. */
.side-battle .meters { margin-top: 6px; }
.side-battle .meter { background: #2d2734; padding: 5px 7px; }
.side-battle > b small { font: 12px var(--ui); color: #d0cad7; }

/* ====================== THE DECK, AND THE SHOP'S PACKS ==================== */

.modal-card.cb-deckmod { width: 1100px; gap: 0; display: block; overflow-y: auto; }
.cw-head { display: flex; align-items: center; gap: 18px; }
.cw-head h2 { font: 400 43px/1 var(--display); color: #fff; text-shadow: 0 3px 0 #231a2e; }
.cw-head .cb-kicker { font-size: 20px; color: #cfe3d2; display: block; }
.cw-money { margin-left: auto; text-align: right; font: 12px/1.2 var(--ui); color: #e3eddf; }
.cw-money b { display: block; font: 400 42px/1 var(--display); color: var(--gold); text-shadow: 0 2px 0 #241f2b; }
.cw-intro { font: 13px/1.55 var(--ui); color: #e1eadd; margin: 14px 0 12px; max-width: 980px; }
.cw-intro b { color: #fff; }
.cw-deck { display: grid; gap: 7px; max-height: 334px; overflow-y: auto; padding: 8px 4px 6px; scrollbar-width: thin; scrollbar-color: #a3b997 #3a3046; }
.cw-suitrow { display: flex; align-items: center; gap: 10px; }
.cw-suitrow > .rider { width: 90px; flex: none; font-size: 19px; }
/* Each card stands in a column a card and a gap wide. When a suit has more
   cards than the row has room, the columns narrow together and each card
   overhangs the next: the lap is the layout's, at any card size. The 0.4
   lap was worked out in JS for 45px cards on a 930px row and forgot the
   gap, so a row of 25 (the deck a flush builder makes) ran past the modal. */
.cw-suitrow { --cw: 45px; }
.cw-suitrow .pc.s { --w: var(--cw); }
.cw-suitrow > div {
  flex: 1; min-width: 0; padding-right: var(--cw);
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, calc(var(--cw) + 12px)); justify-content: start;
}
/* A craft out of a pack: what is chosen, and the button that works it. */
.cw-acts { display: flex; align-items: center; gap: 14px; margin-top: 10px; }
.cw-acts .btn { font-size: 28px; padding: 12px 34px 10px; --b: #8b6bb8; --b-lo: #5a4380; color: #fff; }
.cw-acts .picked { flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 52px; font: 12px/1.4 var(--ui); color: #e1eadd; }
.cw-acts .picked .pc { --w: 36px; }
.cw-does { margin-left: auto; font: 600 15px/1.3 var(--ui); color: #fff; text-align: right; }
.cb-deckmod > .pk-hands { margin-top: 10px; }
.cw-acts .picked .to, .pk-ex .to { font: 400 22px/1 var(--display); color: #f2c858; margin: 0 -2px; }

/* The shop's pack row has the shop's whole width (0.6: three deck packs sit
   beside the voucher and the relic pack, and a dropped one makes six). Its
   heading is one line over the row, in the room the shop had spare below. */
.shop-bottom { position: relative; height: 205px; }
.shop-bottom .sb-title { position: absolute; left: 0; right: 0; top: 1px; width: auto; padding: 0; display: flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.shop-bottom .sb-title h3 { margin: 0; font-size: 20px; }
.shop-bottom .sb-title p { overflow: hidden; text-overflow: ellipsis; }
.packs { padding-top: 46px; gap: 10px; }
/* Five fit at full size. A dropped pack or two narrows them all instead of
   lapping them (seven are 122px each); past that ui.js fanRow laps the rest. */
.packs .cw { flex: 0 1 158px; min-width: 118px; }
.packs .card { width: auto; }
.packs .cw:first-child .pack.voucher { margin-right: 6px; }
.packs .p-desc { font-size: 11.5px; }

/* What comes out of a card pack. Its picture is the cards it is about. */
.card.t-deck { --slot: #9181a6; }
.pk-ex { display: flex; align-items: center; justify-content: center; gap: 4px; }
.pk-ex .pc.s { --w: 45px; }
/* Under the open pack: the deck, two suits to a row, or the twelve hands. */
.pk-owned .cw-deck { flex: 1; min-width: 0; grid-template-columns: 1fr 1fr; align-content: center; gap: 8px 18px; max-height: none; padding: 0; overflow: visible; }
.pk-owned .cw-suitrow { --cw: 30px; gap: 6px; }
.pk-owned .cw-suitrow > .rider { width: 96px; font-size: 16px; }
.pk-hands { flex: 1; display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; align-content: center; }
.pk-hands span { padding: 6px 8px; border-radius: 3px; background: #261e30; font: 400 19px/1 var(--display); color: #d7d0df; }
.pk-hands span.up { color: #f6d37c; box-shadow: inset 0 0 0 2px #f2c85866; }
.pk-hands b { display: block; font: 600 11px/1.2 var(--ui); color: #fff; margin-bottom: 3px; white-space: nowrap; }
.pk-hands small { font: 10.5px/1 var(--ui); color: #b5aac2; margin-left: 6px; }

/* The hand guide. */
.cw-guide { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cw-guide > div { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; align-items: center; padding: 8px 10px; border-radius: 3px; background: #382f43; border: 2px solid #827593; }
.cw-guide .ex { display: flex; gap: 2px; grid-row: span 2; width: 106px; }
/* Direct children only: the example cards are spans with a <b> in them too,
   and took the label's white pixel type (they drew as blank cards). */
.cw-guide > div > b, .cw-guide > div > span > b { font: 400 24px/1 var(--display); color: #fff; }
.cw-guide > div > b small { font: 400 17px/1 var(--display); color: #f6d37c; margin-left: 6px; }
.cw-guide > div > span { font: 11.5px/1.2 var(--ui); color: #dbe8d8; }
.cw-rules { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.cw-rules > div { padding: 8px 10px; border-radius: 3px; background: #31283c; font: 11.5px/1.4 var(--ui); color: #dbe8d8; }
.cw-rules .rider { font-size: 21px; display: flex; margin-bottom: 3px; }
.cw-rules .rider .suit { width: 15px; height: 15px; }

@media (prefers-reduced-motion: reduce) { #tbFight.ready { animation: none; } }

/* ------------------------------- RUN OVER -------------------------------- */
/* The hands' row ends "+16.0K surged", which the 60px kills column wrapped. */
.dmg-row { grid-template-columns: 34px 130px 1fr 80px 104px; }
.dmg-row .dr-kills { white-space: nowrap; }
.dmg-row .pc.t { display: inline-block; vertical-align: middle; }

/* Cardbound 0.5: the ask, attunement and the rites. */
.rsuit { display: inline-flex; color: var(--suit); vertical-align: -1px; }
.rsuit .suit { width: 11px; height: 11px; }
.pill.slot .rsuit { margin-right: 4px; filter: drop-shadow(0 1px 0 #0006); }
.tb-relic .rsuit { position: absolute; right: -6px; top: -6px; padding: 2px; border-radius: 50%; background: #21172d; box-shadow: 0 0 0 1px #0006; }
.tb-relic.att { box-shadow: 0 0 0 2px #f2c858, 0 0 14px #f2c858aa; }
.tb-riders em small { display: block; font: 10px/1.2 var(--ui); color: #f2c858; }
.tb-wells > div.short, .tb-slot-nums span.short { background: #7d5a57; box-shadow: 0 4px 0 #4f3634; }
.tb-wells > div.met strong, .tb-slot-nums span.met b { color: #fff3c4; }
.tb-slot-nums span.short { box-shadow: 0 3px 0 #4f3634; }



/* ============================ 0.5: THINGS THAT MOVE ======================= */

/* The hand breathes. `transform` is free for it: the fan, the lift and the
   hover use rotate and translate. --ph is set from the clock (cardbound-ui.js)
   so choosing a card does not start every card's sway again. */
.tb-hand .pc { animation: pcFloat 3.4s ease-in-out infinite; animation-delay: var(--ph, 0s); }
@keyframes pcFloat { 0%, 100% { transform: translateY(-1.6px) rotate(-.55deg); } 50% { transform: translateY(1.6px) rotate(.55deg); } }
.menu-ornament .pc { animation: pcFloat 4.2s ease-in-out infinite; }

/* A well that fills like a vial. --fill is 0 to 1: at the table, how much of
   what the blind asks this hand pours; in the fight, how much surge is left. */
@property --fill { syntax: '<number>'; inherits: true; initial-value: 0; }
.liq { position: relative; overflow: hidden; isolation: isolate; }
.liq::before, .liq::after { content: ''; position: absolute; left: 0; right: 0; z-index: -1; pointer-events: none; }
.liq::before { bottom: 0; height: calc(var(--fill) * 100%); background: #ffffff30; }
.liq::after {
  bottom: calc(var(--fill) * 100%); height: 6px; opacity: min(1, var(--fill) * 40);
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 4' preserveAspectRatio='none' shape-rendering='crispEdges'%3E%3Cpath fill='%23fff' fill-opacity='.19' d='M0 4V2h4V1h4v1h4v1h4v1z'/%3E%3C/svg%3E") repeat-x 0 0 / 24px 6px;
  animation: liqWave 1.3s linear infinite;
}
@keyframes liqWave { to { background-position-x: 24px; } }

/* The tray sat on the old felt's green. */
.ht { border-color: #6b6375; background: #2e2835; box-shadow: 0 4px 0 #19141e; }
.ht kbd { background: #1a1620; }
.ht.next { background: #383142; }
.tb-slot-head kbd { background: #221d28; box-shadow: 0 2px 0 #110e15; }

/* 0.7: the frames are pixel art too, like the cards and the arena. The
   outline is four shadows offset a pixel-step each way, which leaves the
   corner step out (a notched corner, no image); a bevel inside; a hard lip
   under. Radii everywhere else are down to 2-4px for the same reason. */
.panel, .modal-card, .tb-side, .side, .table-hud-panel {
  border: 0; border-radius: 0;
  box-shadow:
    inset 0 3px 0 #ffffff17, inset 3px 0 0 #ffffff0c, inset 0 -3px 0 #0000002e, inset -3px 0 0 #0000001c,
    0 -3px 0 #958ea2, 0 3px 0 #958ea2, -3px 0 0 #958ea2, 3px 0 0 #958ea2,
    0 9px 0 #1c1724;
}
.inset, .tb-now, .tb-riders, .tb-slot { box-shadow: inset 0 3px 0 #00000033, inset 0 -2px 0 #ffffff0d; }
#arenaViewport {
  border-radius: 0;
  box-shadow: 0 0 0 6px #958ea2, 0 -6px 0 6px #1c1724, 0 6px 0 6px #1c1724, -6px 0 0 6px #1c1724, 6px 0 0 6px #1c1724, 0 20px 0 6px #0006;
}
#game { border-radius: 0; }
/* The pixel face sits a little left of its box: room so MIGHT and MULT are not cut. */
#scorebox .sb-well { padding-inline: 8px; }

/* ============================ 0.5: ON A PHONE ============================= */

/* The frame is 1280x720 scaled to the window, so a phone held sideways shows
   it at about half size: a 10px note at 5, a 44px button at 22. A touch
   screen gets the arena across the whole frame with the readouts laid over
   it (it was a window in the dashboard, two thirds the size), nothing to tap
   under 80 frame px, and no line of text under 16. Measure with __BA.fit and
   a 740x360 window: the audit that found these is in VALIDATION.md. */
@media (pointer: coarse) {
  #arenaViewport { left: 0; top: 0; transform: none; border-radius: 0; box-shadow: none; }
  #game { border-radius: 0; }
  #frame.surging #arenaViewport { box-shadow: none; outline: 6px solid #f2c858; outline-offset: -6px; }
  .table-hud-panel, #tableRunStats, #combatHint, #scorebox .sb-breakdown, #bpSub { display: none; }

  /* The left column, as glass over the floor. */
  #blindPlate, #clock, #scorebox { background: #16121bcc; border-color: #0000; }
  #blindPlate { left: 14px; top: 12px; width: 240px; height: auto; padding: 8px 10px; }
  #clock { left: 14px; top: 106px; width: 240px; height: auto; padding: 4px 10px 8px; }
  #clockTime { font-size: 40px; }
  #clockNote { font-size: 16px; }
  #scorebox { left: 14px; top: 176px; width: 240px; max-height: none; padding: 8px; }
  #scorebox .sb-well .label { font-size: 15px; }
  #loadout { left: 14px; top: 356px; width: 240px; padding: 0; background: none; }
  #hearts .hp-text { font-size: 18px; }

  /* Along the top: the relics, then pause and sound at a thumb's size. */
  #hudRight { left: 268px; right: 14px; top: 12px; }
  #relicSlots { max-width: 820px; }
  #hudBtns { gap: 8px; }
  #hudBtns .btn { width: 80px; height: 76px; padding: 0; font-size: 34px; }
  #hudBtns svg { width: 34px; height: 34px; }

  /* The sealed hands, under the right thumb's reach, beside the roll. */
  #handTray { left: 268px; right: 252px; bottom: 14px; height: 84px; gap: 10px; }
  .ht { max-width: none; height: 84px; }
  .ht .pc.t { --w: 32px; }
  .ht .pc.t + .pc.t { margin-left: -9px; }
  .ht-txt b { font-size: 27px; }
  .ht-txt small { font-size: 22px; }
  .ht-bar { height: 6px; }
  #xpBar { left: 268px; right: 252px; top: 608px; }
  #xpLevel { top: -24px; }
  #abil { right: 26px; bottom: 24px; gap: 16px; }
  #abil .ab { width: 92px; height: 92px; border-radius: 50%; }
  #abil .ab-ico { width: 64px; height: 64px; }
  #abil .ab[data-ab="1"] { width: 76px; height: 76px; margin-bottom: 58px; }
  #abil .ab[data-ab="1"] .ab-ico { width: 54px; height: 54px; }

  /* What was centred on the dashboard's window is centred on the frame. */
  #blindBanner { left: 360px; right: 360px; }
  .co { left: 310px; right: 310px; }
  #frame[data-screen="combat"] #combatHint { display: none; }
  #cbHandBadge { font-size: 20px; }
  #scorebox .sb-head { height: auto; }
  .bp-stats #bpMoney { font-size: 27px; }

  /* The title: the lines under the buttons, and the two small buttons. */
  .table-logo .tagline { font-size: 18px; }
  .table-menu-foot { left: 110px; right: 110px; top: 614px; }
  .table-menu-foot p { font-size: 16px; line-height: 1.4; max-width: 640px; }
  .table-menu-foot .btn { font-size: 26px; padding: 22px 18px 20px; }

  /* Choose your knight: the difficulty and BACK at a thumb's size. The number
     keys under the cards are for a keyboard. */
  .diff-row .btn.small { font-size: 22px; padding: 22px 18px 20px; min-width: 150px; }
  #btnKnightBack { font-size: 26px; padding: 20px 30px 18px; }
  .kcard .key { display: none; }
  .lv-kind .pill { font-size: 14px; }
  .ksel .lv-step { font-size: 15px; }

  /* Choose a blind: SELECT and SKIP at a thumb's size, the tag readable.
     The token gives up the room. */
  .bcard { height: 552px; }
  .bcard .bc-state { height: 72px; }
  .bcard .bc-state .btn { font-size: 34px; padding-top: 20px; padding-bottom: 18px; }
  .bcard .bc-state .label, .bcard .bc-tag .tg-name, .bcard .bc-tag .tg-desc, .bcard .bc-rule, .bcard .bc-warden { font-size: 15px; }
  .bcard .bc-tag .tg-desc { line-height: 1.25; }
  .bcard .bc-token { width: 76px; height: 76px; margin-top: 14px; }
  .bcard .bc-goal { font-size: 16px; margin-top: 12px; }
  .bcard .bc-or { font-size: 14px; margin: 10px 0 6px; }
  .bcard .bc-skip { margin-top: 8px; }
  #btnSkip { font-size: 24px; padding: 22px 22px 20px; }

  /* The table. Its heading and the paragraph beside it give their row to
     the hand (the Guide says the same); a suit the chosen cards do not hold
     gives its line to the ones they do. */
  .tb-head, .tb-riders > div.off, .tb-riders:not(:has(> div:not(.off))) { display: none; }
  .tb-side { gap: 7px; padding: 10px; }
  .tb-blind span, .tb-now p, .tb-riders em, .pc-stack-n small, .tb-slot-empty span, .pc-note { font-size: 15px; }
  .tb-wells span, .tb-wells small, .tb-riders em small, .tb-relics > .label small { font-size: 14px; }
  .tb-sidebtns .btn { font-size: 26px; padding: 21px 6px 19px; }
  .tb-slots { top: 0; height: 178px; }
  .tb-slot-nums span { font-size: 13px; }
  .tb-relics { top: 188px; }
  .tb-relics > .label { width: 210px; }
  .tb-bar { top: 258px; height: 60px; font-size: 15px; line-height: 1.25; gap: 14px; }
  .tb-sort { flex: none; }
  .tb-sort .btn { font-size: 24px; padding: 17px 20px 15px; }
  .tb-hand { top: 322px; height: 252px; padding-top: 32px; }
  .tb-actions { bottom: 0; height: 96px; }
  .tb-actions .btn { font-size: 32px; }
  .tb-actions .btn .sub { font-size: 16px; }

  /* The deck and a craft's card picker take the whole frame, and their
     cards are a fingertip wide (they were 22px on the glass). */
  .modal-card.cb-deckmod { width: 1256px; max-height: 704px; padding: 12px 18px; }
  .cw-head .cb-kicker { display: none; }
  .cw-intro { font-size: 16px; line-height: 1.4; }
  .cw-money, .cw-acts .picked, .cw-guide > div > span, .cw-rules > div { font-size: 15px; }
  .cw-does { font-size: 18px; }
  .cw-head .btn { font-size: 26px; padding: 22px 20px 20px; }
  .cw-suitrow { --cw: 68px; }
  .cw-suitrow > .rider { width: 96px; }
  .cw-deck { max-height: none; gap: 6px; padding: 6px 4px; }
  .cw-acts { margin-top: 8px; }
  .cw-acts .btn { font-size: 32px; padding: 22px 40px 20px; }

  /* The shop and the level-up cards: their text a size up (ui.js fitText
     steps a card that overflows back down), the shop's buttons a thumb's. */
  .shelf .card { width: 200px; }
  .shelf.tight .card { width: 168px; }
  .shelf .c-art { height: 52px; }
  .shelf .c-desc { font-size: 15px; line-height: 1.3; }
  .shelf .c-desc.dense { font-size: 13.5px; }
  .shelf .c-desc.denser { font-size: 12px; }
  .lv-cards .lvcard { width: 300px; }
  .lvcard .c-desc { font-size: 16px; line-height: 1.32; }
  .lvcard .c-desc.dense { font-size: 14.5px; }
  .lvcard .c-desc.denser { font-size: 13px; }
  .lv-foot .hint { display: none; }
  .packs .p-desc { font-size: 13.5px; }
  .side-note, .sr-label p, .shop-bottom .sb-title p, .side-blind .sbl-body p { font-size: 14px; }
  .shop-btns { padding-top: 4px; gap: 8px; }
  .shop-btns .cb-shop-entry { height: 64px; }
  .pk-skip .btn { min-height: 64px; min-width: 220px; font-size: 26px; }
  .pk-hands b { font-size: 14px; }
  .pk-hands small { display: block; margin: 3px 0 0; font-size: 14px; }
  .cb-deckmod .pk-hands small { display: inline; margin: 0 0 0 6px; }
  .shop-btns #btnShopMenu { height: 56px; font-size: 24px; }

  /* VERSIONS and LEADERBOARDS: the whole frame, a thumb's buttons. */
  .modal-card.vers { width: 1180px; max-height: 704px; padding: 14px 22px; }
  .modal-card.vers .fb-sub { font-size: 17px; line-height: 1.35; }
  .modal-card.vers .fb-foot .btn { min-height: 80px; font-size: 26px; padding: 0 30px; }
  .ver-list { max-height: 470px; }
  .ver-era { font-size: 24px; margin-top: 14px; }
  .ver-era span { font-size: 17px; }
  .ver-txt .news-v b { font-size: 22px; }
  .ver-txt .news-v span, .ver-txt p, .ver-row .hint { font-size: 17px; }
  .ver-row .btn { min-width: 220px; min-height: 80px; font-size: 26px; padding: 8px 18px; }
  .ver-row .btn .sub { font-size: 16px; }
  .boards .board-vers { gap: 8px; margin-bottom: 8px; }
  .boards .board-vers .bv { height: 72px; padding: 0 24px; border-radius: 36px; font-size: 22px; }
  .boards .board-vers .bv span { font-size: 16px; }
  .bd-one { height: 72px; font-size: 18px; }
  .bd-list { height: 264px; }
  .bd-list .board li { height: 52px; grid-template-columns: 34px minmax(0, 1fr) auto; font-size: 22px; }
  .bd-list .board .rk, .bd-list .board .far { font-size: 20px; }
  .bd-list .board-msg { font-size: 20px; }
}
