* {
  box-sizing: border-box;
}

:root {
  /*
    DO NOT TOUCH — your working desktop coordinates
  */
  --computer-x: 50.4%;
  --computer-y: 48.6%;
  --computer-w: clamp(200px, 160vw, 200px);

  --mpc-x: 76.8%;
  --mpc-y: 54.9%;
  --mpc-w: clamp(95px, 8vw, 130px);

  /*
    DESKTOP CHARACTER SIZE
  */
  --player-w: clamp(210px, 20vw, 330px);
  --player-bottom: 6%;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: #02020a;
  color: #fff;
  overflow-x: hidden;
  font-family: 'Inter', system-ui, sans-serif;
}

body {
  touch-action: manipulation;
}

button {
  font-family: inherit;
}

.game-shell {
  width: 100%;
  min-height: 100vh;
  background: #02020a;
}

.is-hidden {
  display: none !important;
}

/* PRELOADER */

.preloader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background:
    radial-gradient(circle at center, rgba(136, 31, 255, 0.22), transparent 40%),
    #02020a;
  display: grid;
  place-items: center;
}

.loader-card {
  width: min(90vw, 560px);
  padding: 34px 26px;
  border: 3px solid #7c3cff;
  background: rgba(4, 8, 25, 0.94);
  box-shadow:
    0 0 30px rgba(124, 60, 255, 0.65),
    inset 0 0 22px rgba(0, 229, 255, 0.18);
  text-align: center;
}

.loader-title {
  font-family: 'Press Start 2P', monospace;
  color: #ffd429;
  font-size: clamp(20px, 5vw, 38px);
  text-shadow: 4px 4px 0 #3b136f;
  margin-bottom: 18px;
}

.loader-subtitle {
  font-family: 'Press Start 2P', monospace;
  color: #21eaff;
  font-size: 12px;
  margin-bottom: 24px;
}

.loader-bar {
  width: 100%;
  height: 18px;
  border: 2px solid #21eaff;
  padding: 3px;
  background: #030617;
}

.loader-bar span {
  display: block;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #21eaff, #9b4dff, #ffd429);
  animation: loadBar 1.4s ease forwards;
}

@keyframes loadBar {
  to {
    width: 100%;
  }
}

/* START SCREEN */

.start-screen {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  background:
    radial-gradient(circle at 50% 30%, rgba(142, 68, 255, 0.28), transparent 35%),
    radial-gradient(circle at 70% 75%, rgba(0, 221, 255, 0.14), transparent 30%),
    linear-gradient(180deg, #080014, #020208 70%);
}

.start-screen::before {
  content: "";
  position: absolute;
  inset: -40px;
  background:
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px);
  background-size: 32px 32px;
  transform: perspective(500px) rotateX(55deg);
  transform-origin: bottom;
  opacity: 0.35;
}

.start-card {
  position: relative;
  z-index: 2;
  width: min(92vw, 720px);
  padding: clamp(28px, 6vw, 60px);
  border: 4px solid #8b4cff;
  background:
    linear-gradient(180deg, rgba(9, 14, 40, 0.94), rgba(3, 5, 18, 0.96));
  box-shadow:
    0 0 45px rgba(139, 76, 255, 0.55),
    inset 0 0 28px rgba(0, 234, 255, 0.12);
  text-align: center;
}

.tiny-label {
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  letter-spacing: 2px;
  color: #21eaff;
  margin: 0 0 18px;
}

.start-card h1 {
  font-family: 'Press Start 2P', monospace;
  color: #ffd429;
  font-size: clamp(28px, 8vw, 64px);
  line-height: 1.1;
  margin: 0;
  text-shadow:
    5px 5px 0 #4b168f,
    0 0 25px rgba(255, 212, 41, 0.4);
}

.start-card h2 {
  font-family: 'Press Start 2P', monospace;
  color: #21eaff;
  font-size: clamp(15px, 4vw, 32px);
  margin: 18px 0 24px;
  text-shadow: 3px 3px 0 #172060;
}

.start-copy {
  max-width: 560px;
  margin: 0 auto 28px;
  line-height: 1.7;
  color: rgba(255,255,255,0.86);
  font-size: 16px;
}

