/* JSU City — building visits ("Step inside!"). Cosmetic overlay; see js/city-visit.js */

/* ---------- "Visit" button in the building info panel ---------- */
#tileInfo .city-visit-btn {
  background: linear-gradient(180deg, #5aa2ff, #2a62cc) !important;
  border-color: #b8d6ff !important;
  color: #fff !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .35);
  box-shadow: 0 4px 14px rgba(42, 98, 204, .45);
}

/* ---------- celebratory prompt after a server-confirmed build/upgrade ---------- */
.cv-prompt {
  position: fixed;
  left: 50%;
  bottom: calc(92px + env(safe-area-inset-bottom));
  z-index: 1200;
  display: flex;
  align-items: center;
  gap: 10px;
  width: min(420px, calc(100vw - 20px));
  box-sizing: border-box;
  padding: 10px 10px 10px 12px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(22, 36, 88, .97), rgba(40, 22, 70, .97));
  border: 2px solid rgba(255, 213, 79, .65);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .45), 0 0 0 4px rgba(255, 213, 79, .08);
  color: #fff;
  font-family: Nunito, system-ui, sans-serif;
  transform: translate(-50%, 30px) scale(.94);
  opacity: 0;
  transition: opacity .28s ease, transform .38s cubic-bezier(.34, 1.56, .64, 1);
  pointer-events: auto;
}
.cv-prompt.show { opacity: 1; transform: translate(-50%, 0) scale(1); }
.cv-prompt-burst {
  flex: 0 0 auto;
  width: 46px; height: 46px;
  display: grid; place-items: center;
  font-size: 28px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 213, 79, .5), rgba(255, 213, 79, 0) 70%);
  animation: cvBurst 1.4s ease-in-out infinite;
}
@keyframes cvBurst { 0%, 100% { transform: scale(1) rotate(0); } 50% { transform: scale(1.12) rotate(-6deg); } }
.cv-prompt-text { flex: 1 1 auto; min-width: 0; line-height: 1.2; }
.cv-prompt-text strong { display: block; font-size: 15px; font-weight: 900; color: #ffd54f; }
.cv-prompt-text span { display: block; font-size: 12.5px; color: rgba(255, 255, 255, .78); margin-top: 2px; }
.cv-prompt-go {
  flex: 0 0 auto;
  min-height: 44px;
  padding: 0 14px;
  border: 0;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffe082, #f0a02c);
  color: #1b1204;
  font: 900 14px Nunito, system-ui, sans-serif;
  box-shadow: 0 4px 12px rgba(240, 160, 44, .45);
  cursor: pointer;
}
.cv-prompt-x {
  flex: 0 0 auto;
  width: 32px; height: 32px;
  border: 0; border-radius: 50%;
  background: rgba(255, 255, 255, .1);
  color: rgba(255, 255, 255, .75);
  font-size: 14px;
  cursor: pointer;
}

/* ---------- full-screen visit overlay ---------- */
.cv-overlay {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: none;
  background: #0d0b16;
  color: #fff;
  font-family: Nunito, system-ui, sans-serif;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.cv-overlay.cv-open { display: block; animation: cvFadeIn .35s ease; }
@keyframes cvFadeIn { from { opacity: 0; } to { opacity: 1; } }
.cv-loading {
  position: absolute; inset: 0;
  display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center;
  background: radial-gradient(ellipse at 50% 40%, #2a2350, #0d0b16 70%);
  z-index: 30;
}
.cv-overlay.cv-is-loading .cv-loading { display: flex; }
.cv-loading strong { font-size: 22px; color: #ffd54f; font-family: Cinzel, Georgia, serif; }
.cv-loading span { font-size: 14px; color: rgba(255, 255, 255, .7); }
.cv-spinner {
  width: 42px; height: 42px; border-radius: 50%;
  border: 4px solid rgba(255, 255, 255, .15); border-top-color: #ffd54f;
  animation: cvSpin .8s linear infinite; margin-bottom: 8px;
}
@keyframes cvSpin { to { transform: rotate(360deg); } }

.cv-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; outline: none; }

/* HUD */
.cv-hud { position: absolute; inset: 0; pointer-events: none; z-index: 10; }
.cv-hud button { font-family: inherit; }
.cv-top {
  position: absolute;
  top: calc(10px + env(safe-area-inset-top));
  left: calc(10px + env(safe-area-inset-left));
  right: calc(10px + env(safe-area-inset-right));
  display: flex; align-items: flex-start; gap: 8px;
}
.cv-exit {
  pointer-events: auto;
  flex: 0 0 auto;
  min-height: 44px; padding: 0 14px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, .35);
  background: rgba(10, 10, 24, .72);
  color: #fff; font-weight: 900; font-size: 14px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}
.cv-sound {
  pointer-events: auto;
  flex: 0 0 auto;
  width: 44px; min-height: 44px; padding: 0;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, .35);
  background: rgba(10, 10, 24, .72);
  color: #fff; font-size: 18px; line-height: 1;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  cursor: pointer;
}
.cv-title {
  flex: 1 1 auto; min-width: 0;
  padding: 6px 12px;
  border-radius: 14px;
  background: rgba(10, 10, 24, .6);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
  line-height: 1.15;
}
.cv-title strong { display: block; font-size: 15px; color: #ffd54f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-title span { display: block; font-size: 12px; color: rgba(255, 255, 255, .75); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-tour {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 6px;
  min-height: 44px; padding: 0 12px;
  border-radius: 14px;
  background: rgba(10, 10, 24, .6);
  font-weight: 900; font-size: 13px;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.cv-tour i { font-style: normal; color: #ffd54f; }
.cv-arrow {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: #ffd54f;
  color: #221600; font-size: 15px; font-weight: 900; line-height: 1;
  transition: opacity .3s, width .3s;
}
.cv-arrow.off { opacity: 0; width: 0; }

/* joystick (touch) */
.cv-joy {
  position: absolute;
  left: calc(22px + env(safe-area-inset-left));
  bottom: calc(26px + env(safe-area-inset-bottom));
  width: 116px; height: 116px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .34);
  background: radial-gradient(circle, rgba(255, 255, 255, .1), rgba(0, 0, 0, .12));
  transition: opacity .2s;
}
.cv-joy i {
  position: absolute; left: 50%; top: 50%;
  width: 50px; height: 50px; margin: -25px 0 0 -25px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .78);
  box-shadow: 0 4px 14px rgba(0, 0, 0, .35);
}
.cv-joy.idle { opacity: .55; }
.cv-nojoy .cv-joy { display: none; }

.cv-talk {
  pointer-events: auto;
  position: absolute;
  right: calc(20px + env(safe-area-inset-right));
  bottom: calc(34px + env(safe-area-inset-bottom));
  min-width: 96px; min-height: 96px;
  padding: 0 10px;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .85);
  background: radial-gradient(circle at 40% 35%, #7fc3ff, #2266cc);
  color: #fff; font-weight: 1000; font-size: 16px; line-height: 1.05;
  box-shadow: 0 10px 26px rgba(0, 0, 0, .35);
  transform: scale(.6); opacity: 0;
  transition: transform .25s cubic-bezier(.34, 1.56, .64, 1), opacity .2s;
  cursor: pointer;
}
.cv-talk small { display: block; font-size: 11px; font-weight: 800; opacity: .85; max-width: 90px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cv-talk.show { transform: scale(1); opacity: 1; }
.cv-talk:not(.show) { pointer-events: none; }

.cv-hint {
  position: absolute; left: 50%; top: calc(68px + env(safe-area-inset-top));
  transform: translateX(-50%);
  max-width: calc(100vw - 40px);
  padding: 8px 14px; border-radius: 999px;
  background: rgba(10, 10, 24, .7);
  font-size: 13px; font-weight: 800; color: rgba(255, 255, 255, .92);
  text-align: center;
  opacity: 0; transition: opacity .4s;
}
.cv-hint.show { opacity: 1; }

/* point-of-interest caption card */
.cv-caption {
  position: absolute;
  left: 50%;
  bottom: calc(146px + env(safe-area-inset-bottom));
  width: min(440px, calc(100vw - 24px));
  box-sizing: border-box;
  padding: 12px 14px 12px;
  border-radius: 16px;
  background: linear-gradient(160deg, rgba(255, 250, 235, .97), rgba(246, 232, 200, .97));
  color: #2a1d08;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .4);
  transform: translate(-50%, 20px); opacity: 0;
  transition: opacity .3s, transform .35s cubic-bezier(.34, 1.56, .64, 1);
  pointer-events: none;
}
.cv-caption.show { transform: translate(-50%, 0); opacity: 1; }
.cv-caption.show .cv-caption-x { pointer-events: auto; }
.cv-caption b { display: block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #9a6a10; }
.cv-caption strong { display: block; font-size: 17px; font-weight: 900; margin: 1px 0 3px; color: #1f3f8a; }
.cv-caption p { margin: 0; font-size: 14px; line-height: 1.35; font-weight: 700; }
.cv-caption .cv-stat { display: inline-block; margin-top: 6px; padding: 3px 9px; border-radius: 999px; background: rgba(31, 63, 138, .1); color: #1f3f8a; font-size: 12.5px; font-weight: 900; }
.cv-caption-x { position: absolute; top: 6px; right: 8px; width: 30px; height: 30px; border: 0; background: none; font-size: 16px; color: #7a6a4a; cursor: pointer; }

/* speech bubbles (positioned in JS) */
.cv-bubbles { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.cv-bubble {
  position: absolute; left: 0; top: 0;
  max-width: 210px;
  padding: 8px 11px;
  border-radius: 14px;
  background: #fff; color: #1d1d2b;
  font-size: 13.5px; font-weight: 800; line-height: 1.25;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .3);
  transform-origin: 50% 100%;
  will-change: transform;
  opacity: 0; transition: opacity .2s;
}
.cv-bubble.show { opacity: 1; }
.cv-bubble::after {
  content: ''; position: absolute; left: 50%; bottom: -7px; margin-left: -7px;
  border: 7px solid transparent; border-bottom: 0; border-top-color: #fff;
}
.cv-bubble em { display: block; font-style: normal; font-size: 11px; font-weight: 900; color: #2266cc; margin-bottom: 1px; }
.cv-nametag {
  position: absolute; left: 0; top: 0;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(10, 10, 30, .55); color: #fff;
  font-size: 11px; font-weight: 900; white-space: nowrap;
  will-change: transform;
}

/* celebration banner (tour complete / arrival) */
.cv-banner {
  position: absolute; left: 50%; top: 32%;
  transform: translate(-50%, -50%) scale(.7);
  padding: 14px 22px; border-radius: 18px;
  background: linear-gradient(135deg, rgba(255, 224, 130, .97), rgba(240, 160, 44, .97));
  color: #231400; text-align: center;
  font-weight: 1000; font-size: 20px; line-height: 1.2;
  box-shadow: 0 16px 40px rgba(0, 0, 0, .4);
  opacity: 0; transition: opacity .3s, transform .4s cubic-bezier(.34, 1.56, .64, 1);
  width: max-content; max-width: calc(100vw - 40px); box-sizing: border-box;
}
.cv-banner small { display: block; font-size: 13px; font-weight: 800; opacity: .8; margin-top: 2px; }
.cv-banner.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

.cv-cosmetic {
  position: absolute; left: 50%; transform: translateX(-50%); bottom: calc(6px + env(safe-area-inset-bottom));
  font-size: 10.5px; font-weight: 800; color: rgba(255, 255, 255, .6); white-space: nowrap;
  text-shadow: 0 1px 3px rgba(0, 0, 0, .6);
}

@media (min-width: 900px) {
  .cv-title strong { font-size: 18px; }
  .cv-caption { bottom: 40px; left: auto; right: 24px; transform: translate(0, 20px); }
  .cv-caption.show { transform: translate(0, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .cv-prompt, .cv-talk, .cv-caption, .cv-banner { transition: opacity .2s; }
  .cv-prompt-burst { animation: none; }
}

/* Shalom Aleichem chip (home visit, real recording only) */
.cv-song {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(64px + env(safe-area-inset-top));
  pointer-events: auto; min-height: 36px; padding: 0 14px;
  border-radius: 999px; border: 2px solid rgba(255, 213, 79, .7);
  background: rgba(10, 10, 24, .72); color: #fff; font-family: inherit; font-weight: 800; font-size: 13px; line-height: 1;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); cursor: pointer;
}
.cv-song { white-space: nowrap; }
.cv-song b { margin-left: 6px; color: #ffd54f; }
.cv-song.on { box-shadow: 0 0 0 3px rgba(255, 213, 79, .25); }
.cv-song[hidden] { display: none; }
/* CC BY credit for the recording, shown while the chip is */
.cv-song-credit {
  position: absolute; left: 50%; transform: translateX(-50%);
  top: calc(64px + 36px + 6px + env(safe-area-inset-top));
  pointer-events: none; white-space: nowrap; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis;
  font-size: 11px; line-height: 1.2; font-weight: 700; color: rgba(255, 255, 255, .82);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .8);
}
.cv-song-credit[hidden] { display: none; }
