/* ==========================================================================
   Cryo Terminal V2 - Melior Onboarding & Holographic Character Role Stage
   - Stage 1: Gender Selection (Male / Female)
   - Stage 2: Address Format (Ty / Vy)
   - Stage 3: Holographic Role Windows (Tourist / Researcher / Agent / Author)
   ========================================================================== */

/* 1. Terminal Wrapper */
.cryo-terminal-wrapper {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(circle at 50% 40%, #0d1e38 0%, #060e1b 60%, #02050a 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  z-index: 100;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.cryo-terminal-wrapper.is-hidden {
  display: none !important;
}

/* Futuristic background scanlines & vignette */
.cryo-terminal-wrapper::before {
  content: "";
  position: absolute;
  inset: 0;
  background: 
    linear-gradient(rgba(18, 16, 16, 0) 50%, rgba(0, 0, 0, 0.25) 50%),
    linear-gradient(90deg, rgba(255, 0, 0, 0.015), rgba(0, 255, 0, 0.01), rgba(0, 0, 255, 0.015));
  background-size: 100% 3px, 6px 100%;
  pointer-events: none;
  z-index: 1;
  opacity: 0.7;
}

.cryo-terminal-wrapper::after {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 60%, rgba(0, 0, 0, 0.75) 100%);
  pointer-events: none;
  z-index: 2;
}

/* 2. Main Terminal Stage */
.cryo-terminal {
  position: relative;
  width: 100%;
  max-width: 960px;
  height: 100%;
  max-height: 860px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10;
  box-sizing: border-box;
}

/* 3. Top HUD Header */
.cryo-hud-header {
  position: absolute;
  top: 48px;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 40;
  pointer-events: auto;
  padding: 0 16px;
  transition: opacity 0.35s ease, filter 0.35s ease;
}

.cryo-hud-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  max-width: 760px;
  margin-bottom: 6px;
}

.cryo-hud-logo-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: 'Rajdhani', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #00f0ff;
  text-shadow: 0 0 10px rgba(0, 240, 255, 0.6);
  text-transform: uppercase;
}

.cryo-hud-logo-tag .hud-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #00f0ff;
  box-shadow: 0 0 8px #00f0ff;
  animation: hudPulse 2s infinite ease-in-out;
}

@keyframes hudPulse {
  0%, 100% { opacity: 0.4; transform: scale(0.9); }
  50% { opacity: 1; transform: scale(1.15); }
}

.cryo-hud-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cryo-hud-btn {
  background: rgba(8, 20, 38, 0.6);
  border: 1px solid rgba(0, 240, 255, 0.3);
  color: #a5d2ff;
  border-radius: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.25s ease;
  backdrop-filter: blur(6px);
}

.cryo-hud-btn:hover {
  border-color: #00f0ff;
  color: #fff;
  box-shadow: 0 0 12px rgba(0, 240, 255, 0.4);
  transform: translateY(-1px);
}

.cryo-hud-steps {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.cryo-hud-step-pill {
  padding: 3px 12px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  background: rgba(14, 28, 50, 0.7);
  border: 1px solid rgba(0, 240, 255, 0.25);
  color: #648bb5;
  transition: all 0.3s ease;
}

.cryo-hud-step-pill.is-active {
  background: rgba(0, 240, 255, 0.15);
  border-color: #00f0ff;
  color: #00f0ff;
  box-shadow: 0 0 10px rgba(0, 240, 255, 0.35);
}

.cryo-hud-step-pill.is-done {
  background: rgba(16, 185, 129, 0.15);
  border-color: #10b981;
  color: #10b981;
}

.cryo-hud-title {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 0 12px rgba(0, 240, 255, 0.7);
  margin: 0;
  text-align: center;
}

.cryo-hud-subtitle {
  font-size: 12px;
  color: #8bb3dc;
  margin: 3px 0 0;
  text-align: center;
  max-width: 520px;
}

/* 4. Central Cryocapsule & Avatar */
.layer-sphere {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 310px;
  height: 440px;
  z-index: 10;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, filter 0.4s ease, transform 0.4s ease;
}

.sphere-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 25px rgba(0, 230, 255, 0.45));
}

