:root {
  --ink: #100B14;
  --cream: #F3E7D0;
  --magenta: #E22C6E;
  --plum: #4A1B5C;
  --cyan: #23C6C0;
  --gold: #EFB42B;
  --tangerine: #F07232;
  --display: 'Bevan', 'Rockwell', Georgia, serif;
  --text: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
  --mono: 'Azeret Mono', 'Courier New', monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--ink);
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  font-family: var(--text);
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: none;
}

[hidden] { display: none !important; }

#app {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--cream);
}

#stage {
  position: absolute;
  inset: 0;
  z-index: 1;
}

#stage canvas { display: block; }

#grain {
  position: fixed;
  inset: 0;
  z-index: 60;
  pointer-events: none;
  opacity: .55;
  mix-blend-mode: multiply;
  background-repeat: repeat;
  background-size: 220px 220px;
}

#app::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: 59;
  pointer-events: none;
  box-shadow: inset 0 0 0 3px var(--ink);
}

#flash {
  position: fixed;
  inset: 0;
  z-index: 64;
  background: #fff;
  opacity: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

#flash.on { animation: flash-frame .13s steps(1) both; }

@keyframes flash-frame {
  0% { opacity: .92; }
  55% { opacity: .5; }
  100% { opacity: 0; }
}

/* ---------- shared print furniture ---------- */

.display {
  font-family: var(--display);
  font-weight: 400;
  text-transform: uppercase;
  letter-spacing: .01em;
}

.mono {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -.04em;
}

.rule-gold {
  height: 3px;
  background: var(--gold);
  border: 0;
  box-shadow: 0 2px 0 var(--ink);
}

/* ---------- select screen ---------- */

#select {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: clamp(8px, 1.6vh, 18px);
  padding: max(14px, env(safe-area-inset-top)) clamp(12px, 3.4vw, 46px) max(10px, env(safe-area-inset-bottom));
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
}

.select-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-top: clamp(0px, 1.4vh, 16px);
  flex: 0 0 auto;
}

.logo-wrap {
  position: relative;
  padding-left: clamp(6px, 1.4vw, 22px);
  transform: rotate(-2.4deg);
  transform-origin: left top;
}

.logo-arrow {
  position: absolute;
  left: -6%;
  top: 46%;
  width: clamp(240px, 38vw, 560px);
  height: auto;
  z-index: 0;
  opacity: .92;
}

.logo {
  position: relative;
  z-index: 1;
  margin: 0;
  line-height: .76;
  font-size: clamp(46px, 8.6vw, 128px);
  letter-spacing: -.01em;
  color: var(--ink);
  text-shadow: 4px 4px 0 var(--cream), 8px 8px 0 rgba(226, 44, 110, .42);
}

.logo span { display: block; }

.logo .logo-b {
  color: var(--magenta);
  -webkit-text-stroke: clamp(1px, .16vw, 3px) var(--ink);
  text-shadow: 4px 4px 0 var(--cream), 9px 10px 0 rgba(16, 11, 20, .35);
  padding-left: .1em;
}

.logo-rule {
  position: relative;
  z-index: 1;
  height: 5px;
  width: min(78%, 560px);
  margin: 14px 0 0 6px;
  background: var(--gold);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(-1deg);
}

.tagline {
  position: relative;
  z-index: 1;
  margin: 10px 0 0 8px;
  font-family: var(--display);
  font-size: clamp(11px, 1.12vw, 17px);
  letter-spacing: .14em;
  color: var(--ink);
}

.select-note {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  margin-top: 8px;
  flex: 0 0 auto;
}

.select-note span {
  font-family: var(--mono);
  font-size: clamp(9px, .82vw, 12px);
  letter-spacing: .12em;
  background: var(--ink);
  color: var(--cream);
  padding: 4px 8px 3px;
  transform: rotate(1.4deg);
  box-shadow: 3px 3px 0 var(--plum);
}

.select-note span + span {
  background: var(--magenta);
  color: var(--cream);
  transform: rotate(-1.6deg);
}

#deck {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(8px, 1.2vw, 18px);
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  flex: 1 1 auto;
  align-content: center;
}

.stand-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-height: 0;
  padding: clamp(23px, 2.4vw, 32px) clamp(9px, 1vw, 15px) clamp(9px, 1vw, 14px);
  background: var(--cream);
  border: 3px solid var(--ink);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  box-shadow: 6px 6px 0 var(--plum);
  transition: transform .12s steps(2), box-shadow .12s steps(2), background .12s steps(2);
  overflow: hidden;
}

.stand-card::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid var(--gold);
  pointer-events: none;
  opacity: .85;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}

.stand-card .part {
  position: absolute;
  top: 0;
  left: 0;
  padding: 4px 9px 4px 7px;
  background: var(--ink);
  color: var(--cream);
  font-family: var(--mono);
  font-size: clamp(8px, .7vw, 11px);
  letter-spacing: .08em;
  clip-path: polygon(0 0, 100% 0, calc(100% - 9px) 100%, 0 100%);
}

.stand-card .sigil {
  width: clamp(30px, 3vw, 46px);
  height: clamp(30px, 3vw, 46px);
  color: var(--c, var(--magenta));
  margin-bottom: 2px;
}

.stand-card .sigil svg { width: 100%; height: 100%; display: block; }

.stand-card .user {
  font-family: var(--display);
  font-size: clamp(12px, 1.15vw, 19px);
  line-height: 1.02;
  letter-spacing: .01em;
  color: var(--ink);
}

.stand-card .stand {
  font-family: var(--display);
  font-size: clamp(11px, 1vw, 16px);
  line-height: 1;
  color: var(--c, var(--magenta));
  -webkit-text-stroke: .4px var(--ink);
  letter-spacing: .02em;
}

.stand-card .ability {
  margin-top: auto;
  padding-top: 5px;
  border-top: 2px solid var(--ink);
  font-family: var(--text);
  font-size: clamp(8px, .68vw, 11px);
  line-height: 1.15;
  color: var(--ink);
}

.stand-card .ability b {
  display: block;
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(8px, .68vw, 11px);
  letter-spacing: -.02em;
  color: var(--ink);
}

.stand-card .ability span { opacity: .78; }

.stand-card.dealt-you {
  background: var(--cream);
  transform: translateY(-5px) rotate(-1.2deg);
  box-shadow: 9px 10px 0 var(--magenta), 0 0 0 4px var(--ink);
}

.stand-card.dealt-rival {
  transform: translateY(-3px) rotate(1.2deg);
  box-shadow: 9px 10px 0 var(--tangerine), 0 0 0 4px var(--ink);
}

.stand-card.shuffling {
  background: #efe0c2;
  box-shadow: 9px 10px 0 var(--gold);
}

.stand-card .stamp {
  position: absolute;
  right: -3px;
  bottom: 22%;
  padding: 4px 8px 3px;
  font-family: var(--display);
  font-size: clamp(10px, .9vw, 14px);
  background: var(--magenta);
  color: var(--cream);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--ink);
  transform: rotate(-6deg);
  opacity: 0;
  pointer-events: none;
}

.stand-card.dealt-you .stamp-you,
.stand-card.dealt-rival .stamp-rival { opacity: 1; }

.stand-card.dealt-rival .stamp-rival { background: var(--tangerine); }

.select-foot {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: clamp(10px, 2vw, 28px);
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  padding-top: 4px;
  flex: 0 0 auto;
}

.deal-btn {
  position: relative;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1px;
  padding: clamp(11px, 1.3vw, 17px) clamp(22px, 2.6vw, 42px) clamp(10px, 1.2vw, 15px) clamp(18px, 2.2vw, 34px);
  background: var(--cream);
  border: 4px solid var(--ink);
  box-shadow: 7px 8px 0 var(--ink), 11px 13px 0 var(--magenta);
  clip-path: polygon(0 0, calc(100% - 20px) 0, 100% 20px, 100% 100%, 16px 100%, 0 calc(100% - 16px));
  color: var(--ink);
  cursor: pointer;
  transform: rotate(-1deg);
  transition: transform .08s steps(2), box-shadow .08s steps(2), background .08s steps(2);
  touch-action: manipulation;
}

.deal-btn .deal-word {
  font-family: var(--display);
  font-size: clamp(19px, 2.2vw, 34px);
  line-height: .92;
  letter-spacing: .01em;
}

