:root {
  --bone: #E8DCC4;
  --ink: #16130F;
  --vermilion: #C9302C;
  --green: #1F6F52;
  --ochre: #D9A227;
  --violet: #5B4A8A;
  --ghost: #B9AE99;
  --overprint: #3A241C;
  --stage-ink: #C9302C;
  --barh: clamp(54px, 9.5vh, 88px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: #12100d;
}

body {
  font-family: 'Archivo', sans-serif;
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  background:
    radial-gradient(circle at 1px 1px, rgba(232, 220, 196, 0.05) 0.8px, transparent 1.1px) 0 0 / 5px 5px,
    #12100d;
}

button { font-family: inherit; }

#app {
  height: 100dvh;
  width: 100%;
  padding: clamp(6px, 1.5vmin, 22px);
  display: flex;
  align-items: center;
  justify-content: center;
}

#sheet {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 1760px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: var(--bone);
  border: clamp(4px, 0.7vmin, 9px) solid var(--ink);
  box-shadow: 0 0 0 1px rgba(232, 220, 196, 0.18), 0 22px 60px rgba(0, 0, 0, 0.55);
  overflow: hidden;
  isolation: isolate;
}

#sheet::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgba(22, 19, 15, 0.28) 0.7px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.18;
  mix-blend-mode: multiply;
}

#sheet::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 79;
  pointer-events: none;
  background-image: radial-gradient(circle at 2px 2px, rgba(22, 19, 15, 0.16) 1px, transparent 1.6px);
  background-size: 8px 8px;
  opacity: 0.12;
  mix-blend-mode: multiply;
}

/* ---------- top bar ---------- */

#topbar {
  position: relative;
  z-index: 12;
  display: grid;
  grid-template-columns: clamp(142px, 17vw, 296px) minmax(0, 1fr);
  gap: clamp(8px, 1.5vw, 24px);
  padding: clamp(6px, 1.2vh, 14px) clamp(8px, 1.3vw, 20px) clamp(5px, 0.9vh, 10px);
  background: var(--bone);
  border-bottom: 3px solid var(--ink);
}

#brand { display: flex; align-items: flex-start; }
#brand img {
  width: 100%;
  height: auto;
  display: block;
}

#hud {
  min-width: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: clamp(3px, 0.7vh, 9px);
}

.barRow {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: clamp(10px, 2.1vw, 30px);
}

.barBlock { min-width: 0; }

.barMeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  height: clamp(13px, 2.1vh, 22px);
  margin-bottom: 1px;
  font-size: clamp(8px, 1.15vh, 12px);
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
  color: var(--ink);
}

.tagYou { letter-spacing: 0.24em; }

.hpNum {
  font-size: 0.92em;
  letter-spacing: 0.08em;
  opacity: 0.72;
}

