.projectile {
  width: 32px !important;
  height: 32px !important;
  z-index: 12;
  pointer-events: none;
}

.projectile img {
  width: 100% !important;
  height: 100% !important;
  object-fit: contain;
  image-rendering: pixelated;
}

#overlay, .overlay, #obstacle-layer, .obstacle-layer, #bat, .bat {
  pointer-events: none !important;
}

html {
  height: 100%;
}

body {
  margin: 0;
  font-family: 'Press Start 2P', cursive;
  color: #f7efe1;
  background: #18120c;
}

body[data-mode="ifrit"] {
  background: #090605;
}

* {
  box-sizing: border-box;
  font-family: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.top-bar {
  position: sticky;
  top: 0;
  font-family: 'Press Start 2P', cursive;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  background: rgba(6, 5, 4, 0.72);
  font-size: 12px;
  backdrop-filter: blur(12px);
}

.top-bar__title {
  font-family: 'Press Start 2P', cursive;
  font-size: 14px;
  font-size: 11px;
  letter-spacing: 0.6px;
}

.back-link,
.top-bar__button,
.start-btn,
.action-btn {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.06);
  color: inherit;
  text-decoration: none;
  transition: transform 0.18s ease, background 0.18s ease, border-color 0.18s ease;
}

.back-link,
.top-bar__button {
  padding: 10px 14px;
}

.start-btn,
.action-btn {
  padding: 14px 16px;
  cursor: pointer;
  font-size: 11px;
}

.back-link:hover,
.top-bar__button:hover,
.start-btn:hover,
.action-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.3);
}

.bat-app {
  width: min(1200px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.bat-hero {
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 0.8fr);
  align-items: stretch;
  padding: 24px;
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background:
    radial-gradient(circle at top left, rgba(180, 132, 59, 0.18), transparent 28%),
    radial-gradient(circle at top right, rgba(92, 173, 171, 0.14), transparent 26%),
    linear-gradient(180deg, rgba(27, 21, 16, 0.94), rgba(14, 11, 9, 0.9));
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.32);
}

.eyebrow {
  margin: 0 0 10px;
  color: #f0c86d;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 1px;
}

.bat-hero h1 {
  margin: 0 0 14px;
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(20px, 3vw, 34px);
  line-height: 1.45;
}

.hero-text {
  margin: 0;
  max-width: 62ch;
  font-size: 18px;
  line-height: 1.65;
  color: rgba(247, 239, 225, 0.9);
}

.bat-hud {
  display: grid;
  gap: 10px;
  align-content: start;
}

.hud-note {
  margin: 2px 0 0;
  font-size: 9px;
  line-height: 1.7;
  color: rgba(247, 239, 225, 0.78);
}

.bat-hud__item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.bat-hud__item span {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(247, 239, 225, 0.8);
}

.bat-hud__item strong {
  font-family: 'Press Start 2P', cursive;
  font-size: 12px;
  color: #fff5d5;
}

.game-shell {
  margin-top: 18px;
  display: grid;
  gap: 14px;
}

.milestone-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.milestone-strip__chip {
  padding: 8px 10px;
  border-radius: 999px;
  font-size: 9px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.05);
  color: rgba(247, 239, 225, 0.82);
}

.milestone-strip__chip.is-active {
  background: rgba(240, 200, 109, 0.18);
  border-color: rgba(240, 200, 109, 0.4);
  color: #fff4cb;
}

.world {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 480px;
  overflow: hidden;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  outline: none;
}

.world[data-mode="ifrit"] {
  background: url('images/flappy/ifrit-game/Nether Fortress') center/cover no-repeat;
}

.world[data-mode="bat"] {
  background: url('images/flappy/bat-game/cave.jpg') center/cover no-repeat !important;
}

.world[data-mode="bat"] .world__layer {
  display: none;
}

.world[data-mode="ifrit"] .world__layer {
  display: none;
}

.world[data-mode="ifrit"] .mode-decoration {
  display: none;
}

.world:focus-visible {
  box-shadow: 0 0 0 3px rgba(240, 200, 109, 0.3), 0 24px 70px rgba(0, 0, 0, 0.42);
}

.world__layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.world__layer--far {
  opacity: 0.35;
  background:
    radial-gradient(circle at 12% 16%, rgba(255, 255, 255, 0.16) 0 2px, transparent 3px),
    radial-gradient(circle at 82% 28%, rgba(255, 255, 255, 0.14) 0 1.5px, transparent 3px),
    radial-gradient(circle at 68% 14%, rgba(255, 255, 255, 0.14) 0 2px, transparent 3px),
    linear-gradient(180deg, rgba(18, 25, 28, 0.18), rgba(8, 10, 14, 0.58));
  animation: drift-far 60s linear infinite;
}