.arcade-btn {
  border: 0;
  cursor: pointer;
  padding: 18px 26px;
  background: linear-gradient(180deg, #ffd429, #ff8a00);
  color: #1a0b00;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  box-shadow:
    0 8px 0 #7b3300,
    0 0 24px rgba(255, 212, 41, 0.45);
  transform: translateY(0);
}

.arcade-btn:hover {
  transform: translateY(2px);
  box-shadow:
    0 6px 0 #7b3300,
    0 0 30px rgba(255, 212, 41, 0.65);
}

.arcade-btn:active {
  transform: translateY(7px);
  box-shadow:
    0 1px 0 #7b3300,
    0 0 20px rgba(255, 212, 41, 0.45);
}

.arcade-btn.small {
  font-size: 11px;
  padding: 14px 18px;
}

/* LEVEL */

.level {
  position: relative;
  width: 100%;
  height: 100vh;
  min-height: 720px;
  overflow: hidden;
  background: #02020a;
  touch-action: none;
}

.level-bg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  image-rendering: auto;
  z-index: 1;
}

.vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    radial-gradient(circle at center, transparent 42%, rgba(0,0,0,0.42) 100%),
    linear-gradient(180deg, rgba(0,0,0,0.15), transparent 24%, rgba(0,0,0,0.42));
}

.scanlines {
  position: absolute;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  opacity: 0.12;
  background: repeating-linear-gradient(
    180deg,
    rgba(255,255,255,0.22) 0,
    rgba(255,255,255,0.22) 1px,
    transparent 1px,
    transparent 4px
  );
  mix-blend-mode: overlay;
}

/* HUD */

