/* KSIM_V54 — üheksa mänguloogikaga seotud inimese visuaalset olekut. */

.scene[data-human-state]:not([data-human-state="none"]) .contact-stage.visible {
  display: grid !important;
  opacity: 1 !important;
  visibility: visible !important;
  isolation: isolate;
}

.contact-visual-state {
  position: absolute;
  z-index: 6;
  left: 50%;
  top: -.45cqw;
  width: max-content;
  max-width: 13.5cqw;
  transform: translate(-50%, -100%);
  padding: .28cqw .58cqw;
  border: 1px solid color-mix(in srgb, var(--human-state-accent, #65dcff) 74%, transparent);
  border-radius: .25cqw;
  background: rgba(1, 12, 29, .92);
  box-shadow: 0 0 .7cqw color-mix(in srgb, var(--human-state-accent, #65dcff) 28%, transparent);
  color: var(--human-state-accent, #9ceeff);
  font-size: clamp(8px, .54cqw, 11px);
  font-weight: 950;
  line-height: 1.12;
  letter-spacing: .055em;
  text-align: center;
  text-wrap: balance;
  pointer-events: none;
}

.scene:not([data-contact-form="ship"])[data-human-state]:not([data-human-state="none"]) .contact-stage.visible {
  left: 27% !important;
  bottom: 17% !important;
  width: 17% !important;
  height: 55% !important;
  place-items: center !important;
  z-index: 9 !important;
  border: 1px solid color-mix(in srgb, var(--human-state-accent, #65dcff) 34%, transparent);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at center,
      color-mix(in srgb, var(--human-state-accent, #65dcff) 14%, transparent) 0 35%,
      rgba(1, 18, 39, .22) 58%,
      transparent 76%);
  box-shadow:
    inset 0 0 1.8cqw color-mix(in srgb, var(--human-state-accent, #65dcff) 15%, transparent),
    0 0 1.2cqw rgba(0, 10, 28, .28);
}

.scene:not([data-contact-form="ship"])[data-human-state]:not([data-human-state="none"]) .contact-sprite {
  position: relative;
  z-index: 3;
  width: 92% !important;
  height: 92% !important;
  max-width: 92% !important;
  max-height: 92% !important;
  object-fit: contain !important;
  object-position: center center !important;
  image-rendering: auto !important;
  filter:
    drop-shadow(0 .3cqw .32cqw rgba(0, 7, 18, .42))
    drop-shadow(0 0 .72cqw color-mix(in srgb, var(--human-state-accent, #65dcff) 46%, transparent)) !important;
}

.scene:not([data-contact-form="ship"])[data-human-state]:not([data-human-state="none"]) .contact-name {
  display: block !important;
  z-index: 6;
  bottom: -.3cqw;
  color: #d9f8ff;
}

.scene[data-room-owner="mantis"]:not([data-contact-form="ship"])[data-human-state]:not([data-human-state="none"]) .contact-stage.visible {
  left: 18.5% !important;
  bottom: 18% !important;
  width: 10.5% !important;
  height: 50% !important;
}

.scene[data-room-owner="oversoul"]:not([data-contact-form="ship"])[data-human-state]:not([data-human-state="none"]) .contact-stage.visible {
  left: 27% !important;
  bottom: 18% !important;
  width: 12% !important;
  height: 50% !important;
}

.scene[data-room-owner="white"]:not([data-contact-form="ship"])[data-human-state]:not([data-human-state="none"]) .contact-stage.visible {
  left: 28% !important;
  bottom: 18% !important;
  width: 13% !important;
  height: 50% !important;
}

.scene[data-contact-form="ship"]:not([data-room-owner="grey"]):not([data-contact-host="white"]):not([data-contact-host="mantis"])[data-human-state]:not([data-human-state="none"]) .contact-stage.visible {
  left: 20% !important;
  bottom: 12% !important;
  width: 13% !important;
  height: 61% !important;
  place-items: end center !important;
  z-index: 9 !important;
}

.scene[data-contact-form="ship"][data-room-owner="mantis"]:not([data-contact-host="mantis"])[data-human-state]:not([data-human-state="none"]) .contact-stage.visible {
  left: 17.5% !important;
  width: 11.5% !important;
}

.scene[data-contact-form="ship"][data-room-owner="white"]:not([data-contact-host="white"])[data-human-state]:not([data-human-state="none"]) .contact-stage.visible {
  left: 27% !important;
  width: 13.5% !important;
}

/* Inimese olek saab päris stseeniruumi; otsustusaken algab tema tsooni järel. */
.scene[data-room-owner="grey"]:not([data-contact-form="ship"])[data-human-state]:not([data-human-state="none"]) .holo-console {
  left: 49% !important;
  width: 48% !important;
}

.scene[data-room-owner="mantis"]:not([data-contact-host="mantis"])[data-human-state]:not([data-human-state="none"]) .holo-console {
  left: 31% !important;
  width: 67% !important;
}

.scene[data-room-owner="oversoul"][data-human-state]:not([data-human-state="none"]) .holo-console {
  left: 42% !important;
  width: 56% !important;
}

.scene[data-room-owner="white"]:not([data-contact-host="white"])[data-human-state]:not([data-human-state="none"]) .holo-console {
  left: 43% !important;
  width: 54% !important;
}

.scene[data-contact-form="ship"][data-contact-host="white"] .holo-console,
.scene[data-contact-form="ship"][data-contact-host="mantis"] .holo-console {
  left: 43% !important;
  width: 41% !important;
}

.scene[data-contact-form="ship"][data-contact-host="white"],
.scene[data-contact-form="ship"][data-contact-host="mantis"] {
  --screen-x: 43%;
  --screen-w: 41%;
}

.scene[data-human-state="sleeping"] { --human-state-accent: #79cfff; }
.scene[data-human-state="astral"] { --human-state-accent: #b08cff; }
.scene[data-human-state="telepathy"] { --human-state-accent: #65edff; }
.scene[data-human-state="distant-confused"] { --human-state-accent: #ff8d62; }
.scene[data-human-state="distant-calm"] { --human-state-accent: #70f0ca; }
.scene[data-human-state="ship-conversation"] { --human-state-accent: #72dfff; }
.scene[data-human-state="ship-panic"] { --human-state-accent: #ff655f; }
.scene[data-human-state="scan"] { --human-state-accent: #62dfff; }
.scene[data-human-state="integration"] { --human-state-accent: #83f1c9; }
.scene[data-human-state="scan"][data-step-type="fearScan"] { --human-state-accent: #ff5f68; }

.scene[data-human-state="sleeping"] .contact-stage::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 17% 10%;
  border: 1px solid rgba(117, 207, 255, .48);
  border-radius: 50%;
  box-shadow: 0 0 1.4cqw rgba(96, 196, 255, .28);
  animation: humanSleepPulse 3.2s ease-in-out infinite;
}

.scene[data-human-state="sleeping"] .contact-stage::after {
  content: "Z · Z · Z";
  position: absolute;
  z-index: 5;
  top: 11%;
  right: 4%;
  color: #bcecff;
  font-size: clamp(10px, .72cqw, 15px);
  font-weight: 900;
  letter-spacing: .1em;
  text-shadow: 0 0 .55cqw #63cfff;
  animation: humanSleepFloat 3.2s ease-in-out infinite;
}

.scene[data-human-state="astral"] .contact-stage::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 4%;
  background: var(--human-sprite) center / contain no-repeat;
  opacity: .2;
  filter: hue-rotate(38deg) brightness(1.5) drop-shadow(0 0 .8cqw #ae8cff);
  transform: translate(9%, -6%) scale(.98);
  animation: humanAstralEcho 3.8s ease-in-out infinite;
}

.scene[data-human-state="astral"] .contact-stage::after,
.scene[data-human-state="distant-calm"] .contact-stage::after,
.scene[data-human-state="integration"] .contact-stage::after {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 10%;
  border: 1px solid color-mix(in srgb, var(--human-state-accent) 70%, transparent);
  border-radius: 50%;
  box-shadow:
    0 0 0 .55cqw color-mix(in srgb, var(--human-state-accent) 12%, transparent),
    0 0 0 1.15cqw color-mix(in srgb, var(--human-state-accent) 7%, transparent);
  animation: humanAuraExpand 3.4s ease-out infinite;
}

.scene[data-human-state="astral"] .contact-sprite {
  animation: humanAstralFloat 3.8s ease-in-out infinite;
}

.scene[data-human-state="telepathy"] .contact-stage::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: -4%;
  border-radius: 50%;
  background:
    repeating-radial-gradient(circle at center,
      transparent 0 13%,
      rgba(101, 237, 255, .22) 14% 15%,
      transparent 16% 24%);
  animation: humanTelepathyWave 3s linear infinite;
}

.scene[data-human-state="telepathy"] .contact-stage::after {
  content: "";
  position: absolute;
  z-index: 5;
  top: 33%;
  left: 65%;
  width: 43%;
  height: 28%;
  border-top: 2px solid rgba(112, 239, 255, .76);
  border-right: 1px solid rgba(112, 239, 255, .28);
  border-radius: 50%;
  filter: drop-shadow(0 0 .45cqw #62dfff);
  animation: humanSignalBlink 1.7s ease-in-out infinite;
}

.scene[data-human-state="distant-confused"] .contact-stage::before {
  content: "!";
  position: absolute;
  z-index: 5;
  top: 12%;
  right: 7%;
  display: grid;
  width: 2.2cqw;
  height: 2.2cqw;
  min-width: 25px;
  min-height: 25px;
  place-items: center;
  border: 2px solid #ff8d62;
  border-radius: 50%;
  background: rgba(65, 12, 10, .86);
  color: #ffd6c5;
  font-weight: 950;
  box-shadow: 0 0 .8cqw rgba(255, 95, 74, .62);
}

.scene[data-human-state="distant-confused"] .contact-stage::after {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 6%;
  border: 2px dashed rgba(255, 119, 83, .62);
  border-radius: 46%;
  animation: humanConfusionSpin 5s linear infinite;
}

.scene[data-human-state="distant-confused"] .contact-sprite,
.scene[data-human-state="ship-panic"] .contact-sprite {
  animation: humanPanicShake .34s ease-in-out infinite alternate;
  filter:
    saturate(.86)
    drop-shadow(0 .3cqw .3cqw rgba(0, 5, 15, .42))
    drop-shadow(0 0 .78cqw rgba(255, 86, 72, .72)) !important;
}

.scene[data-human-state="ship-panic"] .contact-stage::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 7%;
  border: 2px solid rgba(255, 89, 80, .64);
  border-radius: 45%;
  box-shadow:
    inset 0 0 1.4cqw rgba(255, 69, 65, .22),
    0 0 1.2cqw rgba(255, 69, 65, .3);
  animation: humanPanicPulse .72s ease-in-out infinite alternate;
}

.scene[data-human-state="scan"] .contact-stage::before {
  content: "";
  position: absolute;
  z-index: 1;
  inset: 4%;
  border: 1px solid color-mix(in srgb, var(--human-state-accent) 75%, transparent);
  border-radius: 46%;
  background:
    repeating-linear-gradient(90deg,
      color-mix(in srgb, var(--human-state-accent) 10%, transparent) 0 1px,
      transparent 1px 1.1cqw);
  box-shadow: inset 0 0 1.3cqw color-mix(in srgb, var(--human-state-accent) 18%, transparent);
}

.scene[data-human-state="scan"] .contact-stage::after {
  content: "";
  position: absolute;
  z-index: 5;
  left: 4%;
  right: 4%;
  top: 12%;
  height: .32cqw;
  min-height: 3px;
  background: var(--human-state-accent);
  box-shadow:
    0 0 .5cqw var(--human-state-accent),
    0 0 1.2cqw var(--human-state-accent);
  animation: humanScanSweep 2.1s ease-in-out infinite alternate;
}

.scene[data-human-state="integration"] .contact-sprite {
  animation: humanIntegrationBreathe 4.4s ease-in-out infinite;
}

@keyframes humanSleepPulse {
  0%, 100% { opacity: .3; transform: scale(.94); }
  50% { opacity: .72; transform: scale(1.02); }
}

@keyframes humanSleepFloat {
  0%, 100% { opacity: .4; transform: translateY(.5cqw); }
  50% { opacity: 1; transform: translateY(-.3cqw); }
}

@keyframes humanAstralEcho {
  0%, 100% { opacity: .12; transform: translate(7%, -3%) scale(.97); }
  50% { opacity: .3; transform: translate(12%, -8%) scale(1.02); }
}

@keyframes humanAstralFloat {
  0%, 100% { transform: translateY(.35cqw); }
  50% { transform: translateY(-.45cqw); }
}

@keyframes humanAuraExpand {
  0% { opacity: .15; transform: scale(.82); }
  55% { opacity: .62; }
  100% { opacity: 0; transform: scale(1.14); }
}

@keyframes humanTelepathyWave {
  from { opacity: .34; transform: scale(.86); }
  to { opacity: .76; transform: scale(1.08); }
}

@keyframes humanSignalBlink {
  0%, 100% { opacity: .28; transform: scale(.88); }
  50% { opacity: .92; transform: scale(1.08); }
}

@keyframes humanConfusionSpin {
  to { transform: rotate(360deg); }
}

@keyframes humanPanicShake {
  from { transform: translate(-.14cqw, 0) rotate(-.35deg); }
  to { transform: translate(.14cqw, -.04cqw) rotate(.35deg); }
}

@keyframes humanPanicPulse {
  from { opacity: .26; transform: scale(.96); }
  to { opacity: .78; transform: scale(1.03); }
}

@keyframes humanScanSweep {
  from { top: 12%; }
  to { top: 86%; }
}

@keyframes humanIntegrationBreathe {
  0%, 100% { transform: scale(.985); filter: drop-shadow(0 0 .55cqw rgba(89, 239, 191, .42)); }
  50% { transform: scale(1.015); filter: drop-shadow(0 0 .9cqw rgba(89, 239, 191, .72)); }
}

@media (max-width: 900px) {
  .contact-visual-state {
    max-width: 14.5cqw;
    font-size: 8px;
  }

  .scene:not([data-contact-form="ship"])[data-human-state]:not([data-human-state="none"]) .contact-stage.visible {
    left: 26% !important;
    width: 17.5% !important;
  }

  .scene[data-room-owner="mantis"]:not([data-contact-form="ship"])[data-human-state]:not([data-human-state="none"]) .contact-stage.visible {
    left: 17.8% !important;
    width: 10.8% !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scene[data-human-state] .contact-stage::before,
  .scene[data-human-state] .contact-stage::after,
  .scene[data-human-state] .contact-sprite {
    animation: none !important;
  }
}
