/* ---- Nugget Knight ---- */

#knightWorld {
  position: fixed;
  inset: 0;
  z-index: 9990;
  display: none;
  pointer-events: none;
  background: #131029;
}
#knightWorld.active { display: block; }
#knightWorld svg { display: block; }

/* Torch flames flicker (inner group only — position lives on the outer g) */
@keyframes kFlicker {
  0%, 100% { transform: scale(1, 1); }
  30%      { transform: scale(0.92, 1.08) rotate(-2deg); }
  55%      { transform: scale(1.06, 0.94) rotate(2deg); }
  80%      { transform: scale(0.96, 1.05); }
}
.k-flame {
  animation: kFlicker 0.9s ease-in-out infinite;
  transform-box: fill-box;
  transform-origin: center bottom;
}

/* Pennants wave gently */
@keyframes kWave {
  0%, 100% { transform: skewY(0deg); }
  50%      { transform: skewY(5deg); }
}
.k-pennant { animation: kWave 2.6s ease-in-out infinite; }

/* Taking a hit: quick red flash on the whole rig */
@keyframes kHurt {
  0%   { filter: saturate(3) hue-rotate(-30deg) brightness(1.4); }
  100% { filter: none; }
}
.k-hurt { animation: kHurt 0.45s ease-out 1; }

/* An enemy that soaked a hit flashes white */
.k-en-flash { filter: brightness(2.2) saturate(0.4); }

/* ---- Between-wave upgrade cards ---- */
.k-upgrade {
  position: fixed;
  top: 22%;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9998;
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 0.9rem;
  pointer-events: auto;
}
.k-upgrade.active { display: flex; }
.k-up-title {
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  color: #fbbf24;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.8);
}
.k-up-cards { display: flex; gap: 0.8rem; }
.k-up-cards button {
  position: relative;
  width: 158px;
  padding: 1.1rem 0.8rem 0.9rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  background: rgba(15, 23, 42, 0.96);
  border: 2px solid rgba(245, 158, 11, 0.45);
  border-radius: 1rem;
  color: #f8fafc;
  cursor: pointer;
  box-shadow: 0 18px 45px -12px rgba(0, 0, 0, 0.8);
  transition: transform 0.12s, border-color 0.12s;
  font-family: -apple-system, "Segoe UI", Roboto, sans-serif;
}
.k-up-cards button:hover {
  transform: translateY(-4px) scale(1.03);
  border-color: #f59e0b;
}
.k-up-emoji { font-size: 1.9rem; line-height: 1; }
.k-up-name { font-size: 0.85rem; font-weight: 900; }
.k-up-desc { font-size: 0.7rem; font-weight: 600; color: #94a3b8; text-align: center; line-height: 1.35; }
.k-up-key {
  position: absolute;
  top: 6px;
  left: 8px;
  font-size: 0.62rem;
  font-weight: 900;
  color: #64748b;
  border: 1px solid #334155;
  border-radius: 5px;
  padding: 1px 5px;
}

/* ---- The oath select (difficulty) ---- */
.k-oath { top: 18%; }
.k-oath .k-up-cards button { width: 178px; min-height: 190px; }
.k-oath .k-up-cards button.k-last { border-color: #f59e0b; box-shadow: 0 0 22px rgba(245, 158, 11, 0.35); }
.k-oath .k-up-cards button[data-oath="nuggmare"]:not(.k-locked) {
  border-color: rgba(220, 38, 38, 0.7);
}
.k-oath .k-up-cards button[data-oath="nuggmare"]:not(.k-locked):hover {
  border-color: #ef4444;
  box-shadow: 0 0 26px rgba(239, 68, 68, 0.5);
}
.k-oath .k-up-cards button.k-locked {
  filter: grayscale(0.9);
  opacity: 0.65;
  cursor: not-allowed;
}
.k-oath-mult { font-size: 0.72rem; font-weight: 900; color: #fbbf24; }
.k-oath-best { font-size: 0.62rem; font-weight: 700; color: #64748b; min-height: 0.8em; }
.k-oath-note {
  font-size: 0.68rem;
  font-weight: 700;
  color: #94a3b8;
  letter-spacing: 0.08em;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}
@keyframes kShake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-7px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(3px); }
}
.k-oath .k-up-cards button.k-shake { animation: kShake 0.4s ease-out 1; }

/* "Seasoned" elite enemies + the enraged Whisk burn hot */
.k-elite {
  filter: drop-shadow(0 0 9px rgba(255, 61, 61, 0.9)) saturate(1.5);
}

/* ---- touch button cluster (mobile patch) ---- */
.k-touch {
  position: fixed;
  inset: 0;
  z-index: 9992; /* above the courtyard, below the storm HUD */
  display: none;
  pointer-events: none;
}
.k-touch.on { display: block; }
.k-tbtn {
  position: absolute;
  bottom: 4vh;
  width: 15vmin;
  height: 15vmin;
  min-width: 52px;
  min-height: 52px;
  border-radius: 50%;
  border: 1px solid rgba(238, 242, 255, 0.35);
  background: rgba(5, 5, 12, 0.45);
  color: #eef2ff;
  font-size: clamp(1.1rem, 5vmin, 1.8rem);
  pointer-events: auto;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.k-tbtn:active { background: rgba(255, 210, 58, 0.25); }
.k-t-left  { left: 4vw; }
.k-t-right { left: calc(4vw + 17vmin); }
.k-t-slash { right: 4vw; bottom: 5vh; }
.k-t-jump  { right: calc(4vw + 17vmin); bottom: 12vh; }
