:root {
  --ink: #111111;
  --paper: #f3f3ef;
  --paper-dark: #d9d9d3;
  --cash: #ffd400;
  --dps: #00d9ff;
  --danger: #e52530;
  --pink: #ff0062;
  --gold: #f5c400;
  --volume: 39%;
}

@font-face {
  font-family: "BangersLocal";
  src: url("assets/fonts/Bangers-Regular.ttf") format("truetype");
  font-display: swap;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background-color: #07111c;
  background-image:
    radial-gradient(circle at 50% 42%, rgba(15, 58, 91, 0.12) 0 23%, rgba(0, 0, 0, 0.28) 56%, rgba(0, 0, 0, 0.56) 100%),
    linear-gradient(rgba(4, 10, 18, 0.05), rgba(3, 7, 12, 0.24)),
    url("assets/backgrounds/background.png"),
    radial-gradient(circle at 12% 42%, rgba(32, 216, 255, 0.55) 0 7%, transparent 18%),
    radial-gradient(circle at 86% 48%, rgba(23, 195, 255, 0.42) 0 8%, transparent 20%),
    linear-gradient(130deg, #061422 0%, #123a5b 42%, #082136 68%, #02070e 100%);
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  font-family: "BangersLocal", "Bangers", Impact, "Arial Black", system-ui, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
  font-synthesis: none;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background-image: repeating-linear-gradient(
    62deg,
    rgba(255, 255, 255, 0.06) 0,
    rgba(255, 255, 255, 0.06) 1px,
    transparent 1px,
    transparent 6px
  );
  mix-blend-mode: soft-light;
}

button {
  font: inherit;
}

.hidden,
[hidden] {
  display: none !important;
}

.game-shell {
  position: relative;
  z-index: 1;
  display: flex;
  min-height: 100dvh;
  align-items: flex-start;
  justify-content: center;
  gap: clamp(20px, 2vw, 30px);
  padding: 24px;
}

.game-shell.is-unlocking {
  animation: screen-shake 520ms steps(2, end);
}

.game-shell.is-guild-transitioning {
  animation: guild-window-transition 780ms cubic-bezier(0.12, 0.82, 0.2, 1) both;
}

.game-shell.is-collection-revealing .battle-panel {
  animation: battle-make-room 920ms cubic-bezier(0.12, 0.82, 0.2, 1) both;
}

.panel {
  border: 4px solid var(--ink);
  box-shadow: 11px 12px 0 rgba(0, 0, 0, 0.34), 0 0 0 2px rgba(255, 255, 255, 0.2) inset;
  transform-origin: 50% 52%;
}

.battle-panel {
  position: relative;
  width: clamp(500px, 39vw, 528px);
  min-height: 650px;
  padding: 14px 16px 12px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    36deg,
    rgba(0, 0, 0, 0.045) 0,
    rgba(0, 0, 0, 0.045) 2px,
    rgba(255, 255, 255, 0.55) 2px,
    rgba(255, 255, 255, 0.55) 6px
  );
  transform: rotate(-1.25deg) skew(-0.35deg);
}

.shop-panel {
  width: clamp(338px, 26vw, 360px);
  height: 650px;
  padding: 8px;
  background:
    repeating-linear-gradient(42deg, rgba(255, 255, 255, 0.03) 0 2px, transparent 2px 7px),
    #151515;
  transform: rotate(0.9deg) skew(0.25deg);
}

.shop-panel.is-revealing {
  transform-origin: left center;
  animation: collection-slide-out 920ms cubic-bezier(0.12, 0.82, 0.2, 1) both;
}

.clear-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 24px;
  background: transparent;
  animation: clear-overlay-fade 320ms ease-out both;
}

.clear-screen.is-guild-call {
  background: transparent;
}

.clear-panel {
  width: min(620px, calc(100vw - 32px));
  padding: 14px 16px 18px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    36deg,
    rgba(0, 0, 0, 0.045) 0,
    rgba(0, 0, 0, 0.045) 2px,
    rgba(255, 255, 255, 0.55) 2px,
    rgba(255, 255, 255, 0.55) 6px
  );
  transform: rotate(-1.5deg) skew(-0.25deg);
}

.clear-screen:not([hidden]) .clear-panel {
  animation: clear-panel-pop 520ms cubic-bezier(0.12, 0.82, 0.2, 1) both;
}

.clear-screen.is-guild-call:not([hidden]) .clear-panel {
  animation: guild-call-panel-pop 780ms cubic-bezier(0.08, 0.86, 0.18, 1) both;
}

.clear-screen.is-guild-call.is-guild-exiting:not([hidden]) .clear-panel {
  animation: guild-call-panel-exit 620ms cubic-bezier(0.72, 0.02, 0.74, 0.42) both;
}

.clear-screen.is-guild-call.is-guild-exiting:not([hidden]) {
  animation: guild-call-overlay-exit 720ms ease-out both;
}

.clear-screen.is-guild-call .clear-panel {
  box-shadow:
    11px 12px 0 rgba(0, 0, 0, 0.34),
    0 0 0 2px rgba(255, 255, 255, 0.2) inset,
    0 0 34px rgba(255, 212, 0, 0.38);
}

.clear-panel .panel-header {
  min-height: 92px;
}

.clear-panel .panel-header h2 {
  font-size: clamp(2.9rem, 7vw, 5.6rem);
  text-shadow:
    4px 4px 0 #2468c8,
    8px 8px 0 #000000,
    -2px -2px 0 rgba(255, 255, 255, 0.25);
}

.clear-body {
  display: grid;
  min-height: 260px;
  place-items: center;
  gap: 22px;
  margin-top: 14px;
  border: 3px dashed rgba(0, 0, 0, 0.16);
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 212, 0, 0.24), transparent 36%),
    radial-gradient(circle, rgba(0, 0, 0, 0.11) 1px, transparent 1px),
    repeating-linear-gradient(55deg, rgba(0, 0, 0, 0.035) 0 2px, transparent 2px 9px),
    #f4f4f0;
  background-size: auto, 15px 15px, auto, auto;
}

.clear-stamp {
  color: var(--gold);
  font-size: clamp(2.4rem, 6vw, 4.4rem);
  text-shadow:
    4px 4px 0 #000000,
    -2px -2px 0 #ffffff;
  transform: rotate(-7deg) skew(-8deg);
}

.clear-screen.is-guild-call:not([hidden]) .clear-stamp {
  animation: guild-call-stamp 900ms cubic-bezier(0.12, 0.82, 0.2, 1) 220ms both;
}

.clear-screen.is-guild-call:not([hidden]) .clear-message {
  animation: guild-call-message 520ms ease-out 420ms both;
}

.clear-screen.is-guild-call:not([hidden]) .comic-button {
  animation: guild-call-button 960ms ease-out 620ms both;
}

.clear-message {
  max-width: 500px;
  margin: 0;
  padding: 0 16px;
  font-size: clamp(1.28rem, 3vw, 2rem);
  line-height: 1.08;
  text-align: center;
  text-transform: uppercase;
}

.comic-button {
  border: 4px solid var(--ink);
  padding: 12px 20px 10px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 4px, transparent 4px 9px),
    var(--gold);
  color: var(--ink);
  cursor: pointer;
  font-size: clamp(1.3rem, 3vw, 2rem);
  text-transform: uppercase;
  box-shadow: 6px 6px 0 rgba(0, 0, 0, 0.36);
  transform: skew(-8deg) rotate(1deg);
}

.comic-button:hover,
.comic-button:focus-visible {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0 4px, transparent 4px 9px),
    var(--pink);
  color: #ffffff;
  outline: none;
}

.guild-screen {
  position: fixed;
  inset: 0;
  z-index: 12;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 24px;
  background:
    linear-gradient(180deg, rgba(10, 5, 2, 0.2), rgba(0, 0, 0, 0.36)),
    url("assets/backgrounds/guild-hall.png");
  background-position: center;
  background-size: cover;
}

.guild-hq-screen {
  background:
    linear-gradient(180deg, rgba(7, 4, 4, 0.06), rgba(0, 0, 0, 0.32)),
    var(--guild-hq-bg, url("assets/backgrounds/guild-hall.png"));
  background-position: center;
  background-size: cover;
}

.guild-screen:not([hidden]) {
  animation: guild-screen-enter 780ms cubic-bezier(0.12, 0.82, 0.2, 1) both;
}

.guild-screen:not([hidden]) .guild-panel {
  animation: guild-panel-enter 760ms cubic-bezier(0.12, 0.82, 0.2, 1) 120ms both;
}

.guild-panel {
  width: min(1080px, calc(100vw - 34px));
  min-height: min(720px, calc(100dvh - 42px));
  padding: 14px 16px 18px;
  background:
    linear-gradient(180deg, rgba(244, 231, 202, 0.82), rgba(238, 220, 181, 0.68));
  backdrop-filter: blur(1.5px);
  transform: rotate(-0.65deg);
}

.guild-header {
  min-height: 112px;
  flex-direction: column;
  gap: 8px;
  padding: 14px 20px;
}

.guild-header h1 {
  font-size: clamp(2.5rem, 6vw, 5rem);
  text-shadow:
    4px 4px 0 #e52530,
    8px 8px 0 #000000,
    -2px -2px 0 rgba(255, 255, 255, 0.24);
}