.arcade-hud-css {
  position: absolute;
  top: max(16px, env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  width: min(94vw, 1160px);
  display: grid;
  grid-template-columns: 1.25fr 1fr 1fr;
  gap: 12px;
  font-family: 'Press Start 2P', monospace;
  pointer-events: none;
}

.hud-panel {
  min-height: 78px;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    linear-gradient(180deg, rgba(8, 15, 46, 0.86), rgba(3, 7, 24, 0.86));
  border: 3px solid #8b35ff;
  box-shadow:
    0 0 18px rgba(139, 53, 255, 0.55),
    inset 0 0 18px rgba(0, 234, 255, 0.14);
}

.hud-left {
  justify-content: flex-start;
  gap: 18px;
}

.hud-player {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hud-center {
  flex-direction: column;
  gap: 8px;
}

.hud-center strong {
  color: #22eaff;
  font-size: clamp(20px, 4vw, 42px);
  text-shadow: 0 0 12px rgba(34, 234, 255, 0.8);
}

.hud-right {
  flex-direction: column;
  gap: 10px;
}

.hud-small {
  color: #22eaff;
  font-size: clamp(9px, 1.4vw, 14px);
}

.hud-name {
  color: #ffd429;
  font-size: clamp(10px, 1.5vw, 16px);
}

.hearts {
  color: #ff304f;
  font-size: clamp(16px, 2vw, 24px);
  text-shadow: 0 0 10px rgba(255, 48, 79, 0.8);
}

.coins {
  color: #fff;
  font-size: clamp(10px, 1.6vw, 16px);
}

.coins::first-letter {
  color: #ffd429;
}

/* MISSION BOX */

.mission-box-css {
  position: absolute;
  top: 122px;
  left: 26px;
  z-index: 42;
  width: min(30vw, 360px);
  padding: 22px;
  font-family: 'Press Start 2P', monospace;
  background:
    linear-gradient(180deg, rgba(8, 15, 46, 0.86), rgba(3, 7, 24, 0.86));
  border: 3px solid #8b35ff;
  box-shadow:
    0 0 22px rgba(139, 53, 255, 0.55),
    inset 0 0 18px rgba(0, 234, 255, 0.12);
  transition: max-height 0.25s ease, padding 0.25s ease, width 0.25s ease;
}

.mission-toggle {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 28px;
  border: 2px solid #22eaff;
  background: rgba(0,0,0,0.35);
  color: #22eaff;
  font-family: 'Press Start 2P', monospace;
  font-size: 13px;
  cursor: pointer;
  z-index: 5;
}

.mission-box-css h3 {
  margin: 0 42px 16px 0;
  color: #ffd429;
  font-size: clamp(18px, 2vw, 28px);
  text-shadow: 3px 3px 0 #4b168f;
}

.mission-level {
  color: #22eaff;
  font-size: 10px;
  line-height: 1.6;
  margin: 0 0 18px;
}

.mission-list {
  margin-top: 16px;
}

.mission-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  color: #fff;
  font-size: 10px;
  line-height: 1.6;
  margin: 15px 0;
}

.mission-item .box {
  width: 14px;
  height: 14px;
  border: 2px solid #22eaff;
  flex: 0 0 auto;
  margin-top: 1px;
  box-shadow: 0 0 10px rgba(34, 234, 255, 0.45);
}

.mission-item.done .box {
  background: #ffd429;
  border-color: #ffd429;
  box-shadow: 0 0 14px rgba(255, 212, 41, 0.75);
}

.mission-item.done span:last-child {
  color: #ffd429;
}

.mission-reward {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px solid rgba(34, 234, 255, 0.45);
  color: #ffd429;
  font-size: 9px;
  line-height: 1.6;
}

.mission-box-css.is-collapsed {
  width: 210px;
  max-height: 58px;
  overflow: hidden;
  padding: 12px 52px 12px 14px;
}

.mission-box-css.is-collapsed h3 {
  margin: 0;
  font-size: 15px;
}

.mission-box-css.is-collapsed .mission-level,
.mission-box-css.is-collapsed .mission-list,
.mission-box-css.is-collapsed .mission-reward {
  display: none;
}

/* PROPS */

.prop {
  position: absolute;
  z-index: 18;
  image-rendering: auto;
  filter: drop-shadow(0 10px 16px rgba(0,0,0,0.38));
  transition: transform 0.2s ease, filter 0.2s ease;
}

.interactable {
  cursor: pointer;
}

.interactable:hover {
  filter:
    drop-shadow(0 10px 16px rgba(0,0,0,0.38))
    drop-shadow(0 0 16px rgba(33, 234, 255, 0.65));
}

/* COMPUTER + MPC POSITIONING — DO NOT TOUCH */

.computer-sprite {
  width: var(--computer-w);
  left: var(--computer-x);
  top: var(--computer-y);
  transform: translate(-50%, -50%);
  z-index: 20;
}

.computer-sprite:hover {
  transform: translate(-50%, -50%) scale(1.04);
}

.mpc-sprite {
  width: var(--mpc-w);
  left: var(--mpc-x);
  top: var(--mpc-y);
  transform: translate(-50%, -50%) rotate(-4deg);
  z-index: 21;
}

.mpc-sprite:hover {
  transform: translate(-50%, -50%) rotate(-4deg) scale(1.04);
}

/* PLAYER */

.player-sprite {
  position: absolute;
  z-index: 30;
  width: var(--player-w);
  left: 38%;
  bottom: var(--player-bottom);
  transform: translateX(-50%) scaleX(1);
  transform-origin: bottom center;
  image-rendering: auto;
  filter:
    drop-shadow(0 20px 20px rgba(0,0,0,0.55))
    drop-shadow(0 0 16px rgba(255, 212, 41, 0.45));
  transition: left 0.12s linear, bottom 0.12s linear;
}

.player-sprite.near-object {
  filter:
    drop-shadow(0 20px 20px rgba(0,0,0,0.55))
    drop-shadow(0 0 26px rgba(255, 212, 41, 0.95));
}

/* DIALOGUE BOX */

.dialogue-box-css {
  position: absolute;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 45;
  width: min(92vw, 980px);
  min-height: 132px;
  padding: 24px 34px;
  font-family: 'Press Start 2P', monospace;
  background:
    linear-gradient(180deg, rgba(8, 15, 46, 0.9), rgba(3, 7, 24, 0.9));
  border: 3px solid #8b35ff;
  box-shadow:
    0 0 24px rgba(139, 53, 255, 0.65),
    inset 0 0 20px rgba(0, 234, 255, 0.12);
}

.dialogue-speaker {
  color: #ffd429;
  font-size: 12px;
  margin-bottom: 12px;
}

.dialogue-box-css p {
  margin: 0;
  max-width: 82%;
  color: #fff;
  font-size: clamp(10px, 1.6vw, 15px);
  line-height: 1.8;
  text-shadow: 2px 2px 0 #000;
}

.next-label {
  position: absolute;
  right: 24px;
  bottom: 18px;
  border: 0;
  background: transparent;
  color: #22eaff;
  font-family: 'Press Start 2P', monospace;
  font-size: 11px;
  cursor: pointer;
  animation: blinkNext 0.9s infinite;
}

@keyframes blinkNext {
  0%, 100% {
    opacity: 1;
  }

  50% {
    opacity: 0.35;
  }
}

/* INTERACTION PROMPT */

.interaction-prompt {
  position: absolute;
  left: 50%;
  top: 34%;
  z-index: 70;
  transform: translateX(-50%) translateY(-10px);
  opacity: 0;
  padding: 10px 12px;
  border: 2px solid #21eaff;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font-family: 'Press Start 2P', monospace;
  font-size: 9px;
  pointer-events: none;
  box-shadow: 0 0 18px rgba(33, 234, 255, 0.42);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.interaction-prompt.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* VICTORY */

.victory-overlay {
  position: absolute;
  inset: 0;
  z-index: 120;
  background:
    radial-gradient(circle at center, rgba(255, 212, 41, 0.22), transparent 34%),
    rgba(0, 0, 0, 0.78);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 22px;
}

.victory-overlay.show {
  display: flex;
}

.victory-card {
  width: min(92vw, 680px);
  padding: 34px;
  text-align: center;
  border: 4px solid #ffd429;
  background: rgba(3, 7, 25, 0.95);
  box-shadow:
    0 0 38px rgba(255, 212, 41, 0.48),
    inset 0 0 24px rgba(124, 60, 255, 0.2);
}

.victory-card h2 {
  font-family: 'Press Start 2P', monospace;
  color: #ffd429;
  font-size: clamp(22px, 6vw, 48px);
  margin: 10px 0 18px;
  text-shadow: 4px 4px 0 #5b1d99;
}

.victory-card p {
  line-height: 1.7;
  color: rgba(255,255,255,0.9);
  margin-bottom: 24px;
}

/* CONTROLS */

.mobile-controls {
  position: absolute;
  left: 50%;
  bottom: 176px;
  z-index: 90;
  transform: translateX(-50%);
  display: none;
  gap: 8px;
  pointer-events: auto;
}

.mobile-controls button {
  border: 2px solid #21eaff;
  color: #fff;
  background: rgba(3, 7, 25, 0.72);
  box-shadow: 0 0 12px rgba(33, 234, 255, 0.25);
  padding: 10px 12px;
  min-width: 48px;
  min-height: 40px;
  font-family: 'Press Start 2P', monospace;
  font-size: 8px;
  border-radius: 8px;
  touch-action: none;
}

#actionBtn {
  min-width: 76px;
  color: #ffd429;
  border-color: #ffd429;
}

.keyboard-help {
  position: absolute;
  left: 24px;
  bottom: 20px;
  z-index: 55;
  color: rgba(255,255,255,0.58);
  font-size: 12px;
  background: rgba(0,0,0,0.42);
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,0.12);
}