.world__layer--mid {
  opacity: 0.72;
  background:
    radial-gradient(circle at 18% 76%, rgba(61, 54, 46, 0.58) 0 120px, transparent 122px),
    radial-gradient(circle at 58% 68%, rgba(45, 38, 33, 0.72) 0 150px, transparent 152px),
    radial-gradient(circle at 88% 74%, rgba(39, 33, 28, 0.68) 0 130px, transparent 132px);
  transform: translateY(10%);
  animation: drift-mid 42s linear infinite;
}

.world__layer--near {
  opacity: 0.92;
  background:
    radial-gradient(circle at 12% 100%, rgba(8, 8, 8, 0.96) 0 18%, transparent 19%),
    radial-gradient(circle at 36% 92%, rgba(9, 8, 8, 0.96) 0 24%, transparent 25%),
    radial-gradient(circle at 64% 96%, rgba(10, 8, 8, 0.96) 0 26%, transparent 27%),
    radial-gradient(circle at 88% 90%, rgba(10, 8, 8, 0.96) 0 20%, transparent 21%),
    linear-gradient(180deg, transparent 0%, rgba(4, 4, 4, 0.52) 100%);
  animation: drift-near 28s linear infinite;
}

.obstacle-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
}

.obstacle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 96px;
}

.obstacle__column {
  position: absolute;
  left: 50%;
  width: 96px;
  display: flex;
  transform: translateX(-50%);
  align-items: stretch;
  overflow: hidden;
}

.obstacle__column--top {
  top: 0;
  flex-direction: column;
}

.obstacle__column--bottom {
  bottom: 0;
  flex-direction: column-reverse;
}

.stone-tile {
  width: 32px;
  min-width: 32px;
  max-width: 32px;
  height: 32px;
  box-sizing: border-box;
  position: relative;
  overflow: hidden;
  border: 0;
  background-image: url('images/flappy/bat-game/stone.jpg');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
  box-shadow: none;
  image-rendering: pixelated;
  flex: 0 0 auto;
}

.world[data-mode="ifrit"] .stone-tile {
  background-image: url('images/flappy/ifrit-game/nether_bricks.png');
}

.stone-row {
  display: flex;
  width: 96px;
  height: 32px;
  gap: 0;
}

.stone-tile--coal {
  background-image: url('images/flappy/bat-game/coal.jpg'), url('images/flappy/bat-game/stone.jpg');
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-size: cover, 100% 100%;
}

.stone-tile--iron {
  background-image: url('images/flappy/bat-game/iron.jpg'), url('images/flappy/bat-game/stone.jpg');
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-size: cover, 100% 100%;
}

.stone-tile--gold {
  background-image: url('images/flappy/bat-game/gold.jpg'), url('images/flappy/bat-game/stone.jpg');
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-size: cover, 100% 100%;
}

.stone-tile--lapis {
  background-image: url('images/flappy/bat-game/lapis.jpg'), url('images/flappy/bat-game/stone.jpg');
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-size: cover, 100% 100%;
}

.stone-tile--diamond {
  background-image: url('images/flappy/bat-game/diamond.jpg'), url('images/flappy/bat-game/stone.jpg');
  background-position: center, center;
  background-repeat: no-repeat, no-repeat;
  background-size: cover, 100% 100%;
}

.stone-tile--bedrock {
  background-image: url('images/flappy/bat-game/bedrock.jpg');
  background-position: center;
  background-repeat: no-repeat;
  background-size: cover;
}

.world[data-mode="ifrit"] .stone-tile--bedrock {
  background-image: url('images/flappy/bat-game/bedrock.jpg');
}

.obstacle--bedrock .stone-tile {
  filter: saturate(0.72) brightness(0.88);
}

.mode-decoration {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}

.mode-decoration--ifrit::before,
.mode-decoration--ifrit::after {
  content: none;
}

.bedrock {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 74px;
  z-index: 4;
  background: url('images/flappy/ifrit-game/nether_bricks.png') center/cover repeat;
  border-top: 2px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 8px 16px rgba(0, 0, 0, 0.16);
  transform: translateY(18px);
  opacity: 0.92;
}

.world[data-mode="bat"] .bedrock {
  background: linear-gradient(180deg, rgba(64, 64, 64, 0.98), rgba(20, 20, 20, 0.98));
}

.finish-glow {
  position: absolute;
  left: 50%;
  bottom: 32px;
  width: 260px;
  height: 110px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 200, 109, 0.34), transparent 68%);
  filter: blur(6px);
  opacity: 0;
  z-index: 3;
  pointer-events: none;
}