.guild-header p {
  max-width: 760px;
  margin: 0;
  font-size: clamp(1rem, 2vw, 1.35rem);
  line-height: 1.05;
  text-shadow: 2px 2px 0 #000000;
}

.guild-lineup {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  align-items: end;
  gap: clamp(12px, 2vw, 22px);
  min-height: 430px;
  margin: 18px 0;
  padding: 24px clamp(12px, 2vw, 26px) 18px;
  border: 4px solid var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.58) 0 58%, rgba(0, 0, 0, 0.15) 58% 100%),
    repeating-linear-gradient(0deg, rgba(0, 0, 0, 0.06) 0 2px, transparent 2px 12px),
    #f5f1e6;
  box-shadow: inset 0 -24px 0 rgba(0, 0, 0, 0.08);
}

.guild-hq-panel {
  min-height: auto;
  width: min(760px, calc(100vw - 34px));
}

.guild-hq-screen[data-guild="fire"] .guild-hq-panel {
  box-shadow:
    9px 9px 0 rgba(0, 0, 0, 0.88),
    0 0 42px rgba(255, 78, 14, 0.36);
}

.guild-hq-screen[data-guild="plant"] .guild-hq-panel {
  box-shadow:
    9px 9px 0 rgba(0, 0, 0, 0.88),
    0 0 42px rgba(100, 219, 74, 0.34);
}

.guild-hq-screen[data-guild="lightning"] .guild-hq-panel {
  box-shadow:
    9px 9px 0 rgba(0, 0, 0, 0.88),
    0 0 46px rgba(50, 152, 255, 0.42);
}

.guild-hq-body {
  display: grid;
  min-height: 330px;
  place-items: center;
  gap: 18px;
  margin-top: 18px;
  border: 4px solid var(--ink);
  padding: 28px 18px;
  background:
    radial-gradient(circle at 50% 36%, rgba(255, 212, 0, 0.22), transparent 42%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(232, 211, 170, 0.82));
  text-align: center;
}

.guild-hq-stamp {
  color: var(--gold);
  font-size: clamp(2rem, 6vw, 4rem);
  line-height: 0.92;
  text-shadow:
    4px 4px 0 #000000,
    -2px -2px 0 #ffffff;
  transform: rotate(-5deg) skew(-8deg);
}

.guild-hq-body p {
  max-width: 560px;
  margin: 0;
  font-size: clamp(1.2rem, 3vw, 1.9rem);
  line-height: 1.05;
  text-transform: uppercase;
}

.guild-master {
  --guild-main: #e52530;
  --guild-secondary: #ffd400;
  --guild-dark: #1a1a1a;
  --skin: #f0b184;
  display: grid;
  min-height: 430px;
  align-content: end;
  justify-items: center;
  padding: 14px 10px 16px;
  border: 3px solid var(--ink);
  background:
    repeating-linear-gradient(42deg, rgba(255, 255, 255, 0.14) 0 3px, transparent 3px 10px),
    rgba(255, 255, 255, 0.52);
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  box-shadow: 7px 8px 0 rgba(0, 0, 0, 0.22);
}

.guild-master:hover,
.guild-master:focus-visible {
  outline: none;
  background:
    repeating-linear-gradient(42deg, rgba(255, 255, 255, 0.2) 0 3px, transparent 3px 10px),
    linear-gradient(180deg, rgba(255, 212, 0, 0.34), rgba(255, 255, 255, 0.64));
  box-shadow:
    7px 8px 0 rgba(0, 0, 0, 0.22),
    0 0 0 6px rgba(255, 212, 0, 0.46);
}

.guild-master.is-selected {
  background:
    repeating-linear-gradient(42deg, rgba(255, 255, 255, 0.26) 0 3px, transparent 3px 10px),
    linear-gradient(180deg, rgba(255, 212, 0, 0.5), rgba(255, 255, 255, 0.78));
  box-shadow:
    7px 8px 0 rgba(0, 0, 0, 0.22),
    0 0 0 8px var(--guild-secondary),
    0 0 0 12px var(--ink);
}

.guild-master:nth-child(1) {
  transform: rotate(-1.4deg);
}

.guild-master:nth-child(2) {
  transform: translateY(-16px) rotate(0.7deg);
}

.guild-master:nth-child(3) {
  transform: rotate(1.25deg);
}

.guild-master.is-plant {
  --guild-main: #18a558;
  --guild-secondary: #b5ff3d;
  --guild-dark: #17311f;
  --skin: #d79a70;
}

.guild-master.is-lightning {
  --guild-main: #f5c400;
  --guild-secondary: #2468c8;
  --guild-dark: #20150b;
  --skin: #b96f46;
}

.master-name {
  display: block;
  margin: 8px 0 4px;
  font-size: clamp(1.25rem, 2vw, 1.72rem);
  line-height: 0.96;
  text-transform: uppercase;
}

.master-copy {
  display: block;
  max-width: 230px;
  margin: 0;
  font-size: clamp(0.86rem, 1.35vw, 1rem);
  line-height: 1.08;
  text-transform: uppercase;
}

.master-reward {
  display: block;
  margin-top: 10px;
  border: 3px solid var(--ink);
  padding: 6px 9px 4px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0 3px, transparent 3px 8px),
    var(--guild-secondary);
  font-size: clamp(0.8rem, 1.25vw, 0.96rem);
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.24);
  transform: skew(-7deg);
}

.master-figure {
  position: relative;
  display: block;
  width: min(210px, 46vw);
  height: 300px;
  filter: drop-shadow(10px 12px 0 rgba(0, 0, 0, 0.26));
}

.master-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center bottom;
}

.master-aura {
  position: absolute;
  left: 50%;
  top: 16px;
  width: 142px;
  height: 168px;
  background:
    repeating-linear-gradient(35deg, rgba(255, 255, 255, 0.36) 0 4px, transparent 4px 12px),
    var(--guild-secondary);
  clip-path: polygon(50% 0, 60% 34%, 100% 20%, 73% 50%, 96% 80%, 58% 68%, 50% 100%, 42% 68%, 4% 80%, 27% 50%, 0 20%, 40% 34%);
  opacity: 0.72;
  transform: translateX(-50%) rotate(-7deg);
}

.master-head,
.master-hair,
.master-body,
.master-arm,
.master-leg {
  position: absolute;
  display: block;
  border: 4px solid var(--ink);
}

.master-head {
  left: 50%;
  top: 20px;
  z-index: 4;
  width: 62px;
  height: 62px;
  background:
    radial-gradient(circle at 36% 42%, #111111 0 4px, transparent 5px),
    radial-gradient(circle at 64% 42%, #111111 0 4px, transparent 5px),
    linear-gradient(var(--skin), var(--skin));
  border-radius: 50%;
  transform: translateX(-50%);
}

.master-hair {
  left: 50%;
  top: 10px;
  z-index: 5;
  width: 78px;
  height: 40px;
  background: var(--guild-dark);
  border-radius: 44px 44px 10px 10px;
  transform: translateX(-50%) rotate(-4deg);
}

.master-body {
  left: 50%;
  top: 82px;
  z-index: 3;
  width: 92px;
  height: 104px;
  background:
    linear-gradient(90deg, var(--guild-secondary) 0 22%, transparent 22% 78%, var(--guild-secondary) 78%),
    var(--guild-main);
  clip-path: polygon(14% 0, 86% 0, 100% 88%, 50% 100%, 0 88%);
  transform: translateX(-50%);
}

.master-arm {
  top: 96px;
  z-index: 2;
  width: 28px;
  height: 92px;
  background: var(--guild-main);
  border-radius: 18px;
}

.master-arm.left {
  left: 18px;
  transform: rotate(18deg);
}

.master-arm.right {
  right: 18px;
  transform: rotate(-18deg);
}

.master-leg {
  top: 176px;
  z-index: 1;
  width: 34px;
  height: 74px;
  background: var(--guild-dark);
}

.master-leg.left {
  left: 42px;
  transform: rotate(4deg);
}

.master-leg.right {
  right: 42px;
  transform: rotate(-4deg);
}

.guild-continue-button {
  display: block;
  margin: 0 auto;
}

.guild-continue-button:disabled {
  cursor: not-allowed;
  filter: grayscale(0.82);
  opacity: 0.55;
}

.home-shell {
  position: relative;
  z-index: 1;
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 24px;
}

.home-panel {
  width: min(1040px, calc(100vw - 36px));
  min-height: min(660px, calc(100dvh - 48px));
  padding: 14px 16px 18px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    36deg,
    rgba(0, 0, 0, 0.045) 0,
    rgba(0, 0, 0, 0.045) 2px,
    rgba(255, 255, 255, 0.55) 2px,
    rgba(255, 255, 255, 0.55) 6px
  );
  transform: rotate(-0.65deg) skew(-0.2deg);
}

.home-main-header,
.battle-main-header {
  position: relative;
}

.home-header-actions {
  position: absolute;
  top: 50%;
  right: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
  transform: translateY(-50%);
}

.home-action-button {
  max-width: 118px;
  border: 3px solid var(--ink);
  padding: 7px 9px 5px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 3px, transparent 3px 8px),
    var(--dps);
  color: #ffffff;
  cursor: pointer;
  font-size: 0.86rem;
  line-height: 1;
  text-align: center;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #000000;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.28);
  transform: rotate(-2deg);
}

