@keyframes flicker {
  0% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
  50% {
    transform: scale(1.1) translateY(-5px);
    opacity: 0.8;
  }
  100% {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}
.bg-element-fire {
  background-color: #ff0000;
}

.icon-element-fire {
  color: #ff0000;
}

.bg-element-water {
  background-color: #00ff15;
}

.icon-element-water {
  color: #00ff15;
}

.bg-element-earth {
  background-color: #ffa600;
}

.icon-element-earth {
  color: #ffa600;
}

.bg-element-air {
  background-color: #00d9ff;
}

.icon-element-air {
  color: #00d9ff;
}

.bg-element-light {
  background-color: #f1f1f1;
}

.icon-element-light {
  color: #f1f1f1;
}

.bg-element-darkness {
  background-color: #7a7a7a;
}

.icon-element-darkness {
  color: #7a7a7a;
}

.bg-element-ice {
  background-color: #cacaca;
}

.icon-element-ice {
  color: #cacaca;
}

.bg-element-lightning {
  background-color: #ffea00;
}

.icon-element-lightning {
  color: #ffea00;
}

.bg-element-poison {
  background-color: #ff00e1;
}

.icon-element-poison {
  color: #ff00e1;
}

.bg-element-null {
  background-color: #70f5ff;
}

.icon-element-null {
  color: #70f5ff;
}

.icon-vocation-Warrior {
  color: #ff0000;
}

.icon-vocation-Vagabond {
  color: #ff00dd;
}

.icon-vocation-Physician {
  color: #ffa600;
}

.icon-vocation-Scholar {
  color: #003cff;
}

.icon-vocation-Ritualist {
  color: #797979;
}

.icon-vocation-Guardian {
  color: #00eeff;
}

.icon-vocation-Swordsman {
  color: #00ff0d;
}

.flame1,
.flame2 {
  width: 1px;
  height: 1px;
  border-radius: 50%;
  box-shadow: 0 0 50px 50px rgba(255, 165, 0, 0.5); /* Orange glow */
  filter: drop-shadow(0 0 50px rgba(255, 165, 0, 0.7)); /* More glow */
  animation: flicker 2s infinite alternate; /* Add flicker animation */
  position: absolute;
}

.flame1 {
  top: 50%;
  left: 28%;
}

.flame2 {
  animation-direction: alternate-reverse;
  top: 50%;
  right: 30%;
}

.viewport {
  perspective: 400px;
}
.viewport .viewport-grid {
  transform-style: preserve-3d;
  transform: rotateX(90deg) translateY(125px) translateZ(-40px);
}
.viewport .viewport-tile {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
}
.viewport .viewport-tile .face {
  width: 100%;
  height: 100%;
  position: absolute;
  background-repeat: no-repeat;
  background-size: cover;
}
.viewport .viewport-tile .face.top {
  transform: translateZ(100px) rotateY(180deg);
  background-image: url(/images/game/tileset/dungeon-tiles-1.png);
}
.viewport .viewport-tile .face.bottom {
  background-image: url(/images/game/tileset/dungeon-tiles-1.png);
}
.viewport .viewport-tile .face.left {
  transform: rotateX(-90deg) rotateY(-90deg) translateZ(64px) translateY(-59px);
}
.viewport .viewport-tile .face.right {
  transform: rotateX(270deg) rotateY(-270deg) translateZ(64px) translateY(-59px);
}
.viewport .viewport-tile .face.front {
  transform: rotateX(90deg);
  transform-origin: top;
}
.viewport .viewport-tile .face.back {
  transform: rotateX(-90deg);
  transform-origin: bottom;
}
.viewport .viewport-tile.tile-label-W .face.left, .viewport .viewport-tile.tile-label-W .face.right, .viewport .viewport-tile.tile-label-W .face.front, .viewport .viewport-tile.tile-label-W .face.back {
  background-image: url(/images/game/tileset/dungeon-tiles-1.png);
}
.viewport .viewport-tile.tile-label-D .face.left, .viewport .viewport-tile.tile-label-D .face.right, .viewport .viewport-tile.tile-label-D .face.front, .viewport .viewport-tile.tile-label-D .face.back {
  background-image: url(/images/game/tileset/door-1.png);
}
.viewport .viewport-tile.player-tile .face.left, .viewport .viewport-tile.player-tile .face.right, .viewport .viewport-tile.player-tile .face.front, .viewport .viewport-tile.player-tile .face.back {
  background-image: none !important;
}
.viewport .viewport-tile.farthest .face {
  filter: brightness(40%);
}
.viewport .viewport-tile.farther .face {
  filter: brightness(50%);
}
.viewport .viewport-tile.far .face {
  filter: brightness(60%);
}
.viewport .viewport-tile.near .face {
  filter: brightness(80%);
}
.movement-controls button {
  justify-content: center;
  align-items: center;
  display: flex;
}
.movement-controls button svg {
  opacity: 0.5;
  height: 75%;
  width: 75%;
}
.movement-controls button.move-left svg {
  transform: rotate(-90deg);
}
.movement-controls button.move-right svg {
  transform: rotate(90deg);
}
.movement-controls button.move-back svg {
  transform: rotate(180deg);
}
.status-bar {
  transition: width 0.3s linear, height 0.3s linear;
}

@property --angle {
  syntax: "<angle>";
  initial-value: 0deg;
  inherits: false;
}
.acting-character::before {
  content: "";
  position: absolute;
  box-sizing: border-box;
  background: conic-gradient(from var(--angle), transparent 50%, #ffffff);
  animation: rotateGradient 4s linear infinite;
  pointer-events: none;
  left: -3px;
  right: -3px;
  top: -3px;
  bottom: -3px;
}

@keyframes rotateGradient {
  from {
    --angle: 0deg;
  }
  to {
    --angle: 360deg;
  }
}
img.incapacitated {
  filter: grayscale(100%);
}

@keyframes battleEvent {
  0% {
    opacity: 0;
    transform: scale(0.9);
  }
  15% {
    opacity: 0.8;
    transform: scale(0.9);
  }
  85% {
    opacity: 1;
    transform: scale(1);
  }
  100% {
    opacity: 1;
    transform: scale(1);
  }
}
.animate-battle-event {
  animation: battleEvent 0.8s ease-out forwards;
}

.slashable {
  --slash-color: #7ffcff; /* glow tint */
  --slash-angle: 56deg; /* diagonal */
  --slash-time: 600ms; /* duration */
  position: relative;
  padding: 0.9rem 1.2rem;
  border: 0;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  box-shadow: inset 0 0 0 1px #2a2a2a;
}

/* the flash */
.slashable::after {
  content: "";
  position: absolute;
  inset: -60% -20%; /* give room outside edges */
  background: linear-gradient(90deg, transparent 0 44%, rgba(255, 255, 255, 0.95) 50%, transparent 56% 100%);
  transform: rotate(var(--slash-angle)) translateY(-100%);
  filter: blur(1.5px) drop-shadow(0 0 6px white) drop-shadow(0 0 18px var(--slash-color));
  opacity: 0;
  pointer-events: none;
  animation: slash var(--slash-time) cubic-bezier(0.2, 0.6, 0.1, 1) forwards;
}

@keyframes slash {
  0% {
    transform: rotate(var(--slash-angle)) translateY(-100%);
    opacity: 0;
  }
  10% {
    opacity: 1;
  }
  90% {
    opacity: 1;
  }
  100% {
    transform: rotate(var(--slash-angle)) translateY(100%);
    opacity: 1;
  }
}
/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {
  .slashable::after {
    animation: none !important;
  }
  .slashable:hover::after {
    opacity: 0;
  }
}
.sparks {
  position: relative;
  width: 40px;
  height: 40px;
}
.sparks span {
  background: #ffbf00;
  position: absolute;
  top: 50%;
  left: 50%;
  display: block;
  border-radius: 50%;
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.8);
  box-shadow: 0 0 20px rgba(255, 232, 167, 0.9);
  animation: sparkFly 700ms cubic-bezier(0.2, 0.6, 0.1, 1) forwards;
}
.sparks span:nth-child(1) {
  width: 5px;
  height: 5px;
  --tx: -56px;
  --ty: 100px;
  animation-delay: 282ms;
}
.sparks span:nth-child(2) {
  width: 12px;
  height: 12px;
  --tx: -29px;
  --ty: 48px;
  animation-delay: 64ms;
}
.sparks span:nth-child(3) {
  width: 5px;
  height: 5px;
  --tx: -47px;
  --ty: 98px;
  animation-delay: 123ms;
}
.sparks span:nth-child(4) {
  width: 9px;
  height: 9px;
  --tx: -92px;
  --ty: 98px;
  animation-delay: 286ms;
}
.sparks span:nth-child(5) {
  width: 4px;
  height: 4px;
  --tx: -3px;
  --ty: 65px;
  animation-delay: 149ms;
}
.sparks span:nth-child(6) {
  width: 18px;
  height: 18px;
  --tx: 27px;
  --ty: -76px;
  animation-delay: 166ms;
}
.sparks span:nth-child(7) {
  width: 8px;
  height: 8px;
  --tx: -95px;
  --ty: 74px;
  animation-delay: 23ms;
}
.sparks span:nth-child(8) {
  width: 3px;
  height: 3px;
  --tx: -6px;
  --ty: -52px;
  animation-delay: 134ms;
}

@keyframes sparkFly {
  0% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  85% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--tx)), calc(-50% + var(--ty))) scale(0.3);
  }
}
.action-value {
  animation: actionValueRise 1s ease-out forwards;
  text-shadow: 0 0 6px #000000, 0 0 12px #000000;
}

@keyframes actionValueRise {
  0% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateY(-50px) scale(1.5);
  }
}