.masterPlate {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-width: 0;
  max-width: 72%;
  height: clamp(14px, 2.2vh, 24px);
  padding: 0 clamp(9px, 1.2vw, 18px);
}
.masterPlate img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
}
.masterPlate b {
  position: relative;
  z-index: 1;
  color: var(--bone);
  font-style: normal;
  font-size: clamp(8px, 1.05vh, 11px);
  letter-spacing: 0.2em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.healthBar {
  position: relative;
  height: clamp(23px, 4.3vh, 46px);
}
.healthBar .frame {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}
.healthBar .fill {
  position: absolute;
  left: 2.6%;
  top: 23%;
  bottom: 23%;
  width: calc(var(--v, 1) * 88%);
  background: var(--vermilion);
  clip-path: polygon(0 0, calc(100% - 6px) 0, 100% 13%, calc(100% - 8px) 27%, 100% 41%, calc(100% - 5px) 57%, 100% 71%, calc(100% - 7px) 86%, 100% 100%, 0 100%);
  transition: width 0.16s steps(4, end);
}
.healthBar .masterFill { background: var(--stage-ink); }

/* ---------- tool row ---------- */

.toolRow {
  display: flex;
  align-items: center;
  gap: clamp(7px, 1.6vw, 22px);
  min-height: clamp(26px, 4.4vh, 46px);
}

.ammoGroup {
  display: flex;
  align-items: center;
  gap: clamp(4px, 0.5vw, 8px);
  flex: 0 1 auto;
  min-width: 0;
}
.gunIcon {
  height: clamp(24px, 3.8vh, 42px);
  width: auto;
  max-width: 18vw;
  object-fit: contain;
}
.ammoPill {
  position: relative;
  width: clamp(76px, 8.4vw, 128px);
  height: clamp(23px, 3.6vh, 40px);
  flex: 0 1 auto;
  min-width: 54px;
}
.ammoPill > img {
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}
.ammoCover {
  position: absolute;
  top: 15%;
  bottom: 15%;
  left: calc(6% + var(--ammo, 1) * 86%);
  right: 4%;
  background: var(--bone);
  clip-path: polygon(8px 0, 0 18%, 6px 34%, 0 52%, 7px 68%, 0 84%, 5px 100%, 100% 100%, 100% 0);
  transition: left 0.12s steps(3, end);
}
.ammoCount {
  font-size: clamp(10px, 1.55vh, 16px);
  font-weight: 700;
  letter-spacing: 0.06em;
  min-width: 1.4em;
}

.mono {
  font-family: 'Archivo', sans-serif;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.knifeGroup {
  position: relative;
  display: flex;
  align-items: center;
  gap: 4px;
  height: clamp(24px, 3.8vh, 42px);
  flex: 0 1 auto;
  transition: opacity 0.15s;
}
.knifeGroup > img {
  height: 68%;
  width: auto;
  max-width: clamp(90px, 12vw, 180px);
  object-fit: contain;
}
.knifeGroup.cooling > img { opacity: 0.3; }
.keyTag {
  display: inline-grid;
  place-items: center;
  width: clamp(15px, 2vh, 20px);
  height: clamp(15px, 2vh, 20px);
  border: 2px solid var(--ink);
  font-size: clamp(8px, 1.1vh, 11px);
  line-height: 1;
}

.stageTag {
  position: relative;
  margin-left: auto;
  flex: 0 0 auto;
  width: clamp(124px, 14vw, 218px);
  height: clamp(28px, 4.6vh, 50px);
}
.stageTag .bannerBg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  display: block;
}
.stageNum {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -52%);
  font-family: 'Big Shoulders Stencil', sans-serif;
  font-weight: 700;
  font-size: clamp(26px, 5.2vh, 54px);
  line-height: 0.75;
  letter-spacing: 0.02em;
  color: var(--stage-ink);
}
.stageTag::before {
  content: 'BOUT';
  position: absolute;
  left: 8%;
  top: 50%;
  transform: translateY(-50%);
  z-index: 2;
  color: var(--bone);
  font-size: clamp(7px, 1vh, 10px);
  font-weight: 700;
  letter-spacing: 0.18em;
}

/* ---------- arena ---------- */

#arena {
  position: relative;
  min-height: 0;
  overflow: hidden;
  background: var(--bone);
}

#game {
  position: absolute;
  inset: 0;
}
#game canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}

#sheet.jolt {
  animation: jolt 0.24s steps(4, end);
}
@keyframes jolt {
  0% { transform: translate(0, 0) rotate(0deg); }
  18% { transform: translate(calc(var(--jx, 3) * 1px), calc(var(--jy, -2) * 1px)) rotate(calc(var(--jr, 0.25) * 1deg)); }
  46% { transform: translate(calc(var(--jx, 3) * -0.6px), calc(var(--jy, -2) * 0.5px)) rotate(calc(var(--jr, 0.25) * -0.5deg)); }
  74% { transform: translate(calc(var(--jx, 3) * 0.35px), calc(var(--jy, -2) * -0.3px)) rotate(calc(var(--jr, 0.25) * 0.2deg)); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

#arena.hurt::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 18;
  pointer-events: none;
  background: var(--vermilion);
  opacity: 0.32;
  animation: hurtflash 0.34s steps(3, end);
}
@keyframes hurtflash {
  0% { opacity: 0.4; }
  100% { opacity: 0; }
}

.toast {
  position: absolute;
  left: 50%;
  top: clamp(8px, 2vh, 20px);
  z-index: 24;
  transform: translate(-50%, -12px) rotate(-2deg);
  background: var(--ink);
  color: var(--bone);
  padding: clamp(5px, 0.9vh, 9px) clamp(10px, 1.6vw, 18px);
  font-family: 'Alfa Slab One', serif;
  font-size: clamp(11px, 1.7vh, 17px);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.14s, transform 0.14s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0) rotate(-2deg); }