.home-action-button:hover,
.home-action-button:focus-visible {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.16) 0 3px, transparent 3px 8px),
    var(--pink);
  outline: none;
  transform: rotate(2deg) scale(1.04);
}

.home-reset-button {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 3px, transparent 3px 8px),
    var(--danger);
  transform: rotate(2deg);
}

.test-reset-button {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 3px, transparent 3px 8px),
    var(--danger);
  transform: rotate(2deg);
}

.home-content {
  display: grid;
  min-height: 520px;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: 16px;
  margin-top: 16px;
}

.home-section {
  min-width: 0;
  border: 4px solid var(--ink);
  padding: 10px;
  background:
    repeating-linear-gradient(42deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 7px),
    #151515;
}

.home-section-header {
  display: flex;
  min-height: 50px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 10px;
  color: #ffffff;
  background:
    repeating-linear-gradient(38deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 7px),
    #151515;
  text-transform: uppercase;
  text-shadow:
    2px 2px 0 #2468c8,
    4px 4px 0 rgba(0, 0, 0, 0.65);
}

.home-section-header h2 {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 400;
  line-height: 1;
  transform: skew(-8deg);
}

.home-section-header strong {
  color: var(--cash);
  font-size: 1.18rem;
  text-shadow: 3px 3px 0 #000000;
}

.dungeon-map {
  position: relative;
  min-height: 450px;
  overflow: hidden;
  border: 4px solid var(--ink);
  background:
    repeating-linear-gradient(42deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 7px),
    #111111;
  cursor: grab;
  touch-action: none;
  user-select: none;
}

.dungeon-map.is-dragging {
  cursor: grabbing;
}

.map-canvas {
  position: absolute;
  top: 0;
  left: 0;
  width: max(920px, 205%);
  height: max(560px, 134%);
  min-height: 450px;
  overflow: hidden;
  padding: 0;
  background:
    radial-gradient(circle at 20% 28%, rgba(0, 217, 255, 0.16), transparent 20%),
    radial-gradient(circle at 47% 78%, rgba(255, 0, 98, 0.12), transparent 18%),
    radial-gradient(circle at 76% 62%, rgba(255, 212, 0, 0.15), transparent 22%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(215, 232, 230, 0.78)),
    repeating-linear-gradient(42deg, rgba(0, 0, 0, 0.04) 0 2px, rgba(255, 255, 255, 0.38) 2px 7px);
  transform: translate(0, 0);
  will-change: transform;
}

.map-canvas::before,
.dungeon-map::after,
.map-canvas::after {
  position: absolute;
  content: "";
  pointer-events: none;
}

.map-canvas::before {
  z-index: 0;
  inset: 18px;
  border: 3px dashed rgba(0, 0, 0, 0.15);
}

.map-canvas::after {
  z-index: 0;
  top: 20px;
  right: 32px;
  width: 164px;
  height: 52px;
  border: 4px solid rgba(0, 0, 0, 0.26);
  background:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.06) 0 3px, rgba(255, 255, 255, 0.4) 3px 8px),
    rgba(255, 255, 255, 0.5);
  transform: rotate(2deg);
}

.dungeon-map::after {
  right: 20px;
  bottom: 18px;
  z-index: 5;
  width: 86px;
  height: 86px;
  border: 4px solid rgba(0, 0, 0, 0.28);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 47%, rgba(0, 0, 0, 0.28) 48% 52%, transparent 53%),
    linear-gradient(0deg, transparent 47%, rgba(0, 0, 0, 0.28) 48% 52%, transparent 53%);
  opacity: 0.38;
}

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

.map-route-shadow,
.map-route-open,
.map-route-done {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.map-route-shadow {
  stroke: rgba(0, 0, 0, 0.58);
  stroke-width: 8;
}

.map-route-open {
  stroke: #ffffff;
  stroke-dasharray: 2 6;
  stroke-width: 4;
}

.map-route-done {
  stroke: var(--gold);
  stroke-width: 5;
}

.map-node {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  display: grid;
  width: 134px;
  grid-template-rows: 64px auto;
  justify-items: center;
  gap: 6px;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  transform: translate(-50%, -50%) rotate(var(--tilt));
  transition: transform 140ms ease, filter 140ms ease, opacity 140ms ease;
}

.map-node:hover,
.map-node:focus-visible {
  filter: drop-shadow(0 0 10px rgba(245, 196, 0, 0.65));
  outline: none;
  transform: translate(-50%, -50%) rotate(var(--tilt)) scale(1.06);
}

.map-node.is-locked {
  cursor: default;
  opacity: 0.58;
  filter: saturate(0.55);
}

.map-node.is-locked:hover,
.map-node.is-locked:focus-visible {
  filter: saturate(0.55);
  transform: translate(-50%, -50%) rotate(var(--tilt));
}

.map-pin {
  display: grid;
  width: 64px;
  aspect-ratio: 1;
  place-items: center;
  border: 4px solid var(--ink);
  border-radius: 6px;
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95), transparent 20%),
    linear-gradient(135deg, #ffdd55, #ff5c5c 48%, #28d7ff);
  color: #ffffff;
  font-size: 1.28rem;
  overflow: hidden;
  text-shadow: 2px 2px 0 #000000;
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.26);
}

.map-pin-img,
.map-pin-fallback {
  transform: none;
}

.map-pin-img {
  width: 118%;
  height: 118%;
  object-fit: cover;
  filter: saturate(1.08) contrast(1.05);
}

.map-pin-img.is-loaded + .map-pin-fallback {
  display: none;
}

.map-pin-fallback {
  display: block;
}

.map-node.is-complete .map-pin {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.95), transparent 18%),
    linear-gradient(135deg, #18e26d, #10a858 48%, #00d9ff);
}

.map-node.is-current .map-pin {
  box-shadow: 0 0 0 5px rgba(245, 196, 0, 0.35), 5px 5px 0 rgba(0, 0, 0, 0.26);
}

.map-node.is-locked .map-pin {
  background:
    radial-gradient(circle at 35% 28%, rgba(255, 255, 255, 0.8), transparent 18%),
    linear-gradient(135deg, #777777, #444444);
}

.map-label {
  display: block;
  width: 134px;
  border: 3px solid var(--ink);
  padding: 6px 7px 5px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    42deg,
    rgba(0, 0, 0, 0.05) 0,
    rgba(0, 0, 0, 0.05) 2px,
    rgba(255, 255, 255, 0.56) 2px,
    rgba(255, 255, 255, 0.56) 6px
  );
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.22);
  text-transform: uppercase;
}

.map-label strong,
.map-label span {
  display: block;
  overflow-wrap: anywhere;
}

.map-label strong {
  font-size: 0.9rem;
  line-height: 1;
  transform: skew(-8deg);
}

.map-label span {
  margin-top: 4px;
  color: #555555;
  font-size: 0.75rem;
  line-height: 1;
}

.map-label .map-achievements {
  color: #0f7b46;
  font-size: 0.68rem;
}

.quest-panel {
  position: fixed;
  inset: 24px;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(0, 0, 0, 0.38);
}

.quest-window {
  display: grid;
  width: min(940px, 100%);
  max-height: min(720px, calc(100dvh - 84px));
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
  border: 4px solid var(--ink);
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    36deg,
    rgba(0, 0, 0, 0.045) 0,
    rgba(0, 0, 0, 0.045) 2px,
    rgba(255, 255, 255, 0.55) 2px,
    rgba(255, 255, 255, 0.55) 6px
  );
  box-shadow: 11px 12px 0 rgba(0, 0, 0, 0.3);
  transform: rotate(0.35deg);
}

.quest-header {
  display: flex;
  min-height: 58px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  color: #ffffff;
  background:
    repeating-linear-gradient(38deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 7px),
    #151515;
  text-transform: uppercase;
  text-shadow:
    2px 2px 0 #2468c8,
    4px 4px 0 rgba(0, 0, 0, 0.65);
}

.quest-header h2 {
  margin: 0;
  font-size: 1.55rem;
  font-weight: 400;
  line-height: 1;
  transform: skew(-8deg);
}

.quest-close-button {
  display: grid;
  width: 38px;
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid var(--ink);
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.12) 0 3px, transparent 3px 8px),
    var(--danger);
  color: #ffffff;
  cursor: pointer;
  font-size: 1rem;
  text-shadow: 2px 2px 0 #000000;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.24);
}

.quest-list {
  display: grid;
  gap: 12px;
  overflow-y: auto;
  padding: 12px;
  scrollbar-color: var(--gold) #101010;
  scrollbar-width: thin;
}

.quest-dungeon {
  border: 4px solid var(--ink);
  background:
    repeating-linear-gradient(42deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 7px),
    #151515;
}

.quest-dungeon-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 10px;
  color: #ffffff;
  text-transform: uppercase;
  text-shadow: 2px 2px 0 #000000;
}

.quest-dungeon-header strong {
  font-size: 1.02rem;
  line-height: 1;
  transform: skew(-8deg);
}

.quest-dungeon-header span {
  color: var(--gold);
  font-size: 0.94rem;
}

