:root {
  --ink: #2b1b1e;
  --ink-2: #4a2f28;
  --bone: #f4e4c6;
  --bone-2: #e8d0a6;
  --brass: #c98b2e;
  --brass-hi: #e8bd66;
  --red: #8c3b2b;
  --red-hi: #b8563f;
  --teal: #2e4a44;
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --brand-h: clamp(58px, 7.2vw, 96px);
  --haze1: rgba(255, 223, 172, 0.5);
  --haze2: rgba(255, 215, 160, 0.16);
  --vign: rgba(78, 38, 22, 0.26);
  --grade-warm: rgba(255, 186, 104, 0.22);
  --grade-cool: rgba(24, 92, 96, 0.18);
  --grade-dark: rgba(78, 38, 22, 0.3);
}

* { box-sizing: border-box; }

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

body {
  font-family: 'Hanken Grotesk', system-ui, sans-serif;
  color: var(--ink);
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
}

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background:
    radial-gradient(130% 100% at 50% 6%, #fbe0b4 0%, #f2c48c 26%, #e3a568 55%, #cf8b55 78%, #bd7a49 100%);
}

#sky {
  position: absolute;
  inset: 0;
  z-index: 0;
  background:
    linear-gradient(to bottom, rgba(255, 214, 158, 0.34) 0%, rgba(255, 190, 132, 0.12) 26%, rgba(120, 88, 74, 0.1) 62%, rgba(64, 36, 26, 0.24) 100%),
    url('assets/sky_haze.webp') center 38% / cover no-repeat;
  filter: saturate(0.94) contrast(1.02);
  pointer-events: none;
}

#sky::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(70% 60% at 12% 6%, rgba(255, 196, 110, 0.5), rgba(255, 196, 110, 0) 62%),
    linear-gradient(to bottom, rgba(60, 30, 20, 0) 46%, rgba(60, 30, 22, 0.34) 100%);
}

#stage::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
  background:
    linear-gradient(to bottom, var(--haze1) 0%, var(--haze2) 12%, rgba(255, 210, 155, 0) 46%),
    radial-gradient(130% 110% at 50% 48%, rgba(0, 0, 0, 0) 48%, var(--vign) 100%);
}

#scene {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  display: block;
}

#grade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
  background:
    radial-gradient(120% 120% at 15% 6%, var(--grade-warm) 0%, rgba(255, 176, 96, 0) 56%),
    radial-gradient(85% 80% at 86% 88%, var(--grade-cool) 0%, rgba(24, 92, 96, 0) 72%),
    linear-gradient(to bottom, rgba(255, 206, 146, 0.10), rgba(0, 0, 0, 0) 34%, rgba(0, 0, 0, 0) 66%, var(--grade-dark) 100%),
    radial-gradient(90% 80% at 50% 50%, rgba(0, 0, 0, 0) 56%, rgba(66, 31, 18, 0.30) 100%);
}

.hidden { display: none !important; }

#hud {
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

body.modal #hud {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.plate-wrap {
  position: absolute;
  filter: drop-shadow(0 5px 12px rgba(60, 30, 18, 0.4));
}

.plate {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.brand {
  position: absolute;
  top: calc(var(--safe-t) + 12px);
  left: clamp(10px, 2.2vw, 28px);
  display: flex;
  align-items: center;
  gap: clamp(6px, 1.2vw, 14px);
  z-index: 3;
}

.medallion {
  position: relative;
  width: var(--brand-h);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 4px 10px rgba(60, 30, 18, 0.45));
  flex: none;
}

.medallion .ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.medallion .portrait {
  position: absolute;
  inset: 13%;
  width: 74%;
  height: 74%;
  border-radius: 50%;
  object-fit: cover;
  object-position: 50% 36%;
  transform: scale(1.06);
  background: #c98b5a;
}