.layer-avatar {
  position: absolute;
  top: 45%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 310px;
  height: 440px;
  z-index: 12;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, filter 0.4s ease, transform 0.4s ease;
}

.avatar-sprite {
  position: absolute;
  width: 78%;
  height: 78%;
  object-fit: contain;
  filter: drop-shadow(0 0 18px rgba(0, 240, 255, 0.6));
  transition: opacity 0.4s ease, transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), filter 0.4s ease;
  will-change: opacity, transform;
}

.avatar-sprite.is-inactive {
  display: none !important;
  opacity: 0 !important;
  transform: scale(0.94);
  pointer-events: none;
}

.avatar-sprite.is-active {
  display: block !important;
  opacity: 1 !important;
  transform: scale(1);
}

/* 5. Lower Console (Stages 1 and 2) */
.layer-console {
  position: absolute;
  bottom: 155px;
  left: 0;
  right: 0;
  margin: 0 auto;
  width: 92%;
  max-width: 460px;
  z-index: 25;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: opacity 0.35s ease, filter 0.35s ease, transform 0.35s ease;
}

.cryo-console-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  width: 100%;
}

.cryo-console-btn {
  flex: 1;
  min-height: 46px;
  background: rgba(9, 23, 44, 0.85);
  border: 1.5px solid rgba(0, 240, 255, 0.4);
  border-radius: 12px;
  color: #c4e1ff;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.25s ease;
  backdrop-filter: blur(8px);
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.cryo-console-btn:hover {
  background: rgba(14, 34, 64, 0.95);
  border-color: #00f0ff;
  color: #fff;
  box-shadow: 0 0 16px rgba(0, 240, 255, 0.45);
  transform: translateY(-2px);
}

.cryo-console-btn.is-active {
  background: linear-gradient(135deg, rgba(0, 200, 255, 0.4), rgba(0, 114, 255, 0.6));
  border-color: #00f0ff;
  color: #ffffff;
  box-shadow: 0 0 20px rgba(0, 240, 255, 0.65), inset 0 0 12px rgba(0, 240, 255, 0.35);
}

.cryo-action-next-btn {
  width: 100%;
  min-height: 46px;
  background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 20px rgba(0, 198, 255, 0.55), inset 0 0 10px rgba(255, 255, 255, 0.25);
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.cryo-action-next-btn:hover {
  box-shadow: 0 0 30px rgba(0, 198, 255, 0.8), inset 0 0 14px rgba(255, 255, 255, 0.4);
  transform: translateY(-2px);
}

.cryo-action-back-btn {
  background: rgba(8, 20, 38, 0.85);
  border: 1px solid rgba(0, 240, 255, 0.4);
  border-radius: 8px;
  color: #8bbce8;
  font-size: 12px;
  letter-spacing: 1px;
  cursor: pointer;
  padding: 6px 14px;
  text-transform: uppercase;
  transition: all 0.2s ease;
}

.cryo-action-back-btn:hover {
  color: #00f0ff;
  border-color: #00f0ff;
}

/* ==========================================================================
   6. STAGE 3: HOLOGRAPHIC ROLE WINDOWS
   ========================================================================== */
.cryo-holo-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 20;
  pointer-events: none;
}

.cryo-holo-stage.is-hidden {
  display: none !important;
}

/* Darkening and blur backdrop when a card is opened */
.cryo-holo-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 7, 16, 0.82);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  z-index: 25;
}

.cryo-holo-backdrop.is-active {
  opacity: 1;
  pointer-events: auto;
  cursor: pointer;
}