.cardToast {
  top: auto;
  bottom: clamp(58px, 9vh, 96px);
  z-index: 36;
}

/* ---------- overlays ---------- */

.overlay {
  position: absolute;
  inset: 0;
  z-index: 26;
  display: grid;
  place-items: center;
  overflow: hidden;
}
.overlay.hidden { display: none; }
.overlayInk {
  position: absolute;
  inset: 0;
  background: var(--stage-ink);
  opacity: 0.94;
}
#pause .overlayInk { background: var(--bone); opacity: 0.95; }
.defeatSplat {
  position: absolute;
  left: 50%;
  top: 52%;
  width: min(70%, 680px);
  transform: translate(-50%, -50%) rotate(6deg);
  opacity: 0.9;
}
.overlayBody {
  position: relative;
  z-index: 3;
  text-align: center;
  padding: 20px;
  color: var(--bone);
}
#pause .overlayBody { color: var(--ink); }
.overlayKicker {
  font-size: clamp(9px, 1.3vh, 13px);
  font-weight: 700;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  opacity: 0.8;
}
.overlayWord {
  font-family: 'Alfa Slab One', serif;
  font-size: clamp(34px, 8vh, 92px);
  line-height: 0.95;
  text-transform: uppercase;
  margin: 4px 0 clamp(12px, 2.4vh, 26px);
  letter-spacing: 0.01em;
}
#pause .overlayWord { font-size: clamp(30px, 7vh, 78px); }
.overlayBtns {
  display: flex;
  flex-wrap: wrap;
  gap: clamp(8px, 1.4vw, 16px);
  justify-content: center;
}
.stampBtn {
  border: 3px solid var(--bone);
  background: var(--bone);
  color: var(--ink);
  padding: clamp(8px, 1.4vh, 13px) clamp(12px, 1.8vw, 22px);
  font-size: clamp(10px, 1.4vh, 14px);
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  cursor: pointer;
}
.stampBtn:hover { background: transparent; color: var(--bone); }
.stampBtn.ghost { background: transparent; color: var(--bone); }
.stampBtn.ghost:hover { background: var(--bone); color: var(--ink); }
#pause .stampBtn { border-color: var(--ink); background: var(--ink); color: var(--bone); }
#pause .stampBtn:hover { background: transparent; color: var(--ink); }
#pause .stampBtn.ghost { background: transparent; color: var(--ink); }
#pause .stampBtn.ghost:hover { background: var(--ink); color: var(--bone); }

/* ---------- bottom bar ---------- */

#bottombar {
  position: relative;
  z-index: 34;
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.1vw, 16px);
  min-height: var(--barh);
  padding: clamp(4px, 0.8vh, 8px) clamp(8px, 1.3vw, 18px);
  background: var(--ink);
  color: var(--bone);
  border-top: 3px solid var(--ink);
}