.medallion .help-chip {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: clamp(18px, 2.1vw, 26px);
  height: clamp(18px, 2.1vw, 26px);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, var(--brass-hi), var(--brass) 62%, #8a5a1c);
  border: 1px solid #5d3d1b;
  color: #3a2413;
  font: 700 clamp(10px, 1.2vw, 14px) / 1 'Azeret Mono', monospace;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 5px rgba(50, 25, 12, 0.4);
}

.title-lockup {
  position: absolute;
  left: calc(var(--brand-h) + clamp(6px, 1.2vw, 14px));
  top: 50%;
  width: clamp(180px, 22vw, 340px);
  height: auto;
  transform: translateY(-50%);
  filter: drop-shadow(0 5px 10px rgba(60, 28, 16, 0.38));
  transition: opacity 0.7s ease, transform 0.7s ease;
}

body.run .title-lockup,
body.title-away .title-lockup {
  opacity: 0;
  transform: translate(-14px, -50%) scale(0.96);
  pointer-events: none;
}

.land-strip {
  position: absolute;
  left: clamp(10px, 2.2vw, 28px);
  top: calc(var(--safe-t) + var(--brand-h) + 70px);
  z-index: 5;
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding: 5px 7px;
  background: linear-gradient(to bottom, rgba(251, 240, 214, 0.95), rgba(228, 200, 148, 0.95));
  border: 1.5px solid #3a2421;
  clip-path: polygon(2% 16%, 5% 0%, 95% 2%, 100% 18%, 99% 84%, 96% 100%, 4% 98%, 0% 82%);
  box-shadow: 0 2px 0 #6a4a26, 0 4px 9px rgba(40, 18, 10, 0.24);
  pointer-events: none;
}

.land-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.land-name {
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: 8px;
  letter-spacing: 0.04em;
  line-height: 1;
  color: #3a2421;
  opacity: 0.95;
  white-space: nowrap;
}

.land-dot {
  width: 30px;
  height: 30px;
  padding: 0;
  border: 2px solid #4a2f18;
  border-radius: 50%;
  background-color: #c98b2e;
  background-size: cover;
  background-position: center;
  box-shadow: inset 0 0 0 1px rgba(255, 244, 218, 0.5);
  pointer-events: auto;
  cursor: pointer;
}

.land-dot.current {
  box-shadow: 0 0 0 2px #f0c96a, 0 0 0 3.5px #6a4a26;
  transform: translateY(-1px);
}

.zone-tag {
  position: absolute;
  left: clamp(12px, 2.2vw, 28px);
  top: calc(var(--safe-t) + var(--brand-h) + 16px);
  display: inline-block;
  padding: 0.42em 0.75em 0.36em;
  border: 2px solid #3a2421;
  background: linear-gradient(to bottom, #fbf0d6, #e4c894);
  clip-path: polygon(2% 12%, 6% 0%, 96% 2%, 100% 16%, 99% 84%, 95% 100%, 4% 98%, 0% 82%);
  box-shadow: 0 2px 0 #6a4a26, 0 4px 8px rgba(40, 18, 10, 0.24);
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(7px, 0.74vw, 10px);
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: #3a2421;
  white-space: nowrap;
  z-index: 4;
  opacity: 0;
  transform: translateY(-4px);
  transition: opacity 0.6s ease 0.25s, transform 0.6s ease 0.25s;
}

body.run .zone-tag,
body.title-away .zone-tag {
  opacity: 1;
  transform: none;
}

.map-btn {
  position: absolute;
  top: calc(var(--safe-t) + 14px);
  right: clamp(10px, 2.2vw, 26px);
  width: clamp(52px, 5.4vw, 68px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  filter: drop-shadow(0 4px 9px rgba(40, 18, 10, 0.35));
}

.map-btn .ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.map-glyph {
  position: absolute;
  inset: 26%;
  width: 48%;
  height: 48%;
  pointer-events: none;
}

.map-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 1px);
  transform: translateX(-50%);
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(7px, 0.66vw, 9px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #3a2421;
  text-shadow: 0 0 3px rgba(248, 225, 188, 0.94), 0 1px 0 rgba(248, 225, 188, 0.94);
  white-space: nowrap;
  pointer-events: none;
}

.map-veil {
  background: radial-gradient(90% 80% at 50% 45%, rgba(64, 31, 18, 0.35), rgba(40, 19, 12, 0.66));
}

.map-sheet {
  position: relative;
  width: min(92vw, 88vh, 650px);
  aspect-ratio: 1;
  filter: drop-shadow(0 18px 30px rgba(34, 15, 8, 0.55));
}

.map-paper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 4px;
}