.deal-btn .deal-sub {
  font-family: var(--mono);
  font-size: clamp(8px, .72vw, 11px);
  letter-spacing: .14em;
  opacity: .72;
}

.deal-btn .keycap {
  position: absolute;
  top: -13px;
  right: 12px;
  padding: 2px 6px;
  background: var(--gold);
  border: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: clamp(8px, .7vw, 10px);
  letter-spacing: .08em;
  transform: rotate(3deg);
}

.deal-btn:hover { background: #fff3dd; transform: translate(-1px, -2px) rotate(-1deg); }

.deal-btn:active,
.deal-btn.pressed {
  transform: translate(5px, 6px) rotate(-1deg);
  box-shadow: 2px 2px 0 var(--ink), 4px 4px 0 var(--magenta);
  background: var(--magenta);
  color: var(--cream);
}

.deal-btn:disabled { cursor: default; opacity: .75; }

.howto {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: clamp(6px, .9vw, 14px);
  font-family: var(--mono);
  font-size: clamp(8px, .72vw, 11px);
  letter-spacing: .02em;
  text-align: right;
  max-width: 52%;
}

.howto .knob {
  display: inline-block;
  min-width: 1.6em;
  padding: 2px 4px;
  margin-right: 3px;
  background: var(--ink);
  color: var(--cream);
  border: 1px solid var(--ink);
  text-align: center;
}

.howto .how {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  background: var(--cream);
  padding: 3px 7px;
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--plum);
}

/* ---------- battle hud ---------- */

.hud {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.battle-logo {
  position: absolute;
  left: 12px;
  top: 8px;
  font-size: clamp(18px, 1.7vw, 27px);
  line-height: .78;
  color: var(--ink);
  transform: rotate(-3deg);
  text-shadow: 3px 3px 0 var(--cream), 5px 5px 0 rgba(226, 44, 110, .5);
}

.battle-logo span { color: var(--magenta); -webkit-text-stroke: .8px var(--ink); }

.health-card {
  position: absolute;
  top: clamp(8px, 1.2vh, 16px);
  width: clamp(190px, 29vw, 440px);
  padding: 3px;
  background: var(--ink);
  clip-path: polygon(0 9%, 7% 0, 93% 0, 100% 9%, 100% 91%, 93% 100%, 7% 100%, 0 91%);
  filter: drop-shadow(6px 7px 0 rgba(74, 27, 92, .62));
}

.health-card.card-left { left: clamp(8px, 2vw, 30px); transform: rotate(-1.1deg); }
.health-card.card-right { right: clamp(8px, 2vw, 30px); transform: rotate(1.1deg); }

.hc-in {
  position: relative;
  padding: clamp(7px, .9vw, 12px) clamp(10px, 1.2vw, 18px) clamp(7px, .8vw, 11px);
  background: var(--cream);
  clip-path: polygon(0 9%, 7% 0, 93% 0, 100% 9%, 100% 91%, 93% 100%, 7% 100%, 0 91%);
  box-shadow: inset 0 0 0 1px var(--gold), inset 0 0 0 4px var(--cream);
}

.hc-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 3px;
}

.hc-user {
  font-family: var(--display);
  font-size: clamp(12px, 1.28vw, 22px);
  line-height: .95;
  letter-spacing: .01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hc-part {
  font-family: var(--mono);
  font-size: clamp(7px, .62vw, 10px);
  letter-spacing: .06em;
  padding: 1px 4px;
  background: var(--ink);
  color: var(--cream);
  flex: 0 0 auto;
}

.hp-row {
  display: flex;
  align-items: center;
  gap: 7px;
}

.hp-track {
  position: relative;
  flex: 1 1 auto;
  height: clamp(12px, 1.2vw, 19px);
  background: #d9c8aa;
  border: 2px solid var(--ink);
  overflow: hidden;
}

.hp-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  background: var(--magenta);
  transition: width .16s steps(5);
}

.card-right .hp-fill { background: var(--tangerine); }

.hp-fill::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(115deg, transparent 0 5px, rgba(16, 11, 20, .26) 5px 6px);
}

.hp-num {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(12px, 1.3vw, 21px);
  line-height: 1;
  min-width: 3ch;
  text-align: right;
}

.hp-track.hit { animation: track-hit .18s steps(2); }
@keyframes track-hit {
  0% { background: var(--cream); }
  50% { background: #fff; }
  100% { background: #d9c8aa; }
}

.stand-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 5px;
}

.stand-name {
  font-family: var(--display);
  font-size: clamp(8px, .82vw, 13px);
  letter-spacing: .03em;
  color: var(--plum);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 0 1 auto;
}

.meter {
  display: flex;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 40px;
  margin-left: auto;
  max-width: 46%;
}

.meter i {
  display: block;
  flex: 1 1 0;
  height: clamp(6px, .55vw, 9px);
  background: rgba(16, 11, 20, .16);
  border: 1px solid var(--ink);
}

.meter i.on { background: var(--cyan); }
.card-right .meter i.on { background: var(--gold); }

.meter.full i.on { background: var(--magenta); animation: meter-pulse .5s steps(2) infinite; }

@keyframes meter-pulse {
  0%, 100% { background: var(--magenta); }
  50% { background: var(--gold); }
}

.round-badge {
  position: absolute;
  left: 50%;
  top: clamp(4px, .7vh, 10px);
  transform: translateX(-50%) rotate(-2deg);
  width: clamp(62px, 6.2vw, 96px);
  height: clamp(62px, 6.2vw, 96px);
  background: var(--cream);
  border: 3px solid var(--ink);
  border-radius: 50%;
  box-shadow: 4px 5px 0 var(--plum);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
}

.round-badge::after {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid var(--gold);
  border-radius: 50%;
}

.rb-label {
  font-family: var(--mono);
  font-size: clamp(6px, .55vw, 9px);
  letter-spacing: .12em;
  line-height: 1;
}

.rb-time {
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(18px, 1.9vw, 30px);
  line-height: 1;
}

.rb-round {
  font-family: var(--mono);
  font-size: clamp(6px, .55vw, 9px);
  letter-spacing: .1em;
  line-height: 1;
  color: var(--magenta);
}

.battle-log {
  position: absolute;
  right: clamp(10px, 1.7vw, 26px);
  top: clamp(96px, 15vh, 150px);
  width: clamp(150px, 16vw, 250px);
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.log-head {
  align-self: flex-end;
  font-size: clamp(7px, .6vw, 9px);
  letter-spacing: .18em;
  background: var(--ink);
  color: var(--cream);
  padding: 2px 7px;
  transform: rotate(1.2deg);
}

#logList {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.log-entry {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  background: var(--cream);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 rgba(74, 27, 92, .55);
  padding: 4px 6px;
  font-family: var(--text);
  font-size: clamp(8px, .74vw, 11px);
  line-height: 1.18;
  animation: log-slam .16s steps(2) both;
}

.log-entry:nth-child(odd) { transform: rotate(-.5deg); }
.log-entry:nth-child(even) { transform: rotate(.5deg); }

.log-tab {
  flex: 0 0 auto;
  font-family: var(--mono);
  font-size: clamp(7px, .6vw, 9px);
  font-weight: 700;
  padding: 1px 3px;
  background: var(--ink);
  color: var(--cream);
  line-height: 1.2;
}

@keyframes log-slam {
  0% { transform: translateY(-8px) scale(1.04); opacity: 0; }
  100% { opacity: 1; }
}

/* ---------- controls ---------- */

.controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 clamp(10px, 2.4vw, 34px);
  pointer-events: none;
}

.move-cluster,
.action-cluster {
  display: flex;
  gap: clamp(6px, .7vw, 12px);
  pointer-events: auto;
}

.action-cluster {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
}

.key {
  position: relative;
  width: clamp(58px, 6.2vw, 88px);
  height: clamp(50px, 6.4vh, 66px);
  padding: 4px 5px 3px;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 5px 6px 0 var(--ink), 8px 9px 0 rgba(226, 44, 110, .5);
  clip-path: polygon(6% 0, 100% 0, 94% 100%, 0 100%);
  color: var(--ink);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  cursor: pointer;
  touch-action: none;
  transition: transform .06s steps(1), box-shadow .06s steps(1), background .06s steps(1);
  font-family: var(--text);
}