.iconRow { display: flex; align-items: center; gap: clamp(2px, 0.4vw, 6px); flex: 0 0 auto; }
.ctrl {
  position: relative;
  width: clamp(32px, 5vh, 50px);
  height: clamp(32px, 5vh, 50px);
  overflow: hidden;
  padding: clamp(4px, 0.6vh, 7px);
  display: grid;
  place-items: center;
  background: transparent;
  border: 0;
  cursor: pointer;
  color: var(--bone);
}
.ctrl > img, .ctrl .pauseBars img, .ctrl .soundIcon img {
  max-height: 100%;
  max-width: 100%;
  height: auto;
  width: auto;
  filter: invert(87%) sepia(13%) saturate(280%) hue-rotate(2deg) brightness(1.02);
  pointer-events: none;
}
.ctrl img { max-width: 100%; }
.ctrl:hover, .ctrl:focus-visible { background: var(--bone); }
.ctrl:hover img, .ctrl:focus-visible img { filter: none; }
.ctrl:focus-visible { outline: 2px solid var(--bone); outline-offset: 2px; }
.ctrl:disabled { opacity: 0.35; cursor: default; }
.ctrl:disabled:hover { background: transparent; }
.ctrl:disabled:hover img { filter: invert(87%) sepia(13%) saturate(280%) hue-rotate(2deg) brightness(1.02); }

.pauseBars { display: flex; align-items: center; gap: clamp(4px, 0.7vw, 9px); height: clamp(20px, 3.2vh, 30px); }
.pauseBars img { height: 100%; width: clamp(5px, 0.85vh, 8px); object-fit: fill; }
.soundIcon { display: flex; align-items: center; justify-content: center; height: 100%; width: 100%; overflow: hidden; }
.soundCtrl { width: clamp(40px, 6.4vh, 64px); }
.soundIcon .speaker { height: clamp(18px, 2.9vh, 30px); width: auto; }
.soundIcon .waves { height: clamp(22px, 3.5vh, 34px); width: auto; margin-left: -1px; }
.soundCtrl.muted .waves { opacity: 0.2; }
.soundCtrl.muted::after {
  content: '';
  position: absolute;
  width: 74%;
  height: 3px;
  background: var(--vermilion);
  transform: rotate(-38deg);
}

.touchMove { display: none; gap: 4px; flex: 0 0 auto; }
.moveBtn {
  width: clamp(42px, 7vh, 56px);
  height: clamp(32px, 5.2vh, 46px);
  display: grid;
  place-items: center;
  background: var(--bone);
  border: 3px solid var(--bone);
  cursor: pointer;
  touch-action: none;
}
.moveBtn span {
  display: block;
  width: 0;
  height: 0;
  border-top: clamp(6px, 1.4vh, 10px) solid transparent;
  border-bottom: clamp(6px, 1.4vh, 10px) solid transparent;
  border-right: clamp(10px, 1.9vh, 16px) solid var(--ink);
}
#btnRight span { transform: rotate(180deg); }
.moveBtn:active, .moveBtn.held { background: var(--ink); }
.moveBtn:active span, .moveBtn.active span { border-right-color: var(--bone); }

.hint {
  flex: 1 1 auto;
  min-width: 0;
  text-align: center;
  font-size: clamp(8px, 1.16vh, 12px);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #BCB19A;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: clamp(5px, 0.8vw, 10px);
  flex: 0 0 auto;
}
.actionBtn {
  position: relative;
  height: clamp(38px, 6.4vh, 58px);
  min-width: clamp(52px, 6.8vh, 72px);
  padding: 4px clamp(5px, 0.7vw, 10px);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bone);
  border: 3px solid var(--bone);
  cursor: pointer;
  touch-action: none;
}
.actionBtn img { max-height: 100%; max-width: 100%; width: auto; height: auto; display: block; }
.actionBtn .fireArt { max-height: 84%; }
.knifeBtn { min-width: clamp(64px, 8.8vh, 96px); }
.knifeBtn .knifeArt { width: 100%; max-height: 62%; object-fit: contain; }
.actionKey {
  position: absolute;
  right: 3px;
  bottom: 1px;
  font-size: clamp(9px, 1.2vh, 12px);
  line-height: 1;
  color: var(--ink);
  opacity: 0.8;
}
.actionBtn:hover, .actionBtn:focus-visible { background: var(--ink); border-color: var(--bone); }
.actionBtn:hover img, .actionBtn:focus-visible img { filter: invert(87%) sepia(13%) saturate(280%) hue-rotate(2deg) brightness(1.02); }
.actionBtn:hover .actionKey, .actionBtn:focus-visible .actionKey { color: var(--bone); }
.actionBtn:active, .actionBtn.pressed { transform: translateY(2px); }
.actionBtn:focus-visible { outline: 2px solid var(--bone); outline-offset: 2px; }