.quest-items {
  display: grid;
  gap: 8px;
  padding: 0 8px 8px;
}

.quest-card {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(112px, 0.8fr) minmax(92px, 0.55fr) 74px;
  align-items: center;
  gap: 8px;
  border: 3px solid var(--ink);
  padding: 8px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    42deg,
    rgba(0, 0, 0, 0.05) 0,
    rgba(0, 0, 0, 0.05) 2px,
    rgba(255, 255, 255, 0.56) 2px,
    rgba(255, 255, 255, 0.56) 6px
  );
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  text-transform: uppercase;
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.24);
}

.quest-card:disabled {
  cursor: default;
}

.quest-card.is-ready {
  background-color: #fff6bf;
  filter: drop-shadow(0 0 8px rgba(245, 196, 0, 0.3));
}

.quest-card.is-claimed {
  opacity: 0.62;
  filter: grayscale(0.6);
}

.quest-copy {
  min-width: 0;
}

.quest-copy strong,
.quest-copy small,
.quest-reward,
.quest-action {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1;
}

.quest-copy strong {
  font-size: 0.92rem;
  transform: skew(-8deg);
}

.quest-copy small {
  margin-top: 5px;
  color: #555555;
  font-size: 0.72rem;
}

.quest-progress {
  position: relative;
  min-height: 24px;
  overflow: hidden;
  border: 3px solid var(--ink);
  background: #252525;
  color: #ffffff;
  text-align: center;
  text-shadow: 2px 2px 0 #000000;
}

.quest-progress-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), transparent 55%),
    var(--gold);
}

.quest-progress span:last-child {
  position: relative;
  z-index: 1;
  display: block;
  padding-top: 4px;
  font-size: 0.72rem;
}

.quest-reward {
  color: #0f7b46;
  font-size: 0.76rem;
  text-align: right;
}

.quest-action {
  border: 3px solid var(--ink);
  padding: 6px 5px 4px;
  background: #222222;
  color: #ffffff;
  font-size: 0.72rem;
  text-align: center;
  text-shadow: 2px 2px 0 #000000;
}

.quest-card.is-ready .quest-action {
  background: var(--gold);
  color: var(--ink);
  text-shadow: none;
}

.permanent-shop-list {
  position: relative;
  min-height: 450px;
  overflow: hidden;
  border: 4px solid var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 38%),
    repeating-linear-gradient(42deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 7px),
    #151515;
}

.permanent-shop-list::before {
  position: absolute;
  inset: 18px 18px auto;
  height: 88px;
  border: 4px solid rgba(0, 0, 0, 0.5);
  content: "";
  background:
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.06) 0 12px, transparent 12px 22px),
    #242424;
  box-shadow: 0 74px 0 #1c1c1c;
}

.shopkeeper-area {
  position: absolute;
  top: 44px;
  left: 50%;
  z-index: 2;
  width: min(310px, 76%);
  aspect-ratio: 1;
  transform: translateX(-50%);
}

.shopkeeper-img,
.table-img {
  position: relative;
  z-index: 2;
  object-fit: contain;
}

.shopkeeper-fallback {
  position: relative;
  z-index: 2;
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  border: 5px solid var(--ink);
  border-radius: 30% 30% 18% 18%;
  background:
    radial-gradient(circle at 32% 35%, #ffffff 0 4%, transparent 5%),
    radial-gradient(circle at 68% 35%, #ffffff 0 4%, transparent 5%),
    linear-gradient(145deg, #93e650 0%, #247a30 46%, #111111 100%);
  color: #ffffff;
  font-size: 1.4rem;
  text-transform: uppercase;
  text-shadow: 3px 3px 0 #000000;
  box-shadow: inset 0 -18px 0 rgba(0, 0, 0, 0.2), 7px 7px 0 rgba(0, 0, 0, 0.3);
}

.shopkeeper-fallback::before,
.shopkeeper-fallback::after {
  position: absolute;
  top: 32px;
  width: 48px;
  height: 36px;
  border: 5px solid var(--ink);
  content: "";
  background: #8fdf4f;
}

.shopkeeper-fallback::before {
  left: -26px;
  border-radius: 60% 20% 60% 40%;
  transform: rotate(-18deg);
}

.shopkeeper-fallback::after {
  right: -26px;
  border-radius: 20% 60% 40% 60%;
  transform: rotate(18deg);
}

.shopkeeper-img.is-loaded + .shopkeeper-fallback,
.table-img.is-loaded + .table-fallback,
.perma-item-img.is-loaded + .perma-item-fallback {
  display: none;
}

.perma-table {
  position: absolute;
  right: 24px;
  bottom: 40px;
  left: 24px;
  z-index: 3;
  height: 132px;
}

.table-img {
  width: 100%;
  height: 100%;
}

.table-fallback {
  width: 100%;
  height: 100%;
  border: 5px solid var(--ink);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 34%),
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0.12) 0 4px, transparent 4px 24px),
    linear-gradient(180deg, #9f6330 0 38%, #71411f 38% 100%);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.3);
  transform: skew(-2deg);
}

.table-fallback::before {
  position: absolute;
  right: 16px;
  bottom: -25px;
  left: 16px;
  height: 25px;
  border: 5px solid var(--ink);
  border-top: 0;
  content: "";
  background: #5b3217;
}

.perma-goods {
  position: absolute;
  right: 24px;
  bottom: 102px;
  left: 24px;
  z-index: 4;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: end;
  gap: 6px;
  height: 170px;
}

.perma-good {
  position: relative;
  display: grid;
  width: min(100%, 96px);
  justify-items: center;
  gap: 5px;
  justify-self: center;
  align-self: end;
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: center;
  transform: rotate(-2deg);
  transition: transform 140ms ease, filter 140ms ease, opacity 140ms ease;
}

.perma-good:nth-child(even) {
  transform: rotate(2deg);
}

.perma-good * {
  pointer-events: none;
}

.perma-good:hover,
.perma-good:focus-visible {
  filter: drop-shadow(0 0 10px rgba(245, 196, 0, 0.68));
  outline: none;
  transform: rotate(-2deg) translateY(-5px) scale(1.06);
}

.perma-good:nth-child(even):hover,
.perma-good:nth-child(even):focus-visible {
  transform: rotate(2deg) translateY(-5px) scale(1.06);
}

.perma-good.cannot-buy {
  filter: saturate(0.75);
}

.perma-good.is-sold {
  cursor: default;
  opacity: 0.55;
  filter: grayscale(0.65);
}

.perma-good.is-sold:hover,
.perma-good.is-sold:focus-visible {
  transform: rotate(-2deg);
  filter: grayscale(0.65);
}

.perma-good:nth-child(even).is-sold:hover,
.perma-good:nth-child(even).is-sold:focus-visible {
  transform: rotate(2deg);
}

.perma-good-art {
  display: grid;
  width: min(62px, 72%);
  aspect-ratio: 1;
  place-items: center;
  border: 4px solid var(--ink);
  background:
    radial-gradient(circle at 36% 32%, rgba(255, 255, 255, 0.9), transparent 20%),
    linear-gradient(135deg, #ffdd55, #ff5c5c 45%, #28d7ff);
  box-shadow: 5px 5px 0 rgba(0, 0, 0, 0.28);
}

.perma-item-img {
  width: 88%;
  height: 88%;
  object-fit: contain;
}

.perma-item-fallback {
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.55rem;
  line-height: 1;
  text-shadow: none;
}

.perma-tag {
  display: block;
  width: 100%;
  min-height: 66px;
  border: 3px solid var(--ink);
  padding: 5px 4px 4px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    42deg,
    rgba(0, 0, 0, 0.05) 0,
    rgba(0, 0, 0, 0.05) 2px,
    rgba(255, 255, 255, 0.56) 2px,
    rgba(255, 255, 255, 0.56) 6px
  );
  box-shadow: 4px 4px 0 rgba(0, 0, 0, 0.24);
  text-transform: uppercase;
}

.perma-tag strong,
.perma-tag span,
.perma-tag small {
  display: block;
  overflow-wrap: anywhere;
  line-height: 1;
}

.perma-tag strong {
  font-size: 0.68rem;
  transform: skew(-8deg);
}

.perma-tag span {
  margin-top: 3px;
  color: var(--cash);
  font-size: 0.74rem;
  text-shadow: 1px 1px 0 #000000;
}

.perma-tag small {
  margin-top: 3px;
  color: #555555;
  font-size: 0.58rem;
}

.panel-header {
  display: flex;
  min-height: 64px;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  color: #ffffff;
  background:
    repeating-linear-gradient(38deg, rgba(255, 255, 255, 0.04) 0 2px, transparent 2px 7px),
    #151515;
  text-align: center;
  text-transform: uppercase;
  text-shadow:
    3px 3px 0 #2468c8,
    5px 5px 0 rgba(0, 0, 0, 0.65),
    -1px -1px 0 rgba(255, 255, 255, 0.22);
}

.panel-header h1,
.panel-header h2 {
  margin: 0;
  font-size: clamp(1.72rem, 2.45vw, 2.05rem);
  line-height: 1;
  font-weight: 400;
  transform: skew(-8deg) rotate(-1deg);
}

.story-row {
  display: block;
  min-height: 38px;
  padding: 7px 4px 2px;
  font-size: 1.38rem;
  text-align: center;
  text-transform: uppercase;
  transform: skew(-6deg);
}

.tutorial-guide {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

.tutorial-spotlight,
.tutorial-ring {
  position: fixed;
  border-radius: 8px;
  pointer-events: none;
}

.tutorial-spotlight {
  z-index: 1;
  border: 5px solid var(--gold);
  box-shadow:
    0 0 0 999vmax rgba(0, 0, 0, 0.46),
    0 0 22px rgba(245, 196, 0, 0.9);
}

.tutorial-ring {
  z-index: 3;
  border: 4px solid var(--dps);
  box-shadow:
    inset 0 0 0 3px rgba(255, 255, 255, 0.9),
    0 0 0 0 rgba(0, 217, 255, 0.7);
  animation: tutorial-pulse 900ms ease-out infinite;
}

.tutorial-guide[data-target^="unlockAdd"] .tutorial-ring {
  animation: none;
}

.tutorial-callout {
  position: fixed;
  z-index: 4;
  display: grid;
  gap: 7px;
  border: 4px solid var(--ink);
  padding: 11px 13px 10px;
  background:
    repeating-linear-gradient(44deg, rgba(0, 0, 0, 0.055) 0 2px, rgba(255, 255, 255, 0.62) 2px 7px),
    #fff3a8;
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.34);
  text-transform: uppercase;
  transform: rotate(-1deg);
}

.tutorial-callout::before {
  position: absolute;
  left: var(--tail-x, 50%);
  width: 22px;
  height: 22px;
  border: 4px solid var(--ink);
  content: "";
  background: #fff3a8;
  transform: translateX(-50%) rotate(45deg);
}

.tutorial-callout.is-above::before {
  bottom: -15px;
  border-top: 0;
  border-left: 0;
}

.tutorial-callout.is-below::before {
  top: -15px;
  border-right: 0;
  border-bottom: 0;
}

.tutorial-callout strong,
.tutorial-callout span,
.tutorial-callout small {
  position: relative;
  z-index: 1;
  display: block;
  overflow-wrap: anywhere;
  line-height: 1;
}

.tutorial-callout small {
  justify-self: start;
  border: 3px solid var(--ink);
  padding: 4px 7px 3px;
  background: var(--dps);
  color: #ffffff;
  font-size: 0.72rem;
  text-shadow: 2px 2px 0 #000000;
}

.tutorial-callout strong {
  color: var(--danger);
  font-size: 1.15rem;
  text-shadow: 1px 1px 0 #ffffff;
  transform: skew(-8deg);
}

.tutorial-callout span {
  font-family: "Courier New", monospace;
  font-size: 0.88rem;
  font-weight: 700;
  letter-spacing: 0;
}

.hp-bar {
  position: relative;
  height: 42px;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: 8px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.04) 0 3px, transparent 3px 8px),
    #222222;
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.12);
}