/* Dimming background elements when card is expanded */
.cryo-terminal.has-expanded-card .layer-sphere,
.cryo-terminal.has-expanded-card .layer-avatar,
.cryo-terminal.has-expanded-card .layer-console,
.cryo-terminal.has-expanded-card .cryo-hud-header {
  opacity: 0.15 !important;
  filter: blur(4px) !important;
  pointer-events: none !important;
}

.cryo-terminal.has-expanded-card .cryo-holo-card:not(.is-expanded) {
  opacity: 0.12 !important;
  filter: blur(4px) !important;
  pointer-events: none !important;
}

/* Holographic Floating Card (Compact State) */
.cryo-holo-card {
  position: absolute;
  pointer-events: auto;
  cursor: pointer;
  background: rgba(6, 20, 42, 0.65);
  border: 1.5px solid rgba(0, 240, 255, 0.45);
  border-radius: 14px;
  padding: 10px 12px;
  width: 175px;
  box-shadow: 0 0 18px rgba(0, 240, 255, 0.22), inset 0 0 15px rgba(0, 240, 255, 0.1);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), 
              box-shadow 0.35s ease, 
              border-color 0.35s ease, 
              opacity 0.35s ease, 
              filter 0.35s ease;
  user-select: none;
  z-index: 22;
  animation: holoCardFloat 4.5s ease-in-out infinite alternate;
}

@keyframes holoCardFloat {
  0% { transform: translateY(0px); }
  100% { transform: translateY(-7px); }
}

/* Card positions flanking the central cryocapsule */
.cryo-holo-card--tourist {
  left: 3%;
  top: 18%;
  animation-delay: 0s;
}

.cryo-holo-card--agent {
  left: 3%;
  top: 48%;
  animation-delay: 1.2s;
}

.cryo-holo-card--researcher {
  right: 3%;
  top: 18%;
  animation-delay: 0.6s;
}

.cryo-holo-card--author {
  right: 3%;
  top: 48%;
  animation-delay: 1.8s;
}

.cryo-holo-card:hover {
  transform: scale(1.05) translateY(-5px);
  border-color: #00f0ff;
  box-shadow: 0 0 28px rgba(0, 240, 255, 0.65), inset 0 0 20px rgba(0, 240, 255, 0.2);
}

/* Compact Card Inner Elements */
.cryo-card-badge {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  padding: 2px 8px;
  border-radius: 8px;
  margin-bottom: 6px;
  background: rgba(0, 240, 255, 0.15);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: #00f0ff;
}

.cryo-holo-card--researcher .cryo-card-badge {
  color: #c084fc;
  border-color: rgba(192, 132, 252, 0.5);
  background: rgba(192, 132, 252, 0.15);
}

.cryo-holo-card--agent .cryo-card-badge {
  color: #fbbf24;
  border-color: rgba(251, 191, 36, 0.5);
  background: rgba(251, 191, 36, 0.15);
}

.cryo-holo-card--author .cryo-card-badge {
  color: #34d399;
  border-color: rgba(52, 211, 153, 0.5);
  background: rgba(52, 211, 153, 0.15);
}

.cryo-card-thumb-wrap {
  position: relative;
  width: 100%;
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  overflow: hidden;
}

.cryo-card-thumb {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 0 10px rgba(0, 240, 255, 0.5));
  transition: transform 0.3s ease;
}

.cryo-holo-card:hover .cryo-card-thumb {
  transform: scale(1.06);
}

.cryo-card-name {
  font-size: 13.5px;
  font-weight: 800;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: #ffffff;
  text-shadow: 0 0 8px rgba(0, 240, 255, 0.8);
  margin-bottom: 2px;
}

.cryo-card-hint {
  font-size: 10px;
  letter-spacing: 0.8px;
  color: #79a6d2;
  text-transform: uppercase;
}

/* ==========================================================================
   7. EXPANDED MODAL CARD STATE (.is-expanded)
   ========================================================================== */
