/* =============================================================================
   BITCH, PLEASE — pixel-RPG estate tour
   Fonts: "Press Start 2P" (display) + "VT323" (body/dialog)
   ========================================================================== */

:root {
  --ink: #1b1830;
  --ink-2: #2a2545;
  --ink-3: #3a3358;
  --outline: #241a2e;
  --cream: #f2e8d5;
  --cream-dim: #cfc4ae;
  --gold: #e8b93e;
  --gold-d: #b8892e;
  --gold-l: #f2d98a;
  --red: #d43a2f;
  --shadow: rgba(10, 8, 20, .45);
  --font-d: "Press Start 2P", monospace;
  --font-b: "VT323", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  background: var(--ink);
  color: var(--cream);
  font-family: var(--font-b);
  overflow: hidden;
  -webkit-font-smoothing: none;
  user-select: none;
}

img { image-rendering: pixelated; image-rendering: crisp-edges; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

#app { position: fixed; inset: 0; }

/* ============================================================== SCREENS */
.screen {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.screen.active { display: flex; }

.stage {
  position: relative;
  box-shadow: 0 0 0 4px var(--outline), 12px 12px 0 var(--shadow);
}
.stage > img { display: block; width: 100%; height: 100%; }

#map-stage {
  aspect-ratio: 384 / 256;
  width: min(96vw, calc((100dvh - 170px) * 1.5));
}
#room-stage {
  aspect-ratio: 384 / 216;
  width: min(96vw, calc((100dvh - 130px) * 1.78));
}

#map-hint {
  margin-top: 18px;
  font-size: 20px;
  letter-spacing: .06em;
  color: var(--cream-dim);
  text-align: center;
}

/* ================================================================= HUD */
#hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 40;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  background: var(--ink-2);
  border-bottom: 3px solid var(--outline);
  font-family: var(--font-d);
}
#hud[hidden] { display: none; }
.hud-left { text-align: left; }
.hud-center { text-align: center; }
.hud-right { text-align: right; }
#hud-logo { font-size: 10px; color: var(--gold); letter-spacing: .08em; }
#hud-worth-label { font-size: 7px; color: var(--cream-dim); letter-spacing: .08em; }
#hud-worth { font-size: 14px; color: var(--gold-l); margin-top: 3px; }
#hud-worth-rate { font-size: 6px; color: var(--cream-dim); margin-top: 3px; letter-spacing: .04em; }
.hud-btn {
  font-family: var(--font-d);
  font-size: 8px;
  color: var(--cream);
  border: 2px solid var(--ink-3);
  background: var(--ink);
  padding: 7px 10px;
  margin-left: 6px;
}
.hud-btn:hover { border-color: var(--gold); color: var(--gold-l); }
.hud-btn:active { transform: translate(1px, 1px); }

/* ============================================================ TITLE */
#screen-title { background: var(--ink) radial-gradient(circle at 50% 30%, #2c2548 0%, var(--ink) 62%); }
.title-wrap { position: relative; text-align: center; padding: 24px; }
.title-wrap.shake { animation: shake .32s steps(8); }
@keyframes shake {
  0% { transform: translate(0, 0); }  25% { transform: translate(-6px, 3px); }
  50% { transform: translate(5px, -4px); } 75% { transform: translate(-3px, -2px); }
  100% { transform: translate(0, 0); }
}

/* entrance choreography — elements get .shown from the JS sequence */
#title-crest, #fancy-name, #estates-line, #title-sub, #title-footer {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity .5s ease-out, transform .5s ease-out;
}
#title-crest.shown, #fancy-name.shown, #estates-line.shown,
#title-sub.shown, #title-footer.shown { opacity: 1; transform: none; }