/* TABLET */

@media (max-width: 980px) {
  :root {
    --player-w: 260px;
    --player-bottom: 5%;
  }

  .level {
    height: 100svh;
    min-height: 760px;
  }

  .arcade-hud-css {
    top: 10px;
    width: 94vw;
    grid-template-columns: 1fr 0.75fr 0.85fr;
    gap: 6px;
  }

  .hud-panel {
    min-height: 46px;
    padding: 7px 9px;
    border-width: 2px;
  }

  .hud-center {
    display: flex;
    gap: 4px;
  }

  .hud-center .hud-small {
    font-size: 7px;
  }

  .hud-center strong {
    font-size: 16px;
    line-height: 1;
  }

  .mission-box-css {
    top: 68px;
    left: 12px;
    width: 260px;
    padding: 14px;
  }

  .mission-box-css h3 {
    font-size: 18px;
  }

  .mission-level,
  .mission-item {
    font-size: 8px;
  }

  .dialogue-box-css {
    bottom: 64px;
    width: 88vw;
    min-height: 92px;
    padding: 14px 18px;
  }

  .dialogue-speaker {
    font-size: 9px;
    margin-bottom: 8px;
  }

  .dialogue-box-css p {
    max-width: 88%;
    font-size: 9px;
    line-height: 1.55;
  }

  .next-label {
    right: 14px;
    bottom: 10px;
    font-size: 8px;
  }

  .mobile-controls {
    display: flex;
    bottom: max(12px, env(safe-area-inset-bottom));
  }

  .keyboard-help {
    display: none;
  }
}

/* MOBILE */