.cryo-holo-card.is-expanded {
  position: fixed !important;
  left: 50% !important;
  top: 46% !important;
  bottom: auto !important;
  right: auto !important;
  transform: translate(-50%, -50%) scale(1) !important;
  width: 90% !important;
  max-width: 440px !important;
  max-height: 80vh !important;
  z-index: 50 !important;
  padding: 22px 20px !important;
  border-radius: 20px !important;
  background: linear-gradient(155deg, rgba(8, 22, 45, 0.96), rgba(3, 10, 24, 0.98)) !important;
  border: 2px solid rgba(0, 240, 255, 0.85) !important;
  box-shadow: 0 0 45px rgba(0, 240, 255, 0.55), inset 0 0 30px rgba(0, 240, 255, 0.18) !important;
  animation: holoModalPop 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  cursor: default !important;
}

@keyframes holoModalPop {
  0% {
    opacity: 0;
    transform: translate(-50%, -46%) scale(0.92);
  }
  100% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
}

.cryo-card-close-btn {
  display: none;
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(0, 240, 255, 0.4);
  color: #fff;
  font-size: 18px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
}

.cryo-holo-card.is-expanded .cryo-card-close-btn {
  display: flex !important;
}

.cryo-card-close-btn:hover {
  background: rgba(0, 240, 255, 0.25);
  border-color: #00f0ff;
  transform: rotate(90deg);
}

/* Expanded Graphic */
.cryo-holo-card.is-expanded .cryo-card-thumb-wrap {
  height: 180px;
  margin-bottom: 12px;
}

.cryo-holo-card.is-expanded .cryo-card-thumb {
  max-height: 180px;
  filter: drop-shadow(0 0 20px rgba(0, 240, 255, 0.65));
}

.cryo-holo-card.is-expanded .cryo-card-badge {
  font-size: 11.5px;
  padding: 4px 12px;
  margin-bottom: 8px;
}

.cryo-holo-card.is-expanded .cryo-card-name {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 2.5px;
  margin-bottom: 6px;
}

.cryo-card-desc-box {
  display: none;
  width: 100%;
  background: rgba(4, 13, 28, 0.75);
  border: 1px solid rgba(0, 240, 255, 0.25);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 18px;
  text-align: left;
  box-sizing: border-box;
}

.cryo-holo-card.is-expanded .cryo-card-desc-box {
  display: block !important;
}

.cryo-card-desc-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: #b8d4f0;
  margin: 0 0 8px;
}