#title-crest {
  width: clamp(88px, 13vw, 140px);
  filter: drop-shadow(6px 6px 0 var(--shadow));
  margin-bottom: 10px;
}
#fancy-name {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-weight: 600;
  font-size: clamp(46px, 9vw, 100px);
  line-height: 1;
  color: var(--gold-l);
  letter-spacing: .04em;
  text-shadow: 3px 3px 0 var(--outline), 7px 7px 0 var(--shadow);
}
#estates-line {
  display: flex; align-items: center; justify-content: center; gap: 14px;
  margin-top: 12px;
  font-family: "Cormorant Garamond", serif;
  font-weight: 600;
  font-size: clamp(11px, 1.8vw, 17px);
  letter-spacing: .42em;
  color: var(--cream-dim);
  text-transform: uppercase;
}
#estates-line::before, #estates-line::after {
  content: "";
  width: clamp(30px, 7vw, 80px); height: 1px;
  background: var(--gold-d);
}
#punch-stamp {
  display: inline-block;
  margin-top: 30px;
  font-family: var(--font-d);
  font-size: clamp(14px, 3vw, 26px);
  letter-spacing: .1em;
  color: var(--red);
  border: 4px solid var(--red);
  padding: 13px 20px 10px;
  transform: rotate(-4deg) scale(2.6);
  opacity: 0;
  box-shadow: 6px 6px 0 var(--shadow);
}
#punch-stamp.stamped {
  opacity: 1;
  transform: rotate(-4deg) scale(1);
  transition: transform .16s steps(3), opacity .16s;
}
#title-sub {
  margin-top: 30px;
  font-family: var(--font-d);
  font-size: clamp(8px, 1.5vw, 12px);
  color: var(--cream);
  letter-spacing: .22em;
}
#title-start {
  margin-top: 46px;
  font-family: var(--font-d);
  font-size: clamp(11px, 2vw, 16px);
  color: var(--gold-l);
  opacity: 0;
  transition: opacity .3s;
}
.title-wrap.ready #title-start { opacity: 1; }
#title-footer {
  margin-top: 44px;
  font-size: 20px;
  color: var(--cream-dim);
  letter-spacing: .05em;
}
.rating-badge {
  position: absolute;
  top: -10px; left: -10px;
  display: flex; align-items: center; gap: 8px;
  border: 3px solid var(--cream);
  padding: 8px 10px;
  background: var(--ink);
  box-shadow: 4px 4px 0 var(--shadow);
  transform: rotate(-6deg);
}
.rating-grade { font-family: var(--font-d); font-size: 26px; color: var(--cream); }
.rating-text { font-family: var(--font-d); font-size: 6px; line-height: 1.7; color: var(--cream-dim); text-align: left; }

.blink { animation: blink 1.1s steps(2, start) infinite; }
@keyframes blink { to { visibility: hidden; } }

/* ========================================================== HOTSPOTS */
.hotspot { position: absolute; cursor: pointer; }
.hotspot::before {
  content: "";
  position: absolute; inset: 0;
  border: 2px dashed transparent;
}
.hotspot:hover::before, .hotspot.armed::before {
  border-color: var(--gold);
  background: rgba(232, 185, 62, .12);
}
.hotspot .tag, .car .tag {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 20px;
  letter-spacing: .05em;
  color: var(--ink);
  background: var(--gold);
  border: 2px solid var(--outline);
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 2px 8px 0;
  opacity: 0;
  pointer-events: none;
  z-index: 5;
}
.hotspot:hover .tag, .hotspot.armed .tag,
.car:hover .tag, .car.armed .tag { opacity: 1; }
.hotspot.tag-below .tag, .car.tag-below .tag { top: calc(100% + 8px); bottom: auto; }
/* pulsing marker on hotspots that lead somewhere */
.hotspot.enterable::after {
  content: "▼";
  position: absolute;
  top: -14px; left: 50%;
  transform: translateX(-50%);
  font-size: 17px;
  color: var(--gold);
  text-shadow: 2px 2px 0 var(--outline), -1px -1px 0 var(--outline),
               1px -1px 0 var(--outline), -1px 1px 0 var(--outline), 1px 1px 0 var(--outline);
  animation: bob 0.9s steps(2, start) infinite;
  pointer-events: none;
}
@keyframes bob { 50% { transform: translate(-50%, 5px); } }