.key .icon {
  width: clamp(20px, 2.1vw, 30px);
  height: clamp(20px, 2.1vw, 30px);
  display: block;
}

.key .icon svg { width: 100%; height: 100%; display: block; }

.key .label {
  font-family: var(--display);
  font-size: clamp(7px, .62vw, 10px);
  letter-spacing: .04em;
  line-height: 1;
  text-align: center;
}

.key .cap {
  position: absolute;
  top: -11px;
  right: 5px;
  padding: 1px 4px;
  background: var(--gold);
  border: 2px solid var(--ink);
  font-family: var(--mono);
  font-weight: 700;
  font-size: clamp(7px, .58vw, 9px);
  line-height: 1.2;
  transform: rotate(3deg);
}

.key.pressed,
.key:active {
  background: var(--magenta);
  color: var(--cream);
  transform: translate(4px, 5px);
  box-shadow: 1px 1px 0 var(--ink), 2px 2px 0 rgba(74, 27, 92, .6);
}

.key.pressed .cap,
.key:active .cap { background: var(--cream); }

.key.ready {
  box-shadow: 5px 6px 0 var(--ink), 8px 9px 0 var(--magenta);
  animation: key-ready .6s steps(2) infinite;
}

@keyframes key-ready {
  0%, 100% { background: var(--cream); }
  50% { background: #ffe6ef; }
}

.key-move {
  width: clamp(52px, 5vw, 72px);
  height: clamp(46px, 5.2vh, 60px);
}

.key-move .icon {
  width: clamp(16px, 1.5vw, 22px);
  height: clamp(16px, 1.5vw, 22px);
}

@media (min-width: 900px) {
  .controls { justify-content: flex-start; }
  .action-cluster { left: 50%; }
}

/* ---------- round card and stamps ---------- */

.round-card {
  position: fixed;
  inset: 0;
  z-index: 72;
  background: var(--cream);
  box-shadow: inset 0 0 0 6px var(--ink);
  overflow: hidden;
}

.round-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--plum) 1.4px, transparent 1.5px);
  background-size: 13px 13px;
  opacity: .13;
  pointer-events: none;
}

.round-card.slam { animation: rc-slam .3s steps(3) both; }
.round-card.out { animation: rc-out .24s steps(2) both; }

@keyframes rc-slam {
  0% { transform: translateY(-104%); }
  66% { transform: translateY(2.2%); }
  100% { transform: translateY(0); }
}

@keyframes rc-out {
  0% { transform: translateY(0); }
  100% { transform: translateY(-104%); }
}

.rc-inner {
  position: absolute;
  inset: 0;
  padding: clamp(18px, 5vh, 60px) clamp(18px, 5vw, 80px);
}

.rc-top {
  font-size: clamp(9px, .8vw, 13px);
  letter-spacing: .4em;
  border-bottom: 2px solid var(--ink);
  padding-bottom: 6px;
  display: flex;
  justify-content: space-between;
}

.rc-round {
  position: absolute;
  left: clamp(18px, 6vw, 90px);
  top: 21%;
  font-size: clamp(34px, 5.4vw, 92px);
  line-height: .8;
  letter-spacing: .04em;
  transform: rotate(-2deg);
}

.rc-num {
  position: absolute;
  right: clamp(10px, 4vw, 70px);
  top: 6%;
  font-size: clamp(130px, 35vw, 500px);
  line-height: .78;
  color: var(--magenta);
  -webkit-text-stroke: clamp(1px, .18vw, 4px) var(--ink);
  text-shadow: clamp(3px, .5vw, 9px) clamp(3px, .5vw, 9px) 0 var(--gold);
  transform: rotate(3deg);
  letter-spacing: -.03em;
}

.rc-rule {
  position: absolute;
  left: clamp(18px, 6vw, 90px);
  right: clamp(18px, 6vw, 90px);
  top: 47%;
  height: 4px;
  background: var(--gold);
  border-top: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  transform: rotate(-.7deg);
}

.rc-names {
  position: absolute;
  left: clamp(18px, 6vw, 90px);
  bottom: clamp(60px, 15vh, 150px);
  font-size: clamp(15px, 2.1vw, 38px);
  max-width: 80%;
  line-height: 1.1;
}

.rc-names em { font-style: normal; color: var(--magenta); }

.rc-score {
  position: absolute;
  left: clamp(18px, 6vw, 90px);
  bottom: clamp(28px, 7vh, 70px);
  font-size: clamp(11px, .9vw, 15px);
  letter-spacing: .24em;
}

.rc-tag {
  position: absolute;
  right: clamp(18px, 5vw, 70px);
  bottom: clamp(24px, 6vh, 60px);
  font-family: var(--mono);
  font-size: clamp(8px, .7vw, 11px);
  letter-spacing: .2em;
  transform: rotate(2deg);
  background: var(--ink);
  color: var(--cream);
  padding: 4px 9px;
}

.stamp {
  position: fixed;
  left: 50%;
  top: 46%;
  z-index: 71;
  transform: translate(-50%, -50%) rotate(-6deg) scale(.4);
  font-family: var(--display);
  font-size: clamp(56px, 13vw, 190px);
  color: var(--magenta);
  -webkit-text-stroke: clamp(2px, .35vw, 6px) var(--ink);
  text-shadow: clamp(4px, .7vw, 12px) clamp(4px, .7vw, 12px) 0 var(--cream), clamp(8px, 1.2vw, 20px) clamp(8px, 1.2vw, 20px) 0 var(--ink);
  opacity: 0;
  pointer-events: none;
  white-space: nowrap;
}

.stamp.show { animation: stamp-slam .5s steps(3) both; }

@keyframes stamp-slam {
  0% { opacity: 0; transform: translate(-50%, -50%) rotate(-11deg) scale(2.4); }
  45% { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(.92); }
  60% { transform: translate(-50%, -50%) rotate(-6deg) scale(1.06); }
  100% { opacity: 1; transform: translate(-50%, -50%) rotate(-6deg) scale(1); }
}

/* ---------- result ---------- */

.result {
  position: fixed;
  inset: 0;
  z-index: 74;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(16, 11, 20, .55);
}

.result-card {
  position: relative;
  width: min(720px, 94vw);
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--cream);
  border: 5px solid var(--ink);
  box-shadow: 12px 13px 0 var(--magenta), 20px 22px 0 rgba(74, 27, 92, .6);
  clip-path: polygon(0 0, calc(100% - 32px) 0, 100% 32px, 100% 100%, 32px 100%, 0 calc(100% - 32px));
  padding: clamp(20px, 4vw, 44px);
  text-align: left;
  animation: result-slam .32s steps(3) both;
}

@keyframes result-slam {
  0% { transform: scale(1.25) rotate(-2deg); opacity: 0; }
  100% { transform: scale(1) rotate(0); opacity: 1; }
}

.result-kicker {
  font-size: clamp(9px, .85vw, 12px);
  letter-spacing: .3em;
  margin-bottom: 8px;
}

.result-title {
  margin: 0;
  font-size: clamp(42px, 8vw, 108px);
  line-height: .8;
  color: var(--magenta);
  -webkit-text-stroke: clamp(1px, .2vw, 3px) var(--ink);
  text-shadow: clamp(3px, .5vw, 8px) clamp(3px, .5vw, 8px) 0 var(--gold);
  transform: rotate(-2deg);
}

.result-title.lose { color: var(--plum); }

.result-sub {
  margin-top: 12px;
  font-family: var(--display);
  font-size: clamp(13px, 1.5vw, 20px);
}

.result-line {
  margin: 8px 0 0;
  font-size: clamp(12px, 1.1vw, 15px);
  line-height: 1.45;
  max-width: 60ch;
}

.result-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 0;
}

.stat {
  background: var(--ink);
  color: var(--cream);
  padding: 6px 10px 5px;
  font-family: var(--mono);
  font-size: clamp(9px, .8vw, 12px);
  letter-spacing: .04em;
}

.stat b { color: var(--gold); }

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 22px;
  align-items: center;
}

.deal-btn.small {
  padding: 12px 26px 10px 22px;
  box-shadow: 5px 6px 0 var(--ink), 8px 9px 0 var(--magenta);
}

.deal-btn.small .deal-word { font-size: clamp(16px, 1.7vw, 24px); }