.cryo-card-perks-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cryo-card-perk-item {
  font-size: 12.5px;
  color: #92bce6;
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.cryo-card-perk-item::before {
  content: "✦";
  color: #00f0ff;
  font-size: 11px;
  line-height: 1.4;
}

/* Neon Action Button «ПРИНЯТЬ» («ПРИНЯТЬ РОЛЬ») */
.cryo-role-confirm-btn {
  display: none;
  width: 100%;
  min-height: 50px;
  background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
  border: none;
  border-radius: 12px;
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: 2px;
  text-transform: uppercase;
  cursor: pointer;
  box-shadow: 0 0 25px rgba(0, 198, 255, 0.65), inset 0 0 12px rgba(255, 255, 255, 0.3);
  transition: all 0.25s ease;
  align-items: center;
  justify-content: center;
  gap: 10px;
  z-index: 10;
}

.cryo-holo-card.is-expanded .cryo-role-confirm-btn {
  display: flex !important;
}

.cryo-role-confirm-btn:hover {
  box-shadow: 0 0 35px rgba(0, 198, 255, 0.9), inset 0 0 16px rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
}

.cryo-role-confirm-btn:active {
  transform: translateY(1px) scale(0.98);
}

/* 8. Gateway Decompression FX Overlay */
.layer-gateway-fx {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 80;
  background: radial-gradient(circle at 50% 50%, rgba(0, 240, 255, 0.35) 0%, rgba(4, 10, 22, 0.96) 80%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: gatewayFadeIn 0.4s ease-out forwards;
}

.layer-gateway-fx.is-hidden {
  display: none !important;
}

@keyframes gatewayFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.gateway-burst {
  width: 140px;
  height: 140px;
  border-radius: 50%;
  border: 3px solid #00f0ff;
  box-shadow: 0 0 40px #00f0ff, inset 0 0 30px #00f0ff;
  margin-bottom: 24px;
  animation: burstRings 1.2s infinite ease-out;
}

@keyframes burstRings {
  0% { transform: scale(0.6); opacity: 1; }
  100% { transform: scale(1.4); opacity: 0; }
}

.gateway-hud-text {
  font-size: 22px;
  font-weight: 900;
  letter-spacing: 3px;
  color: #00f0ff;
  text-shadow: 0 0 25px #00f0ff, 0 0 50px rgba(0, 240, 255, 0.8);
  text-transform: uppercase;
  text-align: center;
  padding: 0 20px;
}

/* ==========================================================================
   9. MOBILE RESPONSIVENESS (Portrait viewport <= 640px)
   ========================================================================== */
@media (max-width: 640px) {
  .cryo-hud-header {
    top: 52px;
    padding: 0 10px;
  }
  
  .cryo-hud-title {
    font-size: 14.5px;
    letter-spacing: 1px;
  }

  .cryo-hud-subtitle {
    font-size: 11px;
  }

  .layer-sphere, .layer-avatar {
    width: 250px;
    height: 360px;
    top: 44%;
  }

  /* Compact 4 cards flanking capsule on mobile */
  .cryo-holo-card {
    width: 110px !important;
    padding: 8px 6px !important;
    border-radius: 12px !important;
  }

  .cryo-holo-card--tourist {
    left: 8px !important;
    top: 17% !important;
  }

  .cryo-holo-card--agent {
    left: 8px !important;
    top: 45% !important;
    bottom: auto !important;
  }

  .cryo-holo-card--researcher {
    right: 8px !important;
    top: 17% !important;
  }

  .cryo-holo-card--author {
    right: 8px !important;
    top: 45% !important;
    bottom: auto !important;
  }

  .cryo-card-badge {
    font-size: 8.5px !important;
    padding: 2px 5px !important;
    letter-spacing: 0.6px !important;
    margin-bottom: 3px !important;
  }

  .cryo-card-thumb-wrap {
    height: 56px !important;
    margin-bottom: 3px !important;
  }

  .cryo-card-name {
    font-size: 11px !important;
    letter-spacing: 0.8px !important;
  }

  .cryo-card-hint {
    display: none !important;
  }

  /* Expanded Modal Card on Mobile */
  .cryo-holo-card.is-expanded {
    width: 92% !important;
    max-width: 350px !important;
    max-height: 78vh !important;
    top: 44% !important;
    padding: 18px 14px !important;
  }

  .cryo-holo-card.is-expanded .cryo-card-thumb-wrap {
    height: 125px !important;
  }

  .cryo-holo-card.is-expanded .cryo-card-thumb {
    max-height: 125px !important;
  }

  .cryo-holo-card.is-expanded .cryo-card-name {
    font-size: 19px !important;
  }

  .cryo-card-desc-box {
    padding: 10px 12px !important;
    margin-bottom: 12px !important;
  }

  .cryo-card-desc-text {
    font-size: 12px !important;
  }

  .cryo-card-perk-item {
    font-size: 11px !important;
  }

  .cryo-role-confirm-btn {
    min-height: 46px !important;
    font-size: 13.5px !important;
  }

  .layer-console {
    bottom: 150px !important;
    width: 94% !important;
  }

  .cryo-console-btn {
    min-height: 44px;
    font-size: 12px;
  }

  .cryo-action-next-btn {
    min-height: 44px;
    font-size: 13px;
  }
}