#sheet.cardMode .actions,
#sheet.cardMode #touchMove { display: none !important; }

#footBrand {
  flex: 0 0 auto;
  margin-left: clamp(2px, 0.8vw, 10px);
  font-family: 'Alfa Slab One', serif;
  font-size: clamp(13px, 2.1vh, 23px);
  letter-spacing: 0.02em;
  color: var(--bone);
  white-space: nowrap;
}

/* ---------- match card ---------- */

#card {
  position: absolute;
  inset: 0;
  grid-row: 1 / 3;
  grid-column: 1 / -1;
  z-index: 30;
  background: var(--bone);
  overflow: hidden;
}
#card.hidden { display: none; }
#card::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: radial-gradient(circle at 1px 1px, rgba(22, 19, 15, 0.22) 0.7px, transparent 1px);
  background-size: 3px 3px;
  opacity: 0.16;
  mix-blend-mode: multiply;
}

.cardWrap {
  position: relative;
  z-index: 2;
  height: 100%;
  display: flex;
  flex-direction: column;
  padding: clamp(12px, 2.4vh, 28px) clamp(14px, 2.6vw, 42px) clamp(12px, 2vh, 22px);
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--ink) var(--bone);
}

.cardHead {
  display: grid;
  grid-template-columns: minmax(150px, 24%) minmax(0, 1fr);
  gap: clamp(14px, 3vw, 44px);
  align-items: end;
  flex-shrink: 0;
  padding-bottom: clamp(8px, 1.8vh, 18px);
  border-bottom: 3px solid var(--ink);
}
.cardTitle { width: 100%; max-width: 380px; height: auto; display: block; }
.cardCopy { padding-bottom: clamp(2px, 0.7vh, 8px); }
.kicker {
  font-size: clamp(9px, 1.25vh, 12px);
  font-weight: 700;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--overprint);
  margin-bottom: clamp(4px, 0.8vh, 8px);
}
.lead {
  font-family: 'Alfa Slab One', serif;
  font-size: clamp(16px, 2.5vh, 27px);
  line-height: 1.06;
  margin: 0 0 clamp(6px, 1.3vh, 12px);
  text-transform: uppercase;
  max-width: 36em;
}
.keys {
  margin: 0;
  font-size: clamp(8px, 1.15vh, 12px);
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--overprint);
  line-height: 1.6;
}
.touchKeys { display: none; }

.bouts {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  border-top: 2px solid var(--ink);
}

.bout {
  position: relative;
  width: 100%;
  display: grid;
  grid-template-columns: clamp(44px, 5vw, 72px) clamp(66px, 9.6vh, 104px) minmax(0, 1fr) auto;
  align-items: center;
  gap: clamp(8px, 1.5vw, 24px);
  min-height: clamp(58px, 10.4vh, 108px);
  padding: clamp(4px, 0.9vh, 10px) clamp(4px, 0.9vw, 16px);
  flex: 1 1 auto;
  background: transparent;
  border: 0;
  border-bottom: 2px solid var(--ink);
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  transition: background 0.12s;
}
.bout:hover, .bout:focus-visible {
  background: color-mix(in srgb, var(--row-ink) 13%, transparent);
}
.bout:focus-visible { outline: 3px solid var(--ink); outline-offset: -3px; }
.bout.locked { cursor: not-allowed; }
.bout.locked:hover { background: transparent; }
.bout.locked .boutBust img { filter: grayscale(1) contrast(0.82) brightness(1.05); opacity: 0.55; }
.bout.locked .boutText b, .bout.locked .boutText i, .bout.locked .boutNum { opacity: 0.45; }