.ghost-btn {
  background: transparent;
  border: 3px solid var(--ink);
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(14px, 1.4vw, 20px);
  padding: 10px 20px 8px;
  cursor: pointer;
  box-shadow: 4px 4px 0 var(--plum);
  touch-action: manipulation;
}

.ghost-btn:hover { background: var(--gold); }

/* ---------- pause ---------- */

.pause {
  position: fixed;
  inset: 0;
  z-index: 73;
  display: grid;
  place-items: center;
  background: rgba(243, 231, 208, .85);
}

.pause-card {
  background: var(--cream);
  border: 5px solid var(--ink);
  box-shadow: 10px 11px 0 var(--plum);
  padding: 26px 40px;
  text-align: center;
  transform: rotate(-1.4deg);
}

.pause-card .display { font-size: clamp(30px, 5vw, 60px); margin: 0 0 6px; }
.pause-card p { margin: 0; font-family: var(--mono); font-size: 11px; letter-spacing: .18em; }

/* ---------- narrow screens ---------- */

@media (max-width: 860px) {
  #select { gap: 8px; padding: 10px 10px max(8px, env(safe-area-inset-bottom)); }

  .select-note { display: none; }

  .logo { font-size: clamp(44px, 14vw, 96px); }
  .logo-arrow { width: 88%; opacity: .8; }
  .tagline { font-size: 9px; letter-spacing: .1em; margin-top: 7px; }

  #deck {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
    align-content: start;
    padding-bottom: 4px;
  }

  .stand-card { padding: 21px 8px 8px; box-shadow: 4px 4px 0 var(--plum); }
  .stand-card .sigil { width: 26px; height: 26px; }
  .stand-card .user { font-size: 11px; }
  .stand-card .stand { font-size: 10px; }
  .stand-card .ability { font-size: 8px; }
  .stand-card .ability b { font-size: 8px; }

  .select-foot { flex-direction: column; align-items: stretch; gap: 9px; }
  .deal-btn { align-self: center; }
  .howto { max-width: none; justify-content: center; font-size: 8px; gap: 5px; }
  .howto .how { padding: 2px 5px; }

  .battle-logo { display: none; }

  .health-card { width: 44.5vw; top: 42px; }
  .health-card.card-left { left: 6px; transform: rotate(-1deg); }
  .health-card.card-right { right: 6px; transform: rotate(1deg); }
  .health-card .hc-in { padding: 5px 7px 5px; }
  .hc-user { font-size: 9px; }
  .hc-part { display: none; }
  .hp-row { gap: 4px; }
  .hp-num { font-size: 11px; min-width: 2.4ch; }
  .hp-track { height: 11px; }
  .stand-line { gap: 4px; margin-top: 3px; }
  .stand-name { font-size: 7px; }
  .meter { gap: 1px; max-width: 50%; min-width: 26px; }
  .meter i { height: 5px; }

  .round-badge {
    top: 4px;
    width: auto;
    height: auto;
    min-width: 92px;
    border-radius: 0;
    flex-direction: row;
    gap: 5px;
    padding: 3px 8px;
    clip-path: polygon(6% 0, 100% 0, 94% 100%, 0 100%);
    box-shadow: 3px 3px 0 var(--plum);
  }
  .round-badge::after { display: none; }
  .rb-time { font-size: 15px; }

  .battle-log {
    top: 128px;
    right: 6px;
    width: 47vw;
    gap: 4px;
  }
  .log-entry { font-size: 8px; padding: 3px 5px; box-shadow: 2px 2px 0 rgba(74, 27, 92, .5); }
  .log-entry:nth-child(n+3) { display: none; }
  .log-head { font-size: 6px; padding: 1px 5px; }

  .controls {
    padding: 0 10px;
    bottom: max(8px, env(safe-area-inset-bottom));
  }

  .action-cluster {
    left: auto;
    right: 0;
    transform: none;
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 7px;
  }

  .key {
    width: clamp(55px, 15.5vw, 74px);
    height: clamp(55px, 15.5vw, 74px);
    box-shadow: 4px 4px 0 var(--ink), 6px 7px 0 rgba(226, 44, 110, .55);
  }

  .key .icon { width: 22px; height: 22px; }
  .key .label { font-size: 7px; }
  .key .cap { top: -8px; right: 3px; font-size: 6px; }

  .move-cluster {
    display: grid;
    grid-template-columns: repeat(2, auto);
    gap: 7px;
    align-self: flex-end;
  }

  .key-move { width: clamp(55px, 15vw, 70px); height: clamp(55px, 15vw, 70px); }
  .key-move .icon { width: 20px; height: 20px; }
  .key-move .label { display: none; }

  .result-card { box-shadow: 8px 9px 0 var(--magenta), 13px 14px 0 rgba(74, 27, 92, .6); }

  .rc-round { top: 24%; }
  .rc-rule { top: 44%; }
}

@media (max-width: 860px) and (orientation: landscape) {
  #select { overflow: hidden; }
  .select-head { margin-top: 0; }
  .logo { font-size: clamp(34px, 5.6vw, 58px); }
  .logo-arrow { width: 70%; }
  #deck {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-content: center;
  }
  .stand-card { padding: 19px 7px 6px; }
  .stand-card .sigil { display: none; }
  .stand-card .ability span { display: none; }
  .select-foot { flex-direction: row; align-items: flex-end; }
  .deal-btn { align-self: auto; }
  .howto { max-width: 55%; justify-content: flex-end; }
  .battle-log { top: 120px; }
}

@media (max-height: 520px) and (orientation: landscape) {
  .select-head { position: absolute; left: 10px; top: 6px; z-index: 2; }
  .logo { font-size: 34px; }
  .tagline { display: none; }
  .logo-rule { margin-top: 6px; }
  .select-note { display: none; }
  #select { padding-top: 8px; }
  #deck { padding-top: 70px; }
  .stand-card .ability { display: none; }
  .stand-card .sigil { display: none; }
  .select-foot { padding-bottom: 2px; }
  .deal-btn { padding: 8px 18px 7px 16px; }
  .deal-btn .deal-word { font-size: 16px; }
  .howto { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  #flash.on { animation-duration: .01s; }
  .stamp.show { animation-duration: .01s; }
  .stand-card, .deal-btn, .key { transition: none; }
}

/* ---------- character creator, deck of twelve, stand arrow ---------- */

#select {
  gap: clamp(8px, 1.2vh, 14px);
}

#select .logo {
  font-size: clamp(40px, 6.8vw, 104px);
}

#select .tagline {
  font-size: clamp(9px, .92vw, 13px);
  letter-spacing: .11em;
}

.select-main {
  display: flex;
  align-items: stretch;
  gap: clamp(10px, 1.5vw, 22px);
  width: 100%;
  max-width: 1520px;
  margin: 0 auto;
  flex: 0 0 auto;
}

.creator-card {
  position: relative;
  flex: 0 0 auto;
  width: min(560px, 45vw);
  display: flex;
  gap: 10px;
  padding: 9px;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--plum);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
}

.preview-card {
  position: relative;
  flex: 0 0 clamp(118px, 12vw, 176px);
  aspect-ratio: 400 / 520;
  overflow: hidden;
  border: 3px solid var(--ink);
  background: var(--cream);
  box-shadow: 4px 4px 0 var(--magenta);
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
}

.preview-card canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.preview-foot {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 4px 6px 5px;
  background: var(--ink);
  color: var(--cream);
  pointer-events: none;
}