.map-inner {
  position: absolute;
  inset: 21% 11% 8%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.45em;
  text-align: center;
}

.map-inner h2 {
  margin: 0 0 0.1em;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(19px, 2.5vw, 30px);
  line-height: 1;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--ink);
  background: rgba(244, 228, 198, 0.9);
  padding: 0.16em 0.7em 0.12em;
  border: 1.5px solid rgba(58, 36, 33, 0.55);
  clip-path: polygon(2% 16%, 5% 0%, 95% 2%, 100% 18%, 99% 84%, 96% 100%, 4% 98%, 0% 82%);
}

.map-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: clamp(4px, 1.2vw, 14px);
  width: 100%;
  max-width: 430px;
  margin: 0.15em 0 0.35em;
}

.zone-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
  color: var(--ink);
}

.zone-thumb {
  position: relative;
  width: clamp(56px, 8.4vw, 88px);
  aspect-ratio: 1;
  border-radius: 50%;
  overflow: visible;
  filter: drop-shadow(0 3px 6px rgba(40, 18, 10, 0.35));
}

.zone-thumb img:first-child {
  position: absolute;
  inset: 14%;
  width: 72%;
  height: 72%;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid #6a4a26;
  z-index: 2;
}

.zone-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.zone-name {
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(9px, 1.02vw, 12px);
  line-height: 1.05;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 244, 216, 0.55);
  background: rgba(244, 228, 198, 0.82);
  padding: 0 0.28em;
}

.zone-here {
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(6px, 0.62vw, 8px);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7a4632;
  opacity: 0.9;
  background: rgba(244, 228, 198, 0.82);
  padding: 0 0.3em;
}

.zone-btn.current .zone-here {
  color: #7a2c1e;
  opacity: 1;
}

.zone-btn.current .zone-thumb::after {
  content: '';
  position: absolute;
  right: 8%;
  top: 2%;
  width: 22%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #f6d68c, #c98b2e 62%, #7d4f16);
  border: 1.5px solid #4a2f18;
  box-shadow: 0 2px 4px rgba(40, 18, 10, 0.4);
}

.zone-btn:active .zone-thumb { transform: translateY(2px); }

@media (max-width: 520px) {
  .map-inner { inset: 12% 8%; }
  .map-grid { gap: 3px; }
  .zone-thumb { width: clamp(50px, 15vw, 70px); }
  .zone-name { font-size: 9px; }
}

body:not(.run) #bossPlate {
  opacity: 0;
  transform: translate(-50%, -140%);
}

.boss-plate {
  top: calc(var(--safe-t) + 8px);
  left: 50%;
  width: clamp(230px, 25vw, 320px);
  aspect-ratio: 546 / 225;
  transform: translate(-50%, -140%);
  opacity: 0;
  transition: transform 0.5s cubic-bezier(0.2, 1.5, 0.4, 1), opacity 0.35s ease;
}

.boss-plate.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

.boss-inner {
  position: absolute;
  left: 9%;
  right: 9%;
  top: 11%;
  bottom: 11%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 2%;
}

.boss-name {
  text-align: center;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(14px, 1.55vw, 21px);
  line-height: 1;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--ink);
  text-shadow: 0 1px 0 rgba(255, 244, 220, 0.55);
}