.boutNum {
  font-family: 'Big Shoulders Stencil', sans-serif;
  font-weight: 700;
  font-size: clamp(38px, 7vh, 78px);
  line-height: 0.78;
  color: var(--row-ink);
  text-align: center;
}
.boutBust {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: clamp(52px, 9.2vh, 100px);
  min-width: 0;
}
.boutBust img { max-height: 100%; max-width: 100%; width: auto; object-fit: contain; display: block; }

.boutText { min-width: 0; }
.boutText b {
  display: block;
  font-family: 'Alfa Slab One', serif;
  font-weight: 400;
  font-size: clamp(18px, 3.2vh, 38px);
  line-height: 0.95;
  letter-spacing: 0.005em;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.boutText i {
  display: block;
  margin-top: clamp(2px, 0.5vh, 6px);
  font-style: normal;
  font-size: clamp(8px, 1.25vh, 12px);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--overprint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.boutState {
  font-size: clamp(8px, 1.15vh, 11px);
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: #6d5c46;
  white-space: nowrap;
}
.bout.cleared .boutState { visibility: hidden; }

.closedBar {
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  background: var(--ink);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left center;
  pointer-events: none;
}
.bout.cleared .closedBar {
  opacity: 0.17;
  transform: scaleX(1);
  transition: transform 0.5s steps(6, end), opacity 0.2s;
}
.closedStamp {
  position: absolute;
  right: clamp(12px, 3vw, 52px);
  top: 50%;
  transform: translateY(-50%) rotate(-7deg) scale(1.5);
  border: 3px solid var(--vermilion);
  color: var(--vermilion);
  background: rgba(232, 220, 196, 0.65);
  padding: clamp(2px, 0.4vh, 5px) clamp(7px, 1vw, 13px);
  font-family: 'Alfa Slab One', serif;
  font-size: clamp(12px, 2vh, 22px);
  line-height: 1;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.25s steps(4, end);
}
.bout.cleared .closedStamp {
  opacity: 1;
  transform: translateY(-50%) rotate(-7deg) scale(1);
}

.cardFoot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-shrink: 0;
  padding-top: clamp(7px, 1.3vh, 13px);
  font-size: clamp(8px, 1.1vh, 11px);
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #6d5c46;
}
#saveNote { color: var(--vermilion); }
.cardSign { font-family: 'Alfa Slab One', serif; font-weight: 400; letter-spacing: 0.04em; color: var(--ink); opacity: 0.72; }

/* ---------- stage transition ---------- */

#transition {
  position: absolute;
  inset: 0;
  grid-row: 1 / -1;
  grid-column: 1 / -1;
  z-index: 60;
  display: grid;
  place-items: center;
  background: var(--trans-ink, var(--vermilion));
  color: var(--trans-text, var(--bone));
  transition: transform 0.5s cubic-bezier(0.55, 0, 0.15, 1);
  will-change: transform;
  overflow: hidden;
}
#transition.hidden { display: none; }
#transition.offUp { transform: translateY(-101%); }
#transition.offDown { transform: translateY(101%); }
.transInner { text-align: center; padding: 20px; }
.transKicker {
  margin-bottom: clamp(8px, 1.5vh, 18px);
  font-size: clamp(9px, 1.4vh, 14px);
  font-weight: 700;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  opacity: 0.82;
}
.transNum {
  font-family: 'Big Shoulders Stencil', sans-serif;
  font-weight: 700;
  font-size: clamp(110px, 30vh, 310px);
  line-height: 0.72;
  margin: 0.04em 0 0.08em;
}
.transName {
  font-family: 'Alfa Slab One', serif;
  font-size: clamp(20px, 4.2vh, 46px);
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.01em;
}
.transMaster {
  margin-top: clamp(3px, 0.8vh, 8px);
  font-size: clamp(9px, 1.4vh, 14px);
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* ---------- responsive ---------- */

@media (max-width: 1100px) {
  #footBrand { display: none; }
  .hint { font-size: 9px; letter-spacing: 0.06em; }
}

@media (any-pointer: coarse), (max-width: 760px) {
  #touchMove { display: flex; }
  .hint { display: none; }
}

@media (max-width: 760px) {
  #app { padding: 4px; }
  #sheet { border-width: 4px; }
  #topbar {
    grid-template-columns: clamp(78px, 22vw, 112px) minmax(0, 1fr);
    gap: 6px;
    padding: 6px 6px 4px;
  }
  .barRow { gap: 7px; }
  .barMeta { height: 13px; font-size: 8px; letter-spacing: 0.08em; }
  .masterPlate { max-width: 76%; height: 15px; padding: 0 6px; }
  .masterPlate b { font-size: 8px; letter-spacing: 0.1em; }
  .healthBar { height: 24px; }
  .toolRow { gap: 5px; min-height: 24px; }
  .gunIcon { height: 21px; max-width: 40px; }
  .ammoPill { width: 68px; height: 22px; }
  .ammoCount { font-size: 10px; }
  .knifeGroup { height: 22px; }
  .knifeGroup > img { max-width: 84px; }
  .keyTag { display: none; }
  .stageTag { width: clamp(84px, 24vw, 120px); height: 28px; }
  .stageTag::before { display: none; }
  .stageNum { font-size: 24px; }
  #bottombar { flex-wrap: wrap; min-height: 0; padding: 5px 6px; gap: 5px; row-gap: 4px; }
  .ctrl { width: 34px; height: 34px; padding: 5px; }
  #controlIcons { flex: 0 0 100%; justify-content: flex-start; }
  .touchMove { order: 2; }
  .moveBtn { width: 48px; height: 38px; }
  .actions { order: 3; margin-left: auto; }
  .actionBtn { height: 42px; min-width: 48px; }
  .knifeBtn { min-width: 60px; }
  .iconRow { order: 1; }
  .cardWrap { padding: 10px 10px 14px; }
  .cardHead { grid-template-columns: 1fr; gap: 8px; }
  .cardTitle { max-width: 180px; }
  .lead { font-size: 16px; }
  .keys { display: none; }
  .touchKeys { display: block; font-size: 8px; }
  .bout {
    grid-template-columns: 34px 56px minmax(0, 1fr) auto;
    gap: 7px;
    min-height: 64px;
    padding: 5px 2px;
  }
  .boutNum { font-size: 34px; }
  .boutBust { height: 46px; }
  .boutText b { font-size: 17px; }
  .boutText i { font-size: 7px; letter-spacing: 0.1em; }
  .boutState { font-size: 7px; letter-spacing: 0.1em; }
  .closedStamp { right: 6px; font-size: 12px; padding: 2px 6px; border-width: 2px; }
  .cardFoot { font-size: 7px; padding-top: 6px; }
  .cardSign { display: none; }
  .overlayWord { font-size: clamp(30px, 9vw, 52px); }
  .transNum { font-size: clamp(90px, 26vh, 180px); }
}

@media (max-height: 620px) and (orientation: landscape) {
  #topbar { padding-top: 4px; padding-bottom: 3px; }
  .barMeta { height: 12px; font-size: 8px; }
  .healthBar { height: 21px; }
  .toolRow { min-height: 22px; }
  .gunIcon { height: 20px; }
  .ammoPill { height: 20px; width: 74px; }
  .stageTag { height: 30px; width: 112px; }
  .stageTag::before { display: none; }
  .stageNum { font-size: 32px; }
  #bottombar { min-height: 46px; padding-top: 3px; padding-bottom: 3px; }
  .ctrl { width: 32px; height: 32px; }
  .actionBtn { height: 36px; }
  .knifeBtn { min-width: 56px; }
  .bout { min-height: 54px; }
  .boutBust { height: 40px; }
  .boutNum { font-size: 30px; }
  .boutText b { font-size: 16px; }
  .boutText i { font-size: 7px; }
  .lead { font-size: 14px; }
  .cardTitle { max-width: 170px; }
  .closedStamp { font-size: 12px; }
}