.hp-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 100%;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(255, 255, 255, 0) 45%),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0 6px, transparent 6px 12px),
    var(--danger);
  transition: width 220ms ease-out;
}

.hp-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  font-size: 1.2rem;
  text-shadow: 2px 2px 0 #000000;
}

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin: 36px 0 20px;
}

.stat-card {
  position: relative;
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: center;
  padding: 10px 12px 7px;
  border-radius: 4px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.035) 0 2px, transparent 2px 6px),
    #151515;
  color: #ffffff;
  text-align: center;
}

.stat-label {
  position: absolute;
  top: -25px;
  left: 50%;
  border: 3px solid var(--ink);
  padding: 3px 8px 2px;
  background: #ffffff;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1;
  text-transform: uppercase;
  transform: translateX(-50%) rotate(-4deg);
}

.cash-card .stat-label,
.cash-card strong {
  color: var(--cash);
}

.dps-card .stat-label,
.dps-card strong {
  color: var(--dps);
}

.stat-card strong {
  display: block;
  max-width: 100%;
  overflow-wrap: anywhere;
  font-size: 1.75rem;
  line-height: 1;
  text-shadow: 3px 3px 0 #000000;
  transform: skew(-8deg);
}

.battle-field {
  position: relative;
  display: grid;
  width: 100%;
  height: 288px;
  place-items: center;
  padding: 0;
  border: 3px dashed rgba(0, 0, 0, 0.12);
  border-radius: 5px;
  background-color: #f4f4f0;
  background-image:
    radial-gradient(circle, rgba(0, 0, 0, 0.11) 1px, transparent 1px),
    repeating-linear-gradient(55deg, rgba(0, 0, 0, 0.035) 0 2px, transparent 2px 9px);
  background-size: 15px 15px, auto;
  cursor: crosshair;
}

.battle-field:disabled {
  cursor: default;
}

.monster-wrap {
  position: relative;
  display: grid;
  width: min(250px, 58%);
  aspect-ratio: 1;
  place-items: center;
}

.monster-wrap::after {
  position: absolute;
  right: 14%;
  bottom: 8%;
  left: 13%;
  height: 14px;
  border-radius: 50%;
  content: "";
  background: rgba(0, 0, 0, 0.23);
  filter: blur(2px);
}

.sprite-img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: auto;
}

.sprite-img.is-loaded {
  display: block;
}

.monster-img {
  position: relative;
  z-index: 2;
  filter: drop-shadow(8px 10px 0 rgba(0, 0, 0, 0.28));
}