.bar {
  position: relative;
  background: rgba(43, 27, 30, 0.72);
  border: 2px solid #3a2421;
  overflow: hidden;
  clip-path: polygon(0.6% 14%, 2% 0%, 98% 1%, 99.6% 16%, 99% 86%, 97.7% 100%, 2.2% 99%, 0.4% 84%);
  box-shadow: inset 0 2px 4px rgba(30, 14, 10, 0.5);
}

.bar i {
  display: block;
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(to bottom, var(--red-hi) 0%, var(--red) 52%, #732c22 100%);
  box-shadow: inset 0 1px 0 rgba(255, 210, 160, 0.28);
  transition: transform 0.22s ease-out;
}

.boss-bar {
  height: 26%;
  margin: 0 13%;
}

.health-plate {
  left: clamp(10px, 2.2vw, 32px);
  bottom: calc(var(--safe-b) + 152px);
  width: clamp(238px, 29vw, 390px);
  aspect-ratio: 534 / 143;
}

.hp-inner {
  position: absolute;
  left: 7.6%;
  right: 7.4%;
  top: 25%;
  bottom: 25%;
  display: flex;
  align-items: center;
  gap: 3.5%;
}

.hp-bar {
  flex: 1 1 auto;
  height: 54%;
}

.hp-num {
  flex: none;
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(12px, 1.5vw, 17px);
  letter-spacing: -0.02em;
  color: var(--ink);
  white-space: nowrap;
  text-shadow: 0 1px 0 rgba(255, 244, 218, 0.5);
}

.hp-num .slash {
  opacity: 0.55;
  margin: 0 0.18em;
}

.health-plate.low .hp-bar i {
  background: linear-gradient(to bottom, #d06448, #9c3325 60%, #77241a);
  animation: lowpulse 0.9s ease-in-out infinite;
}

@keyframes lowpulse {
  0%, 100% { filter: brightness(1); }
  50% { filter: brightness(1.35); }
}

.health-plate.hurt {
  animation: platehurt 0.32s ease-out;
}

@keyframes platehurt {
  0% { transform: translate(0, 0) rotate(0); }
  22% { transform: translate(-5px, 3px) rotate(-0.7deg); }
  52% { transform: translate(4px, -2px) rotate(0.5deg); }
  100% { transform: translate(0, 0); }
}

.prompt-plate {
  left: 50%;
  bottom: calc(var(--safe-b) + 114px);
  width: clamp(240px, 27vw, 370px);
  aspect-ratio: 427 / 194;
  transform: translateX(-50%);
  transition: opacity 0.6s ease, transform 0.6s ease;
  pointer-events: auto;
}

.prompt-plate.faded {
  opacity: 0;
  transform: translate(-50%, 10px);
  pointer-events: none;
}

.prompt-inner {
  position: absolute;
  left: 11%;
  right: 11%;
  top: 24%;
  bottom: 24%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5%;
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(9px, 0.92vw, 12px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: center;
}

.prompt-inner .grp {
  display: flex;
  align-items: center;
  gap: 0.45em;
  white-space: nowrap;
}

.prompt-inner .keys {
  display: flex;
  gap: 0.22em;
}

.key {
  display: inline-grid;
  place-items: center;
  min-width: 1.55em;
  height: 1.55em;
  padding: 0 0.28em;
  border: 1.5px solid #3a2421;
  border-radius: 3px;
  background: linear-gradient(to bottom, #fbf0d6, #e6cda1);
  box-shadow: 0 1.5px 0 #6a4a26;
  font-size: 0.92em;
  color: #33201f;
}

.purse {
  position: absolute;
  right: clamp(10px, 2.2vw, 26px);
  bottom: calc(var(--safe-b) + clamp(16px, 2.8vh, 30px));
  width: clamp(52px, 6vw, 80px);
  aspect-ratio: 1;
  filter: drop-shadow(0 4px 9px rgba(60, 30, 18, 0.35));
}

.purse .ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.purse .glyph {
  position: absolute;
  inset: 23%;
  width: 54%;
  height: 54%;
}

.drop-slip {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 5;
  width: clamp(108px, 11vw, 158px);
  aspect-ratio: 324 / 400;
  pointer-events: none;
  filter: drop-shadow(0 8px 14px rgba(52, 24, 14, 0.42));
  transform: translate(-50%, -100%);
  will-change: transform, left, top;
}

.drop-slip .slip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.slip-inner {
  position: absolute;
  left: 12%;
  right: 12%;
  top: 17%;
  bottom: 12%;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  animation: slips 3.6s ease-in-out infinite;
}

@keyframes slips {
  0%, 100% { transform: rotate(-1.4deg); }
  50% { transform: rotate(1.4deg); }
}

.slip-kicker,
.slip-note {
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(6px, 0.62vw, 8px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #6b4a34;
}

.slip-name {
  margin: 9% 0 7%;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(12px, 1.35vw, 19px);
  line-height: 1.03;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.slip-note {
  margin-top: auto;
  padding-bottom: 6%;
  color: #7a3f2c;
}

#controls {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
}

.stick {
  position: absolute;
  left: 18px;
  bottom: calc(var(--safe-b) + 20px);
  width: clamp(92px, 9.5vw, 114px);
  height: clamp(94px, 9.7vw, 116px);
  pointer-events: auto;
  touch-action: none;
  cursor: grab;
}

.stick-base {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0.9;
  pointer-events: none;
}

.knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 46%;
  height: 46%;
  margin: -23% 0 0 -23%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, #fdf2da 0%, #e8d0a6 52%, #b98a4d 100%);
  border: 2px solid #5d3d1b;
  box-shadow: 0 4px 8px rgba(40, 18, 10, 0.4), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  pointer-events: none;
  will-change: transform;
}

.control-label {
  position: absolute;
  top: -15px;
  left: 0;
  right: 0;
  text-align: center;
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(7px, 0.7vw, 9px);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #3a2421;
  text-shadow: 0 0 3px rgba(248, 225, 188, 0.9), 0 1px 0 rgba(248, 225, 188, 0.9);
}

.skills {
  position: absolute;
  left: 50%;
  bottom: calc(var(--safe-b) + 28px);
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: clamp(6px, 0.9vw, 12px);
  pointer-events: none;
}

.skill {
  position: relative;
  width: clamp(54px, 5.6vw, 72px);
  aspect-ratio: 1;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  pointer-events: auto;
  cursor: pointer;
  filter: drop-shadow(0 4px 8px rgba(40, 18, 10, 0.35));
  touch-action: manipulation;
}

.skill-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.skill-glyph {
  position: absolute;
  inset: 26%;
  width: 48%;
  height: 48%;
  pointer-events: none;
  filter: drop-shadow(0 1px 0 rgba(255, 244, 216, 0.45));
}

.cooldown {
  position: absolute;
  inset: 17%;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: conic-gradient(rgba(43, 27, 30, 0.6) var(--cool, 0deg), rgba(43, 27, 30, 0) 0);
  transition: opacity 0.15s linear;
}

.skill.cooling .cooldown { opacity: 1; }

.cdnum {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(11px, 1.2vw, 15px);
  color: #f2e2c4;
  text-shadow: 0 1px 2px rgba(30, 15, 10, 0.7);
  opacity: 0;
  pointer-events: none;
}

.skill.cooling .cdnum { opacity: 1; }

.keytag {
  position: absolute;
  right: 0;
  bottom: 0;
  width: clamp(15px, 1.5vw, 19px);
  height: clamp(15px, 1.5vw, 19px);
  display: grid;
  place-items: center;
  border: 1.5px solid #3a2421;
  border-radius: 3px;
  background: linear-gradient(to bottom, #fbf0d6, #e6cda1);
  box-shadow: 0 1.5px 0 #6a4a26;
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(8px, 0.8vw, 10px);
  color: #33201f;
  pointer-events: none;
}

.skill-label {
  position: absolute;
  left: 50%;
  top: calc(100% + 2px);
  transform: translateX(-50%);
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(7px, 0.66vw, 9px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #3a2421;
  text-shadow: 0 0 3px rgba(248, 225, 188, 0.92), 0 1px 0 rgba(248, 225, 188, 0.92);
  white-space: nowrap;
  pointer-events: none;
}

.skill:active .skill-ring { filter: brightness(1.08); }
.skill:active { transform: translateY(2px); }

.skill.ready-pop { animation: skillpop 0.35s ease-out; }

@keyframes skillpop {
  0% { transform: scale(1); }
  40% { transform: scale(1.12); }
  100% { transform: scale(1); }
}

.intro-hint {
  position: absolute;
  left: 50%;
  top: 22%;
  transform: translate(-50%, -50%);
  z-index: 5;
  padding: 0.5em 1.1em;
  border: 2px solid rgba(58, 36, 33, 0.5);
  background: rgba(244, 228, 198, 0.72);
  color: #3a2421;
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(9px, 1vw, 12px);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 0.8s ease;
  pointer-events: none;
  white-space: nowrap;
  max-width: 88vw;
  text-align: center;
}

.intro-hint,
.intro-hint.show { display: none; }

.dmg {
  position: absolute;
  left: 0;
  top: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 7;
}

.dmg span {
  display: block;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(18px, 2.4vw, 30px);
  letter-spacing: 0.01em;
  color: #2b1b1e;
  text-shadow:
    0 0 2px rgba(250, 232, 198, 0.95),
    0 1px 0 rgba(250, 232, 198, 0.9),
    0 -1px 0 rgba(250, 232, 198, 0.9),
    1px 0 0 rgba(250, 232, 198, 0.9),
    -1px 0 0 rgba(250, 232, 198, 0.9);
  animation: stamp 0.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.dmg.player span {
  color: #7c2a1e;
  font-size: clamp(16px, 2vw, 24px);
}

.dmg.big span {
  font-size: clamp(26px, 3.4vw, 46px);
}

@keyframes stamp {
  0% { transform: scale(1.9) rotate(-7deg); opacity: 0; }
  14% { transform: scale(0.92) rotate(-3deg); opacity: 1; }
  26% { transform: scale(1.03) rotate(-2deg); }
  40% { transform: scale(1) rotate(-2deg); opacity: 1; }
  100% { transform: scale(1) rotate(-2deg) translateY(-30px); opacity: 0; }
}

.big-stamp {
  position: absolute;
  left: 50%;
  top: 15%;
  transform: translate(-50%, -50%);
  z-index: 8;
  pointer-events: none;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(20px, 3vw, 44px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: #2b1b1e;
  text-shadow:
    0 0 3px rgba(250, 232, 198, 0.9),
    0 2px 0 rgba(250, 232, 198, 0.85),
    0 -2px 0 rgba(250, 232, 198, 0.85),
    2px 0 0 rgba(250, 232, 198, 0.85),
    -2px 0 0 rgba(250, 232, 198, 0.85);
  animation: centrestamp 2.6s ease-out forwards;
  text-align: center;
  white-space: nowrap;
}

@keyframes centrestamp {
  0% { transform: translate(-50%, -50%) scale(1.7) rotate(-2deg); opacity: 0; }
  9% { transform: translate(-50%, -50%) scale(0.94) rotate(-1deg); opacity: 1; }
  16% { transform: translate(-50%, -50%) scale(1.02) rotate(-1deg); }
  24% { transform: translate(-50%, -50%) scale(1) rotate(-1deg); opacity: 1; }
  82% { transform: translate(-50%, -50%) scale(1) rotate(-1deg); opacity: 1; }
  100% { transform: translate(-50%, -50%) scale(0.98) rotate(-1deg); opacity: 0; }
}

.veil {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: radial-gradient(90% 80% at 50% 45%, rgba(64, 31, 18, 0.28), rgba(46, 22, 14, 0.56));
  padding: 18px;
}

#endCard.compact {
  background: linear-gradient(to bottom, rgba(46, 22, 14, 0.22), rgba(46, 22, 14, 0) 32%);
  place-items: start center;
  padding-top: calc(var(--safe-t) + 10px);
  pointer-events: none;
}

#endCard.compact .note {
  width: min(42vw, 168px);
  pointer-events: auto;
  filter: drop-shadow(0 10px 18px rgba(40, 18, 10, 0.42));
}

#endCard.compact .note-inner {
  left: 12%;
  right: 12%;
  top: 12%;
  bottom: 7%;
  gap: 0.24em;
}

#endCard.compact .note-kicker { font-size: 6.5px; letter-spacing: 0.12em; }
#endCard.compact .note h2 { font-size: clamp(13px, 3.4vw, 18px); }
#endCard.compact .note p { display: none; }
#endCard.compact .ink-button { font-size: 9px; padding: 0.42em 0.75em; margin-top: 0.15em; }

@media (orientation: landscape) {
  #endCard.compact {
    background: none;
    place-items: center end;
    padding: 8px;
  }
  #endCard.compact .note { width: min(24vw, 162px); }
  #endCard.compact .note h2 { font-size: clamp(11px, 1.25vw, 15px); }
}

.note {
  position: relative;
  width: min(86vw, 330px);
  aspect-ratio: 324 / 400;
  filter: drop-shadow(0 14px 26px rgba(40, 18, 10, 0.5));
}

.note .slip {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.note-inner {
  position: absolute;
  left: 13%;
  right: 13%;
  top: 15%;
  bottom: 10%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 0.42em;
}

.note-kicker {
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: 8px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: #7a4632;
}

.note h2 {
  margin: 0.05em 0 0.12em;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 800;
  font-size: clamp(18px, 2.4vw, 26px);
  line-height: 1.02;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  color: var(--ink);
}

.note p {
  margin: 0;
  font-size: clamp(11px, 1.1vw, 13px);
  line-height: 1.35;
  color: #4a2f28;
  max-width: 22em;
}

.rules {
  margin: 0.1em 0 0;
  padding: 0 0.1em;
  list-style: none;
  text-align: left;
  font-size: clamp(9px, 1vw, 11.5px);
  line-height: 1.3;
  color: #4a2f28;
  display: grid;
  gap: 0.32em;
}

.rules li {
  padding-left: 0.9em;
  position: relative;
}

.rules li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.52em;
  width: 0.34em;
  height: 0.34em;
  background: var(--brass);
  border: 1px solid #6a4a26;
  transform: rotate(45deg);
}

.rules b {
  color: var(--ink);
  font-weight: 800;
}

.ink-button {
  margin-top: 0.3em;
  padding: 0.5em 1.1em;
  border: 2px solid #3a2421;
  border-radius: 3px;
  background: linear-gradient(to bottom, #fbf0d6, #e4c894);
  color: #33201f;
  font-family: 'Azeret Mono', monospace;
  font-weight: 700;
  font-size: clamp(10px, 1.1vw, 12px);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 3px 0 #6a4a26, 0 6px 12px rgba(40, 18, 10, 0.25);
  pointer-events: auto;
}

.ink-button:active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #6a4a26;
}

body.touch .stick {
  width: clamp(96px, 26vw, 122px);
  height: clamp(98px, 26.5vw, 124px);
  left: 14px;
  bottom: calc(var(--safe-b) + 30px);
}

body.touch .control-label {
  top: auto;
  bottom: -15px;
}

body.touch .stick .knob {
  border-width: 2px;
}

body.touch .skills {
  left: auto;
  right: 12px;
  bottom: calc(var(--safe-b) + 20px);
  transform: none;
  gap: 6px;
}

body.touch .skill {
  width: clamp(50px, 13vw, 64px);
}

body.touch .keytag { display: none; }

body.touch .health-plate {
  top: auto;
  left: 12px;
  bottom: calc(var(--safe-b) + 176px);
  width: min(46vw, 300px);
}

body.touch .prompt-plate {
  left: auto;
  right: 12px;
  bottom: calc(var(--safe-b) + 106px);
  width: min(44vw, 250px);
  transform: none;
}

body.touch .prompt-plate.faded {
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
}

body.touch .prompt-inner {
  font-size: clamp(8px, 2vw, 10px);
  flex-direction: column;
  gap: 0.22em;
}

body.touch .purse {
  right: 10px;
  bottom: auto;
  top: calc(var(--safe-t) + 76px);
  width: clamp(46px, 12vw, 64px);
}

body.touch .boss-plate {
  width: min(56vw, 290px);
  top: calc(var(--safe-t) + 10px);
}

body.touch .map-btn {
  width: clamp(46px, 12.5vw, 58px);
  top: calc(var(--safe-t) + 10px);
  right: 10px;
}

body.touch .zone-tag {
  left: 14px;
  top: auto;
  bottom: calc(var(--safe-b) + 238px);
  padding: 0.34em 0.6em 0.28em;
  font-size: 7px;
  letter-spacing: 0.1em;
}

body.touch .title-lockup {
  left: calc(var(--brand-h) + 8px);
}

body.touch .medallion {
  width: clamp(52px, 14vw, 76px);
}

body.touch .title-lockup {
  width: clamp(132px, 38vw, 220px);
}

body.touch .intro-hint {
  display: none;
}

body.touch .drop-slip {
  width: clamp(108px, 30vw, 150px);
}

@media (max-width: 760px) {
  :root { --brand-h: clamp(52px, 14vw, 76px); }
  .title-lockup { width: clamp(140px, 38vw, 230px); }
  .boss-name { font-size: clamp(14px, 3.8vw, 20px); }
  .skill-label { font-size: 7px; }
}

@media (orientation: portrait) {
  body.touch .prompt-plate {
    z-index: 7;
  }
  body.touch .prompt-plate.faded {
    opacity: 1;
    transform: none;
    pointer-events: auto;
  }
}

@media (pointer: coarse) and (max-height: 560px) and (orientation: landscape) {
  body.touch .stick {
    width: 92px;
    height: 94px;
    left: 12px;
    bottom: calc(var(--safe-b) + 10px);
  }
  body.touch .control-label {
    top: -12px;
    bottom: auto;
  }
  body.touch .land-strip {
    top: calc(var(--safe-t) + var(--brand-h) + 86px);
  }
  body.touch .skills {
    right: 12px;
    bottom: calc(var(--safe-b) + 12px);
  }
  body.touch .skill { width: 48px; }
  body.touch .health-plate {
    left: 118px;
    bottom: calc(var(--safe-b) + 12px);
    width: min(28vw, 240px);
  }
  body.touch .prompt-plate { display: none; }
  body.touch .purse {
    right: 12px;
    top: calc(var(--safe-t) + 66px);
    bottom: auto;
    width: 46px;
  }
  body.touch .boss-plate { width: min(30vw, 236px); top: calc(var(--safe-t) + 6px); }
  body.touch .zone-tag {
    left: 12px;
    top: calc(var(--safe-t) + var(--brand-h) + 30px);
    bottom: auto;
  }
  body.touch .progress-boss { width: min(44vw, 320px); }
}

@media (prefers-reduced-motion: reduce) {
  .dmg span, .big-stamp { animation-duration: 0.3s; }
}