@media (max-width: 700px) {
  :root {
    --player-w: 250px;
    --player-bottom: 7%;
  }

  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  .level {
    height: 100svh;
    min-height: 100svh;
  }

  .level-bg {
    width: 185%;
    left: 50%;
    transform: translateX(-50%);
    object-fit: cover;
    object-position: center;
  }

  .arcade-hud-css {
    top: max(6px, env(safe-area-inset-top));
    width: 96vw;
    grid-template-columns: 1fr 0.72fr 0.72fr;
    gap: 4px;
  }

  .hud-panel {
    min-height: 32px;
    padding: 5px 6px;
    border-width: 1px;
    background:
      linear-gradient(180deg, rgba(8, 15, 46, 0.58), rgba(3, 7, 24, 0.58));
    box-shadow:
      0 0 10px rgba(139, 53, 255, 0.36),
      inset 0 0 10px rgba(0, 234, 255, 0.08);
  }

  .hud-left {
    gap: 6px;
    overflow: hidden;
  }

  .hud-left > .hud-small {
    display: none;
  }

  .hud-player {
    gap: 4px;
    min-width: 0;
  }

  .hud-right {
    gap: 3px;
  }

  .hud-small {
    font-size: 6px;
    line-height: 1;
  }

  .hud-name {
    font-size: 7px;
    line-height: 1;
    white-space: nowrap;
  }

  .hearts {
    font-size: 9px;
    line-height: 1;
  }

  .hud-center {
    display: flex;
    gap: 3px;
    min-width: 0;
  }

  .hud-center .hud-small {
    font-size: 5.5px;
    line-height: 1;
  }

  .hud-center strong {
    font-size: 10px;
    line-height: 1;
    letter-spacing: -1px;
    white-space: nowrap;
  }

  .coins {
    font-size: 7px;
    line-height: 1;
    white-space: nowrap;
  }

  .mission-box-css {
    top: 44px;
    left: 8px;
    width: 215px;
    max-height: 240px;
    padding: 12px;
    border-width: 2px;
    background:
      linear-gradient(180deg, rgba(8, 15, 46, 0.62), rgba(3, 7, 24, 0.62));
  }

  .mission-box-css h3 {
    font-size: 14px;
    margin-bottom: 10px;
  }

  .mission-level {
    font-size: 7px;
    margin-bottom: 8px;
  }

  .mission-list {
    margin-top: 8px;
  }

  .mission-item {
    font-size: 7px;
    margin: 8px 0;
    gap: 7px;
  }

  .mission-item .box {
    width: 10px;
    height: 10px;
    border-width: 1px;
  }

  .mission-reward {
    font-size: 6px;
    margin-top: 10px;
    padding-top: 8px;
  }

  .mission-toggle {
    top: 7px;
    right: 7px;
    width: 26px;
    height: 24px;
    font-size: 10px;
    border-width: 1px;
  }

  .mission-box-css.is-collapsed {
    width: 138px;
    max-height: 38px;
    padding: 9px 38px 9px 10px;
  }

  .mission-box-css.is-collapsed h3 {
    font-size: 10px;
  }

  .dialogue-box-css {
    bottom: max(58px, calc(env(safe-area-inset-bottom) + 54px));
    width: 92vw;
    min-height: 72px;
    padding: 10px 12px;
    border-width: 2px;
    background:
      linear-gradient(180deg, rgba(8, 15, 46, 0.66), rgba(3, 7, 24, 0.66));
  }

  .dialogue-speaker {
    font-size: 8px;
    margin-bottom: 6px;
  }

  .dialogue-box-css p {
    max-width: 100%;
    font-size: 7px;
    line-height: 1.55;
    padding-right: 44px;
  }

  .next-label {
    right: 10px;
    bottom: 9px;
    font-size: 7px;
  }

  .interaction-prompt {
    top: 38%;
    font-size: 7px;
    padding: 8px 9px;
  }

  .mobile-controls {
    display: flex;
    bottom: max(8px, env(safe-area-inset-bottom));
    gap: 6px;
  }

  .mobile-controls button {
    min-width: 42px;
    min-height: 34px;
    padding: 8px 9px;
    font-size: 7px;
    border-width: 1px;
    background: rgba(3, 7, 25, 0.66);
  }

  #actionBtn {
    min-width: 64px;
  }
}

/* SMALL MOBILE */

@media (max-width: 480px) {
  :root {
    --player-w: 235px;
    --player-bottom: 7%;
  }

  .start-card {
    padding: 28px 20px;
  }

  .start-copy {
    font-size: 14px;
  }

  .arcade-btn {
    width: 100%;
    font-size: 11px;
  }

  .arcade-hud-css {
    grid-template-columns: 1fr 0.68fr 0.68fr;
  }

  .hud-panel {
    min-height: 30px;
    padding: 4px 5px;
  }

  .hud-center strong {
    font-size: 9px;
    letter-spacing: -1px;
  }

  .hud-center .hud-small {
    display: none;
  }

  .coins {
    font-size: 6.5px;
  }

  .dialogue-box-css {
    bottom: max(54px, calc(env(safe-area-inset-bottom) + 50px));
  }

  .dialogue-box-css p {
    font-size: 6.5px;
  }
}