.preview-name {
  font-size: clamp(10px, 1vw, 14px);
  line-height: .95;
  color: var(--cream);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preview-stand {
  font-size: clamp(6px, .5vw, 8px);
  letter-spacing: .06em;
  color: var(--gold);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.arrow-fx {
  position: absolute;
  left: 64%;
  top: -18%;
  width: 27%;
  height: auto;
  transform: rotate(38deg);
  transform-origin: 50% 80%;
  filter: drop-shadow(3px 3px 0 rgba(74, 27, 92, .45));
  animation: arrow-float 2.4s steps(2) infinite;
  pointer-events: none;
}

@keyframes arrow-float {
  0%, 100% { transform: translate(0, 0) rotate(38deg); }
  50% { transform: translate(0, -6px) rotate(38deg); }
}

.preview-card.striking .arrow-fx {
  animation: arrow-strike .85s steps(6) forwards;
}

@keyframes arrow-strike {
  0% { left: 64%; top: -18%; transform: rotate(38deg) scale(1); opacity: 1; }
  55% { left: 51%; top: 1%; transform: rotate(38deg) scale(.86); opacity: 1; }
  70% { left: 49%; top: 5%; transform: rotate(38deg) scale(1.08); opacity: 1; }
  100% { left: 47%; top: 9%; transform: rotate(38deg) scale(.5); opacity: 0; }
}

.preview-flash {
  position: absolute;
  inset: 0;
  background: #fff;
  opacity: 0;
  pointer-events: none;
}

.preview-card.striking .preview-flash {
  animation: preview-flash .55s steps(1) both;
}

@keyframes preview-flash {
  0% { opacity: .95; }
  28% { opacity: 0; }
  46% { opacity: .75; }
  100% { opacity: 0; }
}

.creator-form {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.field-label,
.opt-label {
  font-size: clamp(6px, .48vw, 8px);
  letter-spacing: .14em;
  opacity: .72;
}

#nameInput {
  width: 100%;
  padding: 4px 7px 3px;
  background: #fbf4e4;
  border: 3px solid var(--ink);
  color: var(--ink);
  font-family: var(--display);
  font-size: clamp(13px, 1.2vw, 19px);
  line-height: 1;
  text-transform: uppercase;
  outline: none;
  box-shadow: inset 2px 2px 0 rgba(74, 27, 92, .14);
}

#nameInput:focus {
  background: #fff9ea;
  box-shadow: inset 0 0 0 2px var(--gold);
}

.opt-row {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.opt-label {
  flex: 0 0 42px;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-width: 0;
}

.chip {
  padding: 2px 5px 2px;
  background: var(--cream);
  border: 2px solid var(--ink);
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(6px, .5vw, 8px);
  letter-spacing: .02em;
  line-height: 1.2;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 1px 1px 0 var(--plum);
  touch-action: manipulation;
}

.chip.on {
  background: var(--ink);
  color: var(--cream);
  box-shadow: 1px 1px 0 var(--magenta);
}

.swatch {
  width: clamp(16px, 1.5vw, 22px);
  height: clamp(16px, 1.5vw, 22px);
  padding: 0;
  border: 2px solid var(--ink);
  cursor: pointer;
  box-shadow: 1px 1px 0 rgba(74, 27, 92, .5);
  touch-action: manipulation;
}

.swatch.on {
  box-shadow: 0 0 0 2px var(--gold), 1px 1px 0 var(--ink);
  transform: translateY(-1px);
}

.deck-panel {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.deck-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.deck-head .display {
  font-size: clamp(12px, 1.25vw, 19px);
  color: var(--ink);
  text-shadow: 2px 2px 0 var(--cream);
}

.deck-head .mono {
  font-size: clamp(6px, .52vw, 9px);
  letter-spacing: .16em;
  background: var(--ink);
  color: var(--cream);
  padding: 2px 6px;
  transform: rotate(.6deg);
}

#deck {
  max-width: none;
  margin: 0;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  align-content: start;
}

#deck .stand-card {
  padding: 18px 7px 6px;
  box-shadow: 4px 4px 0 var(--plum);
  min-height: 0;
}

#deck .stand-card .part {
  font-size: clamp(6px, .5vw, 8px);
  padding: 3px 8px 3px 6px;
}

#deck .stand-card .sigil {
  position: absolute;
  right: 4px;
  bottom: 15px;
  width: clamp(26px, 2.6vw, 38px);
  height: clamp(26px, 2.6vw, 38px);
  margin: 0;
  opacity: .26;
  pointer-events: none;
}

#deck .stand-card .user {
  font-size: clamp(8px, .82vw, 13px);
  padding-right: 2px;
}

#deck .stand-card .stand {
  font-size: clamp(7px, .74vw, 11px);
}

#deck .stand-card .ability {
  padding-top: 4px;
  font-size: clamp(6px, .5vw, 8px);
  line-height: 1.05;
}

#deck .stand-card .ability b {
  font-size: clamp(6px, .52vw, 9px);
}

#deck .stand-card .ability span {
  display: none;
}

#deck .stand-card .legend {
  position: absolute;
  top: 0;
  right: 0;
  padding: 3px 8px 2px 11px;
  background: var(--gold);
  color: var(--ink);
  border-left: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: clamp(5px, .42vw, 7px);
  letter-spacing: .08em;
  clip-path: polygon(9px 0, 100% 0, 100% 100%, 0 100%);
}

#deck .stand-card.legendary {
  background: #f9efdb;
  box-shadow: 5px 5px 0 var(--gold);
}

#deck .stand-card.legendary::before {
  border-color: var(--magenta);
}

#deck .stand-card.legendary .sigil {
  opacity: .5;
}

#deck .stand-card.dealt-you {
  box-shadow: 7px 8px 0 var(--magenta), 0 0 0 3px var(--ink);
  transform: translateY(-3px) rotate(-1.2deg);
}

#deck .stand-card.dealt-rival {
  box-shadow: 7px 8px 0 var(--tangerine), 0 0 0 3px var(--ink);
  transform: translateY(-2px) rotate(1.2deg);
}

@media (max-width: 1180px) {
  .select-main { flex-direction: column; }
  .creator-card { width: 100%; max-width: none; }
  .preview-card { flex: 0 0 clamp(104px, 13vw, 150px); }
  #deck { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  #select .logo { font-size: clamp(38px, 12vw, 84px); }
  .select-main { gap: 8px; }
  .creator-card { padding: 7px; gap: 7px; box-shadow: 4px 4px 0 var(--plum); }
  .preview-card { flex: 0 0 104px; border-width: 2px; box-shadow: 3px 3px 0 var(--magenta); }
  .creator-form { gap: 3px; }
  .opt-label { flex-basis: 33px; font-size: 6px; }
  .chip { font-size: 6px; padding: 2px 3px; border-width: 1.5px; }
  .swatch { width: 15px; height: 15px; border-width: 1.5px; }
  .field-label { font-size: 6px; }
  #nameInput { font-size: 13px; padding: 3px 5px 2px; border-width: 2px; }
  #deck { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  #deck .stand-card { padding: 16px 5px 5px; box-shadow: 3px 3px 0 var(--plum); }
  #deck .stand-card .sigil { display: none; }
  #deck .stand-card .user { font-size: 8px; }
  #deck .stand-card .stand { font-size: 7px; }
  #deck .stand-card .legend { font-size: 5px; padding: 2px 5px 2px 8px; }
  .deck-head .display { font-size: 13px; }
  .deck-head .mono { font-size: 6px; }
  .select-foot {
    position: sticky;
    bottom: 0;
    z-index: 6;
    margin: 0 -10px;
    padding: 8px 10px max(8px, env(safe-area-inset-bottom));
    background: var(--cream);
    border-top: 3px solid var(--ink);
    box-shadow: 0 -4px 0 rgba(74, 27, 92, .25);
  }
  .howto { display: none; }
}

@media (max-width: 860px) and (orientation: landscape) {
  #select .logo { font-size: clamp(30px, 5vw, 52px); }
  .creator-card { width: 42%; flex: 0 0 42%; }
  .select-main { flex-direction: row; }
  .preview-card { flex: 0 0 80px; }
  #deck { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .select-foot { position: static; border-top: 0; box-shadow: none; padding-bottom: 0; }
}

/* ---------- granted stand overlay ---------- */

.grant-card {
  position: fixed;
  inset: 0;
  z-index: 73;
  display: grid;
  place-items: center;
  padding: 16px;
  background: var(--cream);
  box-shadow: inset 0 0 0 6px var(--ink);
  overflow: hidden;
}

.grant-card::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(var(--plum) 1.5px, transparent 1.6px);
  background-size: 15px 15px;
  opacity: .13;
  pointer-events: none;
}

.grant-inner {
  position: relative;
  width: min(1000px, 94vw);
  max-height: 92dvh;
  overflow-y: auto;
  padding: clamp(18px, 3.6vw, 48px);
  background: var(--cream);
  border: 5px solid var(--ink);
  box-shadow: 12px 14px 0 var(--magenta), 20px 22px 0 rgba(74, 27, 92, .5);
  clip-path: polygon(0 0, calc(100% - 34px) 0, 100% 34px, 100% 100%, 34px 100%, 0 calc(100% - 34px));
  animation: grant-slam .34s steps(3) both;
}