.monster-fallback {
  position: relative;
  z-index: 2;
  display: grid;
  width: 76%;
  aspect-ratio: 1;
  place-items: center;
  border: 5px solid var(--ink);
  border-radius: 18% 18% 24% 24%;
  background:
    radial-gradient(circle at 32% 38%, #f7f7f0 0 5%, transparent 6%),
    radial-gradient(circle at 68% 38%, #f7f7f0 0 5%, transparent 6%),
    linear-gradient(145deg, #2bd1ff 0%, #284163 38%, #161616 100%);
  color: #ffffff;
  font-size: clamp(2rem, 4vw, 3.2rem);
  text-shadow: 4px 4px 0 #000000;
  transform: rotate(-2deg);
  box-shadow: inset 0 -14px 0 rgba(0, 0, 0, 0.18), 8px 10px 0 rgba(0, 0, 0, 0.2);
}

.monster-fallback::before,
.monster-fallback::after {
  position: absolute;
  top: -22px;
  width: 44px;
  height: 44px;
  border: 5px solid var(--ink);
  content: "";
  background: #e8f7ff;
  transform: rotate(45deg);
}

.monster-fallback::before {
  left: 9%;
}

.monster-fallback::after {
  right: 9%;
}

.monster-img.is-loaded + .monster-fallback {
  display: none;
}

.battle-field.hit .monster-wrap {
  animation: monster-hit 160ms ease-out;
}

.float-layer {
  position: absolute;
  inset: -26px -60px;
  z-index: 5;
  pointer-events: none;
}

.floating-text {
  position: absolute;
  z-index: 8;
  left: 50%;
  top: 42%;
  color: #ffffff;
  font-size: 1rem;
  text-shadow: 3px 3px 0 #000000;
  transform: translate(-50%, -50%);
  animation: float-up 780ms ease-out forwards;
  white-space: nowrap;
}

.floating-text.crit {
  color: var(--gold);
  font-size: 1.25rem;
}

.floating-text.reward {
  color: #18e26d;
}

.floating-text.achievement {
  color: var(--gold);
  font-size: 1.12rem;
}

.floating-text.proc {
  font-size: 1.18rem;
}

.floating-text.fireball {
  color: #ff6138;
}

.floating-text.vines {
  color: #6dff5a;
}

.floating-text.lightningStorm {
  color: #ffe84a;
}

.special-effect,
.special-effect span {
  position: absolute;
  display: block;
  pointer-events: none;
}

.special-effect {
  inset: 0;
  z-index: 6;
  overflow: visible;
}

.fireball-orb {
  left: 50%;
  top: 43%;
  width: 58px;
  height: 58px;
  border: 4px solid #2a0700;
  border-radius: 50%;
  background:
    radial-gradient(circle at 38% 32%, #fff7a8 0 13%, #ffca2d 14% 31%, #ff5a1d 32% 62%, #8c0d00 63% 100%);
  box-shadow:
    0 0 18px #ff9c18,
    0 0 34px rgba(255, 56, 0, 0.84);
  animation: fireball-orb 680ms cubic-bezier(0.14, 0.76, 0.24, 1) forwards;
}

.fireball-trail {
  left: 50%;
  top: 43%;
  width: 120px;
  height: 38px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, transparent 0, rgba(255, 30, 0, 0.08) 10%, #ff5a1d 48%, #fff26f 100%);
  filter: blur(2px);
  transform-origin: right center;
  animation: fireball-trail 680ms cubic-bezier(0.14, 0.76, 0.24, 1) forwards;
}

.fireball-burst {
  left: 50%;
  top: 43%;
  width: 34px;
  height: 34px;
  border: 4px solid #2a0700;
  background:
    radial-gradient(circle, #ffffff 0 12%, #ffe86a 13% 30%, #ff5a1d 31% 58%, transparent 59%);
  clip-path: polygon(50% 0, 61% 31%, 95% 18%, 70% 47%, 100% 65%, 63% 66%, 72% 100%, 50% 73%, 28% 100%, 37% 66%, 0 65%, 30% 47%, 5% 18%, 39% 31%);
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.2) rotate(-12deg);
  animation: fireball-burst 760ms ease-out 420ms forwards;
}

.fire-spark {
  left: 50%;
  top: 43%;
  width: 12px;
  height: 12px;
  border: 2px solid #2a0700;
  background: #ffe86a;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(45deg);
  animation: fire-spark 640ms ease-out 460ms forwards;
}

.spark-1 { --spark-x: -88px; --spark-y: -54px; }
.spark-2 { --spark-x: -48px; --spark-y: -82px; }
.spark-3 { --spark-x: 42px; --spark-y: -76px; }
.spark-4 { --spark-x: 90px; --spark-y: -35px; }
.spark-5 { --spark-x: 86px; --spark-y: 44px; }
.spark-6 { --spark-x: 28px; --spark-y: 82px; }
.spark-7 { --spark-x: -62px; --spark-y: 72px; }
.spark-8 { --spark-x: -98px; --spark-y: 18px; }

.vine-loop {
  left: 50%;
  top: 48%;
  width: 178px;
  height: 76px;
  border: 8px solid #26a845;
  border-top-color: #9cff48;
  border-right-color: #184d23;
  border-radius: 50%;
  box-shadow:
    0 0 0 2px #09250d,
    0 0 18px rgba(109, 255, 90, 0.54);
  opacity: 0;
  transform: translate(-50%, -50%) rotate(-20deg) scale(0.2);
  animation: vine-wrap 1050ms cubic-bezier(0.12, 0.78, 0.2, 1) forwards;
}

.vine-loop.loop-2 {
  width: 146px;
  height: 92px;
  animation-delay: 110ms;
  transform: translate(-50%, -50%) rotate(26deg) scale(0.2);
}

.vine-loop.loop-3 {
  width: 126px;
  height: 112px;
  animation-delay: 220ms;
  transform: translate(-50%, -50%) rotate(88deg) scale(0.2);
}

.vine-leaf {
  left: 50%;
  top: 48%;
  width: 18px;
  height: 12px;
  border: 2px solid #09250d;
  border-radius: 100% 0 100% 0;
  background: #87ff3e;
  opacity: 0;
  transform: translate(-50%, -50%) rotate(45deg);
  animation: vine-leaf-pop 980ms ease-out forwards;
}

.leaf-1 { --leaf-x: -82px; --leaf-y: -34px; animation-delay: 120ms; }
.leaf-2 { --leaf-x: -46px; --leaf-y: -66px; animation-delay: 220ms; }
.leaf-3 { --leaf-x: 52px; --leaf-y: -60px; animation-delay: 300ms; }
.leaf-4 { --leaf-x: 86px; --leaf-y: -18px; animation-delay: 380ms; }
.leaf-5 { --leaf-x: 74px; --leaf-y: 44px; animation-delay: 460ms; }
.leaf-6 { --leaf-x: 10px; --leaf-y: 74px; animation-delay: 540ms; }
.leaf-7 { --leaf-x: -58px; --leaf-y: 54px; animation-delay: 620ms; }
.leaf-8 { --leaf-x: -90px; --leaf-y: 8px; animation-delay: 700ms; }

.vine-tick-pulse {
  left: 50%;
  top: 48%;
  width: 144px;
  height: 116px;
  border: 5px solid #84ff45;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.55) rotate(-12deg);
  animation: vine-tick-pulse 480ms ease-out forwards;
}

.lightning-flash {
  inset: -26px -60px;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.82), transparent 30%),
    linear-gradient(180deg, rgba(85, 219, 255, 0.42), transparent 60%);
  opacity: 0;
  animation: lightning-flash 840ms steps(2, end) forwards;
}

.lightning-bolt {
  top: -38px;
  left: 50%;
  width: 30px;
  height: 265px;
  background:
    linear-gradient(180deg, #ffffff 0 13%, #ffe84a 14% 42%, #36d8ff 43% 100%);
  clip-path: polygon(58% 0, 18% 38%, 45% 38%, 20% 78%, 82% 28%, 54% 30%, 82% 0);
  filter:
    drop-shadow(0 0 8px #ffffff)
    drop-shadow(0 0 16px #36d8ff);
  opacity: 0;
  transform: translateX(-50%) scaleY(0.25);
  animation: lightning-bolt 680ms steps(2, end) var(--bolt-delay) forwards;
}

.bolt-1 { left: 34%; }
.bolt-2 { left: 48%; }
.bolt-3 { left: 62%; }
.bolt-4 { left: 42%; }
.bolt-5 { left: 56%; }

.battle-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 6px 10px;
  font-family: "Courier New", monospace;
  font-size: 0.98rem;
}

#waveStatus {
  display: inline-block;
  border-radius: 4px;
  padding: 2px 5px;
}

.sound-row {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 14px;
  padding: 2px 6px 0;
}

.sound-button {
  display: grid;
  width: 40px;
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid var(--ink);
  background:
    repeating-linear-gradient(45deg, rgba(0, 0, 0, 0.06) 0 2px, rgba(255, 255, 255, 0.6) 2px 6px),
    #eeeeea;
  cursor: pointer;
  font-family: "Segoe UI Emoji", "Apple Color Emoji", "Noto Color Emoji", sans-serif;
  font-size: 1.25rem;
  line-height: 1;
  text-shadow: none;
}

.volume-slider {
  width: 100%;
  height: 28px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}

.volume-slider::-webkit-slider-runnable-track {
  position: relative;
  height: 12px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--pink) 0 var(--volume), #141414 var(--volume) 100%);
}

.volume-slider::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, var(--pink) 0 var(--volume), #141414 var(--volume) 100%);
}

.volume-slider::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -6px;
  appearance: none;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--pink);
}

.volume-slider::-moz-range-thumb {
  width: 23px;
  height: 23px;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background: var(--pink);
}

.shop-list {
  height: calc(100% - 72px);
  overflow-y: auto;
  padding: 8px 5px 8px 0;
  scrollbar-color: var(--gold) #101010;
  scrollbar-width: thin;
}

.shop-list::-webkit-scrollbar {
  width: 14px;
}

.shop-list::-webkit-scrollbar-track {
  border: 3px solid var(--ink);
  background: #101010;
}

.shop-list::-webkit-scrollbar-thumb {
  border: 2px solid var(--ink);
  background: linear-gradient(#ffe65a, var(--gold));
}

.shop-card {
  position: relative;
  display: grid;
  width: calc(100% - 4px);
  min-height: 82px;
  grid-template-columns: 62px 1fr auto;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px 4px;
  border: 4px solid var(--ink);
  padding: 8px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    42deg,
    rgba(0, 0, 0, 0.05) 0,
    rgba(0, 0, 0, 0.05) 2px,
    rgba(255, 255, 255, 0.56) 2px,
    rgba(255, 255, 255, 0.56) 6px
  );
  color: var(--ink);
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, filter 120ms ease, opacity 120ms ease;
  transform: skew(-0.5deg);
}

.shop-card:hover,
.shop-card:focus-visible {
  transform: translateX(-2px) scale(1.025);
  filter: drop-shadow(0 0 8px rgba(245, 196, 0, 0.48));
  outline: none;
}

.shop-card.cannot-buy {
  opacity: 0.78;
  filter: saturate(0.82);
}

.shop-card.is-new {
  background-color: #fff4b8;
  filter: drop-shadow(0 0 10px rgba(245, 196, 0, 0.34));
}

.shop-card.is-trial-item {
  box-shadow:
    7px 7px 0 rgba(0, 0, 0, 0.24),
    0 0 0 5px rgba(255, 212, 0, 0.62),
    0 0 22px rgba(255, 212, 0, 0.52);
  animation: tutorial-pulse 760ms ease-out infinite alternate;
}

.shop-icon {
  position: relative;
  display: grid;
  width: 58px;
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid var(--ink);
  background: #eeeeea;
  overflow: hidden;
}

.shop-icon .sprite-img {
  width: 88%;
  height: 88%;
}

.shop-icon-fallback {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border: 3px solid var(--ink);
  border-radius: 50%;
  background:
    radial-gradient(circle at 36% 32%, rgba(255, 255, 255, 0.9), transparent 20%),
    linear-gradient(135deg, #ffdd55, #ff5c5c 45%, #28d7ff);
  color: #ffffff;
  font-size: 0.78rem;
  text-shadow: 2px 2px 0 #000000;
}

.shop-icon .sprite-img.is-loaded + .shop-icon-fallback {
  display: none;
}

.shop-copy {
  min-width: 0;
  text-transform: uppercase;
}

.shop-name {
  display: block;
  overflow-wrap: anywhere;
  font-size: 0.9rem;
  line-height: 1;
  transform: skew(-8deg);
}

.shop-bonus {
  display: block;
  margin-top: 5px;
  color: #555555;
  font-size: 0.82rem;
  line-height: 1;
}

.shop-meta {
  min-width: 94px;
  text-align: right;
  text-transform: uppercase;
}

.shop-price,
.shop-count {
  display: block;
  font-size: 0.94rem;
  line-height: 1.15;
}

.shop-count {
  margin-top: 7px;
}

.shop-card.is-new .shop-price {
  display: inline-block;
  border: 3px solid var(--ink);
  padding: 6px 7px 4px;
  background: var(--gold);
  color: var(--ink);
  font-size: 0.76rem;
  text-align: center;
  text-shadow: none;
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.28);
}

