/* Inventory Inspection Overlay */
.inspection-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #050510;
    z-index: 3000;
    display: none;
    flex-direction: column;
    overflow: hidden;
    opacity: 0;
    transition: opacity 0.3s ease;
    perspective: 1200px;
}

.inspection-overlay.active {
    display: flex;
    opacity: 1;
}

/* 3D Room Background */
.inspection-background {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #020205;
    z-index: 0;
}

/* Back Wall */
.inspection-grid-ceiling {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 55%;
    /* Meets floor at 55% down */
    background-image:
        linear-gradient(rgba(108, 92, 231, 0.6) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108, 92, 231, 0.6) 1px, transparent 1px);
    background-size: 50px 50px;
    background-position: center bottom;
    mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 100%);
    opacity: 1;
    /* Static back wall or slow pan */
}

/* Floor */
.inspection-grid {
    position: absolute;
    bottom: 0;
    left: -50%;
    width: 200%;
    /* Wider to cover rotations */
    height: 45%;
    /* Floor height */
    background-image:
        linear-gradient(rgba(108, 92, 231, 0.4) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108, 92, 231, 0.4) 1px, transparent 1px);
    background-size: 50px 50px;
    transform-origin: center top;
    transform: perspective(300px) rotateX(45deg);
    /* Classic perspective plane */
    background-position: center top;
    /* animation: gridFlow 5s linear infinite; */
    mask-image: linear-gradient(to top, transparent 0%, black 20%, black 100%);
    box-shadow: inset 0 20px 20px rgba(0, 0, 0, 0.8);
    /* Shadow at horizon */
}

@keyframes gridFlow {
    0% {
        background-position: 0 0;
    }

    100% {
        background-position: 0 50px;
    }
}

/* Horizon Glow */
.inspection-walls {
    position: absolute;
    top: 55%;
    left: 0;
    width: 100%;
    height: 2px;
    background: rgba(108, 92, 231, 1);
    box-shadow: 0 0 25px rgba(108, 92, 231, 1);
    transform: translateY(-50%);
    transform: translateY(-50%);
    z-index: 1;
}

/* Side Walls */
.inspection-wall-left,
.inspection-wall-right {
    position: absolute;
    top: -50%;
    width: 100%;
    height: 200%;
    background-image:
        linear-gradient(rgba(108, 92, 231, 0.3) 1px, transparent 1px),
        linear-gradient(90deg, rgba(108, 92, 231, 0.3) 1px, transparent 1px);
    background-size: 50px 50px;
    transform-origin: center center;
    pointer-events: none;
}

.inspection-wall-left {
    left: -50%;
    transform: perspective(300px) rotateY(90deg) translateX(-50%);
    mask-image: linear-gradient(to right, black 0%, transparent 80%);
}

.inspection-wall-right {
    right: -50%;
    transform: perspective(300px) rotateX(0deg) rotateY(-90deg) translateX(50%);
    mask-image: linear-gradient(to left, black 0%, transparent 80%);
}

/* Vignette */
.inspection-vignette {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: radial-gradient(circle at center, transparent 40%, #000 120%);
    pointer-events: none;
    z-index: 2;
}

/* Particles */
.inspection-particles {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 3;
}

/* Card Container */
.inspection-card-container {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    /* perspective: 1000px; REMOVED - VanillaTilt handles perspective */
    padding-bottom: 120px;
    /* Card floats in front of the room */
}

/* Reuse .result-card styles from gacha_anim.css, with 3D enabled */
.inspection-overlay .result-card {
    transform-style: preserve-3d;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.6);
    /* transition: transform 0.1s ease-out; REMOVED to prevent conflict with VanillaTilt */
    backface-visibility: hidden;
    will-change: transform;
    transform: translateZ(0);
    /* Force GPU layer stabilization */
}

/* Info Panel (Refined) */
.inspection-info-panel {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    padding: 20px 24px 30px 24px;
    background: rgba(20, 20, 35, 0.9);
    backdrop-filter: blur(15px);
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    flex-direction: column;
    gap: 20px;
    z-index: 20;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.5);
}

.inspection-overlay.active .inspection-info-panel {
    transform: translateY(0);
}

/* Details Section */
.inspection-details {
    display: flex;
    flex-direction: column;
    gap: 8px;
    color: white;
}

.inspection-details .profile-main-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
}

.inspection-details .profile-left-col {
    display: flex;
    flex-direction: column;
    text-align: left;
}

.inspection-details .profile-right-col {
    text-align: right;
    padding-left: 20px;
}

.inspection-details .profile-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 2px;
}

.inspection-details .profile-rank {
    font-size: 24px;
    font-weight: 800;
}

.inspection-details .profile-name {
    font-size: 20px;
    margin: 0;
    line-height: 1.2;
    font-weight: 700;
}

.inspection-details .profile-collection {
    color: rgba(255, 255, 255, 0.6);
    font-size: 13px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.inspection-details .stat-box {
    display: flex;
    flex-direction: column;
}

.inspection-details .stat-label {
    font-size: 10px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 1px;
}

.inspection-details .stat-value {
    font-size: 22px;
    font-weight: 800;
    color: white;
}

.inspection-pattern {
    color: var(--secondary-color, #6c5ce7);
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
}

/* Controls Section (Buttons) */
.inspection-controls {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 5px;
}

.btn-square {
    flex: 1;
    aspect-ratio: 1.2/1;
    height: 50px;
    border: none;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    color: white;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.btn-square:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-square:active:not(:disabled) {
    transform: scale(0.95);
}

.btn-square:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.btn-square.close-btn {
    background: rgba(255, 69, 58, 0.2);
    border-color: rgba(255, 69, 58, 0.4);
    color: #ff453a;
}

.btn-square.close-btn:hover {
    background: rgba(255, 69, 58, 0.3);
}