/* cars sit on their pads as <img> elements */
.car { position: absolute; cursor: pointer; z-index: 3; }
.car img { width: 100%; display: block; transition: transform .12s steps(2), filter .12s; }
.car:hover img, .car.armed img {
  transform: translateY(-6%);
  filter: drop-shadow(0 0 8px rgba(232, 185, 62, .95));
}

/* room title plaque */
#room-title-plaque {
  position: absolute;
  top: 10px; left: 10px;
  font-family: var(--font-d);
  font-size: clamp(8px, 1.6vw, 13px);
  color: var(--gold-l);
  background: var(--ink);
  border: 3px solid var(--gold-d);
  box-shadow: 4px 4px 0 var(--shadow);
  padding: 9px 12px;
  letter-spacing: .08em;
  z-index: 6;
}

/* exit chip — always visible, not hover-dependent */
.exit-chip {
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-d);
  font-size: clamp(6px, 1.4vw, 9px);
  color: var(--gold-l);
  background: var(--ink);
  border: 3px solid var(--gold-d);
  box-shadow: 3px 3px 0 var(--shadow);
  z-index: 6;
}
.exit-chip:hover { background: var(--gold); color: var(--ink); }
.hotspot.exit-chip::before, .hotspot.exit-chip:hover::before { border: none; background: none; }
.exit-chip .tag { top: calc(100% + 8px); bottom: auto; }

/* ============================================================== AVATAR */
#avatar {
  position: absolute;
  width: 4.1667%;              /* 16 map-px of 384 */
  aspect-ratio: 16 / 24;
  background-image: url("../assets/img/avatar.png");
  background-size: 300% 400%;  /* 3 cols × 4 rows */
  background-position: 0% 0%;
  transform: translate(-50%, -96%);
  z-index: 4;
  pointer-events: none;
  filter: drop-shadow(2px 3px 0 rgba(10, 8, 20, .4));
}

/* ============================================================== DIALOG */
#dialog {
  position: fixed;
  left: 50%; bottom: 14px;
  transform: translateX(-50%);
  width: min(880px, 96vw);
  z-index: 60;
}
#dialog[hidden] { display: none; }

#dialog-box {
  position: relative;
  background: var(--ink-2);
  border: 4px solid var(--outline);
  box-shadow: 0 0 0 2px var(--gold-d), 8px 8px 0 var(--shadow);
  padding: 20px 22px 16px;
  min-height: 108px;
}
#dialog-name {
  position: absolute;
  top: -16px; left: 14px;
  font-family: var(--font-d);
  font-size: 10px;
  color: var(--ink);
  background: var(--gold);
  border: 3px solid var(--outline);
  box-shadow: 3px 3px 0 var(--shadow);
  padding: 7px 10px;
  letter-spacing: .06em;
}
#dialog-text {
  font-size: clamp(22px, 3.4vw, 30px);
  line-height: 1.16;
  color: var(--cream);
  min-height: 2.3em;
}
#dialog-text::after { content: ""; }
#dialog-next {
  position: absolute;
  right: 14px; bottom: 8px;
  color: var(--gold);
  font-size: 22px;
  animation: blink 0.8s steps(2, start) infinite;
}
#dialog-stats {
  margin: 10px 0 12px;
  padding: 10px 12px;
  border: 2px solid var(--ink-3);
  background: var(--ink);
}
#dialog-stats .row {
  display: flex; justify-content: space-between; gap: 18px;
  font-size: 21px; line-height: 1.25;
}
#dialog-stats .k { color: var(--gold); letter-spacing: .05em; }
#dialog-stats .v { color: var(--cream); text-align: right; }