.shop-card.is-new .shop-count {
  color: var(--danger);
}

.buy-pop {
  position: fixed;
  z-index: 20;
  color: var(--gold);
  font-size: 0.94rem;
  pointer-events: none;
  text-shadow: 3px 3px 0 #000000;
  animation: shop-pop 720ms ease-out forwards;
}

.unlock-overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    repeating-conic-gradient(from -12deg, rgba(255, 212, 0, 0.28) 0deg 9deg, rgba(229, 37, 48, 0.28) 9deg 18deg, rgba(0, 217, 255, 0.24) 18deg 27deg),
    rgba(3, 7, 12, 0.82);
}

.unlock-rays {
  position: absolute;
  inset: -35vmax;
  background:
    repeating-conic-gradient(from 8deg, rgba(255, 255, 255, 0.82) 0deg 5deg, transparent 5deg 14deg),
    var(--gold);
  mix-blend-mode: screen;
  opacity: 0;
  transform: scale(0.25) rotate(0deg);
}

.unlock-overlay.is-showing .unlock-rays {
  animation: unlock-rays 1100ms cubic-bezier(0.18, 0.8, 0.24, 1) forwards;
}

.unlock-particles {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.unlock-particles span {
  width: 18px;
  height: 18px;
  border: 3px solid var(--ink);
  background: var(--gold);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, 0.35);
  opacity: 0;
  transform: rotate(var(--angle)) translateY(0) rotate(45deg);
}

.unlock-particles span:nth-child(3n) {
  background: var(--dps);
}

.unlock-particles span:nth-child(3n + 2) {
  background: var(--pink);
}

.unlock-overlay.is-showing .unlock-particles span {
  animation: unlock-particle 980ms cubic-bezier(0.12, 0.78, 0.2, 1) var(--delay) forwards;
}

.unlock-card {
  position: relative;
  z-index: 2;
  display: grid;
  width: min(420px, calc(100vw - 42px));
  justify-items: center;
  gap: 10px;
  border: 5px solid var(--ink);
  padding: 18px 18px 20px;
  background-color: var(--paper);
  background-image: repeating-linear-gradient(
    36deg,
    rgba(0, 0, 0, 0.045) 0,
    rgba(0, 0, 0, 0.045) 2px,
    rgba(255, 255, 255, 0.58) 2px,
    rgba(255, 255, 255, 0.58) 6px
  );
  box-shadow: 14px 15px 0 rgba(0, 0, 0, 0.42);
  text-align: center;
  text-transform: uppercase;
  transform: scale(0.2) rotate(-16deg);
}

.unlock-overlay.is-showing .unlock-card {
  animation: unlock-card 1600ms cubic-bezier(0.12, 0.82, 0.2, 1) forwards;
}

.unlock-kicker {
  border: 4px solid var(--ink);
  padding: 6px 12px 4px;
  background: var(--danger);
  color: #ffffff;
  font-size: 1.1rem;
  line-height: 1;
  text-shadow: 2px 2px 0 #000000;
  transform: rotate(-3deg) skew(-8deg);
}

.unlock-art {
  position: relative;
  display: grid;
  width: min(176px, 48vw);
  aspect-ratio: 1;
  place-items: center;
  border: 5px solid var(--ink);
  background:
    repeating-conic-gradient(from 12deg, #fff17a 0deg 12deg, #ff5c5c 12deg 24deg, #28d7ff 24deg 36deg);
  box-shadow: 8px 8px 0 rgba(0, 0, 0, 0.3);
}

.unlock-art .sprite-img {
  position: relative;
  z-index: 2;
  width: 82%;
  height: 82%;
  filter: drop-shadow(5px 7px 0 rgba(0, 0, 0, 0.32));
}

.unlock-art .sprite-img.is-loaded + .unlock-fallback {
  display: none;
}

.unlock-fallback {
  position: relative;
  z-index: 1;
  display: grid;
  width: 62%;
  aspect-ratio: 1;
  place-items: center;
  border: 4px solid var(--ink);
  background: #ffffff;
  color: var(--ink);
  font-size: 2rem;
}

.unlock-card h2,
.unlock-card p {
  margin: 0;
  line-height: 1;
}

.unlock-card h2 {
  color: var(--gold);
  font-size: clamp(2.4rem, 10vw, 4.8rem);
  text-shadow:
    4px 4px 0 #000000,
    -2px -2px 0 #ffffff;
  transform: skew(-8deg);
}

.unlock-card p {
  border: 4px solid var(--ink);
  padding: 7px 14px 5px;
  background: #151515;
  color: var(--dps);
  font-size: 1.25rem;
  text-shadow: 2px 2px 0 #000000;
}

.unlock-add-button {
  border: 5px solid var(--ink);
  padding: 11px 18px 9px;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.18) 0 4px, transparent 4px 9px),
    var(--gold);
  color: var(--ink);
  cursor: pointer;
  font-size: clamp(1.35rem, 5vw, 2rem);
  line-height: 1;
  text-transform: uppercase;
  box-shadow: 7px 7px 0 rgba(0, 0, 0, 0.36);
  transform: scale(0.88) rotate(2deg);
  animation: unlock-add-pop 460ms cubic-bezier(0.12, 0.82, 0.2, 1) forwards;
}

.unlock-add-button:hover,
.unlock-add-button:focus-visible {
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, 0.2) 0 4px, transparent 4px 9px),
    var(--pink);
  color: #ffffff;
  outline: none;
  text-shadow: 2px 2px 0 #000000;
  transform: scale(1.05) rotate(-1deg);
}

@keyframes monster-hit {
  0% {
    transform: scale(1) rotate(0);
  }
  45% {
    transform: scale(1.08) rotate(-3deg);
  }
  100% {
    transform: scale(1) rotate(0);
  }
}

@keyframes clear-overlay-fade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes clear-panel-pop {
  0% {
    opacity: 0;
    transform: translateY(26px) scale(0.86) rotate(-4deg) skew(-0.25deg);
  }
  64% {
    opacity: 1;
    transform: translateY(-7px) scale(1.04) rotate(1deg) skew(-0.25deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(-1.5deg) skew(-0.25deg);
  }
}

@keyframes guild-call-panel-pop {
  0% {
    opacity: 0;
    filter: saturate(1.6) brightness(1.24);
    transform: translateY(42px) scale(0.62) rotate(-9deg) skew(-0.25deg);
  }
  36% {
    opacity: 1;
    transform: translateY(-18px) scale(1.12) rotate(3deg) skew(-0.25deg);
  }
  56% {
    transform: translateY(5px) scale(0.97) rotate(-2deg) skew(-0.25deg);
  }
  76% {
    filter: saturate(1.25) brightness(1.1);
    transform: translateY(-3px) scale(1.02) rotate(0.8deg) skew(-0.25deg);
  }
  100% {
    opacity: 1;
    filter: none;
    transform: translateY(0) scale(1) rotate(-1.5deg) skew(-0.25deg);
  }
}

@keyframes guild-call-stamp {
  0% {
    opacity: 0;
    transform: scale(0.18) rotate(-24deg) skew(-8deg);
  }
  46% {
    opacity: 1;
    transform: scale(1.28) rotate(8deg) skew(-8deg);
  }
  66% {
    transform: scale(0.92) rotate(-9deg) skew(-8deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(-7deg) skew(-8deg);
  }
}

@keyframes guild-call-message {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes guild-call-button {
  0% {
    opacity: 0;
    transform: translateY(16px) scale(0.9) skew(-8deg) rotate(1deg);
  }
  46% {
    opacity: 1;
    transform: translateY(0) scale(1.08) skew(-8deg) rotate(-2deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) skew(-8deg) rotate(1deg);
  }
}

@keyframes guild-call-panel-exit {
  0% {
    opacity: 1;
    filter: none;
    transform: translateY(0) scale(1) rotate(-1.5deg) skew(-0.25deg);
  }
  42% {
    opacity: 1;
    filter: saturate(1.6) brightness(1.25);
    transform: translateY(-12px) scale(1.08) rotate(2deg) skew(-0.25deg);
  }
  100% {
    opacity: 0;
    filter: saturate(1.25) brightness(1.08);
    transform: translateY(-80px) scale(0.74) rotate(8deg) skew(-0.25deg);
  }
}

@keyframes guild-call-overlay-exit {
  0% {
    background: transparent;
  }
  42% {
    background: radial-gradient(circle at 50% 45%, rgba(255, 212, 0, 0.22), transparent 36%);
  }
  100% {
    background: radial-gradient(circle at 50% 45%, rgba(255, 212, 0, 0), transparent 42%);
  }
}

@keyframes guild-window-transition {
  0% {
    filter: none;
    transform: scale(1);
  }
  38% {
    filter: saturate(1.25) brightness(1.12);
    transform: scale(0.985);
  }
  100% {
    filter: blur(1.5px) saturate(0.88) brightness(0.82);
    transform: scale(0.965);
  }
}

@keyframes guild-screen-enter {
  0% {
    opacity: 0;
    filter: brightness(1.24) saturate(1.18);
  }
  100% {
    opacity: 1;
    filter: none;
  }
}

@keyframes guild-panel-enter {
  0% {
    opacity: 0;
    transform: translateY(34px) scale(0.9) rotate(-3deg);
  }
  64% {
    opacity: 1;
    transform: translateY(-7px) scale(1.025) rotate(0.8deg);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1) rotate(-0.65deg);
  }
}

@keyframes float-up {
  from {
    opacity: 1;
    transform: translate(-50%, -10%) scale(1);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -150%) scale(1.12);
  }
}

@keyframes fireball-orb {
  0% {
    opacity: 0;
    transform: translate(-220px, -120px) scale(0.28) rotate(-24deg);
  }
  18% {
    opacity: 1;
  }
  72% {
    opacity: 1;
    transform: translate(-54px, -50%) scale(1.12) rotate(10deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.25) rotate(28deg);
  }
}

@keyframes fireball-trail {
  0% {
    opacity: 0;
    transform: translate(-260px, -50px) scaleX(0.28) rotate(25deg);
  }
  22% {
    opacity: 0.88;
  }
  74% {
    opacity: 0.82;
    transform: translate(-154px, -50%) scaleX(1) rotate(8deg);
  }
  100% {
    opacity: 0;
    transform: translate(-90px, -50%) scaleX(0.18) rotate(0);
  }
}

@keyframes fireball-burst {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.2) rotate(-12deg);
  }
  28% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(2.45) rotate(12deg);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(3.4) rotate(44deg);
  }
}