@keyframes grant-slam {
  0% { transform: translateY(18%) scale(1.14) rotate(-1deg); opacity: 0; }
  100% { transform: translateY(0) scale(1) rotate(0); opacity: 1; }
}

.grant-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ink);
  font-size: clamp(8px, .72vw, 11px);
  letter-spacing: .2em;
}

.grant-sigil {
  position: absolute;
  right: clamp(14px, 4vw, 54px);
  top: clamp(50px, 10vh, 100px);
  width: clamp(76px, 15vw, 190px);
  height: clamp(76px, 15vw, 190px);
  color: var(--stand, var(--magenta));
  opacity: .92;
  transform: rotate(4deg);
}

.grant-sigil svg { width: 100%; height: 100%; display: block; }

.grant-stand {
  position: relative;
  margin: clamp(14px, 3vh, 30px) 0 0;
  max-width: 80%;
  font-size: clamp(40px, 8.2vw, 124px);
  line-height: .8;
  color: var(--stand, var(--magenta));
  -webkit-text-stroke: clamp(1px, .16vw, 3px) var(--ink);
  text-shadow: clamp(3px, .5vw, 8px) clamp(3px, .5vw, 8px) 0 var(--gold);
  transform: rotate(-2deg);
  letter-spacing: -.01em;
}

.grant-user {
  margin-top: clamp(10px, 1.6vh, 18px);
  font-size: clamp(14px, 1.8vw, 28px);
  color: var(--ink);
  letter-spacing: .03em;
}

.grant-rule {
  width: min(70%, 560px);
  margin: clamp(12px, 2vh, 22px) 0;
}

.grant-ability {
  font-family: var(--display);
  font-size: clamp(18px, 2.3vw, 34px);
  line-height: .95;
  color: var(--ink);
}

.grant-desc {
  max-width: 54ch;
  margin: 6px 0 0;
  font-family: var(--text);
  font-size: clamp(12px, 1.1vw, 16px);
  line-height: 1.4;
}

.grant-badge {
  display: inline-block;
  margin-top: clamp(10px, 1.8vh, 18px);
  padding: 5px 11px 4px;
  background: var(--ink);
  color: var(--gold);
  font-size: clamp(8px, .72vw, 11px);
  letter-spacing: .24em;
}

.grant-badge.ordinary {
  background: var(--plum);
  color: var(--cream);
}

.grant-fight {
  display: flex;
  margin-top: clamp(18px, 3vh, 30px);
}

@media (max-width: 860px) {
  .grant-inner { box-shadow: 8px 9px 0 var(--magenta), 13px 14px 0 rgba(74, 27, 92, .5); }
  .grant-stand { max-width: 100%; }
  .grant-sigil { opacity: .35; width: 78px; height: 78px; }
}

@media (prefers-reduced-motion: reduce) {
  .arrow-fx { animation: none; }
  .preview-card.striking .arrow-fx { animation: none; opacity: 0; }
  .preview-card.striking .preview-flash { animation-duration: .01s; }
}

/* mobile battle log shows the newest two entries */
@media (max-width: 860px) {
  .log-entry:not(:nth-last-child(-n+2)) { display: none; }
}

/* ---------- epic stand cards ---------- */

#deck .stand-card.epic {
  background: #f9e9ef;
  box-shadow: 5px 5px 0 var(--magenta);
}

#deck .stand-card.epic::before { border-color: var(--cyan); }

#deck .stand-card.epic .legend {
  background: var(--magenta);
  color: var(--cream);
}

#deck .stand-card.epic .sigil { opacity: .45; }

/* keep the arrow button reachable when the deck is long */
.select-foot {
  position: sticky;
  bottom: 0;
  z-index: 7;
  margin: 0 auto;
  padding: 8px 0 max(8px, env(safe-area-inset-bottom));
  background: var(--cream);
  border-top: 3px solid var(--ink);
  box-shadow: 0 -4px 0 rgba(74, 27, 92, .2);
}

/* ---------- big walkable map ---------- */

.map-hud {
  position: fixed;
  inset: 0;
  z-index: 30;
  pointer-events: none;
}

.map-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: max(8px, env(safe-area-inset-top)) clamp(10px, 1.8vw, 28px);
}

.map-who {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
  max-width: 30vw;
  padding: 7px 12px 8px;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 5px 5px 0 var(--plum);
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  transform: rotate(-.8deg);
}

.map-kicker {
  font-size: clamp(6px, .5vw, 8px);
  letter-spacing: .16em;
  opacity: .65;
}