.world[data-mode="bat"] .finish-glow {
  background: radial-gradient(circle, rgba(72, 72, 72, 0.16), transparent 68%);
}

.world--finished .finish-glow {
  opacity: 1;
  animation: pulse 1.9s ease-in-out infinite;
}

.world--finished .bedrock {
  opacity: 1;
  transform: translateY(0);
}

.world--victory-flash::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.84);
  animation: victory-flash 260ms ease-out forwards;
}

.world--victory-dark::after {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 9;
  pointer-events: none;
  background: rgba(0, 0, 0, 1);
}

.bat {
  position: absolute;
  left: 140px;
  top: 180px;
  width: 72px;
  height: 52px;
  z-index: 5;
  transform-origin: 50% 50%;
  will-change: transform;
  filter: drop-shadow(0 8px 8px rgba(0, 0, 0, 0.28));
}

.world[data-mode="ifrit"] .bat {
  filter: drop-shadow(0 0 14px rgba(255, 187, 91, 0.28));
}

.bat--hidden {
  visibility: hidden;
}

.world--finished .bat {
  left: auto;
  top: 22px;
  right: 44px;
  width: 72px;
  height: 52px;
  transform-origin: center;
  z-index: 11;
}

.world--finished .bat img {
  width: 100%;
  height: auto;
  object-fit: contain;
  object-position: center center;
  image-rendering: auto;
  transform: translateX(-20%);
}

.bat img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  image-rendering: pixelated;
  transform: scaleX(-1);
}

.bat::before {
  content: none;
}

.bat--sleeping {
  filter: none;
}

.bat--sleeping img {
  transform: none;
  transform-origin: center;
  filter: none;
}

body[data-mode="ifrit"] .world__layer--mid {
  opacity: 0.6;
  background:
    radial-gradient(circle at 16% 76%, rgba(84, 34, 16, 0.72) 0 120px, transparent 122px),
    radial-gradient(circle at 58% 68%, rgba(94, 37, 20, 0.68) 0 150px, transparent 152px),
    radial-gradient(circle at 88% 74%, rgba(42, 18, 14, 0.78) 0 130px, transparent 132px);
  transform: translateY(10%);
  animation: drift-mid 42s linear infinite;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: block;
  padding: 20px;
  background: rgba(7, 6, 5, 0.56);
  backdrop-filter: blur(9px);
}

.overlay--hidden {
  display: none;
}

.overlay--centered {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
}

.overlay h2 {
  position: absolute;
  top: 24px;
  left: 50%;
  width: calc(100% - 40px);
  margin: 0;
  transform: translateX(-50%);
  text-align: center;
  font-family: 'Press Start 2P', cursive;
  font-size: clamp(18px, 3vw, 28px);
  line-height: 1.45;
}

.overlay p {
  position: absolute;
  top: 50%;
  left: 20px;
  right: 20px;
  margin: 0;
  transform: translateY(-50%);
  text-align: center;
  font-size: 15px;
  line-height: 1.65;
  color: rgba(247, 239, 225, 0.9);
}

.overlay--centered h2,
.overlay--centered p {
  position: static;
  left: auto;
  right: auto;
  top: auto;
  width: auto;
  transform: none;
}

.overlay--centered h2 {
  margin: 0;
}

.overlay--centered p {
  max-width: 28ch;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

@keyframes drift-far {
  from { transform: translateX(0); }
  to { transform: translateX(-120px); }
}

@keyframes drift-mid {
  from { transform: translateX(0); }
  to { transform: translateX(-240px); }
}

@keyframes drift-near {
  from { transform: translateX(0); }
  to { transform: translateX(-360px); }
}

@keyframes pulse {
  0%, 100% { transform: translateX(-50%) scale(1); opacity: 0.92; }
  50% { transform: translateX(-50%) scale(1.04); opacity: 1; }
}

@keyframes snooze {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

@keyframes victory-flash {
  0% {
    opacity: 0;
  }
  20% {
    opacity: 0.95;
  }
  100% {
    opacity: 0;
  }
}

@media (max-width: 960px) {
  .bat-hero {
    grid-template-columns: 1fr;
  }

  .hero-text {
    font-size: 16px;
  }

  .world {
    min-height: 400px;
  }
}

@media (max-width: 720px) {
  .top-bar {
    padding: 14px 16px;
  }

  .top-bar__title {
    font-size: 12px;
  }

  .bat-app {
    padding: 14px;
  }

  .bat-hero {
    padding: 18px;
  }

  .world {
    min-height: 320px;
    aspect-ratio: auto;
  }

  .bat {
    width: 58px;
    height: 42px;
    left: 120px;
  }

  .stone-tile {
    min-height: 28px;
  }
}