/* listing / photo card */
#dialog-media {
  position: relative;
  margin-bottom: 10px;
  border: 4px solid var(--outline);
  box-shadow: 0 0 0 2px var(--gold-d), 8px 8px 0 var(--shadow);
  background: var(--ink);
}
#dialog-media[hidden] { display: none; }
#dialog-photo {
  display: block;
  width: 100%;
  max-height: 42dvh;
  object-fit: cover;
  image-rendering: auto;   /* real photos stay smooth */
}
.photo-nav {
  position: absolute;
  top: 50%; transform: translateY(-50%);
  font-size: 26px;
  color: var(--gold-l);
  background: rgba(27, 24, 48, .8);
  border: 2px solid var(--gold-d);
  padding: 6px 10px;
}
.photo-nav:hover { color: var(--ink); background: var(--gold); }
#photo-prev { left: 8px; }
#photo-next { right: 8px; }
#photo-caption {
  padding: 6px 10px;
  font-size: 20px;
  color: var(--gold-l);
  background: var(--ink-2);
  border-top: 2px solid var(--outline);
}

/* ================================================================ MENU */
#menu {
  position: fixed; inset: 0; z-index: 70;
  background: rgba(10, 8, 20, .72);
  display: flex; align-items: center; justify-content: center;
}
#menu[hidden] { display: none; }
#menu-panel {
  width: min(460px, 92vw);
  background: var(--ink-2);
  border: 4px solid var(--outline);
  box-shadow: 0 0 0 2px var(--gold-d), 10px 10px 0 var(--shadow);
  padding: 26px 26px 20px;
  text-align: center;
}
#menu-title { font-family: var(--font-d); font-size: 12px; color: var(--gold); margin-bottom: 20px; }
#menu-list { display: flex; flex-direction: column; gap: 10px; }
.menu-item {
  font-family: var(--font-d);
  font-size: 10px;
  letter-spacing: .06em;
  color: var(--cream);
  padding: 12px;
  border: 2px solid var(--ink-3);
  background: var(--ink);
}
.menu-item:hover { border-color: var(--gold); color: var(--gold-l); }
.menu-item small { display: block; margin-top: 6px; font-family: var(--font-b); font-size: 18px; color: var(--cream-dim); letter-spacing: 0; }
#menu-about { margin-top: 18px; font-size: 20px; color: var(--cream-dim); cursor: pointer; }
#menu-about:hover { color: var(--gold-l); }
#menu-close { margin-top: 14px; font-family: var(--font-d); font-size: 8px; color: var(--cream-dim); }

/* ================================================================= WIPE */
#wipe { position: fixed; inset: 0; z-index: 80; pointer-events: none; }
#wipe[hidden] { display: none; }
#wipe-grid {
  position: absolute; inset: 0;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-template-rows: repeat(8, 1fr);
}
#wipe-grid .cell { background: var(--ink); opacity: 0; transition: opacity .05s; }
#wipe-tip {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(700px, 90vw);
  text-align: center;
  font-size: clamp(22px, 3.6vw, 32px);
  color: var(--gold-l);
  opacity: 0;
  transition: opacity .15s;
  text-shadow: 2px 2px 0 var(--outline);
}

/* ============================================================ SCANLINES */
#scanlines {
  position: fixed; inset: 0; z-index: 90;
  pointer-events: none;
  background:
    repeating-linear-gradient(0deg, rgba(8, 6, 16, .14) 0 1px, transparent 1px 3px);
  mix-blend-mode: multiply;
}
#scanlines::after {
  content: "";
  position: absolute; inset: 0;
  background: radial-gradient(ellipse at center, transparent 58%, rgba(8, 6, 16, .38) 100%);
}

/* =========================================================== RESPONSIVE */
@media (max-width: 640px) {
  #hud-worth-rate, #hud-logo { display: none; }
  #hud-worth { font-size: 11px; }
  #map-hint { font-size: 16px; padding: 0 12px; }
  .hotspot .tag { font-size: 17px; }
}

@media (prefers-reduced-motion: reduce) {
  .blink, .hotspot.enterable::after { animation: none; }
  .car img { transition: none; }
  #wipe-grid .cell { transition: none; }
  #title-crest, #fancy-name, #estates-line, #title-sub, #title-footer,
  #title-start { transition: none; opacity: 1; transform: none; }
  #punch-stamp { transition: none; transform: rotate(-4deg); opacity: 1; }
}
