:root {
  --ui-bg: rgba(15, 20, 24, 0.9);
  --ui-line: rgba(255, 255, 255, 0.25);
  --ui-text: #f6f2e9;
  --accent: #f0c35a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: #101419;
  color: var(--ui-text);
  font-family: Arial, Helvetica, sans-serif;
}

.game-shell {
  width: min(100vw, 1280px);
  padding: 12px;
}

.title-active .game-shell,
.scene2-active .game-shell,
.scene3-active .game-shell,
.scene4-active .game-shell {
  width: min(96vw, 1400px, calc(82vh * 1.777));
}

.stage {
  position: relative;
  width: 100%;
  aspect-ratio: 2169 / 725;
  overflow: visible;
  background: #222;
  border: 2px solid #1f2529;
  cursor: crosshair;
}

.title-active #game,
.scene2-active #game,
.scene3-active #game,
.scene4-active #game {
  aspect-ratio: 1672 / 941;
  width: 100%;
  height: auto;
  max-height: 82vh;
}

.background {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: fill;
  user-select: none;
  pointer-events: none;
  z-index: 0;
}

.title-active .background,
.scene2-active .background,
.scene3-active .background,
.scene4-active .background {
  object-fit: contain;
  object-position: center;
  background: #000;
}

.cockpit-mask {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background-image: url("Assets/backgrounds/cockpit_side.png");
  background-size: 100% 100%;
  background-position: center;
  background-repeat: no-repeat;
}

.cockpit-pedestal-mask {
  z-index: 12;
  clip-path: polygon(
    30% 53%,
    39% 53%,
    42% 77%,
    31% 77%,
    29% 63%
  );
  outline: 1px solid rgba(255, 255, 0, 0.9);
  filter: drop-shadow(0 0 2px yellow);
}

.character,
.coffee-prop {
  position: absolute;
  user-select: none;
  pointer-events: none;
}

.jana {
  left: 75%;
  bottom: 7%;
  width: 15.6825%;
  z-index: 10;
}

.jana.cockpit-jana {
  z-index: 14;
}

.marin {
  left: 57%;
  bottom: 2%;
  width: 21%;
  z-index: 4;
}

.marin.cockpit-marin {
  transform: scaleX(1);
  z-index: 10;
  cursor: pointer;
  pointer-events: auto;
}

.marin.cockpit-seated-mask {
  clip-path: inset(0 0 28% 0);
}

.scene3-character {
  z-index: 12;
  pointer-events: none;
}

.scene3-character-wrapper {
  position: absolute;
  z-index: 12;
  overflow: visible;
  pointer-events: none;
  transform-origin: bottom center;
}

.scene3-character-wrapper img {
  position: static;
  display: block;
  width: auto;
  height: 100%;
  max-width: none;
  object-fit: contain;
  object-position: bottom center;
}

.scene3-marin-wrapper img {
  /* Scene 3 only: Marin faces Jana via horizontal flip */
  transform: scaleX(-1);
  transform-origin: center center;
}

.scene4-sprite {
  position: absolute;
  z-index: 12;
  width: auto;
  user-select: none;
  pointer-events: none;
}

.scene4-bike {
  z-index: 11;
}

.scene4-current-jana,
.scene4-current-marin,
.scene4-old-marin,
.scene4-young-marin {
  z-index: 12;
}

.coffee-prop {
  left: 20.7%;
  top: 36.5%;
  width: 2.5%;
  z-index: 4;
}

.coffee-prop.hidden,
.hidden {
  display: none;
}

.hotspot {
  position: absolute;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 4px;
  cursor: pointer;
  z-index: 10;
}

.hotspot:hover {
  border-color: rgba(255, 230, 0, 0.75);
  background: rgba(255, 230, 0, 0.18);
}

.coffee-hotspot {
  left: 18.6%;
  top: 33.4%;
  width: 5%;
  height: 13.5%;
  z-index: 9;
}

.door-hotspot {
  left: 3.1%;
  top: 19.2%;
  width: 8.5%;
  height: 57.2%;
  z-index: 12;
}

.intercom-hotspot {
  left: 12.1%;
  top: 33.2%;
  width: 3.1%;
  height: 15.6%;
  z-index: 15;
}

.doorway-hotspot {
  left: 3.1%;
  top: 19.2%;
  width: 10.7%;
  height: 57.2%;
  pointer-events: none;
  z-index: 14;
}

.doorway-hotspot.active {
  pointer-events: auto;
}

.hotspot:disabled {
  cursor: default;
  opacity: 0.55;
}

.floating-text {
  position: absolute;
  left: 7%;
  top: 20%;
  margin: 0;
  padding: 8px 12px;
  max-width: 18%;
  color: #4aa3ff;
  background: rgba(255, 250, 224, 0.94);
  border: 2px solid #3d3525;
  border-radius: 6px;
  font-weight: 700;
  text-align: center;
  pointer-events: none;
  z-index: 30;
}

.floating-dialogue {
  position: absolute;
  display: none;
  left: 0;
  top: 0;
  z-index: 30;
  pointer-events: none;
  font-family: monospace;
  font-weight: 900;
  font-size: 11px;
  line-height: 1.15;
  max-width: 420px;
  width: max-content;
  min-width: 0;
  min-height: 0;
  white-space: normal;
  text-align: center;
  overflow: visible;
  background: transparent;
  border: none;
  padding: 0;
  margin: 0;
  text-shadow:
    -1px -1px 0 #000,
    1px -1px 0 #000,
    -1px 1px 0 #000,
    1px 1px 0 #000,
    0 -1px 0 #000,
    0 1px 0 #000,
    -1px 0 0 #000,
    1px 0 0 #000;
}