.map-name {
  font-size: clamp(14px, 1.5vw, 24px);
  line-height: .95;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-stand {
  font-size: clamp(7px, .62vw, 10px);
  letter-spacing: .04em;
  color: var(--magenta);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.map-centre {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 5px 13px 6px;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 4px 5px 0 var(--gold);
  clip-path: polygon(5% 0, 100% 0, 95% 100%, 0 100%);
  transform: rotate(.5deg);
}

.map-title {
  font-size: clamp(12px, 1.15vw, 18px);
  line-height: 1;
  letter-spacing: .1em;
}

.map-pips {
  display: flex;
  gap: 3px;
}

.map-pip {
  width: clamp(13px, 1.25vw, 19px);
  height: clamp(13px, 1.25vw, 19px);
  display: grid;
  place-items: center;
  background: #e4d3b6;
  border: 2px solid var(--ink);
  font-family: var(--mono);
  font-size: clamp(5px, .42vw, 7px);
  line-height: 1;
  color: var(--ink);
}

.map-pip.done {
  background: var(--magenta);
  color: var(--cream);
}

.map-pip.near {
  background: var(--gold);
  box-shadow: 0 0 0 2px var(--ink);
}

.map-count {
  font-size: clamp(7px, .6vw, 9px);
  letter-spacing: .14em;
}

.map-edit {
  pointer-events: auto;
  padding: 7px 10px 6px;
  background: var(--ink);
  color: var(--cream);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--plum);
  font-size: clamp(7px, .6vw, 10px);
  letter-spacing: .12em;
  cursor: pointer;
  transform: rotate(1deg);
  touch-action: manipulation;
}

.map-edit:hover { background: var(--magenta); }

.map-help {
  position: fixed;
  left: 50%;
  bottom: max(10px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  padding: 4px 10px 3px;
  background: var(--ink);
  color: var(--cream);
  font-size: clamp(7px, .62vw, 10px);
  letter-spacing: .14em;
  white-space: nowrap;
  clip-path: polygon(5% 0, 100% 0, 95% 100%, 0 100%);
}

.map-prompt {
  position: fixed;
  left: 50%;
  bottom: clamp(92px, 15vh, 138px);
  transform: translateX(-50%) rotate(-.6deg);
  z-index: 46;
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.4vw, 18px);
  padding: 8px clamp(10px, 1.6vw, 18px) 9px;
  background: var(--cream);
  border: 3px solid var(--ink);
  box-shadow: 6px 7px 0 var(--magenta);
  clip-path: polygon(0 0, calc(100% - 18px) 0, 100% 18px, 100% 100%, 18px 100%, 0 calc(100% - 18px));
  pointer-events: auto;
  max-width: 94vw;
}

.map-prompt-kicker {
  font-size: clamp(6px, .5vw, 8px);
  letter-spacing: .16em;
  background: var(--ink);
  color: var(--cream);
  padding: 3px 6px;
}

.map-prompt-name {
  font-size: clamp(11px, 1.15vw, 18px);
  line-height: 1;
  white-space: nowrap;
}

.map-challenge {
  padding: 7px 14px 6px 12px;
  box-shadow: 4px 5px 0 var(--ink), 7px 8px 0 var(--magenta);
}

.map-challenge .deal-word { font-size: clamp(13px, 1.2vw, 18px); }
.map-challenge .deal-sub { font-size: clamp(6px, .5vw, 8px); }

.map-controls {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 45;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  padding: 0 clamp(10px, 2.4vw, 34px);
  pointer-events: none;
}

.map-controls .move-cluster { pointer-events: auto; }

.challenge-key {
  pointer-events: auto;
  width: clamp(76px, 8.4vw, 116px);
  height: clamp(58px, 7vh, 72px);
  background: var(--gold);
  box-shadow: 5px 6px 0 var(--ink), 8px 9px 0 var(--magenta);
}

.challenge-key .label { font-size: clamp(7px, .62vw, 10px); }

.challenge-key.disabled {
  opacity: .45;
  pointer-events: none;
}

@media (max-width: 860px) {
  .map-top { padding: 8px 8px 0; gap: 6px; }
  .map-who { max-width: 36vw; padding: 5px 7px 6px; border-width: 2px; box-shadow: 3px 3px 0 var(--plum); }
  .map-name { font-size: 12px; }
  .map-stand { font-size: 7px; }
  .map-kicker { font-size: 5px; }
  .map-centre { padding: 4px 8px; border-width: 2px; box-shadow: 3px 3px 0 var(--gold); }
  .map-title { font-size: 9px; }
  .map-pip { width: 10px; height: 10px; border-width: 1px; font-size: 4px; }
  .map-count { font-size: 6px; }
  .map-edit { padding: 6px 7px 5px; font-size: 6px; }
  .map-help { display: none; }
  .map-prompt {
    bottom: 188px;
    gap: 6px;
    padding: 6px 8px 7px;
    box-shadow: 4px 5px 0 var(--magenta);
  }
  .map-prompt-name { font-size: 10px; }
  .map-prompt-kicker { font-size: 5px; padding: 2px 4px; }
  .map-challenge { padding: 5px 9px 4px 8px; }
  .map-challenge .deal-word { font-size: 11px; }
  .map-challenge .deal-sub { display: none; }
  .map-controls { padding: 0 10px; bottom: max(8px, env(safe-area-inset-bottom)); }
  .challenge-key { width: 74px; height: 62px; }
}

@media (max-width: 860px) and (orientation: landscape) {
  .map-prompt { bottom: 92px; }
  .map-controls { bottom: 6px; }
}

.grant-badge.epic { background: var(--magenta); color: var(--cream); }

.tagline {
  display: inline-block;
  padding: 4px 8px 3px;
  background: var(--cream);
  border: 2px solid var(--ink);
  box-shadow: 3px 3px 0 var(--magenta);
  margin-left: 6px;
}

@media (max-height: 820px) and (min-width: 861px) {
  #select { gap: 5px; padding-top: 8px; }
  .select-head { margin-top: 0; }
  #select .logo { font-size: clamp(36px, 5.1vw, 72px); }
  .logo-arrow { width: 58%; top: 30%; }
  .logo-rule { margin-top: 7px; height: 4px; }
  .tagline { margin-top: 5px; font-size: 8px; }
  .creator-card { padding: 7px; gap: 8px; }
  .preview-card { flex-basis: 112px; }
  .creator-form { gap: 3px; }
  .field-label, .opt-label { font-size: 6px; }
  #nameInput { font-size: 13px; padding: 3px 6px 2px; }
  .chip { font-size: 6px; padding: 2px 4px; }
  .swatch { width: 16px; height: 16px; }
  #deck { gap: 6px; }
  #deck .stand-card { padding: 15px 6px 5px; }
  #deck .stand-card .ability { display: none; }
  #deck .stand-card .user { font-size: 9px; }
  #deck .stand-card .stand { font-size: 8px; }
  #deck .stand-card .legend { font-size: 5px; padding: 2px 5px 2px 8px; }
  .select-foot { padding-top: 5px; padding-bottom: 5px; }
  .deal-btn { padding: 8px 20px 7px 18px; }
  .deal-btn .deal-word { font-size: 22px; }
  .howto { font-size: 8px; }
}

.battle-logo { display: none; }

.stamp.choice {
  font-size: clamp(26px, 4.6vw, 66px);
  max-width: 92vw;
  white-space: nowrap;
  letter-spacing: .02em;
  color: var(--magenta);
  -webkit-text-stroke: 2px var(--ink);
  text-shadow: 3px 4px 0 var(--cream), 5px 7px 0 var(--ink);
}

@media (max-width: 860px) {
  .deck-head .mono { display: none; }
}

/* select fills the screen, and every deck card carries a drawn Stand */
.select-main {
  flex: 1 1 auto;
  min-height: 0;
  align-items: stretch;
}

.creator-card {
  align-self: flex-start;
}

.deck-panel {
  min-height: 0;
}

#deck {
  flex: 1 1 auto;
  min-height: 0;
  grid-auto-rows: 1fr;
  align-content: stretch;
}

#deck .stand-card {
  display: flex;
  flex-direction: column;
  padding: 25px 7px 6px;
}

#deck .stand-card .part { z-index: 3; }
#deck .stand-card .legend { z-index: 3; }

#deck .stand-card .stand-figure {
  position: relative;
  z-index: 1;
  flex: 1 1 54px;
  min-height: 48px;
  margin: 4px 0 3px;
  overflow: hidden;
  pointer-events: none;
}

#deck .stand-card .stand-figure img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center top;
}

#deck .stand-card .sigil {
  z-index: 0;
}

#deck .stand-card .user,
#deck .stand-card .stand,
#deck .stand-card .ability {
  position: relative;
  z-index: 2;
}

#deck .stand-card .ability {
  margin-top: auto;
}

@media (max-width: 860px) {
  .map-prompt {
    width: auto;
    max-width: 94vw;
    box-sizing: border-box;
    gap: 5px;
    padding: 5px 7px 6px;
  }
  .map-prompt-kicker { display: none; }
  .map-prompt-name {
    font-size: 9px;
    max-width: 54vw;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .map-prompt .map-challenge {
    padding: 4px 7px 3px 6px;
    box-shadow: 3px 4px 0 var(--ink), 5px 6px 0 var(--magenta);
  }
  .map-prompt .map-challenge .deal-word { font-size: 10px; }
  .map-prompt .map-challenge .deal-sub { display: none; }
}

@media (max-width: 860px) and (orientation: landscape) {
  .map-prompt { bottom: 92px; }
}

@media (max-width: 1180px) {
  .select-main { align-items: stretch; }
  .creator-card { align-self: flex-start; }
}

#deck .stand-card .ability { display: block; }
#deck .stand-card .stand-figure { flex: 1 1 auto; min-height: 56px; }

#deck .stand-card .sigil { display: none; }
#deck .stand-card .stand-figure { flex: 1 1 auto; min-height: 96px; margin: 3px 0 3px; }
#deck .stand-card .stand-figure img { object-fit: cover; object-position: center top; }
@media (max-width: 860px) {
  #deck .stand-card .stand-figure { min-height: 88px; }
}

#deck { grid-auto-rows: minmax(160px, 1fr); }
#deck .stand-card { min-height: 160px; }
#deck .stand-card .stand-figure { flex: 1 1 auto; min-height: 96px; }
#deck .stand-card .stand-figure img { object-fit: cover; object-position: center top; }

.deck-pager {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-left: auto;
}

.deck-page-btn {
  width: 24px;
  height: 22px;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--cream);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--plum);
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}

.deck-page-btn svg { width: 12px; height: 12px; display: block; }
.deck-page-btn:disabled { opacity: .32; cursor: default; }
.deck-page-btn:active { transform: translate(1px, 1px); box-shadow: 0 0 0 var(--ink); }

#deckPage {
  font-size: clamp(7px, .62vw, 9px);
  letter-spacing: .06em;
  min-width: 34px;
  text-align: center;
}

#deck {
  grid-auto-rows: minmax(160px, 1fr);
  min-height: 327px;
}

@media (max-width: 860px) {
  .deck-head .mono#deckSub { display: none; }
  .deck-page-btn { width: 22px; height: 20px; border-width: 1.5px; }
  #deckPage { font-size: 7px; min-width: 30px; }
}

/* live plaza strip above the character sheet */
#select {
  --strip: clamp(250px, 35vh, 340px);
  display: block;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

#select .select-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 4;
  margin: 0;
  padding: max(8px, env(safe-area-inset-top)) clamp(12px, 3vw, 40px) 0;
  pointer-events: none;
}