@keyframes fire-spark {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(0.2);
  }
  28% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--spark-x)), calc(-50% + var(--spark-y))) rotate(225deg) scale(0.95);
  }
}

@keyframes vine-wrap {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(-70deg) scale(0.08);
  }
  30% {
    opacity: 1;
  }
  68% {
    opacity: 1;
    transform: translate(-50%, -50%) rotate(22deg) scale(1.08);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(46deg) scale(1.02);
  }
}

@keyframes vine-leaf-pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) rotate(45deg) scale(0.2);
  }
  38% {
    opacity: 1;
    transform: translate(calc(-50% + var(--leaf-x)), calc(-50% + var(--leaf-y))) rotate(45deg) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--leaf-x)), calc(-50% + var(--leaf-y) - 18px)) rotate(110deg) scale(0.72);
  }
}

@keyframes vine-tick-pulse {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.55) rotate(-12deg);
  }
  34% {
    opacity: 0.9;
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(1.28) rotate(18deg);
  }
}

@keyframes lightning-flash {
  0%,
  100% {
    opacity: 0;
  }
  10%,
  24%,
  42%,
  58% {
    opacity: 0.7;
  }
  18%,
  34%,
  50% {
    opacity: 0.18;
  }
}

@keyframes lightning-bolt {
  0% {
    opacity: 0;
    transform: translateX(-50%) scaleY(0.18);
  }
  18% {
    opacity: 1;
    transform: translateX(-50%) scaleY(1);
  }
  34% {
    opacity: 0.1;
  }
  52% {
    opacity: 1;
    transform: translateX(-50%) scaleY(0.88) skewX(-8deg);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) scaleY(1.05) skewX(7deg);
  }
}

@keyframes shop-pop {
  from {
    opacity: 1;
    transform: translate(-50%, 0);
  }
  to {
    opacity: 0;
    transform: translate(-50%, -38px);
  }
}

@keyframes tutorial-pulse {
  0% {
    transform: scale(1);
    box-shadow:
      inset 0 0 0 3px rgba(255, 255, 255, 0.9),
      0 0 0 0 rgba(0, 217, 255, 0.7);
  }
  100% {
    transform: scale(1.035);
    box-shadow:
      inset 0 0 0 3px rgba(255, 255, 255, 0.9),
      0 0 0 16px rgba(0, 217, 255, 0);
  }
}

@keyframes battle-make-room {
  0% {
    transform: translateX(clamp(170px, 16vw, 205px)) rotate(-1.25deg) skew(-0.35deg);
  }
  58% {
    transform: translateX(-10px) rotate(-1.25deg) skew(-0.35deg);
  }
  100% {
    transform: translateX(0) rotate(-1.25deg) skew(-0.35deg);
  }
}

@keyframes collection-slide-out {
  0% {
    opacity: 0;
    filter: saturate(1.45) brightness(1.18);
    transform: translateX(clamp(-360px, -30vw, -250px)) scaleX(0.18) rotate(-1.25deg) skew(-0.35deg);
  }
  42% {
    opacity: 1;
  }
  68% {
    transform: translateX(-14px) scaleX(1.05) rotate(1.2deg) skew(0.25deg);
  }
  100% {
    opacity: 1;
    filter: none;
    transform: translateX(0) scaleX(1) rotate(0.9deg) skew(0.25deg);
  }
}

@keyframes screen-shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  20% {
    transform: translate(-6px, 4px);
  }
  40% {
    transform: translate(7px, -5px);
  }
  60% {
    transform: translate(-4px, -3px);
  }
  80% {
    transform: translate(5px, 3px);
  }
}

@keyframes unlock-rays {
  0% {
    opacity: 0;
    transform: scale(0.2) rotate(-20deg);
  }
  42% {
    opacity: 0.82;
  }
  100% {
    opacity: 0.18;
    transform: scale(1) rotate(55deg);
  }
}

@keyframes unlock-card {
  0% {
    opacity: 0;
    transform: scale(0.2) rotate(-18deg);
  }
  34% {
    opacity: 1;
    transform: scale(1.16) rotate(4deg);
  }
  52% {
    transform: scale(0.96) rotate(-2deg);
  }
  72%,
  100% {
    opacity: 1;
    transform: scale(1) rotate(-1deg);
  }
}

@keyframes unlock-add-pop {
  0% {
    opacity: 0;
    transform: scale(0.45) rotate(8deg);
  }
  62% {
    opacity: 1;
    transform: scale(1.08) rotate(-2deg);
  }
  100% {
    opacity: 1;
    transform: scale(1) rotate(2deg);
  }
}

@keyframes unlock-particle {
  0% {
    opacity: 0;
    transform: rotate(var(--angle)) translateY(0) rotate(45deg) scale(0.2);
  }
  16% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: rotate(var(--angle)) translateY(calc(-1 * var(--distance))) rotate(225deg) scale(0.95);
  }
}

@media (max-width: 980px) {
  body {
    overflow-y: auto;
  }

  .game-shell {
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    padding: 18px;
  }

  .battle-panel,
  .shop-panel,
  .home-panel,
  .clear-panel,
  .guild-panel {
    width: min(100%, 560px);
    margin-inline: auto;
    transform: none;
  }

  .shop-panel {
    height: min(560px, 78vh);
  }

  .game-shell.is-collection-revealing .battle-panel {
    animation: none;
  }

  .shop-panel.is-revealing {
    animation: collection-drop-out 820ms cubic-bezier(0.12, 0.82, 0.2, 1) both;
  }

  .home-content {
    grid-template-columns: 1fr;
  }

  .guild-screen {
    align-items: start;
    padding: 14px;
  }

  .guild-panel {
    min-height: auto;
  }

  .guild-hq-body {
    min-height: 270px;
    padding: 22px 12px;
  }

  .guild-lineup {
    grid-template-columns: 1fr;
    min-height: auto;
    padding: 18px 12px;
  }

  .guild-master,
  .guild-master:nth-child(1),
  .guild-master:nth-child(2),
  .guild-master:nth-child(3) {
    min-height: 390px;
    transform: none;
  }

  .master-figure {
    width: min(220px, 74vw);
    height: 260px;
  }

  .quest-panel {
    inset: 12px;
    padding: 10px;
  }

  .quest-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .quest-reward {
    text-align: left;
  }
}

@keyframes collection-drop-out {
  0% {
    opacity: 0;
    transform: translateY(-90px) scaleY(0.2);
  }
  65% {
    opacity: 1;
    transform: translateY(8px) scaleY(1.04);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}

@media (max-width: 560px) {
  .battle-panel {
    min-height: 620px;
    padding: 12px;
  }

  .home-main-header,
  .battle-main-header {
    min-height: 104px;
    align-content: start;
  }

  .home-header-actions {
    top: auto;
    right: 50%;
    bottom: 9px;
    transform: translateX(50%);
  }

  .home-action-button {
    max-width: 104px;
    font-size: 0.76rem;
  }

  .quest-panel {
    inset: 8px;
    padding: 6px;
  }

  .stat-grid,
  .sound-row {
    gap: 9px;
  }

  .battle-field {
    height: 246px;
  }

  .dungeon-map {
    min-height: 420px;
  }

  .map-node {
    width: 112px;
    grid-template-rows: 54px auto;
  }

  .map-pin {
    width: 54px;
    font-size: 1.05rem;
  }

  .map-label {
    width: 112px;
    padding-inline: 5px;
  }

  .map-label strong {
    font-size: 0.78rem;
  }

  .map-label span {
    font-size: 0.67rem;
  }

  .shop-card {
    grid-template-columns: 56px minmax(0, 1fr);
  }

  .shop-meta {
    grid-column: 2;
    justify-self: stretch;
    text-align: left;
  }
}