.floating-dialogue.jana {
  color: #ff4fc3;
}

.floating-dialogue.marin {
  color: #4aa3ff;
}

.sfx-text {
  position: absolute;
  left: 47%;
  top: 34%;
  translate: -50% -50%;
  color: #4aa3ff;
  font-family: "Courier New", monospace;
  font-size: clamp(24px, 4vw, 54px);
  font-weight: 900;
  letter-spacing: 0;
  text-shadow:
    2px 0 #163b73,
    -2px 0 #163b73,
    0 2px #163b73,
    0 -2px #163b73;
  z-index: 13;
  pointer-events: none;
}

.sfx-text.flash {
  animation: sfx-fade 1s steps(4, end) forwards;
}

.fade-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 900ms ease;
}

.fade-overlay.visible {
  opacity: 1;
}

.scene-flash-overlay {
  position: absolute;
  inset: 0;
  z-index: 29;
  background: rgba(170, 235, 255, 0);
  pointer-events: none;
}

.scene-flash-overlay.visible {
  background: rgba(210, 245, 255, 0.88);
}

.birthday-text {
  position: absolute;
  left: 50%;
  top: 18%;
  z-index: 31;
  translate: -50% 0;
  width: min(920px, 90%);
  color: #fff5bd;
  font-family: "Courier New", monospace;
  font-size: clamp(30px, 6vw, 86px);
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  text-shadow:
    -3px -3px 0 #1d2150,
    3px -3px 0 #1d2150,
    -3px 3px 0 #1d2150,
    3px 3px 0 #1d2150,
    0 0 18px rgba(255, 93, 210, 0.9);
  pointer-events: none;
}

.hud {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: stretch;
  margin-top: 8px;
}

.status-box,
.ui-panel {
  min-height: 76px;
  padding: 14px;
  background: var(--ui-bg);
  border: 1px solid var(--ui-line);
}

.status-box {
  height: 76px;
  line-height: 1.45;
  overflow: hidden;
}

.ui-panel {
  display: grid;
  align-content: start;
  gap: 10px;
  min-width: 120px;
}

.choice-panel {
  min-width: min(520px, 46vw);
}

.choice-button {
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 79, 195, 0.65);
  background: rgba(255, 79, 195, 0.12);
  color: var(--ui-text);
  font: inherit;
  font-size: 13px;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
}

.choice-button:hover,
.choice-button:focus-visible {
  border-color: #ff4fc3;
  color: #ffd5f0;
  outline: none;
}

.scene2-active .hud {
  display: flex;
  justify-content: center;
}

.title-active .hud,
.scene3-active .hud {
  display: none;
}

.scene4-active .hud {
  display: none;
}

.title-active #status-box,
.scene2-active #status-box,
.scene3-active #status-box,
.scene4-active #status-box,
.title-active #actions-panel,
.scene2-active #actions-panel,
.scene3-active #actions-panel,
.scene4-active #actions-panel,
.title-active #inventory-panel,
.scene2-active #inventory-panel,
.scene3-active #inventory-panel,
.scene4-active #inventory-panel,
.title-active .hotspot,
.scene2-active .hotspot,
.scene3-active .hotspot,
.scene4-active .hotspot,
.title-active .action-button,
.scene2-active .action-button,
.scene3-active .action-button,
.scene4-active .action-button,
.scene2-active .inventory-slot {
  display: none !important;
}

.scene2-active #choice-panel:not(.hidden) {
  display: grid;
  width: min(720px, 100%);
}

.ui-panel-title {
  margin-bottom: 2px;
  color: #aeb7c2;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.action-button {
  min-height: 34px;
  border: 1px solid var(--ui-line);
  background: rgba(255, 255, 255, 0.08);
  color: var(--ui-text);
  font-weight: 700;
  cursor: pointer;
}

.action-button.selected,
.inventory-slot.selected {
  border-color: var(--accent);
  color: var(--accent);
}

.inventory {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 34px;
  padding: 0;
  background: transparent;
  border: 0;
}

.inventory.hidden {
  visibility: hidden;
  pointer-events: none;
}

.inventory-slot {
  width: 34px;
  height: 34px;
  min-height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.06);
  color: #d9e2ea;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
}

.inventory-slot.empty {
  width: 54px;
  border-style: dashed;
  color: #aeb7c2;
}

.inventory-slot img {
  width: 28px;
  height: 28px;
  object-fit: contain;
  image-rendering: pixelated;
  pointer-events: none;
}

.inventory-slot.has-item {
  border-style: solid;
  border-color: var(--accent);
  color: var(--accent);
}

.inventory-slot.selected {
  border-color: #ff4fc3;
  box-shadow: 0 0 6px rgba(255, 79, 195, 0.7);
}

@keyframes bob {
  from {
    translate: 0 0;
  }

  to {
    translate: 0 -5px;
  }
}

@keyframes sfx-fade {
  0% {
    opacity: 0;
    scale: 0.96;
  }

  18% {
    opacity: 1;
    scale: 1;
  }

  72% {
    opacity: 1;
    scale: 1;
  }

  100% {
    opacity: 0;
    scale: 1.04;
  }
}

@media (max-width: 760px) {
  .game-shell {
    padding: 8px;
  }

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

  .choice-panel {
    min-width: 0;
  }

  .status-box,
  .ui-panel {
    min-height: 58px;
    padding: 10px;
  }

  .status-box {
    height: 58px;
  }

  .inventory {
    padding: 0;
  }
}