#select .logo-wrap { padding-left: 4px; }
#select .logo { font-size: clamp(32px, 4.4vw, 62px); text-shadow: 3px 3px 0 var(--cream), 6px 6px 0 rgba(226,44,110,.38); }
#select .logo .logo-b { -webkit-text-stroke: clamp(1px, .1vw, 2px) var(--ink); }
#select .logo-arrow { width: clamp(160px, 24vw, 340px); top: 34%; opacity: .8; }
#select .logo-rule { height: 3px; margin: 6px 0 0 4px; width: min(72%, 420px); }
#select .tagline { margin: 5px 0 0 4px; font-size: clamp(7px, .72vw, 10px); padding: 3px 6px 2px; letter-spacing: .08em; }

.world-hint {
  position: absolute;
  left: 50%;
  top: calc(var(--strip) - 34px);
  transform: translateX(-50%) rotate(-.5deg);
  z-index: 4;
  padding: 4px 9px 3px;
  background: var(--ink);
  color: var(--cream);
  font-size: clamp(7px, .65vw, 10px);
  letter-spacing: .14em;
  white-space: nowrap;
  pointer-events: none;
  clip-path: polygon(5% 0, 100% 0, 95% 100%, 0 100%);
}

.select-sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  height: calc(100% - var(--strip));
  display: flex;
  flex-direction: column;
  gap: clamp(4px, .8vh, 9px);
  padding: 8px clamp(10px, 3.2vw, 44px) max(8px, env(safe-area-inset-bottom));
  background: var(--cream);
  border-top: 4px solid var(--ink);
  box-shadow: 0 -6px 0 rgba(74, 27, 92, .22);
  overflow-y: auto;
  overflow-x: hidden;
}

.select-sheet .select-main {
  flex: 1 1 auto;
  min-height: 0;
}

.select-sheet .select-foot {
  position: sticky;
  bottom: 0;
  margin: 0;
  background: var(--cream);
  border-top: 2px solid var(--ink);
  padding-top: 6px;
  padding-bottom: 2px;
  box-shadow: none;
}

@media (max-width: 860px) {
  #select { --strip: clamp(238px, 33vh, 320px); }
  #select .select-head { padding: 8px 10px 0; }
  #select .logo { font-size: clamp(30px, 9vw, 56px); }
  #select .logo-arrow { width: 54%; }
  #select .tagline { font-size: 7px; max-width: 86vw; }
  #select .select-note { display: none; }
  .world-hint { top: calc(var(--strip) - 30px); font-size: 6px; }
  .select-sheet { gap: 5px; padding: 7px 8px max(8px, env(safe-area-inset-bottom)); }
}

@media (max-width: 860px) and (orientation: landscape) {
  #select { --strip: clamp(150px, 27vh, 230px); }
  #select .select-head { padding: 4px 10px 0; }
  #select .logo { font-size: 38px; }
  #select .logo-arrow { width: 28%; }
  #select .tagline { display: none; }
  .world-hint { top: calc(var(--strip) - 26px); }
}

@media (max-height: 820px) and (min-width: 861px) {
  #select { --strip: clamp(210px, 30vh, 280px); }
  #select .logo { font-size: 40px; }
  #select .logo-arrow { width: 30%; }
  #select .tagline { font-size: 7px; }
}

.world-walk {
  position: absolute;
  left: 12px;
  top: calc(var(--strip) - 58px);
  z-index: 4;
  display: flex;
  gap: 5px;
  pointer-events: auto;
}

.world-move {
  width: 44px;
  height: 38px;
  box-shadow: 3px 4px 0 var(--ink), 5px 6px 0 var(--magenta);
}

.world-move .icon { width: 18px; height: 18px; }
.world-move .label { display: none; }
.world-move .cap { top: -8px; font-size: 6px; }

@media (max-width: 860px) {
  .world-walk { top: calc(var(--strip) - 52px); left: 8px; }
  .world-move { width: 38px; height: 34px; border-width: 2px; }
}

.world-hint {
  left: 12px;
  top: calc(var(--strip) - 88px);
  transform: rotate(-.5deg);
}

@media (max-width: 860px) {
  .world-hint { top: calc(var(--strip) - 82px); left: 8px; }
}

/* landing plaza, with the creator and deck behind buttons */
#worldIntro {
  position: fixed;
  inset: 0;
  z-index: 39;
  pointer-events: none;
}

.wi-head {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: max(10px, env(safe-area-inset-top)) clamp(12px, 3vw, 40px) 0;
}

.wi-logo { transform: rotate(-2.4deg); transform-origin: left top; }
.wi-logo .logo { font-size: clamp(34px, 4.6vw, 66px); text-shadow: 4px 4px 0 var(--cream), 8px 8px 0 rgba(226,44,110,.4); }
.wi-logo .logo-arrow { width: clamp(180px, 27vw, 380px); top: 40%; opacity: .85; }
.wi-logo .logo-rule { width: min(76%, 460px); margin: 8px 0 0 4px; }
.wi-logo .tagline { margin: 6px 0 0 4px; font-size: clamp(7px, .75vw, 11px); }

.wi-note {
  margin-top: 8px;
  padding: 4px 10px 3px;
  background: var(--ink);
  color: var(--cream);
  font-size: clamp(7px, .7vw, 10px);
  letter-spacing: .2em;
  transform: rotate(1.4deg);
  box-shadow: 3px 3px 0 var(--plum);
}

.wi-actions {
  position: absolute;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: clamp(8px, 1.4vw, 18px);
  flex-wrap: wrap;
  justify-content: center;
  width: min(94vw, 900px);
  pointer-events: auto;
}

.wi-actions .deal-btn { transform: rotate(-.8deg); }
.wi-actions .deal-btn.small { box-shadow: 5px 6px 0 var(--ink), 8px 9px 0 var(--gold); }

.wi-walk {
  position: absolute;
  left: clamp(10px, 2vw, 28px);
  bottom: max(64px, calc(env(safe-area-inset-bottom) + 64px));
  z-index: 2;
  display: flex;
  gap: 6px;
  pointer-events: auto;
}

.wi-hint {
  position: absolute;
  left: clamp(10px, 2vw, 28px);
  bottom: max(16px, env(safe-area-inset-bottom));
  padding: 3px 8px 2px;
  background: var(--ink);
  color: var(--cream);
  font-size: clamp(7px, .6vw, 10px);
  letter-spacing: .14em;
  transform: rotate(-.5deg);
}

.select-back {
  pointer-events: auto;
  position: absolute;
  right: clamp(12px, 3vw, 40px);
  bottom: -30px;
  padding: 3px 7px;
  background: var(--cream);
  border: 2px solid var(--ink);
  box-shadow: 2px 2px 0 var(--plum);
  color: var(--ink);
  font-size: clamp(6px, .55vw, 8px);
  letter-spacing: .1em;
  cursor: pointer;
  transform: rotate(1deg);
  touch-action: manipulation;
}

@media (max-width: 860px) {
  .wi-head { padding: 8px 10px 0; }
  .wi-logo .logo { font-size: clamp(30px, 9.2vw, 56px); }
  .wi-logo .logo-arrow { width: 54%; }
  .wi-logo .tagline { font-size: 7px; max-width: 80vw; }
  .wi-note { font-size: 6px; padding: 3px 6px; }
  .wi-actions { bottom: max(12px, env(safe-area-inset-bottom)); gap: 6px; width: 96vw; }
  .wi-actions .deal-word { font-size: 15px; }
  .wi-actions .deal-btn { padding: 8px 12px 7px 10px; box-shadow: 4px 5px 0 var(--ink), 7px 8px 0 var(--magenta); }
  .wi-actions .deal-btn.small .deal-word { font-size: 12px; }
  .wi-actions .deal-sub { font-size: 6px; }
  .wi-actions .ghost-btn { font-size: 10px; padding: 6px 9px 5px; }
  .wi-walk { bottom: max(100px, calc(env(safe-area-inset-bottom) + 100px)); }
  .wi-hint { bottom: max(64px, calc(env(safe-area-inset-bottom) + 64px)); left: auto; right: 10px; }
  .select-back { bottom: -26px; }
}

@media (max-height: 560px) and (orientation: landscape) {
  .wi-logo .logo { font-size: 34px; }
  .wi-logo .tagline, .wi-note { display: none; }
  .wi-actions { bottom: 8px; }
  .wi-walk { bottom: 58px; }
  .wi-hint { display: none; }
}

#select .select-sheet { padding-right: 14px; }
#select .select-foot { position: static; }
#deck { padding-right: 4px; }
@media (max-width: 860px) {
  #select .select-sheet { padding-right: 10px; }
}
